@tsuga/cli 1.32.0 → 1.34.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 (2) hide show
  1. package/dist/cli.js +70 -69
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,60 +1,62 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var m0=Object.create;var tm=Object.defineProperty;var d0=Object.getOwnPropertyDescriptor;var f0=Object.getOwnPropertyNames;var g0=Object.getPrototypeOf,h0=Object.prototype.hasOwnProperty;var y0=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Xt=(e,r)=>{for(var n in r)tm(e,n,{get:r[n],enumerable:!0})},T0=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of f0(r))!h0.call(e,i)&&i!==n&&tm(e,i,{get:()=>r[i],enumerable:!(o=d0(r,i))||o.enumerable});return e};var dn=(e,r,n)=>(n=e!=null?m0(g0(e)):{},T0(r||!e||!e.__esModule?tm(n,"default",{value:e,enumerable:!0}):n,e));var xA=y0((AA,ou)=>{(function(e){"use strict";let r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},o=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${r}\\.${r}\\.${r}\\.${r}(${a})?$`,"i")};function m(g,T){if(g.indexOf("::")!==g.lastIndexOf("::"))return null;let O=0,b=-1,R=(g.match(l.zoneIndex)||[])[0],P,de;for(R&&(R=R.substring(1),g=g.replace(/%.+$/,""));(b=g.indexOf(":",b+1))>=0;)O++;if(g.substr(0,2)==="::"&&O--,g.substr(-2,2)==="::"&&O--,O>=T)return null;for(de=T-O,P=":";de--;)P+="0:";return g=g.replace("::",P),g[0]===":"&&(g=g.slice(1)),g[g.length-1]===":"&&(g=g.slice(0,-1)),T=(function(){let mn=g.split(":"),Kr=[];for(let zr=0;zr<mn.length;zr++)Kr.push(mn[zr].length>4?NaN:parseInt(mn[zr],16));return Kr})(),{parts:T,zoneId:R}}function f(g,T,O,b){if(g.length!==T.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let R=0,P;for(;b>0;){if(P=O-b,P<0&&(P=0),g[R]>>P!==T[R]>>P)return!1;b-=O,R+=1}return!0}function h(g){if(i.test(g))return parseInt(g,16);if(g[0]==="0"&&!isNaN(parseInt(g[1],10))){if(o.test(g))return parseInt(g,8);throw new Error(`ipaddr: cannot parse ${g} as octal`)}return parseInt(g,10)}function E(g,T){for(;g.length<T;)g=`0${g}`;return g}let I={};I.IPv4=(function(){function g(T){if(T.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let O,b;for(O=0;O<T.length;O++)if(b=T[O],!(0<=b&&b<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=T}return g.prototype.SpecialRanges={unspecified:[[new g([0,0,0,0]),8]],broadcast:[[new g([255,255,255,255]),32]],multicast:[[new g([224,0,0,0]),4]],linkLocal:[[new g([169,254,0,0]),16]],loopback:[[new g([127,0,0,0]),8]],carrierGradeNat:[[new g([100,64,0,0]),10]],private:[[new g([10,0,0,0]),8],[new g([172,16,0,0]),12],[new g([192,168,0,0]),16]],reserved:[[new g([192,0,0,0]),24],[new g([192,0,2,0]),24],[new g([192,88,99,0]),24],[new g([198,18,0,0]),15],[new g([198,51,100,0]),24],[new g([203,0,113,0]),24],[new g([240,0,0,0]),4]],as112:[[new g([192,175,48,0]),24],[new g([192,31,196,0]),24]],amt:[[new g([192,52,193,0]),24]]},g.prototype.kind=function(){return"ipv4"},g.prototype.match=function(T,O){let b;if(O===void 0&&(b=T,T=b[0],O=b[1]),T.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,T.octets,8,O)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,O=!1,b={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},R,P,de;for(R=3;R>=0;R-=1)if(P=this.octets[R],P in b){if(de=b[P],O&&de!==0)return null;de!==8&&(O=!0),T+=de}else return null;return 32-T},g.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},g.prototype.toByteArray=function(){return this.octets.slice(0)},g.prototype.toIPv4MappedAddress=function(){return I.IPv6.parse(`::ffff:${this.toString()}`)},g.prototype.toNormalizedString=function(){return this.toString()},g.prototype.toString=function(){return this.octets.join(".")},g})(),I.IPv4.broadcastAddressFromCIDR=function(g){try{let T=this.parseCIDR(g),O=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),R=[],P=0;for(;P<4;)R.push(parseInt(O[P],10)|parseInt(b[P],10)^255),P++;return new this(R)}catch(T){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:T})}},I.IPv4.isIPv4=function(g){return this.parser(g)!==null},I.IPv4.isValid=function(g){try{return new this(this.parser(g)),!0}catch{return!1}},I.IPv4.isValidCIDR=function(g){try{return this.parseCIDR(g),!0}catch{return!1}},I.IPv4.isValidFourPartDecimal=function(g){return!!(I.IPv4.isValid(g)&&g.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},I.IPv4.isValidCIDRFourPartDecimal=function(g){let T=g.match(/^(.+)\/(\d+)$/);return!I.IPv4.isValidCIDR(g)||!T?!1:I.IPv4.isValidFourPartDecimal(T[1])},I.IPv4.networkAddressFromCIDR=function(g){let T,O,b,R,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),R=[],O=0;O<4;)R.push(parseInt(b[O],10)&parseInt(P[O],10)),O++;return new this(R)}catch(de){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:de})}},I.IPv4.parse=function(g){let T=this.parser(g);if(T===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(T)},I.IPv4.parseCIDR=function(g){let T;if(T=g.match(/^(.+)\/(\d+)$/)){let O=parseInt(T[2]);if(O>=0&&O<=32){let b=[this.parse(T[1]),O];return Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},I.IPv4.parser=function(g){let T,O,b;if(T=g.match(n.fourOctet))return(function(){let R=T.slice(1,6),P=[];for(let de=0;de<R.length;de++)O=R[de],P.push(h(O));return P})();if(T=g.match(n.longValue)){if(b=h(T[1]),b>4294967295||b<0)throw new Error("ipaddr: address outside defined range");return(function(){let R=[],P;for(P=0;P<=24;P+=8)R.push(b>>P&255);return R})().reverse()}else return(T=g.match(n.twoOctet))?(function(){let R=T.slice(1,4),P=[];if(b=h(R[1]),b>16777215||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(R[0])),P.push(b>>16&255),P.push(b>>8&255),P.push(b&255),P})():(T=g.match(n.threeOctet))?(function(){let R=T.slice(1,5),P=[];if(b=h(R[2]),b>65535||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(R[0])),P.push(h(R[1])),P.push(b>>8&255),P.push(b&255),P})():null},I.IPv4.subnetMaskFromPrefixLength=function(g){if(g=parseInt(g),Number.isNaN(g)||g<0||g>32)throw new Error("ipaddr: invalid IPv4 prefix length");let T=[0,0,0,0],O=0,b=Math.floor(g/8);for(;O<b;)T[O]=255,O++;return b<4&&(T[b]=Math.pow(2,g%8)-1<<8-g%8),new this(T)},I.IPv6=(function(){function g(T,O){let b,R;if(T.length===16)for(this.parts=[],b=0;b<=14;b+=2)this.parts.push(T[b]<<8|T[b+1]);else if(T.length===8)this.parts=T;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(b=0;b<this.parts.length;b++)if(R=this.parts[b],!(0<=R&&R<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");O&&(this.zoneId=O)}return g.prototype.SpecialRanges={unspecified:[new g([0,0,0,0,0,0,0,0]),128],linkLocal:[new g([65152,0,0,0,0,0,0,0]),10],multicast:[new g([65280,0,0,0,0,0,0,0]),8],loopback:[new g([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new g([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new g([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new g([65216,0,0,0,0,0,0,0]),10],discard:[new g([256,0,0,0,0,0,0,0]),64],rfc6145:[new g([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new g([100,65435,0,0,0,0,0,0]),96],[new g([100,65435,1,0,0,0,0,0]),48]],"6to4":[new g([8194,0,0,0,0,0,0,0]),16],teredo:[new g([8193,0,0,0,0,0,0,0]),32],benchmarking:[new g([8193,2,0,0,0,0,0,0]),48],amt:[new g([8193,3,0,0,0,0,0,0]),32],as112v6:[[new g([8193,4,274,0,0,0,0,0]),48],[new g([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new g([8193,16,0,0,0,0,0,0]),28],orchid2:[new g([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new g([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new g([24320,0,0,0,0,0,0,0]),16],reserved:[[new g([8193,0,0,0,0,0,0,0]),23],[new g([8193,3512,0,0,0,0,0,0]),32],[new g([16383,0,0,0,0,0,0,0]),20]]},g.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},g.prototype.kind=function(){return"ipv6"},g.prototype.match=function(T,O){let b;if(O===void 0&&(b=T,T=b[0],O=b[1]),T.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,T.parts,16,O)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,O=!1,b={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},R,P;for(let de=7;de>=0;de-=1)if(R=this.parts[de],R in b){if(P=b[R],O&&P!==0)return null;P!==16&&(O=!0),T+=P}else return null;return 128-T},g.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},g.prototype.toByteArray=function(){let T,O=[],b=this.parts;for(let R=0;R<b.length;R++)T=b[R],O.push(T>>8),O.push(T&255);return O},g.prototype.toFixedLengthString=function(){let T=(function(){let b=[];for(let R=0;R<this.parts.length;R++)b.push(E(this.parts[R].toString(16),4));return b}).call(this).join(":"),O="";return this.zoneId&&(O=`%${this.zoneId}`),T+O},g.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let T=this.parts.slice(-2),O=T[0],b=T[1];return new I.IPv4([O>>8,O&255,b>>8,b&255])},g.prototype.toNormalizedString=function(){let T=(function(){let b=[];for(let R=0;R<this.parts.length;R++)b.push(this.parts[R].toString(16));return b}).call(this).join(":"),O="";return this.zoneId&&(O=`%${this.zoneId}`),T+O},g.prototype.toRFC5952String=function(){let T=/((^|:)(0(:|$)){2,})/g,O="";this.zoneId&&(O=`%${this.zoneId}`);let b=this.toNormalizedString(),R=b.slice(0,b.length-O.length),P=0,de=-1,mn=-1,Kr;for(;Kr=T.exec(R);){let zr=(Kr[0].match(/0/g)||[]).length;zr>mn&&(mn=zr,P=Kr.index,de=Kr[0].length)}return de<0?R+O:`${R.substring(0,P)}::${R.substring(P+de)}${O}`},g.prototype.toString=function(){return this.toRFC5952String()},g})(),I.IPv6.broadcastAddressFromCIDR=function(g){try{let T=this.parseCIDR(g),O=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),R=[],P=0;for(;P<16;)R.push(parseInt(O[P],10)|parseInt(b[P],10)^255),P++;return new this(R)}catch(T){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:T})}},I.IPv6.isIPv6=function(g){return this.parser(g)!==null},I.IPv6.isValid=function(g){if(typeof g=="string"&&g.indexOf(":")===-1)return!1;try{let T=this.parser(g);return new this(T.parts,T.zoneId),!0}catch{return!1}},I.IPv6.isValidCIDR=function(g){if(typeof g=="string"&&g.indexOf(":")===-1)return!1;try{return this.parseCIDR(g),!0}catch{return!1}},I.IPv6.networkAddressFromCIDR=function(g){let T,O,b,R,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),R=[],O=0;O<16;)R.push(parseInt(b[O],10)&parseInt(P[O],10)),O++;return new this(R)}catch(de){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:de})}},I.IPv6.parse=function(g){let T=this.parser(g);if(T===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(T.parts,T.zoneId)},I.IPv6.parseCIDR=function(g){let T,O,b;if((O=g.match(/^(.+)\/(\d+)$/))&&(T=parseInt(O[2]),T>=0&&T<=128))return b=[this.parse(O[1]),T],Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},I.IPv6.parser=function(g){let T,O,b,R,P,de;if(b=g.match(l.deprecatedTransitional))return this.parser(`::ffff:${b[1]}`);if(l.native.test(g))return m(g,8);if((b=g.match(l.transitional))&&(de=b[6]||"",T=b[1],b[1].endsWith("::")||(T=T.slice(0,-1)),T=m(T+de,6),T&&T.parts)){for(P=[parseInt(b[2]),parseInt(b[3]),parseInt(b[4]),parseInt(b[5])],O=0;O<P.length;O++)if(R=P[O],!(0<=R&&R<=255))return null;return T.parts.push(P[0]<<8|P[1]),T.parts.push(P[2]<<8|P[3]),{parts:T.parts,zoneId:T.zoneId}}return null},I.IPv6.subnetMaskFromPrefixLength=function(g){if(g=parseInt(g),Number.isNaN(g)||g<0||g>128)throw new Error("ipaddr: invalid IPv6 prefix length");let T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=0,b=Math.floor(g/8);for(;O<b;)T[O]=255,O++;return b<16&&(T[b]=Math.pow(2,g%8)-1<<8-g%8),new this(T)},I.fromByteArray=function(g){let T=g.length;if(T===4)return new I.IPv4(g);if(T===16)return new I.IPv6(g);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},I.isValid=function(g){return I.IPv6.isValid(g)||I.IPv4.isValid(g)},I.isValidCIDR=function(g){return I.IPv6.isValidCIDR(g)||I.IPv4.isValidCIDR(g)},I.parse=function(g){if(I.IPv6.isValid(g))return I.IPv6.parse(g);if(I.IPv4.isValid(g))return I.IPv4.parse(g);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},I.parseCIDR=function(g){try{return I.IPv6.parseCIDR(g)}catch{try{return I.IPv4.parseCIDR(g)}catch(T){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format",{cause:T})}}},I.process=function(g){let T=this.parse(g);return T.kind()==="ipv6"&&T.isIPv4MappedAddress()?T.toIPv4Address():T},I.subnetMatch=function(g,T,O){let b,R,P,de;O==null&&(O="unicast");for(R in T)if(Object.prototype.hasOwnProperty.call(T,R)){for(P=T[R],P[0]&&!(P[0]instanceof Array)&&(P=[P]),b=0;b<P.length;b++)if(de=P[b],g.kind()===de[0].kind()&&g.match.apply(g,de))return R}return O},typeof ou<"u"&&ou.exports?ou.exports=I:e.ipaddr=I})(AA)});var fn=class extends Error{constructor(r,n,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=r,this.nestedError=void 0}},Qn=class extends fn{constructor(r){super(1,"commander.invalidArgument",r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var Sa=class{constructor(r,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,r[0]){case"<":this.required=!0,this._name=r.slice(1,-1);break;case"[":this.required=!1,this._name=r.slice(1,-1);break;default:this.required=!0,this._name=r;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(r,n){return n===this.defaultValue||!Array.isArray(n)?[r]:(n.push(r),n)}default(r,n){return this.defaultValue=r,this.defaultValueDescription=n,this}argParser(r){return this.parseArg=r,this}choices(r){return this.argChoices=r.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Qn(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(n,o):n},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function $c(e){let r=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+r+">":"["+r+"]"}var fy=require("node:events"),jc=dn(require("node:child_process"),1),Er=dn(require("node:path"),1),Oa=dn(require("node:fs"),1),fe=dn(require("node:process"),1),gy=require("node:util");var uy=require("node:util"),ba=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(r){this.helpWidth=this.helpWidth??r.helpWidth??80}visibleCommands(r){let n=r.commands.filter(i=>!i._hidden),o=r._getHelpCommand();return o&&!o._hidden&&n.push(o),this.sortSubcommands&&n.sort((i,a)=>i.name().localeCompare(a.name())),n}compareOptions(r,n){let o=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return o(r).localeCompare(o(n))}visibleOptions(r){let n=r.options.filter(i=>!i.hidden),o=r._getHelpOption();if(o&&!o.hidden){let i=o.short&&r._findOption(o.short),a=o.long&&r._findOption(o.long);!i&&!a?n.push(o):o.long&&!a?n.push(r.createOption(o.long,o.description)):o.short&&!i&&n.push(r.createOption(o.short,o.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(r){if(!this.showGlobalOptions)return[];let n=[];for(let o=r.parent;o;o=o.parent){let i=o.options.filter(a=>!a.hidden);n.push(...i)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(r){return r._argsDescription&&r.registeredArguments.forEach(n=>{n.description=n.description||r._argsDescription[n.name()]||""}),r.registeredArguments.find(n=>n.description)?r.registeredArguments:[]}subcommandTerm(r){let n=r.registeredArguments.map(o=>$c(o)).join(" ");return r._name+(r._aliases[0]?"|"+r._aliases[0]:"")+(r.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(r){return r.flags}argumentTerm(r){return r.name()}longestSubcommandTermLength(r,n){return n.visibleCommands(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(i)))),0)}longestOptionTermLength(r,n){return n.visibleOptions(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestGlobalOptionTermLength(r,n){return n.visibleGlobalOptions(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestArgumentTermLength(r,n){return n.visibleArguments(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(i)))),0)}commandUsage(r){let n=r._name;r._aliases[0]&&(n=n+"|"+r._aliases[0]);let o="";for(let i=r.parent;i;i=i.parent)o=i.name()+" "+o;return o+n+" "+r.usage()}commandDescription(r){return r.description()}subcommandDescription(r){return r.summary()||r.description()}optionDescription(r){let n=[];if(r.argChoices&&n.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&(r.required||r.optional||r.isBoolean()&&typeof r.defaultValue=="boolean")&&n.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),r.presetArg!==void 0&&r.optional&&n.push(`preset: ${JSON.stringify(r.presetArg)}`),r.envVar!==void 0&&n.push(`env: ${r.envVar}`),n.length>0){let o=`(${n.join(", ")})`;return r.description?`${r.description} ${o}`:o}return r.description}argumentDescription(r){let n=[];if(r.argChoices&&n.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&n.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),n.length>0){let o=`(${n.join(", ")})`;return r.description?`${r.description} ${o}`:o}return r.description}formatItemList(r,n,o){return n.length===0?[]:[o.styleTitle(r),...n,""]}groupItems(r,n,o){let i=new Map;return r.forEach(a=>{let c=o(a);i.has(c)||i.set(c,[])}),n.forEach(a=>{let c=o(a);i.has(c)||i.set(c,[]),i.get(c).push(a)}),i}formatHelp(r,n){let o=n.padWidth(r,n),i=n.helpWidth??80;function a(E,I){return n.formatItem(E,o,I,n)}let c=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(r))}`,""],l=n.commandDescription(r);l.length>0&&(c=c.concat([n.boxWrap(n.styleCommandDescription(l),i),""]));let m=n.visibleArguments(r).map(E=>a(n.styleArgumentTerm(n.argumentTerm(E)),n.styleArgumentDescription(n.argumentDescription(E))));if(c=c.concat(this.formatItemList("Arguments:",m,n)),this.groupItems(r.options,n.visibleOptions(r),E=>E.helpGroupHeading??"Options:").forEach((E,I)=>{let g=E.map(T=>a(n.styleOptionTerm(n.optionTerm(T)),n.styleOptionDescription(n.optionDescription(T))));c=c.concat(this.formatItemList(I,g,n))}),n.showGlobalOptions){let E=n.visibleGlobalOptions(r).map(I=>a(n.styleOptionTerm(n.optionTerm(I)),n.styleOptionDescription(n.optionDescription(I))));c=c.concat(this.formatItemList("Global Options:",E,n))}return this.groupItems(r.commands,n.visibleCommands(r),E=>E.helpGroup()||"Commands:").forEach((E,I)=>{let g=E.map(T=>a(n.styleSubcommandTerm(n.subcommandTerm(T)),n.styleSubcommandDescription(n.subcommandDescription(T))));c=c.concat(this.formatItemList(I,g,n))}),c.join(`
3
- `)}displayWidth(r){return(0,uy.stripVTControlCharacters)(r).length}styleTitle(r){return r}styleUsage(r){return r.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n==="[command]"?this.styleSubcommandText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleCommandText(n)).join(" ")}styleCommandDescription(r){return this.styleDescriptionText(r)}styleOptionDescription(r){return this.styleDescriptionText(r)}styleSubcommandDescription(r){return this.styleDescriptionText(r)}styleArgumentDescription(r){return this.styleDescriptionText(r)}styleDescriptionText(r){return r}styleOptionTerm(r){return this.styleOptionText(r)}styleSubcommandTerm(r){return r.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).join(" ")}styleArgumentTerm(r){return this.styleArgumentText(r)}styleOptionText(r){return r}styleArgumentText(r){return r}styleSubcommandText(r){return r}styleCommandText(r){return r}padWidth(r,n){return Math.max(n.longestOptionTermLength(r,n),n.longestGlobalOptionTermLength(r,n),n.longestSubcommandTermLength(r,n),n.longestArgumentTermLength(r,n))}preformatted(r){return/\n[^\S\r\n]/.test(r)}formatItem(r,n,o,i){let c=" ".repeat(2);if(!o)return c+r;let l=r.padEnd(n+r.length-i.displayWidth(r)),m=2,h=(this.helpWidth??80)-n-m-2,E;return h<this.minWidthToWrap||i.preformatted(o)?E=o:E=i.boxWrap(o,h).replace(/\n/g,`
2
+ "use strict";var E0=Object.create;var tm=Object.defineProperty;var _0=Object.getOwnPropertyDescriptor;var I0=Object.getOwnPropertyNames;var S0=Object.getPrototypeOf,b0=Object.prototype.hasOwnProperty;var O0=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),rr=(e,r)=>{for(var n in r)tm(e,n,{get:r[n],enumerable:!0})},A0=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of I0(r))!b0.call(e,i)&&i!==n&&tm(e,i,{get:()=>r[i],enumerable:!(o=_0(r,i))||o.enumerable});return e};var fn=(e,r,n)=>(n=e!=null?E0(S0(e)):{},A0(r||!e||!e.__esModule?tm(n,"default",{value:e,enumerable:!0}):n,e));var PA=O0((CA,iu)=>{(function(e){"use strict";let r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},o=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${r}\\.${r}\\.${r}\\.${r}(${s})?$`,"i")};function m(g,T){if(g.indexOf("::")!==g.lastIndexOf("::"))return null;let O=0,b=-1,R=(g.match(l.zoneIndex)||[])[0],P,de;for(R&&(R=R.substring(1),g=g.replace(/%.+$/,""));(b=g.indexOf(":",b+1))>=0;)O++;if(g.substr(0,2)==="::"&&O--,g.substr(-2,2)==="::"&&O--,O>=T)return null;for(de=T-O,P=":";de--;)P+="0:";return g=g.replace("::",P),g[0]===":"&&(g=g.slice(1)),g[g.length-1]===":"&&(g=g.slice(0,-1)),T=(function(){let dn=g.split(":"),zr=[];for(let Yr=0;Yr<dn.length;Yr++)zr.push(dn[Yr].length>4?NaN:parseInt(dn[Yr],16));return zr})(),{parts:T,zoneId:R}}function f(g,T,O,b){if(g.length!==T.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let R=0,P;for(;b>0;){if(P=O-b,P<0&&(P=0),g[R]>>P!==T[R]>>P)return!1;b-=O,R+=1}return!0}function h(g){if(i.test(g))return parseInt(g,16);if(g[0]==="0"&&!isNaN(parseInt(g[1],10))){if(o.test(g))return parseInt(g,8);throw new Error(`ipaddr: cannot parse ${g} as octal`)}return parseInt(g,10)}function E(g,T){for(;g.length<T;)g=`0${g}`;return g}let I={};I.IPv4=(function(){function g(T){if(T.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let O,b;for(O=0;O<T.length;O++)if(b=T[O],!(0<=b&&b<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=T}return g.prototype.SpecialRanges={unspecified:[[new g([0,0,0,0]),8]],broadcast:[[new g([255,255,255,255]),32]],multicast:[[new g([224,0,0,0]),4]],linkLocal:[[new g([169,254,0,0]),16]],loopback:[[new g([127,0,0,0]),8]],carrierGradeNat:[[new g([100,64,0,0]),10]],private:[[new g([10,0,0,0]),8],[new g([172,16,0,0]),12],[new g([192,168,0,0]),16]],reserved:[[new g([192,0,0,0]),24],[new g([192,0,2,0]),24],[new g([192,88,99,0]),24],[new g([198,18,0,0]),15],[new g([198,51,100,0]),24],[new g([203,0,113,0]),24],[new g([240,0,0,0]),4]],as112:[[new g([192,175,48,0]),24],[new g([192,31,196,0]),24]],amt:[[new g([192,52,193,0]),24]]},g.prototype.kind=function(){return"ipv4"},g.prototype.match=function(T,O){let b;if(O===void 0&&(b=T,T=b[0],O=b[1]),T.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,T.octets,8,O)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,O=!1,b={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},R,P,de;for(R=3;R>=0;R-=1)if(P=this.octets[R],P in b){if(de=b[P],O&&de!==0)return null;de!==8&&(O=!0),T+=de}else return null;return 32-T},g.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},g.prototype.toByteArray=function(){return this.octets.slice(0)},g.prototype.toIPv4MappedAddress=function(){return I.IPv6.parse(`::ffff:${this.toString()}`)},g.prototype.toNormalizedString=function(){return this.toString()},g.prototype.toString=function(){return this.octets.join(".")},g})(),I.IPv4.broadcastAddressFromCIDR=function(g){try{let T=this.parseCIDR(g),O=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),R=[],P=0;for(;P<4;)R.push(parseInt(O[P],10)|parseInt(b[P],10)^255),P++;return new this(R)}catch(T){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:T})}},I.IPv4.isIPv4=function(g){return this.parser(g)!==null},I.IPv4.isValid=function(g){try{return new this(this.parser(g)),!0}catch{return!1}},I.IPv4.isValidCIDR=function(g){try{return this.parseCIDR(g),!0}catch{return!1}},I.IPv4.isValidFourPartDecimal=function(g){return!!(I.IPv4.isValid(g)&&g.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},I.IPv4.isValidCIDRFourPartDecimal=function(g){let T=g.match(/^(.+)\/(\d+)$/);return!I.IPv4.isValidCIDR(g)||!T?!1:I.IPv4.isValidFourPartDecimal(T[1])},I.IPv4.networkAddressFromCIDR=function(g){let T,O,b,R,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),R=[],O=0;O<4;)R.push(parseInt(b[O],10)&parseInt(P[O],10)),O++;return new this(R)}catch(de){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:de})}},I.IPv4.parse=function(g){let T=this.parser(g);if(T===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(T)},I.IPv4.parseCIDR=function(g){let T;if(T=g.match(/^(.+)\/(\d+)$/)){let O=parseInt(T[2]);if(O>=0&&O<=32){let b=[this.parse(T[1]),O];return Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},I.IPv4.parser=function(g){let T,O,b;if(T=g.match(n.fourOctet))return(function(){let R=T.slice(1,6),P=[];for(let de=0;de<R.length;de++)O=R[de],P.push(h(O));return P})();if(T=g.match(n.longValue)){if(b=h(T[1]),b>4294967295||b<0)throw new Error("ipaddr: address outside defined range");return(function(){let R=[],P;for(P=0;P<=24;P+=8)R.push(b>>P&255);return R})().reverse()}else return(T=g.match(n.twoOctet))?(function(){let R=T.slice(1,4),P=[];if(b=h(R[1]),b>16777215||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(R[0])),P.push(b>>16&255),P.push(b>>8&255),P.push(b&255),P})():(T=g.match(n.threeOctet))?(function(){let R=T.slice(1,5),P=[];if(b=h(R[2]),b>65535||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(R[0])),P.push(h(R[1])),P.push(b>>8&255),P.push(b&255),P})():null},I.IPv4.subnetMaskFromPrefixLength=function(g){if(g=parseInt(g),Number.isNaN(g)||g<0||g>32)throw new Error("ipaddr: invalid IPv4 prefix length");let T=[0,0,0,0],O=0,b=Math.floor(g/8);for(;O<b;)T[O]=255,O++;return b<4&&(T[b]=Math.pow(2,g%8)-1<<8-g%8),new this(T)},I.IPv6=(function(){function g(T,O){let b,R;if(T.length===16)for(this.parts=[],b=0;b<=14;b+=2)this.parts.push(T[b]<<8|T[b+1]);else if(T.length===8)this.parts=T;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(b=0;b<this.parts.length;b++)if(R=this.parts[b],!(0<=R&&R<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");O&&(this.zoneId=O)}return g.prototype.SpecialRanges={unspecified:[new g([0,0,0,0,0,0,0,0]),128],linkLocal:[new g([65152,0,0,0,0,0,0,0]),10],multicast:[new g([65280,0,0,0,0,0,0,0]),8],loopback:[new g([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new g([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new g([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new g([65216,0,0,0,0,0,0,0]),10],discard:[new g([256,0,0,0,0,0,0,0]),64],rfc6145:[new g([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new g([100,65435,0,0,0,0,0,0]),96],[new g([100,65435,1,0,0,0,0,0]),48]],"6to4":[new g([8194,0,0,0,0,0,0,0]),16],teredo:[new g([8193,0,0,0,0,0,0,0]),32],benchmarking:[new g([8193,2,0,0,0,0,0,0]),48],amt:[new g([8193,3,0,0,0,0,0,0]),32],as112v6:[[new g([8193,4,274,0,0,0,0,0]),48],[new g([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new g([8193,16,0,0,0,0,0,0]),28],orchid2:[new g([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new g([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new g([24320,0,0,0,0,0,0,0]),16],reserved:[[new g([8193,0,0,0,0,0,0,0]),23],[new g([8193,3512,0,0,0,0,0,0]),32],[new g([16383,0,0,0,0,0,0,0]),20]]},g.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},g.prototype.kind=function(){return"ipv6"},g.prototype.match=function(T,O){let b;if(O===void 0&&(b=T,T=b[0],O=b[1]),T.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,T.parts,16,O)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,O=!1,b={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},R,P;for(let de=7;de>=0;de-=1)if(R=this.parts[de],R in b){if(P=b[R],O&&P!==0)return null;P!==16&&(O=!0),T+=P}else return null;return 128-T},g.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},g.prototype.toByteArray=function(){let T,O=[],b=this.parts;for(let R=0;R<b.length;R++)T=b[R],O.push(T>>8),O.push(T&255);return O},g.prototype.toFixedLengthString=function(){let T=(function(){let b=[];for(let R=0;R<this.parts.length;R++)b.push(E(this.parts[R].toString(16),4));return b}).call(this).join(":"),O="";return this.zoneId&&(O=`%${this.zoneId}`),T+O},g.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let T=this.parts.slice(-2),O=T[0],b=T[1];return new I.IPv4([O>>8,O&255,b>>8,b&255])},g.prototype.toNormalizedString=function(){let T=(function(){let b=[];for(let R=0;R<this.parts.length;R++)b.push(this.parts[R].toString(16));return b}).call(this).join(":"),O="";return this.zoneId&&(O=`%${this.zoneId}`),T+O},g.prototype.toRFC5952String=function(){let T=/((^|:)(0(:|$)){2,})/g,O="";this.zoneId&&(O=`%${this.zoneId}`);let b=this.toNormalizedString(),R=b.slice(0,b.length-O.length),P=0,de=-1,dn=-1,zr;for(;zr=T.exec(R);){let Yr=(zr[0].match(/0/g)||[]).length;Yr>dn&&(dn=Yr,P=zr.index,de=zr[0].length)}return de<0?R+O:`${R.substring(0,P)}::${R.substring(P+de)}${O}`},g.prototype.toString=function(){return this.toRFC5952String()},g})(),I.IPv6.broadcastAddressFromCIDR=function(g){try{let T=this.parseCIDR(g),O=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),R=[],P=0;for(;P<16;)R.push(parseInt(O[P],10)|parseInt(b[P],10)^255),P++;return new this(R)}catch(T){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:T})}},I.IPv6.isIPv6=function(g){return this.parser(g)!==null},I.IPv6.isValid=function(g){if(typeof g=="string"&&g.indexOf(":")===-1)return!1;try{let T=this.parser(g);return new this(T.parts,T.zoneId),!0}catch{return!1}},I.IPv6.isValidCIDR=function(g){if(typeof g=="string"&&g.indexOf(":")===-1)return!1;try{return this.parseCIDR(g),!0}catch{return!1}},I.IPv6.networkAddressFromCIDR=function(g){let T,O,b,R,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),R=[],O=0;O<16;)R.push(parseInt(b[O],10)&parseInt(P[O],10)),O++;return new this(R)}catch(de){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:de})}},I.IPv6.parse=function(g){let T=this.parser(g);if(T===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(T.parts,T.zoneId)},I.IPv6.parseCIDR=function(g){let T,O,b;if((O=g.match(/^(.+)\/(\d+)$/))&&(T=parseInt(O[2]),T>=0&&T<=128))return b=[this.parse(O[1]),T],Object.defineProperty(b,"toString",{value:function(){return this.join("/")}}),b;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},I.IPv6.parser=function(g){let T,O,b,R,P,de;if(b=g.match(l.deprecatedTransitional))return this.parser(`::ffff:${b[1]}`);if(l.native.test(g))return m(g,8);if((b=g.match(l.transitional))&&(de=b[6]||"",T=b[1],b[1].endsWith("::")||(T=T.slice(0,-1)),T=m(T+de,6),T&&T.parts)){for(P=[parseInt(b[2]),parseInt(b[3]),parseInt(b[4]),parseInt(b[5])],O=0;O<P.length;O++)if(R=P[O],!(0<=R&&R<=255))return null;return T.parts.push(P[0]<<8|P[1]),T.parts.push(P[2]<<8|P[3]),{parts:T.parts,zoneId:T.zoneId}}return null},I.IPv6.subnetMaskFromPrefixLength=function(g){if(g=parseInt(g),Number.isNaN(g)||g<0||g>128)throw new Error("ipaddr: invalid IPv6 prefix length");let T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=0,b=Math.floor(g/8);for(;O<b;)T[O]=255,O++;return b<16&&(T[b]=Math.pow(2,g%8)-1<<8-g%8),new this(T)},I.fromByteArray=function(g){let T=g.length;if(T===4)return new I.IPv4(g);if(T===16)return new I.IPv6(g);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},I.isValid=function(g){return I.IPv6.isValid(g)||I.IPv4.isValid(g)},I.isValidCIDR=function(g){return I.IPv6.isValidCIDR(g)||I.IPv4.isValidCIDR(g)},I.parse=function(g){if(I.IPv6.isValid(g))return I.IPv6.parse(g);if(I.IPv4.isValid(g))return I.IPv4.parse(g);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},I.parseCIDR=function(g){try{return I.IPv6.parseCIDR(g)}catch{try{return I.IPv4.parseCIDR(g)}catch(T){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format",{cause:T})}}},I.process=function(g){let T=this.parse(g);return T.kind()==="ipv6"&&T.isIPv4MappedAddress()?T.toIPv4Address():T},I.subnetMatch=function(g,T,O){let b,R,P,de;O==null&&(O="unicast");for(R in T)if(Object.prototype.hasOwnProperty.call(T,R)){for(P=T[R],P[0]&&!(P[0]instanceof Array)&&(P=[P]),b=0;b<P.length;b++)if(de=P[b],g.kind()===de[0].kind()&&g.match.apply(g,de))return R}return O},typeof iu<"u"&&iu.exports?iu.exports=I:e.ipaddr=I})(CA)});var gn=class extends Error{constructor(r,n,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=r,this.nestedError=void 0}},Wn=class extends gn{constructor(r){super(1,"commander.invalidArgument",r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var bs=class{constructor(r,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,r[0]){case"<":this.required=!0,this._name=r.slice(1,-1);break;case"[":this.required=!1,this._name=r.slice(1,-1);break;default:this.required=!0,this._name=r;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(r,n){return n===this.defaultValue||!Array.isArray(n)?[r]:(n.push(r),n)}default(r,n){return this.defaultValue=r,this.defaultValueDescription=n,this}argParser(r){return this.parseArg=r,this}choices(r){return this.argChoices=r.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Wn(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(n,o):n},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Fc(e){let r=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+r+">":"["+r+"]"}var yy=require("node:events"),qc=fn(require("node:child_process"),1),_r=fn(require("node:path"),1),As=fn(require("node:fs"),1),fe=fn(require("node:process"),1),Ty=require("node:util");var dy=require("node:util"),Os=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(r){this.helpWidth=this.helpWidth??r.helpWidth??80}visibleCommands(r){let n=r.commands.filter(i=>!i._hidden),o=r._getHelpCommand();return o&&!o._hidden&&n.push(o),this.sortSubcommands&&n.sort((i,s)=>i.name().localeCompare(s.name())),n}compareOptions(r,n){let o=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return o(r).localeCompare(o(n))}visibleOptions(r){let n=r.options.filter(i=>!i.hidden),o=r._getHelpOption();if(o&&!o.hidden){let i=o.short&&r._findOption(o.short),s=o.long&&r._findOption(o.long);!i&&!s?n.push(o):o.long&&!s?n.push(r.createOption(o.long,o.description)):o.short&&!i&&n.push(r.createOption(o.short,o.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(r){if(!this.showGlobalOptions)return[];let n=[];for(let o=r.parent;o;o=o.parent){let i=o.options.filter(s=>!s.hidden);n.push(...i)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(r){return r._argsDescription&&r.registeredArguments.forEach(n=>{n.description=n.description||r._argsDescription[n.name()]||""}),r.registeredArguments.find(n=>n.description)?r.registeredArguments:[]}subcommandTerm(r){let n=r.registeredArguments.map(o=>Fc(o)).join(" ");return r._name+(r._aliases[0]?"|"+r._aliases[0]:"")+(r.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(r){return r.flags}argumentTerm(r){return r.name()}longestSubcommandTermLength(r,n){return n.visibleCommands(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(i)))),0)}longestOptionTermLength(r,n){return n.visibleOptions(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestGlobalOptionTermLength(r,n){return n.visibleGlobalOptions(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestArgumentTermLength(r,n){return n.visibleArguments(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(i)))),0)}commandUsage(r){let n=r._name;r._aliases[0]&&(n=n+"|"+r._aliases[0]);let o="";for(let i=r.parent;i;i=i.parent)o=i.name()+" "+o;return o+n+" "+r.usage()}commandDescription(r){return r.description()}subcommandDescription(r){return r.summary()||r.description()}optionDescription(r){let n=[];if(r.argChoices&&n.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&(r.required||r.optional||r.isBoolean()&&typeof r.defaultValue=="boolean")&&n.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),r.presetArg!==void 0&&r.optional&&n.push(`preset: ${JSON.stringify(r.presetArg)}`),r.envVar!==void 0&&n.push(`env: ${r.envVar}`),n.length>0){let o=`(${n.join(", ")})`;return r.description?`${r.description} ${o}`:o}return r.description}argumentDescription(r){let n=[];if(r.argChoices&&n.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&n.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),n.length>0){let o=`(${n.join(", ")})`;return r.description?`${r.description} ${o}`:o}return r.description}formatItemList(r,n,o){return n.length===0?[]:[o.styleTitle(r),...n,""]}groupItems(r,n,o){let i=new Map;return r.forEach(s=>{let c=o(s);i.has(c)||i.set(c,[])}),n.forEach(s=>{let c=o(s);i.has(c)||i.set(c,[]),i.get(c).push(s)}),i}formatHelp(r,n){let o=n.padWidth(r,n),i=n.helpWidth??80;function s(E,I){return n.formatItem(E,o,I,n)}let c=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(r))}`,""],l=n.commandDescription(r);l.length>0&&(c=c.concat([n.boxWrap(n.styleCommandDescription(l),i),""]));let m=n.visibleArguments(r).map(E=>s(n.styleArgumentTerm(n.argumentTerm(E)),n.styleArgumentDescription(n.argumentDescription(E))));if(c=c.concat(this.formatItemList("Arguments:",m,n)),this.groupItems(r.options,n.visibleOptions(r),E=>E.helpGroupHeading??"Options:").forEach((E,I)=>{let g=E.map(T=>s(n.styleOptionTerm(n.optionTerm(T)),n.styleOptionDescription(n.optionDescription(T))));c=c.concat(this.formatItemList(I,g,n))}),n.showGlobalOptions){let E=n.visibleGlobalOptions(r).map(I=>s(n.styleOptionTerm(n.optionTerm(I)),n.styleOptionDescription(n.optionDescription(I))));c=c.concat(this.formatItemList("Global Options:",E,n))}return this.groupItems(r.commands,n.visibleCommands(r),E=>E.helpGroup()||"Commands:").forEach((E,I)=>{let g=E.map(T=>s(n.styleSubcommandTerm(n.subcommandTerm(T)),n.styleSubcommandDescription(n.subcommandDescription(T))));c=c.concat(this.formatItemList(I,g,n))}),c.join(`
3
+ `)}displayWidth(r){return(0,dy.stripVTControlCharacters)(r).length}styleTitle(r){return r}styleUsage(r){return r.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n==="[command]"?this.styleSubcommandText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleCommandText(n)).join(" ")}styleCommandDescription(r){return this.styleDescriptionText(r)}styleOptionDescription(r){return this.styleDescriptionText(r)}styleSubcommandDescription(r){return this.styleDescriptionText(r)}styleArgumentDescription(r){return this.styleDescriptionText(r)}styleDescriptionText(r){return r}styleOptionTerm(r){return this.styleOptionText(r)}styleSubcommandTerm(r){return r.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).join(" ")}styleArgumentTerm(r){return this.styleArgumentText(r)}styleOptionText(r){return r}styleArgumentText(r){return r}styleSubcommandText(r){return r}styleCommandText(r){return r}padWidth(r,n){return Math.max(n.longestOptionTermLength(r,n),n.longestGlobalOptionTermLength(r,n),n.longestSubcommandTermLength(r,n),n.longestArgumentTermLength(r,n))}preformatted(r){return/\n[^\S\r\n]/.test(r)}formatItem(r,n,o,i){let c=" ".repeat(2);if(!o)return c+r;let l=r.padEnd(n+r.length-i.displayWidth(r)),m=2,h=(this.helpWidth??80)-n-m-2,E;return h<this.minWidthToWrap||i.preformatted(o)?E=o:E=i.boxWrap(o,h).replace(/\n/g,`
4
4
  `+" ".repeat(n+m)),c+l+" ".repeat(m)+E.replace(/\n/g,`
5
- ${c}`)}boxWrap(r,n){if(n<this.minWidthToWrap)return r;let o=r.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,a=[];return o.forEach(c=>{let l=c.match(i);if(l===null){a.push("");return}let m=[l.shift()],f=this.displayWidth(m[0]);l.forEach(h=>{let E=this.displayWidth(h);if(f+E<=n){m.push(h),f+=E;return}a.push(m.join(""));let I=h.trimStart();m=[I],f=this.displayWidth(I)}),a.push(m.join(""))}),a.join(`
6
- `)}};var ur=class{constructor(r,n){this.flags=r,this.description=n||"",this.required=r.includes("<"),this.optional=r.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(r),this.mandatory=!1;let o=E0(r);this.short=o.shortFlag,this.long=o.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(r,n){return this.defaultValue=r,this.defaultValueDescription=n,this}preset(r){return this.presetArg=r,this}conflicts(r){return this.conflictsWith=this.conflictsWith.concat(r),this}implies(r){let n=r;return typeof r=="string"&&(n={[r]:!0}),this.implied=Object.assign(this.implied||{},n),this}env(r){return this.envVar=r,this}argParser(r){return this.parseArg=r,this}makeOptionMandatory(r=!0){return this.mandatory=!!r,this}hideHelp(r=!0){return this.hidden=!!r,this}_collectValue(r,n){return n===this.defaultValue||!Array.isArray(n)?[r]:(n.push(r),n)}choices(r){return this.argChoices=r.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Qn(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(n,o):n},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?ly(this.name().replace(/^no-/,"")):ly(this.name())}helpGroup(r){return this.helpGroupHeading=r,this}is(r){return this.short===r||this.long===r}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Fc=class{constructor(r){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,r.forEach(n=>{n.negate?this.negativeOptions.set(n.attributeName(),n):this.positiveOptions.set(n.attributeName(),n)}),this.negativeOptions.forEach((n,o)=>{this.positiveOptions.has(o)&&this.dualOptions.add(o)})}valueFromOption(r,n){let o=n.attributeName();if(!this.dualOptions.has(o))return!0;let i=this.negativeOptions.get(o).presetArg,a=i!==void 0?i:!1;return n.negate===(a===r)}};function ly(e){return e.split("-").reduce((r,n)=>r+n[0].toUpperCase()+n.slice(1))}function E0(e){let r,n,o=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat("guard");if(o.test(a[0])&&(r=a.shift()),i.test(a[0])&&(n=a.shift()),!r&&o.test(a[0])&&(r=a.shift()),!r&&i.test(a[0])&&(r=n,n=a.shift()),a[0].startsWith("-")){let c=a[0],l=`option creation failed due to '${c}' in option flags '${e}'`;throw/^-[^-][^-]/.test(c)?new Error(`${l}
5
+ ${c}`)}boxWrap(r,n){if(n<this.minWidthToWrap)return r;let o=r.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,s=[];return o.forEach(c=>{let l=c.match(i);if(l===null){s.push("");return}let m=[l.shift()],f=this.displayWidth(m[0]);l.forEach(h=>{let E=this.displayWidth(h);if(f+E<=n){m.push(h),f+=E;return}s.push(m.join(""));let I=h.trimStart();m=[I],f=this.displayWidth(I)}),s.push(m.join(""))}),s.join(`
6
+ `)}};var ur=class{constructor(r,n){this.flags=r,this.description=n||"",this.required=r.includes("<"),this.optional=r.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(r),this.mandatory=!1;let o=x0(r);this.short=o.shortFlag,this.long=o.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(r,n){return this.defaultValue=r,this.defaultValueDescription=n,this}preset(r){return this.presetArg=r,this}conflicts(r){return this.conflictsWith=this.conflictsWith.concat(r),this}implies(r){let n=r;return typeof r=="string"&&(n={[r]:!0}),this.implied=Object.assign(this.implied||{},n),this}env(r){return this.envVar=r,this}argParser(r){return this.parseArg=r,this}makeOptionMandatory(r=!0){return this.mandatory=!!r,this}hideHelp(r=!0){return this.hidden=!!r,this}_collectValue(r,n){return n===this.defaultValue||!Array.isArray(n)?[r]:(n.push(r),n)}choices(r){return this.argChoices=r.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Wn(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(n,o):n},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?fy(this.name().replace(/^no-/,"")):fy(this.name())}helpGroup(r){return this.helpGroupHeading=r,this}is(r){return this.short===r||this.long===r}isBoolean(){return!this.required&&!this.optional&&!this.negate}},jc=class{constructor(r){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,r.forEach(n=>{n.negate?this.negativeOptions.set(n.attributeName(),n):this.positiveOptions.set(n.attributeName(),n)}),this.negativeOptions.forEach((n,o)=>{this.positiveOptions.has(o)&&this.dualOptions.add(o)})}valueFromOption(r,n){let o=n.attributeName();if(!this.dualOptions.has(o))return!0;let i=this.negativeOptions.get(o).presetArg,s=i!==void 0?i:!1;return n.negate===(s===r)}};function fy(e){return e.split("-").reduce((r,n)=>r+n[0].toUpperCase()+n.slice(1))}function x0(e){let r,n,o=/^-[^-]$/,i=/^--[^-]/,s=e.split(/[ |,]+/).concat("guard");if(o.test(s[0])&&(r=s.shift()),i.test(s[0])&&(n=s.shift()),!r&&o.test(s[0])&&(r=s.shift()),!r&&i.test(s[0])&&(r=n,n=s.shift()),s[0].startsWith("-")){let c=s[0],l=`option creation failed due to '${c}' in option flags '${e}'`;throw/^-[^-][^-]/.test(c)?new Error(`${l}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
9
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):o.test(c)?new Error(`${l}
10
10
  - too many short flags`):i.test(c)?new Error(`${l}
11
11
  - too many long flags`):new Error(`${l}
12
- - unrecognised flag format`)}if(r===void 0&&n===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:r,longFlag:n}}function _0(e,r){if(Math.abs(e.length-r.length)>3)return Math.max(e.length,r.length);let n=[];for(let o=0;o<=e.length;o++)n[o]=[o];for(let o=0;o<=r.length;o++)n[0][o]=o;for(let o=1;o<=r.length;o++)for(let i=1;i<=e.length;i++){let a;e[i-1]===r[o-1]?a=0:a=1,n[i][o]=Math.min(n[i-1][o]+1,n[i][o-1]+1,n[i-1][o-1]+a),i>1&&o>1&&e[i-1]===r[o-2]&&e[i-2]===r[o-1]&&(n[i][o]=Math.min(n[i][o],n[i-2][o-2]+1))}return n[e.length][r.length]}function rm(e,r){if(!r||r.length===0)return"";r=Array.from(new Set(r));let n=e.startsWith("--");n&&(e=e.slice(2),r=r.map(c=>c.slice(2)));let o=[],i=3,a=.4;return r.forEach(c=>{if(c.length<=1)return;let l=_0(e,c),m=Math.max(e.length,c.length);(m-l)/m>a&&(l<i?(i=l,o=[c]):l===i&&o.push(c))}),o.sort((c,l)=>c.localeCompare(l)),n&&(o=o.map(c=>`--${c}`)),o.length>1?`
12
+ - unrecognised flag format`)}if(r===void 0&&n===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:r,longFlag:n}}function R0(e,r){if(Math.abs(e.length-r.length)>3)return Math.max(e.length,r.length);let n=[];for(let o=0;o<=e.length;o++)n[o]=[o];for(let o=0;o<=r.length;o++)n[0][o]=o;for(let o=1;o<=r.length;o++)for(let i=1;i<=e.length;i++){let s;e[i-1]===r[o-1]?s=0:s=1,n[i][o]=Math.min(n[i-1][o]+1,n[i][o-1]+1,n[i-1][o-1]+s),i>1&&o>1&&e[i-1]===r[o-2]&&e[i-2]===r[o-1]&&(n[i][o]=Math.min(n[i][o],n[i-2][o-2]+1))}return n[e.length][r.length]}function rm(e,r){if(!r||r.length===0)return"";r=Array.from(new Set(r));let n=e.startsWith("--");n&&(e=e.slice(2),r=r.map(c=>c.slice(2)));let o=[],i=3,s=.4;return r.forEach(c=>{if(c.length<=1)return;let l=R0(e,c),m=Math.max(e.length,c.length);(m-l)/m>s&&(l<i?(i=l,o=[c]):l===i&&o.push(c))}),o.sort((c,l)=>c.localeCompare(l)),n&&(o=o.map(c=>`--${c}`)),o.length>1?`
13
13
  (Did you mean one of ${o.join(", ")}?)`:o.length===1?`
14
- (Did you mean ${o[0]}?)`:""}var Ho=class e extends fy.EventEmitter{constructor(r){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=r||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:n=>fe.default.stdout.write(n),writeErr:n=>fe.default.stderr.write(n),outputError:(n,o)=>o(n),getOutHelpWidth:()=>fe.default.stdout.isTTY?fe.default.stdout.columns:void 0,getErrHelpWidth:()=>fe.default.stderr.isTTY?fe.default.stderr.columns:void 0,getOutHasColors:()=>dy()??(fe.default.stdout.isTTY&&fe.default.stdout.hasColors?.()),getErrHasColors:()=>dy()??(fe.default.stderr.isTTY&&fe.default.stderr.hasColors?.()),stripColor:n=>(0,gy.stripVTControlCharacters)(n)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(r){return this._outputConfiguration=r._outputConfiguration,this._helpOption=r._helpOption,this._helpCommand=r._helpCommand,this._helpConfiguration=r._helpConfiguration,this._exitCallback=r._exitCallback,this._storeOptionsAsProperties=r._storeOptionsAsProperties,this._combineFlagAndOptionalValue=r._combineFlagAndOptionalValue,this._allowExcessArguments=r._allowExcessArguments,this._enablePositionalOptions=r._enablePositionalOptions,this._showHelpAfterError=r._showHelpAfterError,this._showSuggestionAfterError=r._showSuggestionAfterError,this}_getCommandAndAncestors(){let r=[];for(let n=this;n;n=n.parent)r.push(n);return r}command(r,n,o){let i=n,a=o;typeof i=="object"&&i!==null&&(a=i,i=null),a=a||{};let[,c,l]=r.match(/([^ ]+) *(.*)/),m=this.createCommand(c);return i&&(m.description(i),m._executableHandler=!0),a.isDefault&&(this._defaultCommandName=m._name),m._hidden=!!(a.noHelp||a.hidden),m._executableFile=a.executableFile||null,l&&m.arguments(l),this._registerCommand(m),m.parent=this,m.copyInheritedSettings(this),i?this:m}createCommand(r){return new e(r)}createHelp(){return Object.assign(new ba,this.configureHelp())}configureHelp(r){return r===void 0?this._helpConfiguration:(this._helpConfiguration=r,this)}configureOutput(r){return r===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...r},this)}showHelpAfterError(r=!0){return typeof r!="string"&&(r=!!r),this._showHelpAfterError=r,this}showSuggestionAfterError(r=!0){return this._showSuggestionAfterError=!!r,this}addCommand(r,n){if(!r._name)throw new Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);return n=n||{},n.isDefault&&(this._defaultCommandName=r._name),(n.noHelp||n.hidden)&&(r._hidden=!0),this._registerCommand(r),r.parent=this,r._checkForBrokenPassThrough(),this}createArgument(r,n){return new Sa(r,n)}argument(r,n,o,i){let a=this.createArgument(r,n);return typeof o=="function"?a.default(i).argParser(o):a.default(o),this.addArgument(a),this}arguments(r){return r.trim().split(/ +/).forEach(n=>{this.argument(n)}),this}addArgument(r){let n=this.registeredArguments.slice(-1)[0];if(n?.variadic)throw new Error(`only the last argument can be variadic '${n.name()}'`);if(r.required&&r.defaultValue!==void 0&&r.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${r.name()}'`);return this.registeredArguments.push(r),this}helpCommand(r,n){if(typeof r=="boolean")return this._addImplicitHelpCommand=r,r&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let o=r??"help [command]",[,i,a]=o.match(/([^ ]+) *(.*)/),c=n??"display help for command",l=this.createCommand(i);return l.helpOption(!1),a&&l.arguments(a),c&&l.description(c),this._addImplicitHelpCommand=!0,this._helpCommand=l,(r||n)&&this._initCommandGroup(l),this}addHelpCommand(r,n){return typeof r!="object"?(this.helpCommand(r,n),this):(this._addImplicitHelpCommand=!0,this._helpCommand=r,this._initCommandGroup(r),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(r,n){let o=["preSubcommand","preAction","postAction"];if(!o.includes(r))throw new Error(`Unexpected value for event passed to hook : '${r}'.
16
- Expecting one of '${o.join("', '")}'`);return this._lifeCycleHooks[r]?this._lifeCycleHooks[r].push(n):this._lifeCycleHooks[r]=[n],this}exitOverride(r){return r?this._exitCallback=r:this._exitCallback=n=>{if(n.code!=="commander.executeSubCommandAsync")throw n},this}_exit(r,n,o){this._exitCallback&&this._exitCallback(new fn(r,n,o)),fe.default.exit(r)}action(r){let n=o=>{let i=this.registeredArguments.length,a=o.slice(0,i);return this._storeOptionsAsProperties?a[i]=this:a[i]=this.opts(),a.push(this),r.apply(this,a)};return this._actionHandler=n,this}createOption(r,n){return new ur(r,n)}_callParseArg(r,n,o,i){try{return r.parseArg(n,o)}catch(a){if(a.code==="commander.invalidArgument"){let c=`${i} ${a.message}`;this.error(c,{exitCode:a.exitCode,code:a.code})}throw a}}_registerOption(r){let n=r.short&&this._findOption(r.short)||r.long&&this._findOption(r.long);if(n){let o=r.long&&this._findOption(r.long)?r.long:r.short;throw new Error(`Cannot add option '${r.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${o}'
17
- - already used by option '${n.flags}'`)}this._initOptionGroup(r),this.options.push(r)}_registerCommand(r){let n=i=>[i.name()].concat(i.aliases()),o=n(r).find(i=>this._findCommand(i));if(o){let i=n(this._findCommand(o)).join("|"),a=n(r).join("|");throw new Error(`cannot add command '${a}' as already have command '${i}'`)}this._initCommandGroup(r),this.commands.push(r)}addOption(r){this._registerOption(r);let n=r.name(),o=r.attributeName();r.defaultValue!==void 0&&this.setOptionValueWithSource(o,r.defaultValue,"default");let i=(a,c,l)=>{a==null&&r.presetArg!==void 0&&(a=r.presetArg);let m=this.getOptionValue(o);a!==null&&r.parseArg?a=this._callParseArg(r,a,m,c):a!==null&&r.variadic&&(a=r._collectValue(a,m)),a==null&&(r.negate?a=!1:r.isBoolean()||r.optional?a=!0:a=""),this.setOptionValueWithSource(o,a,l)};return this.on("option:"+n,a=>{let c=`error: option '${r.flags}' argument '${a}' is invalid.`;i(a,c,"cli")}),r.envVar&&this.on("optionEnv:"+n,a=>{let c=`error: option '${r.flags}' value '${a}' from env '${r.envVar}' is invalid.`;i(a,c,"env")}),this}_optionEx(r,n,o,i,a){if(typeof n=="object"&&n instanceof ur)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let c=this.createOption(n,o);if(c.makeOptionMandatory(!!r.mandatory),typeof i=="function")c.default(a).argParser(i);else if(i instanceof RegExp){let l=i;i=(m,f)=>{let h=l.exec(m);return h?h[0]:f},c.default(a).argParser(i)}else c.default(i);return this.addOption(c)}option(r,n,o,i){return this._optionEx({},r,n,o,i)}requiredOption(r,n,o,i){return this._optionEx({mandatory:!0},r,n,o,i)}combineFlagAndOptionalValue(r=!0){return this._combineFlagAndOptionalValue=!!r,this}allowUnknownOption(r=!0){return this._allowUnknownOption=!!r,this}allowExcessArguments(r=!0){return this._allowExcessArguments=!!r,this}enablePositionalOptions(r=!0){return this._enablePositionalOptions=!!r,this}passThroughOptions(r=!0){return this._passThroughOptions=!!r,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(r=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!r,this}getOptionValue(r){return this._storeOptionsAsProperties?this[r]:this._optionValues[r]}setOptionValue(r,n){return this.setOptionValueWithSource(r,n,void 0)}setOptionValueWithSource(r,n,o){return this._storeOptionsAsProperties?this[r]=n:this._optionValues[r]=n,this._optionValueSources[r]=o,this}getOptionValueSource(r){return this._optionValueSources[r]}getOptionValueSourceWithGlobals(r){let n;return this._getCommandAndAncestors().forEach(o=>{o.getOptionValueSource(r)!==void 0&&(n=o.getOptionValueSource(r))}),n}_prepareUserArgs(r,n){if(r!==void 0&&!Array.isArray(r))throw new Error("first parameter to parse must be array or undefined");if(n=n||{},r===void 0&&n.from===void 0){fe.default.versions?.electron&&(n.from="electron");let i=fe.default.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(n.from="eval")}r===void 0&&(r=fe.default.argv),this.rawArgs=r.slice();let o;switch(n.from){case void 0:case"node":this._scriptPath=r[1],o=r.slice(2);break;case"electron":fe.default.defaultApp?(this._scriptPath=r[1],o=r.slice(2)):o=r.slice(1);break;case"user":o=r.slice(0);break;case"eval":o=r.slice(1);break;default:throw new Error(`unexpected parse option { from: '${n.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",o}parse(r,n){this._prepareForParse();let o=this._prepareUserArgs(r,n);return this._parseCommand([],o),this}async parseAsync(r,n){this._prepareForParse();let o=this._prepareUserArgs(r,n);return await this._parseCommand([],o),this}_prepareForParse(){this._savedState===null?(this.options.filter(r=>r.negate&&r.defaultValue===void 0&&this.getOptionValue(r.attributeName())===void 0).forEach(r=>{let n=r.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(r.attributeName(),!0,"default")}),this.saveStateBeforeParse()):this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(r,n,o){if(Oa.default.existsSync(r))return;let i=n?`searched for local subcommand relative to directory '${n}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",a=`'${r}' does not exist
14
+ (Did you mean ${o[0]}?)`:""}var zo=class e extends yy.EventEmitter{constructor(r){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=r||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:n=>fe.default.stdout.write(n),writeErr:n=>fe.default.stderr.write(n),outputError:(n,o)=>o(n),getOutHelpWidth:()=>fe.default.stdout.isTTY?fe.default.stdout.columns:void 0,getErrHelpWidth:()=>fe.default.stderr.isTTY?fe.default.stderr.columns:void 0,getOutHasColors:()=>hy()??(fe.default.stdout.isTTY&&fe.default.stdout.hasColors?.()),getErrHasColors:()=>hy()??(fe.default.stderr.isTTY&&fe.default.stderr.hasColors?.()),stripColor:n=>(0,Ty.stripVTControlCharacters)(n)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(r){return this._outputConfiguration=r._outputConfiguration,this._helpOption=r._helpOption,this._helpCommand=r._helpCommand,this._helpConfiguration=r._helpConfiguration,this._exitCallback=r._exitCallback,this._storeOptionsAsProperties=r._storeOptionsAsProperties,this._combineFlagAndOptionalValue=r._combineFlagAndOptionalValue,this._allowExcessArguments=r._allowExcessArguments,this._enablePositionalOptions=r._enablePositionalOptions,this._showHelpAfterError=r._showHelpAfterError,this._showSuggestionAfterError=r._showSuggestionAfterError,this}_getCommandAndAncestors(){let r=[];for(let n=this;n;n=n.parent)r.push(n);return r}command(r,n,o){let i=n,s=o;typeof i=="object"&&i!==null&&(s=i,i=null),s=s||{};let[,c,l]=r.match(/([^ ]+) *(.*)/),m=this.createCommand(c);return i&&(m.description(i),m._executableHandler=!0),s.isDefault&&(this._defaultCommandName=m._name),m._hidden=!!(s.noHelp||s.hidden),m._executableFile=s.executableFile||null,l&&m.arguments(l),this._registerCommand(m),m.parent=this,m.copyInheritedSettings(this),i?this:m}createCommand(r){return new e(r)}createHelp(){return Object.assign(new Os,this.configureHelp())}configureHelp(r){return r===void 0?this._helpConfiguration:(this._helpConfiguration=r,this)}configureOutput(r){return r===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...r},this)}showHelpAfterError(r=!0){return typeof r!="string"&&(r=!!r),this._showHelpAfterError=r,this}showSuggestionAfterError(r=!0){return this._showSuggestionAfterError=!!r,this}addCommand(r,n){if(!r._name)throw new Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);return n=n||{},n.isDefault&&(this._defaultCommandName=r._name),(n.noHelp||n.hidden)&&(r._hidden=!0),this._registerCommand(r),r.parent=this,r._checkForBrokenPassThrough(),this}createArgument(r,n){return new bs(r,n)}argument(r,n,o,i){let s=this.createArgument(r,n);return typeof o=="function"?s.default(i).argParser(o):s.default(o),this.addArgument(s),this}arguments(r){return r.trim().split(/ +/).forEach(n=>{this.argument(n)}),this}addArgument(r){let n=this.registeredArguments.slice(-1)[0];if(n?.variadic)throw new Error(`only the last argument can be variadic '${n.name()}'`);if(r.required&&r.defaultValue!==void 0&&r.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${r.name()}'`);return this.registeredArguments.push(r),this}helpCommand(r,n){if(typeof r=="boolean")return this._addImplicitHelpCommand=r,r&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let o=r??"help [command]",[,i,s]=o.match(/([^ ]+) *(.*)/),c=n??"display help for command",l=this.createCommand(i);return l.helpOption(!1),s&&l.arguments(s),c&&l.description(c),this._addImplicitHelpCommand=!0,this._helpCommand=l,(r||n)&&this._initCommandGroup(l),this}addHelpCommand(r,n){return typeof r!="object"?(this.helpCommand(r,n),this):(this._addImplicitHelpCommand=!0,this._helpCommand=r,this._initCommandGroup(r),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(r,n){let o=["preSubcommand","preAction","postAction"];if(!o.includes(r))throw new Error(`Unexpected value for event passed to hook : '${r}'.
16
+ Expecting one of '${o.join("', '")}'`);return this._lifeCycleHooks[r]?this._lifeCycleHooks[r].push(n):this._lifeCycleHooks[r]=[n],this}exitOverride(r){return r?this._exitCallback=r:this._exitCallback=n=>{if(n.code!=="commander.executeSubCommandAsync")throw n},this}_exit(r,n,o){this._exitCallback&&this._exitCallback(new gn(r,n,o)),fe.default.exit(r)}action(r){let n=o=>{let i=this.registeredArguments.length,s=o.slice(0,i);return this._storeOptionsAsProperties?s[i]=this:s[i]=this.opts(),s.push(this),r.apply(this,s)};return this._actionHandler=n,this}createOption(r,n){return new ur(r,n)}_callParseArg(r,n,o,i){try{return r.parseArg(n,o)}catch(s){if(s.code==="commander.invalidArgument"){let c=`${i} ${s.message}`;this.error(c,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(r){let n=r.short&&this._findOption(r.short)||r.long&&this._findOption(r.long);if(n){let o=r.long&&this._findOption(r.long)?r.long:r.short;throw new Error(`Cannot add option '${r.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${o}'
17
+ - already used by option '${n.flags}'`)}this._initOptionGroup(r),this.options.push(r)}_registerCommand(r){let n=i=>[i.name()].concat(i.aliases()),o=n(r).find(i=>this._findCommand(i));if(o){let i=n(this._findCommand(o)).join("|"),s=n(r).join("|");throw new Error(`cannot add command '${s}' as already have command '${i}'`)}this._initCommandGroup(r),this.commands.push(r)}addOption(r){this._registerOption(r);let n=r.name(),o=r.attributeName();r.defaultValue!==void 0&&this.setOptionValueWithSource(o,r.defaultValue,"default");let i=(s,c,l)=>{s==null&&r.presetArg!==void 0&&(s=r.presetArg);let m=this.getOptionValue(o);s!==null&&r.parseArg?s=this._callParseArg(r,s,m,c):s!==null&&r.variadic&&(s=r._collectValue(s,m)),s==null&&(r.negate?s=!1:r.isBoolean()||r.optional?s=!0:s=""),this.setOptionValueWithSource(o,s,l)};return this.on("option:"+n,s=>{let c=`error: option '${r.flags}' argument '${s}' is invalid.`;i(s,c,"cli")}),r.envVar&&this.on("optionEnv:"+n,s=>{let c=`error: option '${r.flags}' value '${s}' from env '${r.envVar}' is invalid.`;i(s,c,"env")}),this}_optionEx(r,n,o,i,s){if(typeof n=="object"&&n instanceof ur)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let c=this.createOption(n,o);if(c.makeOptionMandatory(!!r.mandatory),typeof i=="function")c.default(s).argParser(i);else if(i instanceof RegExp){let l=i;i=(m,f)=>{let h=l.exec(m);return h?h[0]:f},c.default(s).argParser(i)}else c.default(i);return this.addOption(c)}option(r,n,o,i){return this._optionEx({},r,n,o,i)}requiredOption(r,n,o,i){return this._optionEx({mandatory:!0},r,n,o,i)}combineFlagAndOptionalValue(r=!0){return this._combineFlagAndOptionalValue=!!r,this}allowUnknownOption(r=!0){return this._allowUnknownOption=!!r,this}allowExcessArguments(r=!0){return this._allowExcessArguments=!!r,this}enablePositionalOptions(r=!0){return this._enablePositionalOptions=!!r,this}passThroughOptions(r=!0){return this._passThroughOptions=!!r,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(r=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!r,this}getOptionValue(r){return this._storeOptionsAsProperties?this[r]:this._optionValues[r]}setOptionValue(r,n){return this.setOptionValueWithSource(r,n,void 0)}setOptionValueWithSource(r,n,o){return this._storeOptionsAsProperties?this[r]=n:this._optionValues[r]=n,this._optionValueSources[r]=o,this}getOptionValueSource(r){return this._optionValueSources[r]}getOptionValueSourceWithGlobals(r){let n;return this._getCommandAndAncestors().forEach(o=>{o.getOptionValueSource(r)!==void 0&&(n=o.getOptionValueSource(r))}),n}_prepareUserArgs(r,n){if(r!==void 0&&!Array.isArray(r))throw new Error("first parameter to parse must be array or undefined");if(n=n||{},r===void 0&&n.from===void 0){fe.default.versions?.electron&&(n.from="electron");let i=fe.default.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(n.from="eval")}r===void 0&&(r=fe.default.argv),this.rawArgs=r.slice();let o;switch(n.from){case void 0:case"node":this._scriptPath=r[1],o=r.slice(2);break;case"electron":fe.default.defaultApp?(this._scriptPath=r[1],o=r.slice(2)):o=r.slice(1);break;case"user":o=r.slice(0);break;case"eval":o=r.slice(1);break;default:throw new Error(`unexpected parse option { from: '${n.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",o}parse(r,n){this._prepareForParse();let o=this._prepareUserArgs(r,n);return this._parseCommand([],o),this}async parseAsync(r,n){this._prepareForParse();let o=this._prepareUserArgs(r,n);return await this._parseCommand([],o),this}_prepareForParse(){this._savedState===null?(this.options.filter(r=>r.negate&&r.defaultValue===void 0&&this.getOptionValue(r.attributeName())===void 0).forEach(r=>{let n=r.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(r.attributeName(),!0,"default")}),this.saveStateBeforeParse()):this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(r,n,o){if(As.default.existsSync(r))return;let i=n?`searched for local subcommand relative to directory '${n}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",s=`'${r}' does not exist
19
19
  - if '${o}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${i}`;throw new Error(a)}_executeSubCommand(r,n){n=n.slice();let o=[".js",".ts",".tsx",".mjs",".cjs"];function i(h,E){let I=Er.default.resolve(h,E);if(Oa.default.existsSync(I))return I;if(o.includes(Er.default.extname(E)))return;let g=o.find(T=>Oa.default.existsSync(`${I}${T}`));if(g)return`${I}${g}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=r._executableFile||`${this._name}-${r._name}`,c=this._executableDir||"";if(this._scriptPath){let h;try{h=Oa.default.realpathSync(this._scriptPath)}catch{h=this._scriptPath}c=Er.default.resolve(Er.default.dirname(h),c)}if(c){let h=i(c,a);if(!h&&!r._executableFile&&this._scriptPath){let E=Er.default.basename(this._scriptPath,Er.default.extname(this._scriptPath));E!==this._name&&(h=i(c,`${E}-${r._name}`))}a=h||a}let l=o.includes(Er.default.extname(a)),m;fe.default.platform!=="win32"?l?(n.unshift(a),n=my(fe.default.execArgv).concat(n),m=jc.default.spawn(fe.default.argv[0],n,{stdio:"inherit"})):m=jc.default.spawn(a,n,{stdio:"inherit"}):(this._checkForMissingExecutable(a,c,r._name),n.unshift(a),n=my(fe.default.execArgv).concat(n),m=jc.default.spawn(fe.default.execPath,n,{stdio:"inherit"})),m.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(E=>{fe.default.on(E,()=>{m.killed===!1&&m.exitCode===null&&m.kill(E)})});let f=this._exitCallback;m.on("close",h=>{h=h??1,f?f(new fn(h,"commander.executeSubCommandAsync","(close)")):fe.default.exit(h)}),m.on("error",h=>{if(h.code==="ENOENT")this._checkForMissingExecutable(a,c,r._name);else if(h.code==="EACCES")throw new Error(`'${a}' not executable`);if(!f)fe.default.exit(1);else{let E=new fn(1,"commander.executeSubCommandAsync","(error)");E.nestedError=h,f(E)}}),this.runningCommand=m}_dispatchSubcommand(r,n,o){let i=this._findCommand(r);i||this.help({error:!0}),i._prepareForParse();let a;return a=this._chainOrCallSubCommandHook(a,i,"preSubcommand"),a=this._chainOrCall(a,()=>{if(i._executableHandler)this._executeSubCommand(i,n.concat(o));else return i._parseCommand(n,o)}),a}_dispatchHelpCommand(r){r||this.help();let n=this._findCommand(r);return n&&!n._executableHandler&&n.help(),this._dispatchSubcommand(r,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((r,n)=>{r.required&&this.args[n]==null&&this.missingArgument(r.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let r=(o,i,a)=>{let c=i;if(i!==null&&o.parseArg){let l=`error: command-argument value '${i}' is invalid for argument '${o.name()}'.`;c=this._callParseArg(o,i,a,l)}return c};this._checkNumberOfArguments();let n=[];this.registeredArguments.forEach((o,i)=>{let a=o.defaultValue;o.variadic?i<this.args.length?(a=this.args.slice(i),o.parseArg&&(a=a.reduce((c,l)=>r(o,l,c),o.defaultValue))):a===void 0&&(a=[]):i<this.args.length&&(a=this.args[i],o.parseArg&&(a=r(o,a,o.defaultValue))),n[i]=a}),this.processedArgs=n}_chainOrCall(r,n){return r?.then&&typeof r.then=="function"?r.then(()=>n()):n()}_chainOrCallHooks(r,n){let o=r,i=[];return this._getCommandAndAncestors().reverse().filter(a=>a._lifeCycleHooks[n]!==void 0).forEach(a=>{a._lifeCycleHooks[n].forEach(c=>{i.push({hookedCommand:a,callback:c})})}),n==="postAction"&&i.reverse(),i.forEach(a=>{o=this._chainOrCall(o,()=>a.callback(a.hookedCommand,this))}),o}_chainOrCallSubCommandHook(r,n,o){let i=r;return this._lifeCycleHooks[o]!==void 0&&this._lifeCycleHooks[o].forEach(a=>{i=this._chainOrCall(i,()=>a(this,n))}),i}_parseCommand(r,n){let o=this.parseOptions(n);if(this._parseOptionsEnv(),this._parseOptionsImplied(),r=r.concat(o.operands),n=o.unknown,this.args=r.concat(n),r&&this._findCommand(r[0]))return this._dispatchSubcommand(r[0],r.slice(1),n);if(this._getHelpCommand()&&r[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(r[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(n),this._dispatchSubcommand(this._defaultCommandName,r,n);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(o.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{o.unknown.length>0&&this.unknownOption(o.unknown[0])},a=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let c;return c=this._chainOrCallHooks(c,"preAction"),c=this._chainOrCall(c,()=>this._actionHandler(this.processedArgs)),this.parent&&(c=this._chainOrCall(c,()=>{this.parent.emit(a,r,n)})),c=this._chainOrCallHooks(c,"postAction"),c}if(this.parent?.listenerCount(a))i(),this._processArguments(),this.parent.emit(a,r,n);else if(r.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",r,n);this.listenerCount("command:*")?this.emit("command:*",r,n):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(r){if(r)return this.commands.find(n=>n._name===r||n._aliases.includes(r))}_findOption(r){return this.options.find(n=>n.is(r))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(r=>{r.options.forEach(n=>{n.mandatory&&r.getOptionValue(n.attributeName())===void 0&&r.missingMandatoryOptionValue(n)})})}_checkForConflictingLocalOptions(){let r=this.options.filter(o=>{let i=o.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});r.filter(o=>o.conflictsWith.length>0).forEach(o=>{let i=r.find(a=>o.conflictsWith.includes(a.attributeName()));i&&this._conflictingOption(o,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(r=>{r._checkForConflictingLocalOptions()})}parseOptions(r){let n=[],o=[],i=n;function a(h){return h.length>1&&h[0]==="-"}let c=h=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(h)?!this._getCommandAndAncestors().some(E=>E.options.map(I=>I.short).some(I=>/^-\d$/.test(I))):!1,l=null,m=null,f=0;for(;f<r.length||m;){let h=m??r[f++];if(m=null,h==="--"){i===o&&i.push(h),i.push(...r.slice(f));break}if(l&&(!a(h)||c(h))){this.emit(`option:${l.name()}`,h);continue}if(l=null,a(h)){let E=this._findOption(h);if(E){if(E.required){let I=r[f++];I===void 0&&this.optionMissingArgument(E),this.emit(`option:${E.name()}`,I)}else if(E.optional){let I=null;f<r.length&&(!a(r[f])||c(r[f]))&&(I=r[f++]),this.emit(`option:${E.name()}`,I)}else this.emit(`option:${E.name()}`);l=E.variadic?E:null;continue}}if(h.length>2&&h[0]==="-"&&h[1]!=="-"){let E=this._findOption(`-${h[1]}`);if(E){E.required||E.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${E.name()}`,h.slice(2)):(this.emit(`option:${E.name()}`),m=`-${h.slice(2)}`);continue}}if(/^--[^=]+=/.test(h)){let E=h.indexOf("="),I=this._findOption(h.slice(0,E));if(I&&(I.required||I.optional)){this.emit(`option:${I.name()}`,h.slice(E+1));continue}}if(i===n&&a(h)&&!(this.commands.length===0&&c(h))&&(i=o),(this._enablePositionalOptions||this._passThroughOptions)&&n.length===0&&o.length===0){if(this._findCommand(h)){n.push(h),o.push(...r.slice(f));break}else if(this._getHelpCommand()&&h===this._getHelpCommand().name()){n.push(h,...r.slice(f));break}else if(this._defaultCommandName){o.push(h,...r.slice(f));break}}if(this._passThroughOptions){i.push(h,...r.slice(f));break}i.push(h)}return{operands:n,unknown:o}}opts(){if(this._storeOptionsAsProperties){let r={},n=this.options.length;for(let o=0;o<n;o++){let i=this.options[o].attributeName();r[i]=i===this._versionOptionName?this._version:this[i]}return r}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((r,n)=>Object.assign(r,n.opts()),{})}error(r,n){this._outputConfiguration.outputError(`${r}
21
+ - ${i}`;throw new Error(s)}_executeSubCommand(r,n){n=n.slice();let o=[".js",".ts",".tsx",".mjs",".cjs"];function i(h,E){let I=_r.default.resolve(h,E);if(As.default.existsSync(I))return I;if(o.includes(_r.default.extname(E)))return;let g=o.find(T=>As.default.existsSync(`${I}${T}`));if(g)return`${I}${g}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=r._executableFile||`${this._name}-${r._name}`,c=this._executableDir||"";if(this._scriptPath){let h;try{h=As.default.realpathSync(this._scriptPath)}catch{h=this._scriptPath}c=_r.default.resolve(_r.default.dirname(h),c)}if(c){let h=i(c,s);if(!h&&!r._executableFile&&this._scriptPath){let E=_r.default.basename(this._scriptPath,_r.default.extname(this._scriptPath));E!==this._name&&(h=i(c,`${E}-${r._name}`))}s=h||s}let l=o.includes(_r.default.extname(s)),m;fe.default.platform!=="win32"?l?(n.unshift(s),n=gy(fe.default.execArgv).concat(n),m=qc.default.spawn(fe.default.argv[0],n,{stdio:"inherit"})):m=qc.default.spawn(s,n,{stdio:"inherit"}):(this._checkForMissingExecutable(s,c,r._name),n.unshift(s),n=gy(fe.default.execArgv).concat(n),m=qc.default.spawn(fe.default.execPath,n,{stdio:"inherit"})),m.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(E=>{fe.default.on(E,()=>{m.killed===!1&&m.exitCode===null&&m.kill(E)})});let f=this._exitCallback;m.on("close",h=>{h=h??1,f?f(new gn(h,"commander.executeSubCommandAsync","(close)")):fe.default.exit(h)}),m.on("error",h=>{if(h.code==="ENOENT")this._checkForMissingExecutable(s,c,r._name);else if(h.code==="EACCES")throw new Error(`'${s}' not executable`);if(!f)fe.default.exit(1);else{let E=new gn(1,"commander.executeSubCommandAsync","(error)");E.nestedError=h,f(E)}}),this.runningCommand=m}_dispatchSubcommand(r,n,o){let i=this._findCommand(r);i||this.help({error:!0}),i._prepareForParse();let s;return s=this._chainOrCallSubCommandHook(s,i,"preSubcommand"),s=this._chainOrCall(s,()=>{if(i._executableHandler)this._executeSubCommand(i,n.concat(o));else return i._parseCommand(n,o)}),s}_dispatchHelpCommand(r){r||this.help();let n=this._findCommand(r);return n&&!n._executableHandler&&n.help(),this._dispatchSubcommand(r,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((r,n)=>{r.required&&this.args[n]==null&&this.missingArgument(r.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let r=(o,i,s)=>{let c=i;if(i!==null&&o.parseArg){let l=`error: command-argument value '${i}' is invalid for argument '${o.name()}'.`;c=this._callParseArg(o,i,s,l)}return c};this._checkNumberOfArguments();let n=[];this.registeredArguments.forEach((o,i)=>{let s=o.defaultValue;o.variadic?i<this.args.length?(s=this.args.slice(i),o.parseArg&&(s=s.reduce((c,l)=>r(o,l,c),o.defaultValue))):s===void 0&&(s=[]):i<this.args.length&&(s=this.args[i],o.parseArg&&(s=r(o,s,o.defaultValue))),n[i]=s}),this.processedArgs=n}_chainOrCall(r,n){return r?.then&&typeof r.then=="function"?r.then(()=>n()):n()}_chainOrCallHooks(r,n){let o=r,i=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[n]!==void 0).forEach(s=>{s._lifeCycleHooks[n].forEach(c=>{i.push({hookedCommand:s,callback:c})})}),n==="postAction"&&i.reverse(),i.forEach(s=>{o=this._chainOrCall(o,()=>s.callback(s.hookedCommand,this))}),o}_chainOrCallSubCommandHook(r,n,o){let i=r;return this._lifeCycleHooks[o]!==void 0&&this._lifeCycleHooks[o].forEach(s=>{i=this._chainOrCall(i,()=>s(this,n))}),i}_parseCommand(r,n){let o=this.parseOptions(n);if(this._parseOptionsEnv(),this._parseOptionsImplied(),r=r.concat(o.operands),n=o.unknown,this.args=r.concat(n),r&&this._findCommand(r[0]))return this._dispatchSubcommand(r[0],r.slice(1),n);if(this._getHelpCommand()&&r[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(r[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(n),this._dispatchSubcommand(this._defaultCommandName,r,n);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(o.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{o.unknown.length>0&&this.unknownOption(o.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let c;return c=this._chainOrCallHooks(c,"preAction"),c=this._chainOrCall(c,()=>this._actionHandler(this.processedArgs)),this.parent&&(c=this._chainOrCall(c,()=>{this.parent.emit(s,r,n)})),c=this._chainOrCallHooks(c,"postAction"),c}if(this.parent?.listenerCount(s))i(),this._processArguments(),this.parent.emit(s,r,n);else if(r.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",r,n);this.listenerCount("command:*")?this.emit("command:*",r,n):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(r){if(r)return this.commands.find(n=>n._name===r||n._aliases.includes(r))}_findOption(r){return this.options.find(n=>n.is(r))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(r=>{r.options.forEach(n=>{n.mandatory&&r.getOptionValue(n.attributeName())===void 0&&r.missingMandatoryOptionValue(n)})})}_checkForConflictingLocalOptions(){let r=this.options.filter(o=>{let i=o.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});r.filter(o=>o.conflictsWith.length>0).forEach(o=>{let i=r.find(s=>o.conflictsWith.includes(s.attributeName()));i&&this._conflictingOption(o,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(r=>{r._checkForConflictingLocalOptions()})}parseOptions(r){let n=[],o=[],i=n;function s(h){return h.length>1&&h[0]==="-"}let c=h=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(h)?!this._getCommandAndAncestors().some(E=>E.options.map(I=>I.short).some(I=>/^-\d$/.test(I))):!1,l=null,m=null,f=0;for(;f<r.length||m;){let h=m??r[f++];if(m=null,h==="--"){i===o&&i.push(h),i.push(...r.slice(f));break}if(l&&(!s(h)||c(h))){this.emit(`option:${l.name()}`,h);continue}if(l=null,s(h)){let E=this._findOption(h);if(E){if(E.required){let I=r[f++];I===void 0&&this.optionMissingArgument(E),this.emit(`option:${E.name()}`,I)}else if(E.optional){let I=null;f<r.length&&(!s(r[f])||c(r[f]))&&(I=r[f++]),this.emit(`option:${E.name()}`,I)}else this.emit(`option:${E.name()}`);l=E.variadic?E:null;continue}}if(h.length>2&&h[0]==="-"&&h[1]!=="-"){let E=this._findOption(`-${h[1]}`);if(E){E.required||E.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${E.name()}`,h.slice(2)):(this.emit(`option:${E.name()}`),m=`-${h.slice(2)}`);continue}}if(/^--[^=]+=/.test(h)){let E=h.indexOf("="),I=this._findOption(h.slice(0,E));if(I&&(I.required||I.optional)){this.emit(`option:${I.name()}`,h.slice(E+1));continue}}if(i===n&&s(h)&&!(this.commands.length===0&&c(h))&&(i=o),(this._enablePositionalOptions||this._passThroughOptions)&&n.length===0&&o.length===0){if(this._findCommand(h)){n.push(h),o.push(...r.slice(f));break}else if(this._getHelpCommand()&&h===this._getHelpCommand().name()){n.push(h,...r.slice(f));break}else if(this._defaultCommandName){o.push(h,...r.slice(f));break}}if(this._passThroughOptions){i.push(h,...r.slice(f));break}i.push(h)}return{operands:n,unknown:o}}opts(){if(this._storeOptionsAsProperties){let r={},n=this.options.length;for(let o=0;o<n;o++){let i=this.options[o].attributeName();r[i]=i===this._versionOptionName?this._version:this[i]}return r}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((r,n)=>Object.assign(r,n.opts()),{})}error(r,n){this._outputConfiguration.outputError(`${r}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0}));let o=n||{},i=o.exitCode||1,a=o.code||"commander.error";this._exit(i,a,r)}_parseOptionsEnv(){this.options.forEach(r=>{if(r.envVar&&r.envVar in fe.default.env){let n=r.attributeName();(this.getOptionValue(n)===void 0||["default","config","env"].includes(this.getOptionValueSource(n)))&&(r.required||r.optional?this.emit(`optionEnv:${r.name()}`,fe.default.env[r.envVar]):this.emit(`optionEnv:${r.name()}`))}})}_parseOptionsImplied(){let r=new Fc(this.options),n=o=>this.getOptionValue(o)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(o));this.options.filter(o=>o.implied!==void 0&&n(o.attributeName())&&r.valueFromOption(this.getOptionValue(o.attributeName()),o)).forEach(o=>{Object.keys(o.implied).filter(i=>!n(i)).forEach(i=>{this.setOptionValueWithSource(i,o.implied[i],"implied")})})}missingArgument(r){let n=`error: missing required argument '${r}'`;this.error(n,{code:"commander.missingArgument"})}optionMissingArgument(r){let n=`error: option '${r.flags}' argument missing`;this.error(n,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(r){let n=`error: required option '${r.flags}' not specified`;this.error(n,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(r,n){let o=c=>{let l=c.attributeName(),m=this.getOptionValue(l),f=this.options.find(E=>E.negate&&l===E.attributeName()),h=this.options.find(E=>!E.negate&&l===E.attributeName());return f&&(f.presetArg===void 0&&m===!1||f.presetArg!==void 0&&m===f.presetArg)?f:h||c},i=c=>{let l=o(c),m=l.attributeName();return this.getOptionValueSource(m)==="env"?`environment variable '${l.envVar}'`:`option '${l.flags}'`},a=`error: ${i(r)} cannot be used with ${i(n)}`;this.error(a,{code:"commander.conflictingOption"})}unknownOption(r){if(this._allowUnknownOption)return;let n="";if(r.startsWith("--")&&this._showSuggestionAfterError){let i=[],a=this;do{let c=a.createHelp().visibleOptions(a).filter(l=>l.long).map(l=>l.long);i=i.concat(c),a=a.parent}while(a&&!a._enablePositionalOptions);n=rm(r,i)}let o=`error: unknown option '${r}'${n}`;this.error(o,{code:"commander.unknownOption"})}_excessArguments(r){if(this._allowExcessArguments)return;let n=this.registeredArguments.length,o=n===1?"":"s",i=r.length,a=this.parent?` for '${this.name()}'`:"",c=r.join(", "),l=`error: too many arguments${a}. Expected ${n} argument${o} but got ${i}: ${c}.`;this.error(l,{code:"commander.excessArguments"})}unknownCommand(){let r=this.args[0],n="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(a=>{i.push(a.name()),a.alias()&&i.push(a.alias())}),n=rm(r,i)}let o=`error: unknown command '${r}'${n}`;this.error(o,{code:"commander.unknownCommand"})}version(r,n,o){if(r===void 0)return this._version;this._version=r,n=n||"-V, --version",o=o||"output the version number";let i=this.createOption(n,o);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${r}
25
- `),this._exit(0,"commander.version",r)}),this}description(r,n){return r===void 0&&n===void 0?this._description:(this._description=r,n&&(this._argsDescription=n),this)}summary(r){return r===void 0?this._summary:(this._summary=r,this)}alias(r){if(r===void 0)return this._aliases[0];let n=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(n=this.commands[this.commands.length-1]),r===n._name)throw new Error("Command alias can't be the same as its name");let o=this.parent?._findCommand(r);if(o){let i=[o.name()].concat(o.aliases()).join("|");throw new Error(`cannot add alias '${r}' to command '${this.name()}' as already have command '${i}'`)}return n._aliases.push(r),this}aliases(r){return r===void 0?this._aliases:(r.forEach(n=>this.alias(n)),this)}usage(r){if(r===void 0){if(this._usage)return this._usage;let n=this.registeredArguments.map(o=>$c(o));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?n:[]).join(" ")}return this._usage=r,this}name(r){return r===void 0?this._name:(this._name=r,this)}helpGroup(r){return r===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=r,this)}commandsGroup(r){return r===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=r,this)}optionsGroup(r){return r===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=r,this)}_initOptionGroup(r){this._defaultOptionGroup&&!r.helpGroupHeading&&r.helpGroup(this._defaultOptionGroup)}_initCommandGroup(r){this._defaultCommandGroup&&!r.helpGroup()&&r.helpGroup(this._defaultCommandGroup)}nameFromFilename(r){return this._name=Er.default.basename(r,Er.default.extname(r)),this}executableDir(r){return r===void 0?this._executableDir:(this._executableDir=r,this)}helpInformation(r){let n=this.createHelp(),o=this._getOutputContext(r);n.prepareContext({error:o.error,helpWidth:o.helpWidth,outputHasColors:o.hasColors});let i=n.formatHelp(this,n);return o.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(r){r=r||{};let n=!!r.error,o,i,a;return n?(o=l=>this._outputConfiguration.writeErr(l),i=this._outputConfiguration.getErrHasColors(),a=this._outputConfiguration.getErrHelpWidth()):(o=l=>this._outputConfiguration.writeOut(l),i=this._outputConfiguration.getOutHasColors(),a=this._outputConfiguration.getOutHelpWidth()),{error:n,write:l=>(i||(l=this._outputConfiguration.stripColor(l)),o(l)),hasColors:i,helpWidth:a}}outputHelp(r){let n;typeof r=="function"&&(n=r,r=void 0);let o=this._getOutputContext(r),i={error:o.error,write:o.write,command:this};this._getCommandAndAncestors().reverse().forEach(c=>c.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let a=this.helpInformation({error:o.error});if(n&&(a=n(a),typeof a!="string"&&!Buffer.isBuffer(a)))throw new Error("outputHelp callback must return a string or a Buffer");o.write(a),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(c=>c.emit("afterAllHelp",i))}helpOption(r,n){return typeof r=="boolean"?(r?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(r??"-h, --help",n??"display help for command"),(r||n)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(r){return this._helpOption=r,this._initOptionGroup(r),this}help(r){this.outputHelp(r);let n=Number(fe.default.exitCode??0);n===0&&r&&typeof r!="function"&&r.error&&(n=1),this._exit(n,"commander.help","(outputHelp)")}addHelpText(r,n){let o=["beforeAll","before","after","afterAll"];if(!o.includes(r))throw new Error(`Unexpected value for position to addHelpText.
26
- Expecting one of '${o.join("', '")}'`);let i=`${r}Help`;return this.on(i,a=>{let c;typeof n=="function"?c=n({error:a.error,command:a.command}):c=n,c&&a.write(`${c}
27
- `)}),this}_outputHelpIfRequested(r){let n=this._getHelpOption();n&&r.find(i=>n.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function my(e){return e.map(r=>{if(!r.startsWith("--inspect"))return r;let n,o="127.0.0.1",i="9229",a;return(a=r.match(/^(--inspect(-brk)?)$/))!==null?n=a[1]:(a=r.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(n=a[1],/^\d+$/.test(a[3])?i=a[3]:o=a[3]):(a=r.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(n=a[1],o=a[3],i=a[4]),n&&i!=="0"?`${n}=${o}:${parseInt(i)+1}`:r})}function dy(){if(fe.default.env.NO_COLOR||fe.default.env.FORCE_COLOR==="0"||fe.default.env.FORCE_COLOR==="false")return!1;if(fe.default.env.FORCE_COLOR||fe.default.env.CLICOLOR_FORCE!==void 0)return!0}var hW=new Ho;function Ze(e){throw new Error(`assertUnreachable: ${JSON.stringify(e,null,2)}`)}var I0=Math.pow(10,8)*24*60*60*1e3,EW=-I0;var hy=864e5,yy=6e4,Ty=36e5;var S0=3600;var Ey=S0*24,_W=Ey*7,b0=Ey*365.2425,O0=b0/12,IW=O0*3,nm=Symbol.for("constructDateFrom");function lr(e,r){return typeof e=="function"?e(r):e&&typeof e=="object"&&nm in e?e[nm](r):e instanceof Date?new e.constructor(r):new Date(r)}function Xe(e,r){return lr(r||e,e)}function _y(e,r,n){let o=Xe(e,n?.in);return isNaN(r)?lr(n?.in||e,NaN):(r&&o.setDate(o.getDate()+r),o)}function Iy(e,r,n){let o=Xe(e,n?.in);if(isNaN(r))return lr(n?.in||e,NaN);if(!r)return o;let i=o.getDate(),a=lr(n?.in||e,o.getTime());a.setMonth(o.getMonth()+r+1,0);let c=a.getDate();return i>=c?a:(o.setFullYear(a.getFullYear(),a.getMonth(),i),o)}function Ko(e,r,n){let{years:o=0,months:i=0,weeks:a=0,days:c=0,hours:l=0,minutes:m=0,seconds:f=0}=r,h=Xe(e,n?.in),E=i||o?Iy(h,i+o*12):h,I=c||a?_y(E,c+a*7):E,g=m+l*60,O=(f+g*60)*1e3;return lr(n?.in||e,+I+O)}var A0={};function Sy(){return A0}function om(e){let r=Xe(e),n=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return n.setUTCFullYear(r.getFullYear()),+e-+n}function It(e,...r){let n=lr.bind(null,e||r.find(o=>typeof o=="object"));return r.map(n)}function im(e,r){let n=Xe(e,r?.in);return n.setHours(0,0,0,0),n}function by(e,r,n){let[o,i]=It(n?.in,e,r),a=im(o),c=im(i),l=+a-om(a),m=+c-om(c);return Math.round((l-m)/hy)}function Wn(e,r){let n=+Xe(e)-+Xe(r);return n<0?-1:n>0?1:n}function Oy(e,r,n){let[o,i]=It(n?.in,e,r),a=o.getFullYear()-i.getFullYear(),c=o.getMonth()-i.getMonth();return a*12+c}function Ay(e,r,n){let[o,i]=It(n?.in,e,r);return o.getFullYear()-i.getFullYear()}function Ry(e,r,n){let[o,i]=It(n?.in,e,r),a=xy(o,i),c=Math.abs(by(o,i));o.setDate(o.getDate()-a*c);let l=+(xy(o,i)===-a),m=a*(c-l);return m===0?0:m}function xy(e,r){let n=e.getFullYear()-r.getFullYear()||e.getMonth()-r.getMonth()||e.getDate()-r.getDate()||e.getHours()-r.getHours()||e.getMinutes()-r.getMinutes()||e.getSeconds()-r.getSeconds()||e.getMilliseconds()-r.getMilliseconds();return n<0?-1:n>0?1:n}function zo(e){return r=>{let o=(e?Math[e]:Math.trunc)(r);return o===0?0:o}}function Cy(e,r,n){let[o,i]=It(n?.in,e,r),a=(+o-+i)/Ty;return zo(n?.roundingMethod)(a)}function qc(e,r){return+Xe(e)-+Xe(r)}function Py(e,r,n){let o=qc(e,r)/yy;return zo(n?.roundingMethod)(o)}function Uy(e,r){let n=Xe(e,r?.in);return n.setHours(23,59,59,999),n}function wy(e,r){let n=Xe(e,r?.in),o=n.getMonth();return n.setFullYear(n.getFullYear(),o+1,0),n.setHours(23,59,59,999),n}function vy(e,r){let n=Xe(e,r?.in);return+Uy(n,r)==+wy(n,r)}function Ny(e,r,n){let[o,i,a]=It(n?.in,e,e,r),c=Wn(i,a),l=Math.abs(Oy(i,a));if(l<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-c*l);let m=Wn(i,a)===-c;vy(o)&&l===1&&Wn(o,a)===1&&(m=!1);let f=c*(l-+m);return f===0?0:f}function Ly(e,r,n){let o=qc(e,r)/1e3;return zo(n?.roundingMethod)(o)}function ky(e,r,n){let[o,i]=It(n?.in,e,r),a=Wn(o,i),c=Math.abs(Ay(o,i));o.setFullYear(1584),i.setFullYear(1584);let l=Wn(o,i)===-a,m=a*(c-+l);return m===0?0:m}function My(e,r){let[n,o]=It(e,r.start,r.end);return{start:n,end:o}}var x0={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Dy=(e,r,n)=>{let o,i=x0[e];return typeof i=="string"?o=i:r===1?o=i.one:o=i.other.replace("{{count}}",r.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function Bc(e){return(r={})=>{let n=r.width?String(r.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var R0={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},C0={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},P0={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Gy={date:Bc({formats:R0,defaultWidth:"full"}),time:Bc({formats:C0,defaultWidth:"full"}),dateTime:Bc({formats:P0,defaultWidth:"full"})};var U0={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},$y=(e,r,n,o)=>U0[e];function Yo(e){return(r,n)=>{let o=n?.context?String(n.context):"standalone",i;if(o==="formatting"&&e.formattingValues){let c=e.defaultFormattingWidth||e.defaultWidth,l=n?.width?String(n.width):c;i=e.formattingValues[l]||e.formattingValues[c]}else{let c=e.defaultWidth,l=n?.width?String(n.width):e.defaultWidth;i=e.values[l]||e.values[c]}let a=e.argumentCallback?e.argumentCallback(r):r;return i[a]}}var w0={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},v0={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},N0={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},L0={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},k0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},M0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},D0=(e,r)=>{let n=Number(e),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Fy={ordinalNumber:D0,era:Yo({values:w0,defaultWidth:"wide"}),quarter:Yo({values:v0,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Yo({values:N0,defaultWidth:"wide"}),day:Yo({values:L0,defaultWidth:"wide"}),dayPeriod:Yo({values:k0,defaultWidth:"wide",formattingValues:M0,defaultFormattingWidth:"wide"})};function Vo(e){return(r,n={})=>{let o=n.width,i=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],a=r.match(i);if(!a)return null;let c=a[0],l=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],m=Array.isArray(l)?$0(l,E=>E.test(c)):G0(l,E=>E.test(c)),f;f=e.valueCallback?e.valueCallback(m):m,f=n.valueCallback?n.valueCallback(f):f;let h=r.slice(c.length);return{value:f,rest:h}}}function G0(e,r){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&r(e[n]))return n}function $0(e,r){for(let n=0;n<e.length;n++)if(r(e[n]))return n}function jy(e){return(r,n={})=>{let o=r.match(e.matchPattern);if(!o)return null;let i=o[0],a=r.match(e.parsePattern);if(!a)return null;let c=e.valueCallback?e.valueCallback(a[0]):a[0];c=n.valueCallback?n.valueCallback(c):c;let l=r.slice(i.length);return{value:c,rest:l}}}var F0=/^(\d+)(th|st|nd|rd)?/i,j0=/\d+/i,q0={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},B0={any:[/^b/i,/^(a|c)/i]},H0={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},K0={any:[/1/i,/2/i,/3/i,/4/i]},z0={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Y0={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},V0={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Q0={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},W0={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Z0={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},qy={ordinalNumber:jy({matchPattern:F0,parsePattern:j0,valueCallback:e=>parseInt(e,10)}),era:Vo({matchPatterns:q0,defaultMatchWidth:"wide",parsePatterns:B0,defaultParseWidth:"any"}),quarter:Vo({matchPatterns:H0,defaultMatchWidth:"wide",parsePatterns:K0,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Vo({matchPatterns:z0,defaultMatchWidth:"wide",parsePatterns:Y0,defaultParseWidth:"any"}),day:Vo({matchPatterns:V0,defaultMatchWidth:"wide",parsePatterns:Q0,defaultParseWidth:"any"}),dayPeriod:Vo({matchPatterns:W0,defaultMatchWidth:"any",parsePatterns:Z0,defaultParseWidth:"any"})};var am={code:"en-US",formatDistance:Dy,formatLong:Gy,formatRelative:$y,localize:Fy,match:qy,options:{weekStartsOn:0,firstWeekContainsDate:1}};var X0=["years","months","weeks","days","hours","minutes","seconds"];function By(e,r){let n=Sy(),o=r?.locale??n.locale??am,i=r?.format??X0,a=r?.zero??!1,c=r?.delimiter??" ";return o.formatDistance?i.reduce((m,f)=>{let h=`x${f.replace(/(^.)/,I=>I.toUpperCase())}`,E=e[f];return E!==void 0&&(a||e[f])?m.concat(o.formatDistance(h,E)):m},[]).join(c):""}function Hy(e,r){let{start:n,end:o}=My(r?.in,e),i={},a=ky(o,n);a&&(i.years=a);let c=Ko(n,{years:i.years}),l=Ny(o,c);l&&(i.months=l);let m=Ko(c,{months:i.months}),f=Ry(o,m);f&&(i.days=f);let h=Ko(m,{days:i.days}),E=Cy(o,h);E&&(i.hours=E);let I=Ko(h,{hours:i.hours}),g=Py(o,I);g&&(i.minutes=g);let T=Ko(I,{minutes:i.minutes}),O=Ly(o,T);return O&&(i.seconds=O),i}var TZ=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z"));var CZ=60*1e3;var uX=1/1e6,cm=1e3,Aa=60*cm,oD=60*Aa,Kc=24*oD,lX=7*Kc,mX=30*Kc;var pm=["past-5-minutes","past-15-minutes","past-30-minutes","past-1-hour","past-2-hours","past-4-hours","past-6-hours","past-12-hours","past-24-hours","past-2-days","past-3-days","past-7-days","past-15-days","past-30-days","past-3-months","current-day","current-week","current-month","current-year","previous-day","previous-week","previous-month","previous-3-months","previous-year"];var iD={s:1,m:60,h:3600,d:86400};function zy(e){for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<48||n>57)return!1}return!0}function Yy(){return Math.floor(Date.now()/1e3)}function Qo(e){if(typeof e=="number")return e;if(e==="now")return Yy();if(e.startsWith("-")&&e.length>=3){let n=e.at(-1),o=n?iD[n]:void 0;if(o){let i=e.slice(1,-1);if(i.length>0&&zy(i))return Yy()-parseInt(i,10)*o}}if(zy(e)&&e.length>0)return parseInt(e,10);let r=Date.parse(e);if(!Number.isNaN(r))return Math.floor(r/1e3);throw new Error(`Invalid time value: ${e}. Use unix seconds, relative (-30m, -1h), 'now', or ISO 8601.`)}var y={};Xt(y,{Assign:()=>aD,Clone:()=>Jn,Create:()=>dG,Discard:()=>fG,Metrics:()=>mr,Update:()=>gG});var mr={assign:0,create:0,clone:0,discard:0,update:0};function aD(e,r){return mr.assign+=1,{...e,...r}}var s={};Xt(s,{Counted:()=>xD,Entries:()=>PD,EntriesRegExp:()=>CD,Every:()=>SD,EveryAll:()=>bD,GraphemeCount:()=>ED,HasPropertyKey:()=>RD,IsArray:()=>Ra,IsBigInt:()=>xa,IsBoolean:()=>rT,IsClassInstance:()=>TD,IsConstructor:()=>mD,IsDeepEqual:()=>dm,IsEqual:()=>re,IsFunction:()=>nT,IsGreaterEqualThan:()=>iT,IsGreaterThan:()=>gD,IsInteger:()=>lm,IsLessEqualThan:()=>oT,IsLessThan:()=>hD,IsMaxLength:()=>_D,IsMinLength:()=>ID,IsMultipleOf:()=>yD,IsNull:()=>Vc,IsNumber:()=>Qc,IsObject:()=>Ca,IsObjectNotArray:()=>dD,IsString:()=>Wc,IsSymbol:()=>fD,IsUndefined:()=>mm,IsUnsafePropertyKey:()=>sT,IsValueLike:()=>aT,Keys:()=>Yc,ShiftLeft:()=>Zc,Some:()=>OD,SomeAll:()=>AD,Symbols:()=>UD,Values:()=>wD});function Zn(e,r,n){return e>=r&&e<=n}function sD(e){return e===8205}function cD(e){return Zn(e,55296,56319)}function Vy(e){return Zn(e,127462,127487)}function Wy(e){return Zn(e,65024,65039)}function Zy(e){return Zn(e,768,879)||Zn(e,6832,6911)||Zn(e,7616,7679)||Zn(e,65056,65071)}function zc(e){return e>65535?2:1}function Qy(e,r){for(;r<e.length;){let n=e.codePointAt(r);if(Zy(n)||Wy(n))r+=zc(n);else break}return r}function um(e,r){let n=e.codePointAt(r),o=r+zc(n);for(o=Qy(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+zc(i),o=Qy(e,o)}return Vy(n)&&o<e.length&&Vy(e.codePointAt(o))&&(o+=zc(e.codePointAt(o))),o}function Xy(e){return cD(e)||Zy(e)||Wy(e)||sD(e)}function Jy(e){let r=0,n=0;for(;n<e.length;)n=um(e,n),r++;return r}function pD(e,r){if(r===0)return!0;let n=0,o=0;for(;o<e.length;)if(o=um(e,o),n++,n>=r)return!0;return!1}function uD(e,r){let n=0,o=0;for(;o<e.length;)if(o=um(e,o),n++,n>r)return!1;return!0}function eT(e,r){if(r===0)return!0;let n=0;for(;n<e.length;){if(Xy(e.charCodeAt(n)))return pD(e,r);if(n++,n>=r)return!0}return!1}function tT(e,r){let n=0;for(;n<e.length;){if(Xy(e.charCodeAt(n)))return uD(e,r);if(n++,n>r)return!1}return!0}function Ra(e){return Array.isArray(e)}function xa(e){return re(typeof e,"bigint")}function rT(e){return re(typeof e,"boolean")}function mD(e){if(mm(e)||!nT(e))return!1;let r=Function.prototype.toString.call(e);return!!(/^class\s/.test(r)||/\[native code\]/.test(r))}function nT(e){return re(typeof e,"function")}function lm(e){return Number.isInteger(e)}function Vc(e){return re(e,null)}function Qc(e){return Number.isFinite(e)}function dD(e){return Ca(e)&&!Ra(e)}function Ca(e){return re(typeof e,"object")&&!Vc(e)}function Wc(e){return re(typeof e,"string")}function fD(e){return re(typeof e,"symbol")}function mm(e){return re(e,void 0)}function re(e,r){return e===r}function gD(e,r){return e>r}function hD(e,r){return e<r}function oT(e,r){return e<=r}function iT(e,r){return e>=r}function yD(e,r){if(xa(e)||xa(r))return BigInt(e)%BigInt(r)===0n;let n=1e-10;if(!Qc(e)||lm(e)&&1/r%1===0)return!0;let o=e%r;return Math.min(Math.abs(o),Math.abs(o-r),Math.abs(o+r))<n}function TD(e){if(!Ca(e))return!1;let r=globalThis.Object.getPrototypeOf(e);return Vc(r)?!1:re(typeof r.constructor,"function")&&!(re(r.constructor,globalThis.Object)||re(r.constructor.name,"Object"))}function aT(e){return xa(e)||rT(e)||Vc(e)||Qc(e)||Wc(e)||mm(e)}function ED(e){return Jy(e)}function _D(e,r){return tT(e,r)}function ID(e,r){return eT(e,r)}function SD(e,r,n){for(let o=r;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function bD(e,r,n){let o=!0;for(let i=r;i<e.length;i++)n(e[i],i)||(o=!1);return o}function OD(e,r){for(let n=0;n<e.length;n++)if(r(e[n],n))return!0;return!1}function AD(e,r){let n=!1;for(let o=0;o<e.length;o++)r(e[o],o)&&(n=!0);return n}function xD(e,r){return e.reduce((n,o,i)=>r(o,i)?++n:n,0)}function Zc(e,r,n){return re(e.length,0)?n():r(e[0],e.slice(1))}function sT(e){return re(e,"__proto__")||re(e,"constructor")||re(e,"prototype")}function RD(e,r){return sT(r)?Object.prototype.hasOwnProperty.call(e,r):r in e}function CD(e){return Yc(e).map(r=>[new RegExp(`^${r}$`),e[r]])}function PD(e){return Object.entries(e)}function Yc(e){return Object.getOwnPropertyNames(e)}function UD(e){return Object.getOwnPropertySymbols(e)}function wD(e){return Object.values(e)}function vD(e,r){if(!Ca(r))return!1;let n=Yc(e);return re(n.length,Yc(r).length)&&n.every(o=>dm(e[o],r[o]))}function ND(e,r){return Ra(r)&&re(e.length,r.length)&&e.every((n,o)=>dm(e[o],r[o]))}function dm(e,r){return Ra(e)?ND(e,r):Ca(e)?vD(e,r):re(e,r)}var St={};Xt(St,{IsBigInt64Array:()=>YD,IsBigUint64Array:()=>VD,IsBoolean:()=>LD,IsDate:()=>WD,IsFloat32Array:()=>KD,IsFloat64Array:()=>zD,IsInt16Array:()=>jD,IsInt32Array:()=>BD,IsInt8Array:()=>GD,IsMap:()=>XD,IsNumber:()=>kD,IsRegExp:()=>QD,IsSet:()=>ZD,IsString:()=>MD,IsTypeArray:()=>DD,IsUint16Array:()=>qD,IsUint32Array:()=>HD,IsUint8Array:()=>$D,IsUint8ClampedArray:()=>FD});function LD(e){return e instanceof Boolean}function kD(e){return e instanceof Number}function MD(e){return e instanceof String}function DD(e){return globalThis.ArrayBuffer.isView(e)}function GD(e){return e instanceof globalThis.Int8Array}function $D(e){return e instanceof globalThis.Uint8Array}function FD(e){return e instanceof globalThis.Uint8ClampedArray}function jD(e){return e instanceof globalThis.Int16Array}function qD(e){return e instanceof globalThis.Uint16Array}function BD(e){return e instanceof globalThis.Int32Array}function HD(e){return e instanceof globalThis.Uint32Array}function KD(e){return e instanceof globalThis.Float32Array}function zD(e){return e instanceof globalThis.Float64Array}function YD(e){return e instanceof globalThis.BigInt64Array}function VD(e){return e instanceof globalThis.BigUint64Array}function QD(e){return e instanceof globalThis.RegExp}function WD(e){return e instanceof globalThis.Date}function ZD(e){return e instanceof globalThis.Set}function XD(e){return e instanceof globalThis.Map}var Xc=s;function eG(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function tG(e){let r={};for(let n of Object.getOwnPropertyNames(e)){if(s.IsUnsafePropertyKey(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=Xn(o.value),s.IsEqual(o.enumerable,!0)?r[n]=o.value:Object.defineProperty(r,n,o)}return r}function rG(e){let r={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(r[n]=Xn(e[n]));for(let n of s.Symbols(e))r[n]=Xn(e[n]);return r}function nG(e){return s.IsClassInstance(e)?e:eG(e)?tG(e):rG(e)}function oG(e){return e.map(r=>Xn(r))}function iG(e){return e.slice()}function aG(e){return new RegExp(e.source,e.flags)}function sG(e){return new Map(Xn([...e.entries()]))}function cG(e){return new Set(Xn([...e.values()]))}function Xn(e){return St.IsTypeArray(e)?iG(e):St.IsRegExp(e)?aG(e):St.IsMap(e)?sG(e):St.IsSet(e)?cG(e):s.IsArray(e)?oG(e):s.IsObject(e)?nG(e):e}function Jn(e){return mr.clone+=1,Xn(e)}var at={};Xt(at,{Get:()=>lG,Reset:()=>pG,Set:()=>uG});var _r={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function pG(){_r.immutableTypes=!1,_r.maxErrors=8,_r.maxInstantiationCount=128,_r.useAcceleration=!0,_r.exactOptionalPropertyTypes=!1,_r.enumerableKind=!1,_r.correctiveParse=!1,_r.unionPrioritySort=!0}function uG(e){for(let r of s.Keys(e)){let n=e[r];n!==void 0&&Object.defineProperty(_r,r,{value:n})}}function lG(){return _r}function mG(e,r){for(let n of Object.keys(r))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:r[n]});return e}function cT(e,r){return{...e,...r}}function dG(e,r,n={}){mr.create+=1;let o=at.Get(),i=cT(r,n),a=o.enumerableKind?cT(i,e):mG(i,e);return o.immutableTypes?Object.freeze(a):a}function fG(e,r){mr.discard+=1;let n={};for(let o of Object.getOwnPropertyNames(e)){if(r.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);i.value=Jn(i.value),Object.defineProperty(n,o,i)}return n}function gG(e,r,n){mr.update+=1;let o=at.Get(),i=Jn(e);for(let a of Object.keys(r))Object.defineProperty(i,a,{configurable:!0,writable:!0,enumerable:o.enumerableKind,value:r[a]});for(let a of Object.keys(n))Object.defineProperty(i,a,{configurable:!0,enumerable:!0,writable:!0,value:n[a]});return i}function w(e,r){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],r)}function Le(e){return s.IsObject(e)}function N(e,r,n){return y.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:r,options:n},{})}function gn(e){return w(e,"Deferred")}function hG(e){return y.Update(e,{"~readonly":!0},{})}function Pa(e,r){return y.Update(hG(e),{},r)}function pT(e,r,n,o){let i=A(e,r,n);return Pa(i,o)}function yG(e){return y.Update(e,{"~optional":!0},{})}function Ua(e,r){return y.Update(yG(e),{},r)}function uT(e,r,n,o){let i=A(e,r,n);return Ua(i,o)}function vt(e,r){return y.Create({"~kind":"Array"},{type:"array",items:e},r)}function J(e){return w(e,"Array")}function Wo(e){return y.Discard(e,["~kind","type","items"])}function Ir(e,r,n={}){return y.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:r},n)}function Ye(e){return w(e,"Constructor")}function lT(e){return y.Discard(e,["~kind","type","parameters","instanceType"])}function Sr(e,r,n={}){return y.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:r},n)}function Ve(e){return w(e,"Function")}function mT(e){return y.Discard(e,["~kind","type","parameters","returnType"])}function st(e,r){return y.Create({"~kind":"Ref"},{$ref:e},r)}function me(e){return w(e,"Ref")}function hn(e,r){return y.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:r})}function Zo(e){return w(e,"Generic")}function Xo(e){return y.Create({"~kind":"Any"},{},e)}function Je(e){return w(e,"Any")}var dT="(?!)";function ge(e){return y.Create({"~kind":"Never"},{not:{}},e)}function dr(e){return w(e,"Never")}function br(e,r={}){return N("AddOptional",[e],r)}function eo(e,r={}){return Ua(e,r)}function fT(e){return eo(e)}function nt(e){return Le(e)&&s.HasPropertyKey(e,"~optional")}function gT(e){return s.Keys(e).filter(r=>!nt(e[r]))}function Jc(e){return s.Keys(e)}function ep(e){return s.Values(e)}function D(e,r={}){let n=gT(e),o=n.length>0?{required:n}:{};return y.Create({"~kind":"Object"},{type:"object",...o,properties:e},r)}function $(e){return w(e,"Object")}function hT(e){return y.Discard(e,["~kind","type","properties","required"])}function et(e){return y.Create({"~kind":"Unknown"},{},e)}function ot(e){return w(e,"Unknown")}function Or(e,r,n){let o=s.Keys(e).reduce((i,a)=>({...i,[a]:y.Update(e[a],{},{$id:a})}),{});return y.Create({"~kind":"Cyclic"},{$defs:o,$ref:r},n)}function _e(e){return w(e,"Cyclic")}function yT(e){return y.Update(e,{"~unsafe":null},{})}function tp(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var ie={};Xt(ie,{Match:()=>TG});function TG(e,r){return r[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function wa(...e){let[r,n]=ie.Match(e,{2:(o,i)=>[o,i,i],1:o=>[o,et(),et()]});return y.Create({"~kind":"Infer"},{type:"infer",name:r,extends:n},{})}function Qe(e){return w(e,"Infer")}function to(e,r,n,o={}){return y.Create({"~kind":"Dependent"},{if:e,then:r,else:n},o)}function $e(e){return w(e,"Dependent")}function TT(e){return y.Discard(e,["~kind","if","then","else"])}function ET(e){return s.IsObjectNotArray(e)}function _T(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function IT(e){return s.IsString(e)||s.IsNumber(e)}function ST(e,r){let n=ET(e)?_T(e):e;return y.Create({"~kind":"Enum"},{enum:n},r)}function We(e){return w(e,"Enum")}function dt(e,r={}){return y.Create({"~kind":"Intersect"},{allOf:e},r)}function G(e){return w(e,"Intersect")}function bT(e){return y.Discard(e,["~kind","allOf"])}var ro={};Xt(ro,{Hash:()=>MG,HashCode:()=>UT});function ye(){throw new Error("Unreachable")}function EG(e){let r=new Set,n=e;for(;n&&n!==Object.prototype;){for(let o of Reflect.ownKeys(n))o!=="constructor"&&typeof o!="symbol"&&r.add(o);n=Object.getPrototypeOf(n)}return[...r]}function _G(e){return typeof e=="number"}var bt;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(bt||(bt={}));var Jo=BigInt("14695981039346656037"),[IG,SG]=[BigInt("1099511628211"),BigInt("18446744073709551616")],bG=Array.from({length:256}).map((e,r)=>BigInt(r)),RT=new Float64Array(1),CT=new DataView(RT.buffer),PT=new Uint8Array(RT.buffer);function ft(e){Jo=Jo^bG[e],Jo=Jo*IG%SG}function OG(e){ft(bt.Array);for(let r of e)yn(r)}function AG(e){ft(bt.BigInt),CT.setBigInt64(0,e);for(let r of PT)ft(r)}function AT(e){ft(bt.Boolean),ft(e?1:0)}function xG(e){ft(bt.Constructor),yn(e.toString())}function RG(e){ft(bt.Date),yn(e.getTime())}function CG(e){ft(bt.Function),yn(e.toString())}function PG(e){ft(bt.Null)}function xT(e){ft(bt.Number),CT.setFloat64(0,e,!0);for(let r of PT)ft(r)}function UG(e){ft(bt.Object);for(let r of EG(e).sort())yn(r),yn(e[r])}function wG(e){ft(bt.RegExp),fm(e.toString())}var vG=new TextEncoder;function fm(e){ft(bt.String);for(let r of vG.encode(e))ft(r)}function NG(e){ft(bt.Symbol),yn(e.toString())}function LG(e){ft(bt.TypeArray);let r=new Uint8Array(e.buffer);for(let n=0;n<r.length;n++)ft(r[n])}function kG(e){return ft(bt.Undefined)}function yn(e){return St.IsTypeArray(e)?LG(e):St.IsDate(e)?RG(e):St.IsRegExp(e)?wG(e):St.IsBoolean(e)?AT(e.valueOf()):St.IsString(e)?fm(e.valueOf()):St.IsNumber(e)?xT(e.valueOf()):_G(e)?xT(e):s.IsArray(e)?OG(e):s.IsBoolean(e)?AT(e):s.IsBigInt(e)?AG(e):s.IsConstructor(e)?xG(e):s.IsNull(e)?PG(e):s.IsObject(e)?UG(e):s.IsString(e)?fm(e):s.IsSymbol(e)?NG(e):s.IsUndefined(e)?kG(e):s.IsFunction(e)?CG(e):ye()}function UT(e){return Jo=BigInt("14695981039346656037"),yn(e),Jo}function MG(e){return UT(e).toString(16).padStart(16,"0")}function wT(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var DG=wT;function vT(){return DG}var va=class{constructor(r,n){this.type=r,this.decode=n}Encode(r){let n=this.type,o=no(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=no(n)?c=>n["~codec"].encode(r(c)):r,a={decode:o,encode:i};return y.Update(this.type,{"~codec":a},{})}},Na=class{constructor(r){this.type=r}Decode(r){return new va(this.type,r)}};function rp(e){return new Na(e)}function LT(e,r){return rp(e).Decode(r).Encode(()=>{throw Error("Encode not implemented")})}function kT(e,r){return rp(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(r)}function no(e){return Le(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function MT(e){return ei(e)}function oo(e){return Le(e)&&s.HasPropertyKey(e,"~immutable")}function Ar(e,r={}){return N("AddReadonly",[e],r)}function io(e,r={}){return Pa(e,r)}function DT(e){return io(e)}function ao(e){return Le(e)&&s.HasPropertyKey(e,"~readonly")}function $G(e,r){let n=np(e)?[...e["~refine"],r]:[r];return y.Update(e,{"~refine":n},{})}function GT(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,()=>"Refine Error"]});return $G(r,{check:n,error:o})}function FG(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function np(e){return Le(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,r=>FG(r))}var $T="-?(?:0|[1-9][0-9]*)n";function La(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Dt(e){return w(e,"BigInt")}function op(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Ot(e){return w(e,"Boolean")}function ka(e){return y.Create({"~kind":"Identifier"},{name:e})}function FT(e){return w(e,"Identifier")}var ip="-?(?:0|[1-9][0-9]*)";function so(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function ct(e){return w(e,"Integer")}var gm=class extends Error{constructor(r){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:r},writable:!1,configurable:!1,enumerable:!1})}};function jG(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new gm(e)})()}function Y(e,r){return y.Create({"~kind":"Literal"},{type:jG(e),const:e},r)}function ap(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function jT(e){return Z(e)&&s.IsBigInt(e.const)}function qT(e){return Z(e)&&s.IsBoolean(e.const)}function sp(e){return Z(e)&&s.IsNumber(e.const)}function cp(e){return Z(e)&&s.IsString(e.const)}function Z(e){return w(e,"Literal")}function ti(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function xr(e){return w(e,"Null")}var pp="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Gt(e){return y.Create({"~kind":"Number"},{type:"number"},e)}function we(e){return w(e,"Number")}function ri(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function Rr(e){return w(e,"Symbol")}function co(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,a],1:i=>[i,et(),et()]});return y.Create({"~kind":"Parameter"},{name:r,extends:n,equals:o},{})}function BT(e){return w(e,"Parameter")}var up=".*";function At(e){return y.Create({"~kind":"String"},{type:"string"},e)}function tt(e){return w(e,"String")}function q(e,r={}){return y.Create({"~kind":"Union"},{anyOf:e},r)}function C(e){return w(e,"Union")}function HT(e){return y.Discard(e,["~kind","anyOf"])}function Ma(e){let r=KT(e);return s.IsEqual(r.length,2)?r[0]:[]}function qG(e){return!0}function zT(e){return s.ShiftLeft(e,(r,n)=>BG(r)?zT(n):!1,()=>!0)}function YT(e){return s.IsEqual(e.length,0)?!1:zT(e)}function BG(e){return C(e)?YT(e.anyOf):Z(e)?qG(e.const):!1}function lp(e){return YT(e)}function mp(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function VT(e,r,n=[]){return s.ShiftLeft(e,(o,i)=>VT(i,r,[...n,`${o}${r}`]),()=>n)}function HG(e,r){return s.IsEqual(e.length,0)?[`${r}`]:VT(e,r)}function QT(e,r,n=[]){return s.ShiftLeft(r,(o,i)=>QT(e,i,[...n,...WT(e,o)]),()=>n)}function WT(e,r){return C(r)?QT(e,r.anyOf):Z(r)?HG(e,r.const):ye()}function ZT(e,r){return s.ShiftLeft(r,(n,o)=>ZT(WT(e,n),o),()=>e)}function KG(e){return e.map(r=>Y(r))}function zG(e){let r=ZT([],e),n=KG(r);return q(n)}function YG(e){return s.IsEqual(e.length,0)?ye():s.IsEqual(e.length,1)&&Z(e[0])?e[0]:zG(e)}function hm(e){let r=Ma(e);return s.IsEqual(r.length,0)?At():lp(r)?YG(r):mp(e)}function Da(e){let r=hm(e);return Ie(r)?At():r}function Nt(e,r){let n="object",o={[e]:r};return y.Create({"~kind":"Record"},{type:n,patternProperties:o})}function XT(e){return Nt(Ht,e)}function JT(e){return D({true:e,false:e})}function Fe(e,r={}){let[n,o,i]=[e,e.length,!1];return y.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:o},r)}function V(e){return w(e,"Tuple")}function eE(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function VG(e){return y.Discard(e,["~readonly"])}function ym(e,r){return y.Update(VG(e),{},r)}function tE(e,r,n,o){let i=A(e,r,n);return ym(i,o)}function rE(e,r={}){return N("RemoveReadonly",[e],r)}function nE(e,r={}){return ym(e,r)}function QG(e){return y.Discard(e,["~optional"])}function Tm(e,r){return y.Update(QG(e),{},r)}function oE(e,r,n,o){let i=A(e,r,n);return Tm(i,o)}function iE(e,r={}){return N("RemoveOptional",[e],r)}function dp(e,r={}){return Tm(e,r)}function Em(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function aE(e){let r=Em(e.items);return D(r)}function WG(e,r){return ao(e)?!!ao(r):!1}function ZG(e,r){return nt(e)?!!nt(r):!1}function XG(e,r){let n=WG(e,r),o=ZG(e,r),i=ke([e,r]),a=nE(dp(i));return n&&o?io(eo(a)):n&&!o?io(a):!n&&o?eo(a):a}function JG(e,r,n){return n in e?n in r?XG(e[n],r[n]):e[n]:n in r?r[n]:ge()}function e$(e,r){return[...new Set([...s.Keys(r),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:JG(e,r,i)}),{})}function sE(e){return $(e)?e.properties:V(e)?Em(e.items):ye()}function cE(e,r){let n=sE(e),o=sE(r),i=e$(n,o);return D(i)}function pE(e,r){let n=po(e,r);return s.IsEqual(n,$a)?e:s.IsEqual(n,Fa)||s.IsEqual(n,Ga)?r:ge()}function uE(e){return $(e)||V(e)}function t$(e,r){let n=C(e),o=C(r);return n||o}function r$(e,r){let n=Jt(e),o=Jt(r),i=t$(n,o),a=uE(n),c=uE(o);return i?ke([n,o]):a&&c?cE(n,o):a&&!c?n:!a&&c?o:pE(n,o)}function lE(e,r,n=[]){return s.ShiftLeft(r,(o,i)=>lE(e,i,[...n,r$(e,o)]),()=>s.IsEqual(n.length,0)?[e]:n)}function mE(e,r,n=[]){return s.ShiftLeft(e,(o,i)=>mE(i,r,[...n,...ja([o],r)]),()=>n)}function ja(e,r=[]){return s.ShiftLeft(e,(n,o)=>C(n)?ja(o,mE(n.anyOf,r)):ja(o,lE(n,r)),()=>r)}function n$(e,r){let n=ht({},e,r);return F.IsExtendsTrueLike(n)?[]:[e]}function o$(e,r){return e.reduce((n,o)=>[...n,...n$(o,r)],[])}function fp(e,r){let n=Jt(e),o=C(n)?n.anyOf:[n],i=o$(o,r);return $t(i)}function fr(e,r,n){let o=dt([e,r]),i=fp(n,e);return $t([o,i])}function Lt(e){let r=e.map(n=>Y(n));return $t(r)}function ke(e){let r=ja(e),n=_m(r);return Yr(n)}function _t(e){let r=Da(e);return Jt(r)}function $t(e){let r=_m(e);return Yr(r)}function Jt(e){return $e(e)?fr(e.if,e.then,e.else):We(e)?Lt(e.enum):G(e)?ke(e.allOf):Ie(e)?_t(e.pattern):C(e)?$t(e.anyOf):e}function Yr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?ge():q(e)}function dE(e,r){let n=Lt(e);return Tn(n,r)}function fE(e,r){return Nt(En,r)}function gE(e,r){let n=ke(e);return Tn(n,r)}function hE(e,r){return s.IsString(e)||s.IsNumber(e)?D({[e]:r}):s.IsEqual(e,!1)?D({false:r}):s.IsEqual(e,!0)?D({true:r}):D({})}function yE(e,r){return Nt(ni,r)}function TE(e,r){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?Nt(e.pattern.toString(),r):Nt(Ht,r)}function EE(e,r){let n=Ma(e);return lp(n)?Tn(_t(e),r):Nt(e,r)}function i$(e){return C(e)?oi(e.anyOf):[e]}function oi(e){return e.reduce((r,n)=>[...r,...i$(n)],[])}function a$(e){return e.some(r=>tt(r)||we(r)||ct(r))}function s$(e,r){return s.IsEqual(a$(e),!0)?Nt(Ht,r):void 0}function c$(e,r){return e.reduce((n,o)=>Z(o)&&(s.IsString(o.const)||s.IsNumber(o.const))?{...n,[o.const]:r}:n,{})}function p$(e,r){let n=c$(e,r);return D(n)}function _E(e,r){let n=oi(e),o=s$(n,r);return Le(o)?o:p$(n,r)}function Tn(e,r){return Je(e)?XT(r):Ot(e)?JT(r):We(e)?dE(e.enum,r):ct(e)?fE(e,r):G(e)?gE(e.allOf,r):Z(e)?hE(e.const,r):we(e)?yE(e,r):C(e)?_E(e.anyOf,r):tt(e)?TE(e,r):Ie(e)?EE(e.pattern,r):D({})}function Im(e,r,n){return K([e])?y.Update(Tn(e,r),{},n):gp(e,r,n)}function IE(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return Im(a,c,i)}var En=`^${ip}$`,ni=`^${pp}$`,Ht=`^${up}$`;function gp(e,r,n={}){return N("Record",[e,r],n)}function ii(e,r,n={}){return Im(e,r,n)}function hp(e,r){return Nt(e,r)}function yp(e){return s.IsEqual(e,Ht)?At():s.IsEqual(e,En)?so():s.IsEqual(e,ni)?Gt():hm(e)}function pt(e){return s.Keys(e.patternProperties)[0]}function _n(e){let r=pt(e);return yp(r)}function xe(e){return e.patternProperties[pt(e)]}function he(e){return w(e,"Record")}function uo(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function In(e){return w(e,"Rest")}function Tp(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function Ep(e){return w(e,"This")}function ai(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function gr(e){return w(e,"Undefined")}function _p(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function Ft(e){return w(e,"Void")}function l$(e,r){return s.IsEqual(e,"Array")?vt(r[0]):s.IsEqual(e,"Capitalize")?Sp(r[0]):s.IsEqual(e,"ConstructorParameters")?Rp(r[0]):s.IsEqual(e,"Evaluate")?SI(r[0]):s.IsEqual(e,"Exclude")?Cp(r[0],r[1]):s.IsEqual(e,"Extract")?Pp(r[0],r[1]):s.IsEqual(e,"Index")?Ka(r[0],r[1]):s.IsEqual(e,"InstanceType")?Up(r[0]):s.IsEqual(e,"Lowercase")?bp(r[0]):s.IsEqual(e,"NonNullable")?wp(r[0]):s.IsEqual(e,"Omit")?vp(r[0],r[1]):s.IsEqual(e,"Parameters")?Np(r[0]):s.IsEqual(e,"Partial")?Lp(r[0]):s.IsEqual(e,"Pick")?kp(r[0],r[1]):s.IsEqual(e,"Readonly")?Mp(r[0]):s.IsEqual(e,"KeyOf")?za(r[0]):s.IsEqual(e,"Record")?gp(r[0],r[1]):s.IsEqual(e,"Required")?Dp(r[0]):s.IsEqual(e,"ReturnType")?Gp(r[0]):s.IsEqual(e,"Uncapitalize")?Op(r[0]):s.IsEqual(e,"Uppercase")?Ap(r[0]):Ha(st(e),r)}function lo(){throw Error("Unreachable")}function xE(e,r=[]){return s.ShiftLeft(e,(n,o)=>xE(o,[...r,n[1]]),()=>r)}function Vr(e){return s.IsEqual(e.length,3)?[e[0],...xE(e[1])]:[]}function RE(e){return co(e[0],e[2],e[4])}function CE(e){return co(e[0],e[2],e[2])}function PE(e){return co(e[0],et(),e[2])}function UE(e){return co(e,et(),et())}function wE(e){return Vr(e)}function vE(e){return e[1]}function NE(e){return Vr(e)}function LE(e){return e[1]}function kE(e){return l$(e[0],e[1])}function ME(e){return null}function DE(e){return At()}function GE(e){return Gt()}function $E(e){return op()}function FE(e){return ai()}function jE(e){return ti()}function qE(e){return so()}function BE(e){return La()}function HE(e){return et()}function KE(e){return Xo()}function zE(e){return D({})}function YE(e){return ge()}function VE(e){return ri()}function QE(e){return _p()}function WE(e){return Tp()}function ZE(e){return Y(BigInt(e))}function XE(e){return Y(s.IsEqual(e,"true"))}function JE(e){return Y(parseFloat(e))}function e_(e){return Y(e)}function t_(e){return e[1]}function r_(e){return Y(e)}function n_(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function o_(e){return e[1]}function i_(e){return Ip(e)}function a_(e){return s.IsEqual(e.length,6)?to(e[1],e[3],e[5]):to(e[1],e[3],et())}function s_(e){return e.length>0}function c_(e){return e.reduce((r,n)=>s.IsEqual(n.length,3)?[...r,[n[1]]]:[...r,[]],[])}function p_(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function u_(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function l_(e){return s.IsEqual(e.length,2)?e[1]:[]}function SE(e,r){return r.reduce((n,o)=>{let i=o;return s.IsEqual(i.length,1)?Ka(n,i[0]):s.IsEqual(i.length,0)?vt(n):lo()},e)}function bE(e,r){return s.IsEqual(r.length,3)?xp(e,r[0],r[1],r[2]):e}function m$(e,r){return s.IsArray(r)&&s.IsEqual(r.length,0)?e:$p(e,r)}function m_(e){let[r,n,o,i,a]=e;return m$(bE(r?za(SE(n,o)):SE(n,o),i),a)}function Sm(e,r){return s.IsEqual(r.length,3)?(()=>{let[n,o,i]=r,a=Sm(o,i);if(s.IsEqual(n,"&"))return G(a)?dt([e,...a.allOf]):dt([e,a]);if(s.IsEqual(n,"|"))return C(a)?q([e,...a.anyOf]):q([e,a]);lo()})():e}function d_(e){let[r,n]=e;return Sm(r,n)}function f_(e){let[r,n]=e;return Sm(r,n)}function g_(e){return II(e[1])}function h_(e){return e[1]}function y_(e){return hn(e[0],e[2])}function T_(e){return s.IsEqual(e.length,4)?wa(e[1],e[3]):s.IsEqual(e.length,2)?wa(e[1],et()):lo()}function E_(e){return`${e}`}function __(e){return ct(e[3])?En:we(e[3])?ni:Rr(e[3])?Ht:tt(e[3])?Ht:lo()}function I_(e){return e.length>0}function S_(e){return e.length>0}function b_(e){let[r,n,o,i,a]=e;return{[n]:r&&o?Ar(br(a)):r&&!o?Ar(a):!r&&o?br(a):a}}function O_(e){return Vr(e)}function A_(e){return e.reduce((r,n)=>s.HasPropertyKey(n,En)||s.HasPropertyKey(n,ni)||s.HasPropertyKey(n,Ht)?[r[0],y.Assign(r[1],n)]:[y.Assign(r[0],n),r[1]],[{},{}])}function x_(e){return A_(e[1])}function R_(e){let[r,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return D(r,o)}function C_(e){return s.IsEqual(e.length,5)?Ar(br(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?Ar(e[3]):br(e[3]):lo()}function P_(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[r,n,o]=e;return r&&o?Ar(br(n)):r&&!o?Ar(n):!r&&o?br(n):n}function U_(e){return s.IsEqual(e.length,2)?uo(e[1]):s.IsEqual(e.length,1)?e[0]:lo()}function w_(e){return Vr(e)}function v_(e){return Fe(e[1])}function N_(e){return Ar(br(e[4]))}function L_(e){return Ar(e[3])}function k_(e){return br(e[3])}function M_(e){return e[2]}function D_(e){return s.IsEqual(e.length,2)?uo(e[1]):s.IsEqual(e.length,1)?e[0]:lo()}function G_(e){return Vr(e)}function $_(e){return Sr(e[1],e[4])}function F_(e){return Ir(e[2],e[5])}function OE(e,r){return s.IsEqual(e,"remove")?rE(r):s.IsEqual(e,"add")?Ar(r):r}function j_(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function AE(e,r){return s.IsEqual(e,"remove")?iE(r):s.IsEqual(e,"add")?br(r):r}function q_(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function B_(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function H_(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?qa(ka(e[3]),e[5],e[6][0],OE(e[1],AE(e[8],e[10]))):qa(ka(e[3]),e[5],st(e[3]),OE(e[1],AE(e[8],e[10])))}function K_(e){return st(e)}function z_(e){return BigInt(e)}function Y_(e){return parseFloat(e)}function V_(e){return s.IsEqual(e,"true")}function Q_(e){return null}function W_(e){return{[e[0]]:e[2]}}function Z_(e){return Vr(e)}function d$(e){return e.reduce((r,n)=>y.Assign(r,n),{})}function X_(e){return d$(e[1])}function J_(e){return Vr(e)}function eI(e){return e[1]}function tI(e){return La()}function rI(e){return At()}function nI(e){return Gt()}function oI(e){return so()}function iI(e){return ge()}function aI(e){return Y(e)}function sI(e){return q(e[1])}function cI(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function pI(e){return[e[0],...e[1]]}function uI(e){return e[1]}function lI(e){return Vr(e)}function mI(e){return s.IsEqual(e.length,2)?e[1]:[]}function dI(e){let r=e[2],n=e[3],[o,i]=e[4],a=s.IsEqual(s.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:hn(r,Ba(n,o,a))}}function fI(e){let r=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Ba(r,n,i)}}function gI(e){return{[e[1]]:hn(e[2],e[4])}}function hI(e){return{[e[1]]:e[3]}}function yI(e){return null}function TI(e){return Vr(e)}function EI(e){return e[1]}function _I(e){let[r,n]=[e[0],e[1]];return bI(y.Assign(r,A_(n)[0]))}function Ya(e){return re(e.length,2)}function X(e,r,n){return Ya(e)?r(e[0],e[1]):n()}function h$(e,r){return re(r.indexOf(e),0)?[e,r.slice(e.length)]:[]}function Me(e,r){for(let n=0;n<e.length;n++){let o=h$(e[n],r);if(Ya(o))return o}return[]}function bm(e,r){return Array.from({length:r-e+1},(n,o)=>String.fromCharCode(e+o))}var OI=[...bm(97,122),...bm(65,90)],Om="0",Am=bm(49,57),si=[Om,...Am],AI=" ",ci=`
28
- `;var Sn="_",Fp=".",xI="$",jp="-";var RI="//",CI="/*",T$="*/";function PI(e){let r=e.indexOf(T$);return re(r,-1)?"":e.slice(r+2)}function UI(e){let r=e.indexOf(ci);return re(r,-1)?"":e.slice(r)}function E$(e){return e.replace(/^[ \t\r\f\v]+/,"")}function qp(e){let r=E$(e);return r.startsWith(CI)?qp(PI(r.slice(2))):r.startsWith(RI)?qp(UI(r.slice(2))):r}function gt(e){let r=e.trimStart();return r.startsWith(CI)?gt(PI(r.slice(2))):r.startsWith(RI)?gt(UI(r.slice(2))):r}function Bp(e,r){return X(Me([e],r),(n,o)=>[n,o],()=>["",r])}function _$(e,r){return e.includes(r)}function pi(e,r,n,o=""){return X(Me(e,n),(i,a)=>_$(r,i)?pi(e,r,a,o):pi(e,r,a,`${o}${i}`),()=>[o,n])}function I$(e){return Me(Am,e)}var S$=[...si,Sn];function b$(e){return pi(S$,[Sn],e)}function O$(e){return X(Me([Om],e),(r,n)=>[r,n],()=>X(I$(e),(r,n)=>X(b$(n),(o,i)=>[`${r}${o}`,i],()=>[]),()=>[]))}function Hp(e){return O$(gt(e))}function A$(e){return Bp(jp,e)}function x$(e){return X(A$(e),(r,n)=>X(Hp(n),(o,i)=>[`${r}${o}`,i],()=>[]),()=>[])}function wI(e){return x$(gt(e))}function R$(e){return X(wI(e),(r,n)=>X(Me(["n"],n),(o,i)=>[`${r}`,i],()=>[]),()=>[])}function xm(e){return R$(e)}function Rm(e,r){return Me([e],r)}function _(e,r){return re(e,"")?["",r]:e.startsWith(ci)?Rm(e,qp(r)):e.startsWith(AI)?Rm(e,r):Rm(e,gt(r))}var vI=[...OI,Sn,xI];function C$(e){return Me(vI,e)}var P$=[...vI,...si];function NI(e,r=""){return X(Me(P$,e),(n,o)=>NI(o,`${r}${n}`),()=>[r,e])}function U$(e){return X(C$(e),(r,n)=>X(NI(n),(o,i)=>[`${r}${o}`,i],()=>[]),()=>[])}function je(e){return U$(gt(e))}var w$=[...si,Sn];function v$(e){return Ya(Me([Fp],e))}function LI(e){return X(pi(w$,[Sn],e),(r,n)=>re(r,"")?[]:[r,n],()=>[])}function N$(e){return X(Me([Fp],e),(r,n)=>X(LI(n),(o,i)=>[`0${r}${o}`,i],()=>[]),()=>[])}function L$(e){return X(Hp(e),(r,n)=>X(Me([Fp],n),(o,i)=>X(LI(i),(a,c)=>[`${r}${o}${a}`,c],()=>[`${r}`,i]),()=>[`${r}`,n]),()=>[])}function k$(e){return v$(e)?N$(e):L$(e)}function kI(e){return k$(gt(e))}function M$(e){return Bp(jp,e)}function D$(e){return X(M$(e),(r,n)=>X(kI(n),(o,i)=>[`${r}${o}`,i],()=>[]),()=>[])}function Kp(e){return D$(gt(e))}function G$(e){return re(e,"")?[]:[e.slice(0,1),e.slice(1)]}function MI(e,r){return Zc(e,(n,o)=>r.startsWith(n)?!0:MI(o,r),()=>!1)}function bn(e,r,n=""){return X(G$(r),(o,i)=>MI(e,r)?[n,r]:bn(e,i,`${n}${o}`),()=>[])}function $$(e,r,n){return X(Me([e],n),(o,i)=>X(bn([r],i),(a,c)=>X(Me([r],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function F$(e,r,n){return X(Me([e],n),(o,i)=>X(bn([ci,r],i),(a,c)=>X(Me([r],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function DI(e,r,n,o){return n?$$(e,r,gt(o)):F$(e,r,gt(o))}function j$(e,r){return Me(e,r)}function q$(e,r){return DI(e,e,!1,r)}function B$(e,r){return X(j$(e,r),(n,o)=>q$(n,`${n}${o}`),()=>[])}function zp(e,r){return B$(e,gt(r))}function GI(e,r){return X(bn(e,r),(n,o)=>re(n,"")?[]:[n,o],()=>[])}var u=(e,r,n=()=>[])=>e.length===2?r(e):n(),K$=e=>u(u(je(e),([r,n])=>u(_("extends",n),([o,i])=>u(ne(i),([a,c])=>u(_("=",c),([l,m])=>u(ne(m),([f,h])=>[[r,o,a,l,f],h]))))),([r,n])=>[RE(r),n]),z$=e=>u(u(je(e),([r,n])=>u(_("extends",n),([o,i])=>u(ne(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[CE(r),n]),Y$=e=>u(u(je(e),([r,n])=>u(_("=",n),([o,i])=>u(ne(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[PE(r),n]),V$=e=>u(je(e),([r,n])=>[UE(r),n]),jI=e=>u(u(K$(e),([r,n])=>[r,n],()=>u(z$(e),([r,n])=>[r,n],()=>u(Y$(e),([r,n])=>[r,n],()=>u(V$(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),qI=(e,r=[])=>u(u(_(",",e),([n,o])=>u(jI(o),([i,a])=>[[n,i],a])),([n,o])=>qI(o,[...r,n]),()=>[r,e]),Q$=e=>u(u(u(jI(e),([r,n])=>u(qI(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[wE(r),n]),Um=e=>u(u(_("<",e),([r,n])=>u(Q$(n),([o,i])=>u(_(">",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[vE(r),n]),BI=(e,r=[])=>u(u(_(",",e),([n,o])=>u(ne(o),([i,a])=>[[n,i],a])),([n,o])=>BI(o,[...r,n]),()=>[r,e]),W$=e=>u(u(u(ne(e),([r,n])=>u(BI(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[NE(r),n]),Z$=e=>u(u(_("<",e),([r,n])=>u(W$(n),([o,i])=>u(_(">",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[LE(r),n]),X$=e=>u(u(je(e),([r,n])=>u(Z$(n),([o,i])=>[[r,o],i])),([r,n])=>[kE(r),n]),HI=e=>u(u(u(_(";",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[ME(r),n]),KI=e=>u(_("string",e),([r,n])=>[DE(r),n]),zI=e=>u(_("number",e),([r,n])=>[GE(r),n]),J$=e=>u(_("boolean",e),([r,n])=>[$E(r),n]),e1=e=>u(_("undefined",e),([r,n])=>[FE(r),n]),t1=e=>u(_("null",e),([r,n])=>[jE(r),n]),YI=e=>u(_("integer",e),([r,n])=>[qE(r),n]),r1=e=>u(_("bigint",e),([r,n])=>[BE(r),n]),n1=e=>u(_("unknown",e),([r,n])=>[HE(r),n]),o1=e=>u(_("any",e),([r,n])=>[KE(r),n]),i1=e=>u(_("object",e),([r,n])=>[zE(r),n]),a1=e=>u(_("never",e),([r,n])=>[YE(r),n]),VI=e=>u(_("symbol",e),([r,n])=>[VE(r),n]),s1=e=>u(_("void",e),([r,n])=>[QE(r),n]),c1=e=>u(_("this",e),([r,n])=>[WE(r),n]),p1=e=>u(u(_("${",e),([r,n])=>u(ne(n),([o,i])=>u(_("}",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[t_(r),n]),Cm=e=>u(bn(["${","`"],e),([r,n])=>[r_(r),n]),QI=e=>u(u(u(Cm(e),([r,n])=>u(p1(n),([o,i])=>u(QI(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u(u(Cm(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u(u(Cm(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))),([r,n])=>[n_(r),n]),wm=e=>u(u(_("`",e),([r,n])=>u(QI(n),([o,i])=>u(_("`",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[o_(r),n]),u1=e=>u(wm(e),([r,n])=>[i_(r),n]),l1=e=>u(u(u(_("if",e),([r,n])=>u(ne(n),([o,i])=>u(_("then",i),([a,c])=>u(ne(c),([l,m])=>u(_("else",m),([f,h])=>u(ne(h),([E,I])=>[[r,o,a,l,f,E],I])))))),([r,n])=>[r,n],()=>u(u(_("if",e),([r,n])=>u(ne(n),([o,i])=>u(_("then",i),([a,c])=>u(ne(c),([l,m])=>[[r,o,a,l],m])))),([r,n])=>[r,n],()=>[])),([r,n])=>[a_(r),n]),m1=e=>u(xm(e),([r,n])=>[ZE(r),n]),d1=e=>u(u(_("true",e),([r,n])=>[r,n],()=>u(_("false",e),([r,n])=>[r,n],()=>[])),([r,n])=>[XE(r),n]),f1=e=>u(Kp(e),([r,n])=>[JE(r),n]),g1=e=>u(zp(["'",'"'],e),([r,n])=>[e_(r),n]),h1=e=>u(u(u(_("keyof",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[s_(r),n]),WI=(e,r=[])=>u(u(u(_("[",e),([n,o])=>u(ne(o),([i,a])=>u(_("]",a),([c,l])=>[[n,i,c],l]))),([n,o])=>[n,o],()=>u(u(_("[",e),([n,o])=>u(_("]",o),([i,a])=>[[n,i],a])),([n,o])=>[n,o],()=>[])),([n,o])=>WI(o,[...r,n]),()=>[r,e]),y1=e=>u(WI(e),([r,n])=>[c_(r),n]),T1=e=>u(u(u(_("extends",e),([r,n])=>u(ne(n),([o,i])=>u(_("?",i),([a,c])=>u(ne(c),([l,m])=>u(_(":",m),([f,h])=>u(ne(h),([E,I])=>[[r,o,a,l,f,E],I])))))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[p_(r),n]),E1=e=>u(u(u(_("(",e),([r,n])=>u(ne(n),([o,i])=>u(_(")",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u(KI(e),([r,n])=>[r,n],()=>u(zI(e),([r,n])=>[r,n],()=>u(J$(e),([r,n])=>[r,n],()=>u(e1(e),([r,n])=>[r,n],()=>u(t1(e),([r,n])=>[r,n],()=>u(YI(e),([r,n])=>[r,n],()=>u(r1(e),([r,n])=>[r,n],()=>u(n1(e),([r,n])=>[r,n],()=>u(o1(e),([r,n])=>[r,n],()=>u(i1(e),([r,n])=>[r,n],()=>u(a1(e),([r,n])=>[r,n],()=>u(VI(e),([r,n])=>[r,n],()=>u(s1(e),([r,n])=>[r,n],()=>u(c1(e),([r,n])=>[r,n],()=>u(m1(e),([r,n])=>[r,n],()=>u(d1(e),([r,n])=>[r,n],()=>u(f1(e),([r,n])=>[r,n],()=>u(g1(e),([r,n])=>[r,n],()=>u(u1(e),([r,n])=>[r,n],()=>u(l1(e),([r,n])=>[r,n],()=>u(U1(e),([r,n])=>[r,n],()=>u(N1(e),([r,n])=>[r,n],()=>u($1(e),([r,n])=>[r,n],()=>u(G1(e),([r,n])=>[r,n],()=>u(B1(e),([r,n])=>[r,n],()=>u(X$(e),([r,n])=>[r,n],()=>u(H1(e),([r,n])=>[r,n],()=>[])))))))))))))))))))))))))))),([r,n])=>[u_(r),n]),_1=e=>u(u(u(_("with",e),([r,n])=>u(dS(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[l_(r),n]),ZI=e=>u(u(h1(e),([r,n])=>u(E1(n),([o,i])=>u(y1(i),([a,c])=>u(T1(c),([l,m])=>u(_1(m),([f,h])=>[[r,o,a,l,f],h]))))),([r,n])=>[m_(r),n]),XI=e=>u(u(u(_("&",e),([r,n])=>u(ZI(n),([o,i])=>u(XI(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[r,n]),JI=e=>u(u(ZI(e),([r,n])=>u(XI(n),([o,i])=>[[r,o],i])),([r,n])=>[d_(r),n]),eS=e=>u(u(u(_("|",e),([r,n])=>u(JI(n),([o,i])=>u(eS(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[r,n]),Yp=e=>u(u(JI(e),([r,n])=>u(eS(n),([o,i])=>[[r,o],i])),([r,n])=>[f_(r),n]),I1=e=>u(u(_("readonly",e),([r,n])=>u(Yp(n),([o,i])=>[[r,o],i])),([r,n])=>[g_(r),n]),S1=e=>u(u(_("|",e),([r,n])=>u(Yp(n),([o,i])=>[[r,o],i])),([r,n])=>[h_(r),n]),b1=e=>u(u(Um(e),([r,n])=>u(_("=",n),([o,i])=>u(ne(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[y_(r),n]),O1=e=>u(u(u(_("infer",e),([r,n])=>u(je(n),([o,i])=>u(_("extends",i),([a,c])=>u(Yp(c),([l,m])=>[[r,o,a,l],m])))),([r,n])=>[r,n],()=>u(u(_("infer",e),([r,n])=>u(je(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>[])),([r,n])=>[T_(r),n]),ne=e=>u(u(O1(e),([r,n])=>[r,n],()=>u(S1(e),([r,n])=>[r,n],()=>u(I1(e),([r,n])=>[r,n],()=>u(Yp(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),A1=e=>u(Kp(e),([r,n])=>[E_(r),n]),x1=e=>u(je(e),([r,n])=>[r,n]),R1=e=>u(zp(["'",'"'],e),([r,n])=>[r,n]),C1=e=>u(u(_("[",e),([r,n])=>u(je(n),([o,i])=>u(_(":",i),([a,c])=>u(u(YI(c),([l,m])=>[l,m],()=>u(zI(c),([l,m])=>[l,m],()=>u(KI(c),([l,m])=>[l,m],()=>u(VI(c),([l,m])=>[l,m],()=>[])))),([l,m])=>u(_("]",m),([f,h])=>[[r,o,a,l,f],h]))))),([r,n])=>[__(r),n]),tS=e=>u(u(A1(e),([r,n])=>[r,n],()=>u(x1(e),([r,n])=>[r,n],()=>u(R1(e),([r,n])=>[r,n],()=>u(C1(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),rS=e=>u(u(u(_("readonly",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[I_(r),n]),nS=e=>u(u(u(_("?",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[S_(r),n]),oS=e=>u(u(rS(e),([r,n])=>u(tS(n),([o,i])=>u(nS(i),([a,c])=>u(_(":",c),([l,m])=>u(ne(m),([f,h])=>[[r,o,a,l,f],h]))))),([r,n])=>[b_(r),n]),Vp=e=>u(u(u(_(",",e),([r,n])=>u(_(`
24
+ `),this.outputHelp({error:!0}));let o=n||{},i=o.exitCode||1,s=o.code||"commander.error";this._exit(i,s,r)}_parseOptionsEnv(){this.options.forEach(r=>{if(r.envVar&&r.envVar in fe.default.env){let n=r.attributeName();(this.getOptionValue(n)===void 0||["default","config","env"].includes(this.getOptionValueSource(n)))&&(r.required||r.optional?this.emit(`optionEnv:${r.name()}`,fe.default.env[r.envVar]):this.emit(`optionEnv:${r.name()}`))}})}_parseOptionsImplied(){let r=new jc(this.options),n=o=>this.getOptionValue(o)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(o));this.options.filter(o=>o.implied!==void 0&&n(o.attributeName())&&r.valueFromOption(this.getOptionValue(o.attributeName()),o)).forEach(o=>{Object.keys(o.implied).filter(i=>!n(i)).forEach(i=>{this.setOptionValueWithSource(i,o.implied[i],"implied")})})}missingArgument(r){let n=`error: missing required argument '${r}'`;this.error(n,{code:"commander.missingArgument"})}optionMissingArgument(r){let n=`error: option '${r.flags}' argument missing`;this.error(n,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(r){let n=`error: required option '${r.flags}' not specified`;this.error(n,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(r,n){let o=c=>{let l=c.attributeName(),m=this.getOptionValue(l),f=this.options.find(E=>E.negate&&l===E.attributeName()),h=this.options.find(E=>!E.negate&&l===E.attributeName());return f&&(f.presetArg===void 0&&m===!1||f.presetArg!==void 0&&m===f.presetArg)?f:h||c},i=c=>{let l=o(c),m=l.attributeName();return this.getOptionValueSource(m)==="env"?`environment variable '${l.envVar}'`:`option '${l.flags}'`},s=`error: ${i(r)} cannot be used with ${i(n)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(r){if(this._allowUnknownOption)return;let n="";if(r.startsWith("--")&&this._showSuggestionAfterError){let i=[],s=this;do{let c=s.createHelp().visibleOptions(s).filter(l=>l.long).map(l=>l.long);i=i.concat(c),s=s.parent}while(s&&!s._enablePositionalOptions);n=rm(r,i)}let o=`error: unknown option '${r}'${n}`;this.error(o,{code:"commander.unknownOption"})}_excessArguments(r){if(this._allowExcessArguments)return;let n=this.registeredArguments.length,o=n===1?"":"s",i=r.length,s=this.parent?` for '${this.name()}'`:"",c=r.join(", "),l=`error: too many arguments${s}. Expected ${n} argument${o} but got ${i}: ${c}.`;this.error(l,{code:"commander.excessArguments"})}unknownCommand(){let r=this.args[0],n="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(s=>{i.push(s.name()),s.alias()&&i.push(s.alias())}),n=rm(r,i)}let o=`error: unknown command '${r}'${n}`;this.error(o,{code:"commander.unknownCommand"})}version(r,n,o){if(r===void 0)return this._version;this._version=r,n=n||"-V, --version",o=o||"output the version number";let i=this.createOption(n,o);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${r}
25
+ `),this._exit(0,"commander.version",r)}),this}description(r,n){return r===void 0&&n===void 0?this._description:(this._description=r,n&&(this._argsDescription=n),this)}summary(r){return r===void 0?this._summary:(this._summary=r,this)}alias(r){if(r===void 0)return this._aliases[0];let n=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(n=this.commands[this.commands.length-1]),r===n._name)throw new Error("Command alias can't be the same as its name");let o=this.parent?._findCommand(r);if(o){let i=[o.name()].concat(o.aliases()).join("|");throw new Error(`cannot add alias '${r}' to command '${this.name()}' as already have command '${i}'`)}return n._aliases.push(r),this}aliases(r){return r===void 0?this._aliases:(r.forEach(n=>this.alias(n)),this)}usage(r){if(r===void 0){if(this._usage)return this._usage;let n=this.registeredArguments.map(o=>Fc(o));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?n:[]).join(" ")}return this._usage=r,this}name(r){return r===void 0?this._name:(this._name=r,this)}helpGroup(r){return r===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=r,this)}commandsGroup(r){return r===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=r,this)}optionsGroup(r){return r===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=r,this)}_initOptionGroup(r){this._defaultOptionGroup&&!r.helpGroupHeading&&r.helpGroup(this._defaultOptionGroup)}_initCommandGroup(r){this._defaultCommandGroup&&!r.helpGroup()&&r.helpGroup(this._defaultCommandGroup)}nameFromFilename(r){return this._name=_r.default.basename(r,_r.default.extname(r)),this}executableDir(r){return r===void 0?this._executableDir:(this._executableDir=r,this)}helpInformation(r){let n=this.createHelp(),o=this._getOutputContext(r);n.prepareContext({error:o.error,helpWidth:o.helpWidth,outputHasColors:o.hasColors});let i=n.formatHelp(this,n);return o.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(r){r=r||{};let n=!!r.error,o,i,s;return n?(o=l=>this._outputConfiguration.writeErr(l),i=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(o=l=>this._outputConfiguration.writeOut(l),i=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:n,write:l=>(i||(l=this._outputConfiguration.stripColor(l)),o(l)),hasColors:i,helpWidth:s}}outputHelp(r){let n;typeof r=="function"&&(n=r,r=void 0);let o=this._getOutputContext(r),i={error:o.error,write:o.write,command:this};this._getCommandAndAncestors().reverse().forEach(c=>c.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let s=this.helpInformation({error:o.error});if(n&&(s=n(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");o.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(c=>c.emit("afterAllHelp",i))}helpOption(r,n){return typeof r=="boolean"?(r?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(r??"-h, --help",n??"display help for command"),(r||n)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(r){return this._helpOption=r,this._initOptionGroup(r),this}help(r){this.outputHelp(r);let n=Number(fe.default.exitCode??0);n===0&&r&&typeof r!="function"&&r.error&&(n=1),this._exit(n,"commander.help","(outputHelp)")}addHelpText(r,n){let o=["beforeAll","before","after","afterAll"];if(!o.includes(r))throw new Error(`Unexpected value for position to addHelpText.
26
+ Expecting one of '${o.join("', '")}'`);let i=`${r}Help`;return this.on(i,s=>{let c;typeof n=="function"?c=n({error:s.error,command:s.command}):c=n,c&&s.write(`${c}
27
+ `)}),this}_outputHelpIfRequested(r){let n=this._getHelpOption();n&&r.find(i=>n.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function gy(e){return e.map(r=>{if(!r.startsWith("--inspect"))return r;let n,o="127.0.0.1",i="9229",s;return(s=r.match(/^(--inspect(-brk)?)$/))!==null?n=s[1]:(s=r.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(n=s[1],/^\d+$/.test(s[3])?i=s[3]:o=s[3]):(s=r.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(n=s[1],o=s[3],i=s[4]),n&&i!=="0"?`${n}=${o}:${parseInt(i)+1}`:r})}function hy(){if(fe.default.env.NO_COLOR||fe.default.env.FORCE_COLOR==="0"||fe.default.env.FORCE_COLOR==="false")return!1;if(fe.default.env.FORCE_COLOR||fe.default.env.CLICOLOR_FORCE!==void 0)return!0}var wW=new zo;function Ye(e){throw new Error(`assertUnreachable: ${JSON.stringify(e,null,2)}`)}var C0=Math.pow(10,8)*24*60*60*1e3,kW=-C0;var Ey=864e5,_y=6e4,Iy=36e5;var P0=3600;var Sy=P0*24,MW=Sy*7,U0=Sy*365.2425,N0=U0/12,DW=N0*3,nm=Symbol.for("constructDateFrom");function lr(e,r){return typeof e=="function"?e(r):e&&typeof e=="object"&&nm in e?e[nm](r):e instanceof Date?new e.constructor(r):new Date(r)}function Xe(e,r){return lr(r||e,e)}function by(e,r,n){let o=Xe(e,n?.in);return isNaN(r)?lr(n?.in||e,NaN):(r&&o.setDate(o.getDate()+r),o)}function Oy(e,r,n){let o=Xe(e,n?.in);if(isNaN(r))return lr(n?.in||e,NaN);if(!r)return o;let i=o.getDate(),s=lr(n?.in||e,o.getTime());s.setMonth(o.getMonth()+r+1,0);let c=s.getDate();return i>=c?s:(o.setFullYear(s.getFullYear(),s.getMonth(),i),o)}function Yo(e,r,n){let{years:o=0,months:i=0,weeks:s=0,days:c=0,hours:l=0,minutes:m=0,seconds:f=0}=r,h=Xe(e,n?.in),E=i||o?Oy(h,i+o*12):h,I=c||s?by(E,c+s*7):E,g=m+l*60,O=(f+g*60)*1e3;return lr(n?.in||e,+I+O)}var w0={};function Ay(){return w0}function om(e){let r=Xe(e),n=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return n.setUTCFullYear(r.getFullYear()),+e-+n}function bt(e,...r){let n=lr.bind(null,e||r.find(o=>typeof o=="object"));return r.map(n)}function im(e,r){let n=Xe(e,r?.in);return n.setHours(0,0,0,0),n}function xy(e,r,n){let[o,i]=bt(n?.in,e,r),s=im(o),c=im(i),l=+s-om(s),m=+c-om(c);return Math.round((l-m)/Ey)}function Zn(e,r){let n=+Xe(e)-+Xe(r);return n<0?-1:n>0?1:n}function Ry(e,r,n){let[o,i]=bt(n?.in,e,r),s=o.getFullYear()-i.getFullYear(),c=o.getMonth()-i.getMonth();return s*12+c}function Cy(e,r,n){let[o,i]=bt(n?.in,e,r);return o.getFullYear()-i.getFullYear()}function Uy(e,r,n){let[o,i]=bt(n?.in,e,r),s=Py(o,i),c=Math.abs(xy(o,i));o.setDate(o.getDate()-s*c);let l=+(Py(o,i)===-s),m=s*(c-l);return m===0?0:m}function Py(e,r){let n=e.getFullYear()-r.getFullYear()||e.getMonth()-r.getMonth()||e.getDate()-r.getDate()||e.getHours()-r.getHours()||e.getMinutes()-r.getMinutes()||e.getSeconds()-r.getSeconds()||e.getMilliseconds()-r.getMilliseconds();return n<0?-1:n>0?1:n}function Vo(e){return r=>{let o=(e?Math[e]:Math.trunc)(r);return o===0?0:o}}function Ny(e,r,n){let[o,i]=bt(n?.in,e,r),s=(+o-+i)/Iy;return Vo(n?.roundingMethod)(s)}function Bc(e,r){return+Xe(e)-+Xe(r)}function wy(e,r,n){let o=Bc(e,r)/_y;return Vo(n?.roundingMethod)(o)}function vy(e,r){let n=Xe(e,r?.in);return n.setHours(23,59,59,999),n}function Ly(e,r){let n=Xe(e,r?.in),o=n.getMonth();return n.setFullYear(n.getFullYear(),o+1,0),n.setHours(23,59,59,999),n}function ky(e,r){let n=Xe(e,r?.in);return+vy(n,r)==+Ly(n,r)}function My(e,r,n){let[o,i,s]=bt(n?.in,e,e,r),c=Zn(i,s),l=Math.abs(Ry(i,s));if(l<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-c*l);let m=Zn(i,s)===-c;ky(o)&&l===1&&Zn(o,s)===1&&(m=!1);let f=c*(l-+m);return f===0?0:f}function Dy(e,r,n){let o=Bc(e,r)/1e3;return Vo(n?.roundingMethod)(o)}function Gy(e,r,n){let[o,i]=bt(n?.in,e,r),s=Zn(o,i),c=Math.abs(Cy(o,i));o.setFullYear(1584),i.setFullYear(1584);let l=Zn(o,i)===-s,m=s*(c-+l);return m===0?0:m}function $y(e,r){let[n,o]=bt(e,r.start,r.end);return{start:n,end:o}}var v0={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Fy=(e,r,n)=>{let o,i=v0[e];return typeof i=="string"?o=i:r===1?o=i.one:o=i.other.replace("{{count}}",r.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function Hc(e){return(r={})=>{let n=r.width?String(r.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var L0={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},k0={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},M0={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},jy={date:Hc({formats:L0,defaultWidth:"full"}),time:Hc({formats:k0,defaultWidth:"full"}),dateTime:Hc({formats:M0,defaultWidth:"full"})};var D0={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},qy=(e,r,n,o)=>D0[e];function Qo(e){return(r,n)=>{let o=n?.context?String(n.context):"standalone",i;if(o==="formatting"&&e.formattingValues){let c=e.defaultFormattingWidth||e.defaultWidth,l=n?.width?String(n.width):c;i=e.formattingValues[l]||e.formattingValues[c]}else{let c=e.defaultWidth,l=n?.width?String(n.width):e.defaultWidth;i=e.values[l]||e.values[c]}let s=e.argumentCallback?e.argumentCallback(r):r;return i[s]}}var G0={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},$0={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},F0={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},j0={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},q0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},B0={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},H0=(e,r)=>{let n=Number(e),o=n%100;if(o>20||o<10)switch(o%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},By={ordinalNumber:H0,era:Qo({values:G0,defaultWidth:"wide"}),quarter:Qo({values:$0,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Qo({values:F0,defaultWidth:"wide"}),day:Qo({values:j0,defaultWidth:"wide"}),dayPeriod:Qo({values:q0,defaultWidth:"wide",formattingValues:B0,defaultFormattingWidth:"wide"})};function Wo(e){return(r,n={})=>{let o=n.width,i=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],s=r.match(i);if(!s)return null;let c=s[0],l=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],m=Array.isArray(l)?z0(l,E=>E.test(c)):K0(l,E=>E.test(c)),f;f=e.valueCallback?e.valueCallback(m):m,f=n.valueCallback?n.valueCallback(f):f;let h=r.slice(c.length);return{value:f,rest:h}}}function K0(e,r){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&r(e[n]))return n}function z0(e,r){for(let n=0;n<e.length;n++)if(r(e[n]))return n}function Hy(e){return(r,n={})=>{let o=r.match(e.matchPattern);if(!o)return null;let i=o[0],s=r.match(e.parsePattern);if(!s)return null;let c=e.valueCallback?e.valueCallback(s[0]):s[0];c=n.valueCallback?n.valueCallback(c):c;let l=r.slice(i.length);return{value:c,rest:l}}}var Y0=/^(\d+)(th|st|nd|rd)?/i,V0=/\d+/i,Q0={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},W0={any:[/^b/i,/^(a|c)/i]},Z0={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},X0={any:[/1/i,/2/i,/3/i,/4/i]},J0={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},eD={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},tD={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},rD={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},nD={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},oD={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Ky={ordinalNumber:Hy({matchPattern:Y0,parsePattern:V0,valueCallback:e=>parseInt(e,10)}),era:Wo({matchPatterns:Q0,defaultMatchWidth:"wide",parsePatterns:W0,defaultParseWidth:"any"}),quarter:Wo({matchPatterns:Z0,defaultMatchWidth:"wide",parsePatterns:X0,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Wo({matchPatterns:J0,defaultMatchWidth:"wide",parsePatterns:eD,defaultParseWidth:"any"}),day:Wo({matchPatterns:tD,defaultMatchWidth:"wide",parsePatterns:rD,defaultParseWidth:"any"}),dayPeriod:Wo({matchPatterns:nD,defaultMatchWidth:"any",parsePatterns:oD,defaultParseWidth:"any"})};var sm={code:"en-US",formatDistance:Fy,formatLong:jy,formatRelative:qy,localize:By,match:Ky,options:{weekStartsOn:0,firstWeekContainsDate:1}};var iD=["years","months","weeks","days","hours","minutes","seconds"];function zy(e,r){let n=Ay(),o=r?.locale??n.locale??sm,i=r?.format??iD,s=r?.zero??!1,c=r?.delimiter??" ";return o.formatDistance?i.reduce((m,f)=>{let h=`x${f.replace(/(^.)/,I=>I.toUpperCase())}`,E=e[f];return E!==void 0&&(s||e[f])?m.concat(o.formatDistance(h,E)):m},[]).join(c):""}function Yy(e,r){let{start:n,end:o}=$y(r?.in,e),i={},s=Gy(o,n);s&&(i.years=s);let c=Yo(n,{years:i.years}),l=My(o,c);l&&(i.months=l);let m=Yo(c,{months:i.months}),f=Uy(o,m);f&&(i.days=f);let h=Yo(m,{days:i.days}),E=Ny(o,h);E&&(i.hours=E);let I=Yo(h,{hours:i.hours}),g=wy(o,I);g&&(i.minutes=g);let T=Yo(I,{minutes:i.minutes}),O=Dy(o,T);return O&&(i.seconds=O),i}var LZ=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z"));var HZ=60*1e3;var xX=1/1e6,cm=1e3,xs=60*cm,lD=60*xs,zc=24*lD,RX=7*zc,CX=30*zc;var pm=["past-5-minutes","past-15-minutes","past-30-minutes","past-1-hour","past-2-hours","past-4-hours","past-6-hours","past-12-hours","past-24-hours","past-2-days","past-3-days","past-7-days","past-15-days","past-30-days","past-3-months","current-day","current-week","current-month","current-year","previous-day","previous-week","previous-month","previous-3-months","previous-year"];var mD={s:1,m:60,h:3600,d:86400};function Qy(e){for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<48||n>57)return!1}return!0}function Wy(){return Math.floor(Date.now()/1e3)}function Zo(e){if(typeof e=="number")return e;if(e==="now")return Wy();if(e.startsWith("-")&&e.length>=3){let n=e.at(-1),o=n?mD[n]:void 0;if(o){let i=e.slice(1,-1);if(i.length>0&&Qy(i))return Wy()-parseInt(i,10)*o}}if(Qy(e)&&e.length>0)return parseInt(e,10);let r=Date.parse(e);if(!Number.isNaN(r))return Math.floor(r/1e3);throw new Error(`Invalid time value: ${e}. Use unix seconds, relative (-30m, -1h), 'now', or ISO 8601.`)}var y={};rr(y,{Assign:()=>dD,Clone:()=>eo,Create:()=>_G,Discard:()=>IG,Metrics:()=>mr,Update:()=>SG});var mr={assign:0,create:0,clone:0,discard:0,update:0};function dD(e,r){return mr.assign+=1,{...e,...r}}var a={};rr(a,{Counted:()=>vD,Entries:()=>MD,EntriesRegExp:()=>kD,Every:()=>PD,EveryAll:()=>UD,GraphemeCount:()=>xD,HasPropertyKey:()=>LD,IsArray:()=>Cs,IsBigInt:()=>Rs,IsBoolean:()=>iT,IsClassInstance:()=>AD,IsConstructor:()=>ED,IsDeepEqual:()=>dm,IsEqual:()=>oe,IsFunction:()=>sT,IsGreaterEqualThan:()=>cT,IsGreaterThan:()=>SD,IsInteger:()=>lm,IsLessEqualThan:()=>aT,IsLessThan:()=>bD,IsMaxLength:()=>RD,IsMinLength:()=>CD,IsMultipleOf:()=>OD,IsNull:()=>Qc,IsNumber:()=>Wc,IsObject:()=>Ps,IsObjectNotArray:()=>_D,IsString:()=>Zc,IsSymbol:()=>ID,IsUndefined:()=>mm,IsUnsafePropertyKey:()=>uT,IsValueLike:()=>pT,Keys:()=>Vc,ShiftLeft:()=>Xc,Some:()=>ND,SomeAll:()=>wD,Symbols:()=>DD,Values:()=>GD});function Xn(e,r,n){return e>=r&&e<=n}function fD(e){return e===8205}function gD(e){return Xn(e,55296,56319)}function Zy(e){return Xn(e,127462,127487)}function Jy(e){return Xn(e,65024,65039)}function eT(e){return Xn(e,768,879)||Xn(e,6832,6911)||Xn(e,7616,7679)||Xn(e,65056,65071)}function Yc(e){return e>65535?2:1}function Xy(e,r){for(;r<e.length;){let n=e.codePointAt(r);if(eT(n)||Jy(n))r+=Yc(n);else break}return r}function um(e,r){let n=e.codePointAt(r),o=r+Yc(n);for(o=Xy(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+Yc(i),o=Xy(e,o)}return Zy(n)&&o<e.length&&Zy(e.codePointAt(o))&&(o+=Yc(e.codePointAt(o))),o}function tT(e){return gD(e)||eT(e)||Jy(e)||fD(e)}function rT(e){let r=0,n=0;for(;n<e.length;)n=um(e,n),r++;return r}function hD(e,r){if(r===0)return!0;let n=0,o=0;for(;o<e.length;)if(o=um(e,o),n++,n>=r)return!0;return!1}function yD(e,r){let n=0,o=0;for(;o<e.length;)if(o=um(e,o),n++,n>r)return!1;return!0}function nT(e,r){if(r===0)return!0;let n=0;for(;n<e.length;){if(tT(e.charCodeAt(n)))return hD(e,r);if(n++,n>=r)return!0}return!1}function oT(e,r){let n=0;for(;n<e.length;){if(tT(e.charCodeAt(n)))return yD(e,r);if(n++,n>r)return!1}return!0}function Cs(e){return Array.isArray(e)}function Rs(e){return oe(typeof e,"bigint")}function iT(e){return oe(typeof e,"boolean")}function ED(e){if(mm(e)||!sT(e))return!1;let r=Function.prototype.toString.call(e);return!!(/^class\s/.test(r)||/\[native code\]/.test(r))}function sT(e){return oe(typeof e,"function")}function lm(e){return Number.isInteger(e)}function Qc(e){return oe(e,null)}function Wc(e){return Number.isFinite(e)}function _D(e){return Ps(e)&&!Cs(e)}function Ps(e){return oe(typeof e,"object")&&!Qc(e)}function Zc(e){return oe(typeof e,"string")}function ID(e){return oe(typeof e,"symbol")}function mm(e){return oe(e,void 0)}function oe(e,r){return e===r}function SD(e,r){return e>r}function bD(e,r){return e<r}function aT(e,r){return e<=r}function cT(e,r){return e>=r}function OD(e,r){if(Rs(e)||Rs(r))return BigInt(e)%BigInt(r)===0n;let n=1e-10;if(!Wc(e)||lm(e)&&1/r%1===0)return!0;let o=e%r;return Math.min(Math.abs(o),Math.abs(o-r),Math.abs(o+r))<n}function AD(e){if(!Ps(e))return!1;let r=globalThis.Object.getPrototypeOf(e);return Qc(r)?!1:oe(typeof r.constructor,"function")&&!(oe(r.constructor,globalThis.Object)||oe(r.constructor.name,"Object"))}function pT(e){return Rs(e)||iT(e)||Qc(e)||Wc(e)||Zc(e)||mm(e)}function xD(e){return rT(e)}function RD(e,r){return oT(e,r)}function CD(e,r){return nT(e,r)}function PD(e,r,n){for(let o=r;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function UD(e,r,n){let o=!0;for(let i=r;i<e.length;i++)n(e[i],i)||(o=!1);return o}function ND(e,r){for(let n=0;n<e.length;n++)if(r(e[n],n))return!0;return!1}function wD(e,r){let n=!1;for(let o=0;o<e.length;o++)r(e[o],o)&&(n=!0);return n}function vD(e,r){return e.reduce((n,o,i)=>r(o,i)?++n:n,0)}function Xc(e,r,n){return oe(e.length,0)?n():r(e[0],e.slice(1))}function uT(e){return oe(e,"__proto__")||oe(e,"constructor")||oe(e,"prototype")}function LD(e,r){return uT(r)?Object.prototype.hasOwnProperty.call(e,r):r in e}function kD(e){return Vc(e).map(r=>[new RegExp(`^${r}$`),e[r]])}function MD(e){return Object.entries(e)}function Vc(e){return Object.getOwnPropertyNames(e)}function DD(e){return Object.getOwnPropertySymbols(e)}function GD(e){return Object.values(e)}function $D(e,r){if(!Ps(r))return!1;let n=Vc(e);return oe(n.length,Vc(r).length)&&n.every(o=>dm(e[o],r[o]))}function FD(e,r){return Cs(r)&&oe(e.length,r.length)&&e.every((n,o)=>dm(e[o],r[o]))}function dm(e,r){return Cs(e)?FD(e,r):Ps(e)?$D(e,r):oe(e,r)}var Ot={};rr(Ot,{IsBigInt64Array:()=>eG,IsBigUint64Array:()=>tG,IsBoolean:()=>jD,IsDate:()=>nG,IsFloat32Array:()=>XD,IsFloat64Array:()=>JD,IsInt16Array:()=>VD,IsInt32Array:()=>WD,IsInt8Array:()=>KD,IsMap:()=>iG,IsNumber:()=>qD,IsRegExp:()=>rG,IsSet:()=>oG,IsString:()=>BD,IsTypeArray:()=>HD,IsUint16Array:()=>QD,IsUint32Array:()=>ZD,IsUint8Array:()=>zD,IsUint8ClampedArray:()=>YD});function jD(e){return e instanceof Boolean}function qD(e){return e instanceof Number}function BD(e){return e instanceof String}function HD(e){return globalThis.ArrayBuffer.isView(e)}function KD(e){return e instanceof globalThis.Int8Array}function zD(e){return e instanceof globalThis.Uint8Array}function YD(e){return e instanceof globalThis.Uint8ClampedArray}function VD(e){return e instanceof globalThis.Int16Array}function QD(e){return e instanceof globalThis.Uint16Array}function WD(e){return e instanceof globalThis.Int32Array}function ZD(e){return e instanceof globalThis.Uint32Array}function XD(e){return e instanceof globalThis.Float32Array}function JD(e){return e instanceof globalThis.Float64Array}function eG(e){return e instanceof globalThis.BigInt64Array}function tG(e){return e instanceof globalThis.BigUint64Array}function rG(e){return e instanceof globalThis.RegExp}function nG(e){return e instanceof globalThis.Date}function oG(e){return e instanceof globalThis.Set}function iG(e){return e instanceof globalThis.Map}var Jc=a;function aG(e){return a.HasPropertyKey(e,"~kind")||a.HasPropertyKey(e,"~unsafe")}function cG(e){let r={};for(let n of Object.getOwnPropertyNames(e)){if(a.IsUnsafePropertyKey(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=Jn(o.value),a.IsEqual(o.enumerable,!0)?r[n]=o.value:Object.defineProperty(r,n,o)}return r}function pG(e){let r={};for(let n of a.Keys(e))a.IsUnsafePropertyKey(n)||(r[n]=Jn(e[n]));for(let n of a.Symbols(e))r[n]=Jn(e[n]);return r}function uG(e){return a.IsClassInstance(e)?e:aG(e)?cG(e):pG(e)}function lG(e){return e.map(r=>Jn(r))}function mG(e){return e.slice()}function dG(e){return new RegExp(e.source,e.flags)}function fG(e){return new Map(Jn([...e.entries()]))}function gG(e){return new Set(Jn([...e.values()]))}function Jn(e){return Ot.IsTypeArray(e)?mG(e):Ot.IsRegExp(e)?dG(e):Ot.IsMap(e)?fG(e):Ot.IsSet(e)?gG(e):a.IsArray(e)?lG(e):a.IsObject(e)?uG(e):e}function eo(e){return mr.clone+=1,Jn(e)}var st={};rr(st,{Get:()=>TG,Reset:()=>hG,Set:()=>yG});var Ir={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function hG(){Ir.immutableTypes=!1,Ir.maxErrors=8,Ir.maxInstantiationCount=128,Ir.useAcceleration=!0,Ir.exactOptionalPropertyTypes=!1,Ir.enumerableKind=!1,Ir.correctiveParse=!1,Ir.unionPrioritySort=!0}function yG(e){for(let r of a.Keys(e)){let n=e[r];n!==void 0&&Object.defineProperty(Ir,r,{value:n})}}function TG(){return Ir}function EG(e,r){for(let n of Object.keys(r))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:r[n]});return e}function lT(e,r){return{...e,...r}}function _G(e,r,n={}){mr.create+=1;let o=st.Get(),i=lT(r,n),s=o.enumerableKind?lT(i,e):EG(i,e);return o.immutableTypes?Object.freeze(s):s}function IG(e,r){mr.discard+=1;let n={};for(let o of Object.getOwnPropertyNames(e)){if(r.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);i.value=eo(i.value),Object.defineProperty(n,o,i)}return n}function SG(e,r,n){mr.update+=1;let o=st.Get(),i=eo(e);for(let s of Object.keys(r))Object.defineProperty(i,s,{configurable:!0,writable:!0,enumerable:o.enumerableKind,value:r[s]});for(let s of Object.keys(n))Object.defineProperty(i,s,{configurable:!0,enumerable:!0,writable:!0,value:n[s]});return i}function N(e,r){return a.IsObject(e)&&a.HasPropertyKey(e,"~kind")&&a.IsEqual(e["~kind"],r)}function Le(e){return a.IsObject(e)}function v(e,r,n){return y.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:r,options:n},{})}function hn(e){return N(e,"Deferred")}function bG(e){return y.Update(e,{"~readonly":!0},{})}function Us(e,r){return y.Update(bG(e),{},r)}function mT(e,r,n,o){let i=A(e,r,n);return Us(i,o)}function OG(e){return y.Update(e,{"~optional":!0},{})}function Ns(e,r){return y.Update(OG(e),{},r)}function dT(e,r,n,o){let i=A(e,r,n);return Ns(i,o)}function Lt(e,r){return y.Create({"~kind":"Array"},{type:"array",items:e},r)}function J(e){return N(e,"Array")}function Xo(e){return y.Discard(e,["~kind","type","items"])}function Sr(e,r,n={}){return y.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:r},n)}function Ve(e){return N(e,"Constructor")}function fT(e){return y.Discard(e,["~kind","type","parameters","instanceType"])}function br(e,r,n={}){return y.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:r},n)}function Qe(e){return N(e,"Function")}function gT(e){return y.Discard(e,["~kind","type","parameters","returnType"])}function at(e,r){return y.Create({"~kind":"Ref"},{$ref:e},r)}function me(e){return N(e,"Ref")}function yn(e,r){return y.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:r})}function Jo(e){return N(e,"Generic")}function ei(e){return y.Create({"~kind":"Any"},{},e)}function Je(e){return N(e,"Any")}var hT="(?!)";function ge(e){return y.Create({"~kind":"Never"},{not:{}},e)}function dr(e){return N(e,"Never")}function Or(e,r={}){return v("AddOptional",[e],r)}function to(e,r={}){return Ns(e,r)}function yT(e){return to(e)}function nt(e){return Le(e)&&a.HasPropertyKey(e,"~optional")}function TT(e){return a.Keys(e).filter(r=>!nt(e[r]))}function ep(e){return a.Keys(e)}function tp(e){return a.Values(e)}function D(e,r={}){let n=TT(e),o=n.length>0?{required:n}:{};return y.Create({"~kind":"Object"},{type:"object",...o,properties:e},r)}function $(e){return N(e,"Object")}function ET(e){return y.Discard(e,["~kind","type","properties","required"])}function et(e){return y.Create({"~kind":"Unknown"},{},e)}function ot(e){return N(e,"Unknown")}function Ar(e,r,n){let o=a.Keys(e).reduce((i,s)=>({...i,[s]:y.Update(e[s],{},{$id:s})}),{});return y.Create({"~kind":"Cyclic"},{$defs:o,$ref:r},n)}function _e(e){return N(e,"Cyclic")}function _T(e){return y.Update(e,{"~unsafe":null},{})}function rp(e){return a.IsObjectNotArray(e)&&a.HasPropertyKey(e,"~unsafe")&&a.IsNull(e["~unsafe"])}var ae={};rr(ae,{Match:()=>AG});function AG(e,r){return r[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function ws(...e){let[r,n]=ae.Match(e,{2:(o,i)=>[o,i,i],1:o=>[o,et(),et()]});return y.Create({"~kind":"Infer"},{type:"infer",name:r,extends:n},{})}function We(e){return N(e,"Infer")}function ro(e,r,n,o={}){return y.Create({"~kind":"Dependent"},{if:e,then:r,else:n},o)}function $e(e){return N(e,"Dependent")}function IT(e){return y.Discard(e,["~kind","if","then","else"])}function ST(e){return a.IsObjectNotArray(e)}function bT(e){return a.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function OT(e){return a.IsString(e)||a.IsNumber(e)}function AT(e,r){let n=ST(e)?bT(e):e;return y.Create({"~kind":"Enum"},{enum:n},r)}function Ze(e){return N(e,"Enum")}function dt(e,r={}){return y.Create({"~kind":"Intersect"},{allOf:e},r)}function G(e){return N(e,"Intersect")}function xT(e){return y.Discard(e,["~kind","allOf"])}var no={};rr(no,{Hash:()=>BG,HashCode:()=>vT});function ye(){throw new Error("Unreachable")}function xG(e){let r=new Set,n=e;for(;n&&n!==Object.prototype;){for(let o of Reflect.ownKeys(n))o!=="constructor"&&typeof o!="symbol"&&r.add(o);n=Object.getPrototypeOf(n)}return[...r]}function RG(e){return typeof e=="number"}var At;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(At||(At={}));var ti=BigInt("14695981039346656037"),[CG,PG]=[BigInt("1099511628211"),BigInt("18446744073709551616")],UG=Array.from({length:256}).map((e,r)=>BigInt(r)),UT=new Float64Array(1),NT=new DataView(UT.buffer),wT=new Uint8Array(UT.buffer);function ft(e){ti=ti^UG[e],ti=ti*CG%PG}function NG(e){ft(At.Array);for(let r of e)Tn(r)}function wG(e){ft(At.BigInt),NT.setBigInt64(0,e);for(let r of wT)ft(r)}function CT(e){ft(At.Boolean),ft(e?1:0)}function vG(e){ft(At.Constructor),Tn(e.toString())}function LG(e){ft(At.Date),Tn(e.getTime())}function kG(e){ft(At.Function),Tn(e.toString())}function MG(e){ft(At.Null)}function PT(e){ft(At.Number),NT.setFloat64(0,e,!0);for(let r of wT)ft(r)}function DG(e){ft(At.Object);for(let r of xG(e).sort())Tn(r),Tn(e[r])}function GG(e){ft(At.RegExp),fm(e.toString())}var $G=new TextEncoder;function fm(e){ft(At.String);for(let r of $G.encode(e))ft(r)}function FG(e){ft(At.Symbol),Tn(e.toString())}function jG(e){ft(At.TypeArray);let r=new Uint8Array(e.buffer);for(let n=0;n<r.length;n++)ft(r[n])}function qG(e){return ft(At.Undefined)}function Tn(e){return Ot.IsTypeArray(e)?jG(e):Ot.IsDate(e)?LG(e):Ot.IsRegExp(e)?GG(e):Ot.IsBoolean(e)?CT(e.valueOf()):Ot.IsString(e)?fm(e.valueOf()):Ot.IsNumber(e)?PT(e.valueOf()):RG(e)?PT(e):a.IsArray(e)?NG(e):a.IsBoolean(e)?CT(e):a.IsBigInt(e)?wG(e):a.IsConstructor(e)?vG(e):a.IsNull(e)?MG(e):a.IsObject(e)?DG(e):a.IsString(e)?fm(e):a.IsSymbol(e)?FG(e):a.IsUndefined(e)?qG(e):a.IsFunction(e)?kG(e):ye()}function vT(e){return ti=BigInt("14695981039346656037"),Tn(e),ti}function BG(e){return vT(e).toString(16).padStart(16,"0")}function LT(e){switch(e.keyword){case"additionalProperties":return"must not have additional properties";case"anyOf":return"must match a schema in anyOf";case"boolean":return"schema is false";case"const":return"must be equal to constant";case"contains":return"must contain at least 1 valid item";case"dependencies":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"dependentRequired":return`must have properties ${e.params.dependencies.join(", ")} when property ${e.params.property} is present`;case"enum":return"must be equal to one of the allowed values";case"exclusiveMaximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"exclusiveMinimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"format":return`must match format "${e.params.format}"`;case"if":return`must match "${e.params.failingKeyword}" schema`;case"maxItems":return`must not have more than ${e.params.limit} items`;case"maxLength":return`must not have more than ${e.params.limit} characters`;case"maxProperties":return`must not have more than ${e.params.limit} properties`;case"maximum":return`must be ${e.params.comparison} ${e.params.limit}`;case"minItems":return`must not have fewer than ${e.params.limit} items`;case"minLength":return`must not have fewer than ${e.params.limit} characters`;case"minProperties":return`must not have fewer than ${e.params.limit} properties`;case"minimum":return`must be ${e.params.comparison} ${e.params.limit}`;case"multipleOf":return`must be multiple of ${e.params.multipleOf}`;case"not":return"must not be valid";case"oneOf":return"must match exactly one schema in oneOf";case"pattern":return`must match pattern "${e.params.pattern}"`;case"propertyNames":return`property names ${e.params.propertyNames.join(", ")} are invalid`;case"required":return`must have required properties ${e.params.requiredProperties.join(", ")}`;case"type":return typeof e.params.type=="string"?`must be ${e.params.type}`:`must be either ${e.params.type.join(" or ")}`;case"unevaluatedItems":return"must not have unevaluated items";case"unevaluatedProperties":return"must not have unevaluated properties";case"uniqueItems":return"must not have duplicate items";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var HG=LT;function kT(){return HG}var vs=class{constructor(r,n){this.type=r,this.decode=n}Encode(r){let n=this.type,o=oo(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=oo(n)?c=>n["~codec"].encode(r(c)):r,s={decode:o,encode:i};return y.Update(this.type,{"~codec":s},{})}},Ls=class{constructor(r){this.type=r}Decode(r){return new vs(this.type,r)}};function np(e){return new Ls(e)}function DT(e,r){return np(e).Decode(r).Encode(()=>{throw Error("Encode not implemented")})}function GT(e,r){return np(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(r)}function oo(e){return Le(e)&&a.HasPropertyKey(e,"~codec")&&a.IsObject(e["~codec"])&&a.HasPropertyKey(e["~codec"],"encode")&&a.HasPropertyKey(e["~codec"],"decode")}function $T(e){return ri(e)}function io(e){return Le(e)&&a.HasPropertyKey(e,"~immutable")}function xr(e,r={}){return v("AddReadonly",[e],r)}function so(e,r={}){return Us(e,r)}function FT(e){return so(e)}function ao(e){return Le(e)&&a.HasPropertyKey(e,"~readonly")}function zG(e,r){let n=op(e)?[...e["~refine"],r]:[r];return y.Update(e,{"~refine":n},{})}function jT(...e){let[r,n,o]=ae.Match(e,{3:(i,s,c)=>[i,s,c],2:(i,s)=>[i,s,()=>"Refine Error"]});return zG(r,{check:n,error:o})}function YG(e){return a.IsObjectNotArray(e)&&a.HasPropertyKey(e,"check")&&a.HasPropertyKey(e,"error")&&a.IsFunction(e.check)&&a.IsFunction(e.error)}function op(e){return Le(e)&&a.HasPropertyKey(e,"~refine")&&a.IsArray(e["~refine"])&&a.Every(e["~refine"],0,r=>YG(r))}var qT="-?(?:0|[1-9][0-9]*)n";function ks(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Dt(e){return N(e,"BigInt")}function ip(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function xt(e){return N(e,"Boolean")}function Ms(e){return y.Create({"~kind":"Identifier"},{name:e})}function BT(e){return N(e,"Identifier")}var sp="-?(?:0|[1-9][0-9]*)";function co(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function ct(e){return N(e,"Integer")}var gm=class extends Error{constructor(r){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:r},writable:!1,configurable:!1,enumerable:!1})}};function VG(e){return a.IsBigInt(e)?"bigint":a.IsBoolean(e)?"boolean":a.IsNumber(e)?"number":a.IsString(e)?"string":(()=>{throw new gm(e)})()}function V(e,r){return y.Create({"~kind":"Literal"},{type:VG(e),const:e},r)}function ap(e){return a.IsBigInt(e)||a.IsBoolean(e)||a.IsNumber(e)||a.IsString(e)}function HT(e){return Z(e)&&a.IsBigInt(e.const)}function KT(e){return Z(e)&&a.IsBoolean(e.const)}function cp(e){return Z(e)&&a.IsNumber(e.const)}function pp(e){return Z(e)&&a.IsString(e.const)}function Z(e){return N(e,"Literal")}function ni(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function Rr(e){return N(e,"Null")}var up="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Gt(e){return y.Create({"~kind":"Number"},{type:"number"},e)}function Ne(e){return N(e,"Number")}function oi(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function Cr(e){return N(e,"Symbol")}function po(...e){let[r,n,o]=ae.Match(e,{3:(i,s,c)=>[i,s,c],2:(i,s)=>[i,s,s],1:i=>[i,et(),et()]});return y.Create({"~kind":"Parameter"},{name:r,extends:n,equals:o},{})}function zT(e){return N(e,"Parameter")}var lp=".*";function Rt(e){return y.Create({"~kind":"String"},{type:"string"},e)}function tt(e){return N(e,"String")}function q(e,r={}){return y.Create({"~kind":"Union"},{anyOf:e},r)}function C(e){return N(e,"Union")}function YT(e){return y.Discard(e,["~kind","anyOf"])}function Ds(e){let r=VT(e);return a.IsEqual(r.length,2)?r[0]:[]}function QG(e){return!0}function QT(e){return a.ShiftLeft(e,(r,n)=>WG(r)?QT(n):!1,()=>!0)}function WT(e){return a.IsEqual(e.length,0)?!1:QT(e)}function WG(e){return C(e)?WT(e.anyOf):Z(e)?QG(e.const):!1}function mp(e){return WT(e)}function dp(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function ZT(e,r,n=[]){return a.ShiftLeft(e,(o,i)=>ZT(i,r,[...n,`${o}${r}`]),()=>n)}function ZG(e,r){return a.IsEqual(e.length,0)?[`${r}`]:ZT(e,r)}function XT(e,r,n=[]){return a.ShiftLeft(r,(o,i)=>XT(e,i,[...n,...JT(e,o)]),()=>n)}function JT(e,r){return C(r)?XT(e,r.anyOf):Z(r)?ZG(e,r.const):ye()}function eE(e,r){return a.ShiftLeft(r,(n,o)=>eE(JT(e,n),o),()=>e)}function XG(e){return e.map(r=>V(r))}function JG(e){let r=eE([],e),n=XG(r);return q(n)}function e$(e){return a.IsEqual(e.length,0)?ye():a.IsEqual(e.length,1)&&Z(e[0])?e[0]:JG(e)}function hm(e){let r=Ds(e);return a.IsEqual(r.length,0)?Rt():mp(r)?e$(r):dp(e)}function Gs(e){let r=hm(e);return Ie(r)?Rt():r}function kt(e,r){let n="object",o={[e]:r};return y.Create({"~kind":"Record"},{type:n,patternProperties:o})}function tE(e){return kt(zt,e)}function rE(e){return D({true:e,false:e})}function Fe(e,r={}){let[n,o,i]=[e,e.length,!1];return y.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:o},r)}function Q(e){return N(e,"Tuple")}function nE(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function t$(e){return y.Discard(e,["~readonly"])}function ym(e,r){return y.Update(t$(e),{},r)}function oE(e,r,n,o){let i=A(e,r,n);return ym(i,o)}function iE(e,r={}){return v("RemoveReadonly",[e],r)}function sE(e,r={}){return ym(e,r)}function r$(e){return y.Discard(e,["~optional"])}function Tm(e,r){return y.Update(r$(e),{},r)}function aE(e,r,n,o){let i=A(e,r,n);return Tm(i,o)}function cE(e,r={}){return v("RemoveOptional",[e],r)}function fp(e,r={}){return Tm(e,r)}function Em(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function pE(e){let r=Em(e.items);return D(r)}function n$(e,r){return ao(e)?!!ao(r):!1}function o$(e,r){return nt(e)?!!nt(r):!1}function i$(e,r){let n=n$(e,r),o=o$(e,r),i=ke([e,r]),s=sE(fp(i));return n&&o?so(to(s)):n&&!o?so(s):!n&&o?to(s):s}function s$(e,r,n){return n in e?n in r?i$(e[n],r[n]):e[n]:n in r?r[n]:ge()}function a$(e,r){return[...new Set([...a.Keys(r),...a.Keys(e)])].reduce((o,i)=>({...o,[i]:s$(e,r,i)}),{})}function uE(e){return $(e)?e.properties:Q(e)?Em(e.items):ye()}function lE(e,r){let n=uE(e),o=uE(r),i=a$(n,o);return D(i)}function mE(e,r){let n=uo(e,r);return a.IsEqual(n,Fs)?e:a.IsEqual(n,js)||a.IsEqual(n,$s)?r:ge()}function dE(e){return $(e)||Q(e)}function c$(e,r){let n=C(e),o=C(r);return n||o}function p$(e,r){let n=nr(e),o=nr(r),i=c$(n,o),s=dE(n),c=dE(o);return i?ke([n,o]):s&&c?lE(n,o):s&&!c?n:!s&&c?o:mE(n,o)}function fE(e,r,n=[]){return a.ShiftLeft(r,(o,i)=>fE(e,i,[...n,p$(e,o)]),()=>a.IsEqual(n.length,0)?[e]:n)}function gE(e,r,n=[]){return a.ShiftLeft(e,(o,i)=>gE(i,r,[...n,...qs([o],r)]),()=>n)}function qs(e,r=[]){return a.ShiftLeft(e,(n,o)=>C(n)?qs(o,gE(n.anyOf,r)):qs(o,fE(n,r)),()=>r)}function u$(e,r){let n=ht({},e,r);return F.IsExtendsTrueLike(n)?[]:[e]}function l$(e,r){return e.reduce((n,o)=>[...n,...u$(o,r)],[])}function gp(e,r){let n=nr(e),o=C(n)?n.anyOf:[n],i=l$(o,r);return $t(i)}function fr(e,r,n){let o=dt([e,r]),i=gp(n,e);return $t([o,i])}function Mt(e){let r=e.map(n=>V(n));return $t(r)}function ke(e){let r=qs(e),n=_m(r);return Vr(n)}function _t(e){let r=Gs(e);return nr(r)}function $t(e){let r=_m(e);return Vr(r)}function nr(e){return $e(e)?fr(e.if,e.then,e.else):Ze(e)?Mt(e.enum):G(e)?ke(e.allOf):Ie(e)?_t(e.pattern):C(e)?$t(e.anyOf):e}function Vr(e){return a.IsEqual(e.length,1)?e[0]:a.IsEqual(e.length,0)?ge():q(e)}function hE(e,r){let n=Mt(e);return En(n,r)}function yE(e,r){return kt(_n,r)}function TE(e,r){let n=ke(e);return En(n,r)}function EE(e,r){return a.IsString(e)||a.IsNumber(e)?D({[e]:r}):a.IsEqual(e,!1)?D({false:r}):a.IsEqual(e,!0)?D({true:r}):D({})}function _E(e,r){return kt(ii,r)}function IE(e,r){return a.HasPropertyKey(e,"pattern")&&(a.IsString(e.pattern)||e.pattern instanceof RegExp)?kt(e.pattern.toString(),r):kt(zt,r)}function SE(e,r){let n=Ds(e);return mp(n)?En(_t(e),r):kt(e,r)}function m$(e){return C(e)?si(e.anyOf):[e]}function si(e){return e.reduce((r,n)=>[...r,...m$(n)],[])}function d$(e){return e.some(r=>tt(r)||Ne(r)||ct(r))}function f$(e,r){return a.IsEqual(d$(e),!0)?kt(zt,r):void 0}function g$(e,r){return e.reduce((n,o)=>Z(o)&&(a.IsString(o.const)||a.IsNumber(o.const))?{...n,[o.const]:r}:n,{})}function h$(e,r){let n=g$(e,r);return D(n)}function bE(e,r){let n=si(e),o=f$(n,r);return Le(o)?o:h$(n,r)}function En(e,r){return Je(e)?tE(r):xt(e)?rE(r):Ze(e)?hE(e.enum,r):ct(e)?yE(e,r):G(e)?TE(e.allOf,r):Z(e)?EE(e.const,r):Ne(e)?_E(e,r):C(e)?bE(e.anyOf,r):tt(e)?IE(e,r):Ie(e)?SE(e.pattern,r):D({})}function Im(e,r,n){return z([e])?y.Update(En(e,r),{},n):hp(e,r,n)}function OE(e,r,n,o,i){let s=A(e,r,n),c=A(e,r,o);return Im(s,c,i)}var _n=`^${sp}$`,ii=`^${up}$`,zt=`^${lp}$`;function hp(e,r,n={}){return v("Record",[e,r],n)}function ai(e,r,n={}){return Im(e,r,n)}function yp(e,r){return kt(e,r)}function Tp(e){return a.IsEqual(e,zt)?Rt():a.IsEqual(e,_n)?co():a.IsEqual(e,ii)?Gt():hm(e)}function pt(e){return a.Keys(e.patternProperties)[0]}function In(e){let r=pt(e);return Tp(r)}function xe(e){return e.patternProperties[pt(e)]}function he(e){return N(e,"Record")}function lo(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function Sn(e){return N(e,"Rest")}function Ep(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function _p(e){return N(e,"This")}function ci(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function gr(e){return N(e,"Undefined")}function Ip(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function Ft(e){return N(e,"Void")}function T$(e,r){return a.IsEqual(e,"Array")?Lt(r[0]):a.IsEqual(e,"Capitalize")?bp(r[0]):a.IsEqual(e,"ConstructorParameters")?Cp(r[0]):a.IsEqual(e,"Evaluate")?AI(r[0]):a.IsEqual(e,"Exclude")?Pp(r[0],r[1]):a.IsEqual(e,"Extract")?Up(r[0],r[1]):a.IsEqual(e,"Index")?zs(r[0],r[1]):a.IsEqual(e,"InstanceType")?Np(r[0]):a.IsEqual(e,"Lowercase")?Op(r[0]):a.IsEqual(e,"NonNullable")?wp(r[0]):a.IsEqual(e,"Omit")?vp(r[0],r[1]):a.IsEqual(e,"Parameters")?Lp(r[0]):a.IsEqual(e,"Partial")?kp(r[0]):a.IsEqual(e,"Pick")?Mp(r[0],r[1]):a.IsEqual(e,"Readonly")?Dp(r[0]):a.IsEqual(e,"KeyOf")?Ys(r[0]):a.IsEqual(e,"Record")?hp(r[0],r[1]):a.IsEqual(e,"Required")?Gp(r[0]):a.IsEqual(e,"ReturnType")?$p(r[0]):a.IsEqual(e,"Uncapitalize")?Ap(r[0]):a.IsEqual(e,"Uppercase")?xp(r[0]):Ks(at(e),r)}function mo(){throw Error("Unreachable")}function PE(e,r=[]){return a.ShiftLeft(e,(n,o)=>PE(o,[...r,n[1]]),()=>r)}function Qr(e){return a.IsEqual(e.length,3)?[e[0],...PE(e[1])]:[]}function UE(e){return po(e[0],e[2],e[4])}function NE(e){return po(e[0],e[2],e[2])}function wE(e){return po(e[0],et(),e[2])}function vE(e){return po(e,et(),et())}function LE(e){return Qr(e)}function kE(e){return e[1]}function ME(e){return Qr(e)}function DE(e){return e[1]}function GE(e){return T$(e[0],e[1])}function $E(e){return null}function FE(e){return Rt()}function jE(e){return Gt()}function qE(e){return ip()}function BE(e){return ci()}function HE(e){return ni()}function KE(e){return co()}function zE(e){return ks()}function YE(e){return et()}function VE(e){return ei()}function QE(e){return D({})}function WE(e){return ge()}function ZE(e){return oi()}function XE(e){return Ip()}function JE(e){return Ep()}function e_(e){return V(BigInt(e))}function t_(e){return V(a.IsEqual(e,"true"))}function r_(e){return V(parseFloat(e))}function n_(e){return V(e)}function o_(e){return e[1]}function i_(e){return V(e)}function s_(e){return a.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function a_(e){return e[1]}function c_(e){return Sp(e)}function p_(e){return a.IsEqual(e.length,6)?ro(e[1],e[3],e[5]):ro(e[1],e[3],et())}function u_(e){return e.length>0}function l_(e){return e.reduce((r,n)=>a.IsEqual(n.length,3)?[...r,[n[1]]]:[...r,[]],[])}function m_(e){return a.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function d_(e){return a.IsArray(e)&&a.IsEqual(e.length,3)?e[1]:e}function f_(e){return a.IsEqual(e.length,2)?e[1]:[]}function AE(e,r){return r.reduce((n,o)=>{let i=o;return a.IsEqual(i.length,1)?zs(n,i[0]):a.IsEqual(i.length,0)?Lt(n):mo()},e)}function xE(e,r){return a.IsEqual(r.length,3)?Rp(e,r[0],r[1],r[2]):e}function E$(e,r){return a.IsArray(r)&&a.IsEqual(r.length,0)?e:Fp(e,r)}function g_(e){let[r,n,o,i,s]=e;return E$(xE(r?Ys(AE(n,o)):AE(n,o),i),s)}function Sm(e,r){return a.IsEqual(r.length,3)?(()=>{let[n,o,i]=r,s=Sm(o,i);if(a.IsEqual(n,"&"))return G(s)?dt([e,...s.allOf]):dt([e,s]);if(a.IsEqual(n,"|"))return C(s)?q([e,...s.anyOf]):q([e,s]);mo()})():e}function h_(e){let[r,n]=e;return Sm(r,n)}function y_(e){let[r,n]=e;return Sm(r,n)}function T_(e){return OI(e[1])}function E_(e){return e[1]}function __(e){return yn(e[0],e[2])}function I_(e){return a.IsEqual(e.length,4)?ws(e[1],e[3]):a.IsEqual(e.length,2)?ws(e[1],et()):mo()}function S_(e){return`${e}`}function b_(e){return ct(e[3])?_n:Ne(e[3])?ii:Cr(e[3])?zt:tt(e[3])?zt:mo()}function O_(e){return e.length>0}function A_(e){return e.length>0}function x_(e){let[r,n,o,i,s]=e;return{[n]:r&&o?xr(Or(s)):r&&!o?xr(s):!r&&o?Or(s):s}}function R_(e){return Qr(e)}function C_(e){return e.reduce((r,n)=>a.HasPropertyKey(n,_n)||a.HasPropertyKey(n,ii)||a.HasPropertyKey(n,zt)?[r[0],y.Assign(r[1],n)]:[y.Assign(r[0],n),r[1]],[{},{}])}function P_(e){return C_(e[1])}function U_(e){let[r,n]=e,o=a.IsEqual(a.Keys(n).length,0)?{}:{patternProperties:n};return D(r,o)}function N_(e){return a.IsEqual(e.length,5)?xr(Or(e[4])):a.IsEqual(e.length,3)?e[2]:a.IsEqual(e.length,4)?a.IsEqual(e[2],"readonly")?xr(e[3]):Or(e[3]):mo()}function w_(e){if(!a.IsArray(e)||!a.IsEqual(e.length,3))return e;let[r,n,o]=e;return r&&o?xr(Or(n)):r&&!o?xr(n):!r&&o?Or(n):n}function v_(e){return a.IsEqual(e.length,2)?lo(e[1]):a.IsEqual(e.length,1)?e[0]:mo()}function L_(e){return Qr(e)}function k_(e){return Fe(e[1])}function M_(e){return xr(Or(e[4]))}function D_(e){return xr(e[3])}function G_(e){return Or(e[3])}function $_(e){return e[2]}function F_(e){return a.IsEqual(e.length,2)?lo(e[1]):a.IsEqual(e.length,1)?e[0]:mo()}function j_(e){return Qr(e)}function q_(e){return br(e[1],e[4])}function B_(e){return Sr(e[2],e[5])}function RE(e,r){return a.IsEqual(e,"remove")?iE(r):a.IsEqual(e,"add")?xr(r):r}function H_(e){return a.IsEqual(e.length,2)&&a.IsEqual(e[0],"-")?"remove":a.IsEqual(e.length,2)&&a.IsEqual(e[0],"+")||a.IsEqual(e.length,1)?"add":"none"}function CE(e,r){return a.IsEqual(e,"remove")?cE(r):a.IsEqual(e,"add")?Or(r):r}function K_(e){return a.IsEqual(e.length,2)&&a.IsEqual(e[0],"-")?"remove":a.IsEqual(e.length,2)&&a.IsEqual(e[0],"+")||a.IsEqual(e.length,1)?"add":"none"}function z_(e){return a.IsEqual(e.length,2)?[e[1]]:[]}function Y_(e){return a.IsArray(e[6])&&a.IsEqual(e[6].length,1)?Bs(Ms(e[3]),e[5],e[6][0],RE(e[1],CE(e[8],e[10]))):Bs(Ms(e[3]),e[5],at(e[3]),RE(e[1],CE(e[8],e[10])))}function V_(e){return at(e)}function Q_(e){return BigInt(e)}function W_(e){return parseFloat(e)}function Z_(e){return a.IsEqual(e,"true")}function X_(e){return null}function J_(e){return{[e[0]]:e[2]}}function eI(e){return Qr(e)}function _$(e){return e.reduce((r,n)=>y.Assign(r,n),{})}function tI(e){return _$(e[1])}function rI(e){return Qr(e)}function nI(e){return e[1]}function oI(e){return ks()}function iI(e){return Rt()}function sI(e){return Gt()}function aI(e){return co()}function cI(e){return ge()}function pI(e){return V(e)}function uI(e){return q(e[1])}function lI(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function mI(e){return[e[0],...e[1]]}function dI(e){return e[1]}function fI(e){return Qr(e)}function gI(e){return a.IsEqual(e.length,2)?e[1]:[]}function hI(e){let r=e[2],n=e[3],[o,i]=e[4],s=a.IsEqual(a.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:yn(r,Hs(n,o,s))}}function yI(e){let r=e[2],[n,o]=e[3],i=a.IsEqual(a.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Hs(r,n,i)}}function TI(e){return{[e[1]]:yn(e[2],e[4])}}function EI(e){return{[e[1]]:e[3]}}function _I(e){return null}function II(e){return Qr(e)}function SI(e){return e[1]}function bI(e){let[r,n]=[e[0],e[1]];return xI(y.Assign(r,C_(n)[0]))}function Vs(e){return oe(e.length,2)}function X(e,r,n){return Vs(e)?r(e[0],e[1]):n()}function b$(e,r){return oe(r.indexOf(e),0)?[e,r.slice(e.length)]:[]}function Me(e,r){for(let n=0;n<e.length;n++){let o=b$(e[n],r);if(Vs(o))return o}return[]}function bm(e,r){return Array.from({length:r-e+1},(n,o)=>String.fromCharCode(e+o))}var RI=[...bm(97,122),...bm(65,90)],Om="0",Am=bm(49,57),pi=[Om,...Am],CI=" ",ui=`
28
+ `;var bn="_",jp=".",PI="$",qp="-";var UI="//",NI="/*",A$="*/";function wI(e){let r=e.indexOf(A$);return oe(r,-1)?"":e.slice(r+2)}function vI(e){let r=e.indexOf(ui);return oe(r,-1)?"":e.slice(r)}function x$(e){return e.replace(/^[ \t\r\f\v]+/,"")}function Bp(e){let r=x$(e);return r.startsWith(NI)?Bp(wI(r.slice(2))):r.startsWith(UI)?Bp(vI(r.slice(2))):r}function gt(e){let r=e.trimStart();return r.startsWith(NI)?gt(wI(r.slice(2))):r.startsWith(UI)?gt(vI(r.slice(2))):r}function Hp(e,r){return X(Me([e],r),(n,o)=>[n,o],()=>["",r])}function R$(e,r){return e.includes(r)}function li(e,r,n,o=""){return X(Me(e,n),(i,s)=>R$(r,i)?li(e,r,s,o):li(e,r,s,`${o}${i}`),()=>[o,n])}function C$(e){return Me(Am,e)}var P$=[...pi,bn];function U$(e){return li(P$,[bn],e)}function N$(e){return X(Me([Om],e),(r,n)=>[r,n],()=>X(C$(e),(r,n)=>X(U$(n),(o,i)=>[`${r}${o}`,i],()=>[]),()=>[]))}function Kp(e){return N$(gt(e))}function w$(e){return Hp(qp,e)}function v$(e){return X(w$(e),(r,n)=>X(Kp(n),(o,i)=>[`${r}${o}`,i],()=>[]),()=>[])}function LI(e){return v$(gt(e))}function L$(e){return X(LI(e),(r,n)=>X(Me(["n"],n),(o,i)=>[`${r}`,i],()=>[]),()=>[])}function xm(e){return L$(e)}function Rm(e,r){return Me([e],r)}function _(e,r){return oe(e,"")?["",r]:e.startsWith(ui)?Rm(e,Bp(r)):e.startsWith(CI)?Rm(e,r):Rm(e,gt(r))}var kI=[...RI,bn,PI];function k$(e){return Me(kI,e)}var M$=[...kI,...pi];function MI(e,r=""){return X(Me(M$,e),(n,o)=>MI(o,`${r}${n}`),()=>[r,e])}function D$(e){return X(k$(e),(r,n)=>X(MI(n),(o,i)=>[`${r}${o}`,i],()=>[]),()=>[])}function je(e){return D$(gt(e))}var G$=[...pi,bn];function $$(e){return Vs(Me([jp],e))}function DI(e){return X(li(G$,[bn],e),(r,n)=>oe(r,"")?[]:[r,n],()=>[])}function F$(e){return X(Me([jp],e),(r,n)=>X(DI(n),(o,i)=>[`0${r}${o}`,i],()=>[]),()=>[])}function j$(e){return X(Kp(e),(r,n)=>X(Me([jp],n),(o,i)=>X(DI(i),(s,c)=>[`${r}${o}${s}`,c],()=>[`${r}`,i]),()=>[`${r}`,n]),()=>[])}function q$(e){return $$(e)?F$(e):j$(e)}function GI(e){return q$(gt(e))}function B$(e){return Hp(qp,e)}function H$(e){return X(B$(e),(r,n)=>X(GI(n),(o,i)=>[`${r}${o}`,i],()=>[]),()=>[])}function zp(e){return H$(gt(e))}function K$(e){return oe(e,"")?[]:[e.slice(0,1),e.slice(1)]}function $I(e,r){return Xc(e,(n,o)=>r.startsWith(n)?!0:$I(o,r),()=>!1)}function On(e,r,n=""){return X(K$(r),(o,i)=>$I(e,r)?[n,r]:On(e,i,`${n}${o}`),()=>[])}function z$(e,r,n){return X(Me([e],n),(o,i)=>X(On([r],i),(s,c)=>X(Me([r],c),(l,m)=>[`${s}`,m],()=>[]),()=>[]),()=>[])}function Y$(e,r,n){return X(Me([e],n),(o,i)=>X(On([ui,r],i),(s,c)=>X(Me([r],c),(l,m)=>[`${s}`,m],()=>[]),()=>[]),()=>[])}function FI(e,r,n,o){return n?z$(e,r,gt(o)):Y$(e,r,gt(o))}function V$(e,r){return Me(e,r)}function Q$(e,r){return FI(e,e,!1,r)}function W$(e,r){return X(V$(e,r),(n,o)=>Q$(n,`${n}${o}`),()=>[])}function Yp(e,r){return W$(e,gt(r))}function jI(e,r){return X(On(e,r),(n,o)=>oe(n,"")?[]:[n,o],()=>[])}var u=(e,r,n=()=>[])=>e.length===2?r(e):n(),X$=e=>u(u(je(e),([r,n])=>u(_("extends",n),([o,i])=>u(ie(i),([s,c])=>u(_("=",c),([l,m])=>u(ie(m),([f,h])=>[[r,o,s,l,f],h]))))),([r,n])=>[UE(r),n]),J$=e=>u(u(je(e),([r,n])=>u(_("extends",n),([o,i])=>u(ie(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[NE(r),n]),e1=e=>u(u(je(e),([r,n])=>u(_("=",n),([o,i])=>u(ie(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[wE(r),n]),t1=e=>u(je(e),([r,n])=>[vE(r),n]),HI=e=>u(u(X$(e),([r,n])=>[r,n],()=>u(J$(e),([r,n])=>[r,n],()=>u(e1(e),([r,n])=>[r,n],()=>u(t1(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),KI=(e,r=[])=>u(u(_(",",e),([n,o])=>u(HI(o),([i,s])=>[[n,i],s])),([n,o])=>KI(o,[...r,n]),()=>[r,e]),r1=e=>u(u(u(HI(e),([r,n])=>u(KI(n),([o,i])=>u(u(_(",",i),([s,c])=>[[s],c],()=>[[],i]),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[LE(r),n]),Um=e=>u(u(_("<",e),([r,n])=>u(r1(n),([o,i])=>u(_(">",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[kE(r),n]),zI=(e,r=[])=>u(u(_(",",e),([n,o])=>u(ie(o),([i,s])=>[[n,i],s])),([n,o])=>zI(o,[...r,n]),()=>[r,e]),n1=e=>u(u(u(ie(e),([r,n])=>u(zI(n),([o,i])=>u(u(_(",",i),([s,c])=>[[s],c],()=>[[],i]),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[ME(r),n]),o1=e=>u(u(_("<",e),([r,n])=>u(n1(n),([o,i])=>u(_(">",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[DE(r),n]),i1=e=>u(u(je(e),([r,n])=>u(o1(n),([o,i])=>[[r,o],i])),([r,n])=>[GE(r),n]),YI=e=>u(u(u(_(";",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[$E(r),n]),VI=e=>u(_("string",e),([r,n])=>[FE(r),n]),QI=e=>u(_("number",e),([r,n])=>[jE(r),n]),s1=e=>u(_("boolean",e),([r,n])=>[qE(r),n]),a1=e=>u(_("undefined",e),([r,n])=>[BE(r),n]),c1=e=>u(_("null",e),([r,n])=>[HE(r),n]),WI=e=>u(_("integer",e),([r,n])=>[KE(r),n]),p1=e=>u(_("bigint",e),([r,n])=>[zE(r),n]),u1=e=>u(_("unknown",e),([r,n])=>[YE(r),n]),l1=e=>u(_("any",e),([r,n])=>[VE(r),n]),m1=e=>u(_("object",e),([r,n])=>[QE(r),n]),d1=e=>u(_("never",e),([r,n])=>[WE(r),n]),ZI=e=>u(_("symbol",e),([r,n])=>[ZE(r),n]),f1=e=>u(_("void",e),([r,n])=>[XE(r),n]),g1=e=>u(_("this",e),([r,n])=>[JE(r),n]),h1=e=>u(u(_("${",e),([r,n])=>u(ie(n),([o,i])=>u(_("}",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[o_(r),n]),Cm=e=>u(On(["${","`"],e),([r,n])=>[i_(r),n]),XI=e=>u(u(u(Cm(e),([r,n])=>u(h1(n),([o,i])=>u(XI(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u(u(Cm(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u(u(Cm(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))),([r,n])=>[s_(r),n]),Nm=e=>u(u(_("`",e),([r,n])=>u(XI(n),([o,i])=>u(_("`",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[a_(r),n]),y1=e=>u(Nm(e),([r,n])=>[c_(r),n]),T1=e=>u(u(u(_("if",e),([r,n])=>u(ie(n),([o,i])=>u(_("then",i),([s,c])=>u(ie(c),([l,m])=>u(_("else",m),([f,h])=>u(ie(h),([E,I])=>[[r,o,s,l,f,E],I])))))),([r,n])=>[r,n],()=>u(u(_("if",e),([r,n])=>u(ie(n),([o,i])=>u(_("then",i),([s,c])=>u(ie(c),([l,m])=>[[r,o,s,l],m])))),([r,n])=>[r,n],()=>[])),([r,n])=>[p_(r),n]),E1=e=>u(xm(e),([r,n])=>[e_(r),n]),_1=e=>u(u(_("true",e),([r,n])=>[r,n],()=>u(_("false",e),([r,n])=>[r,n],()=>[])),([r,n])=>[t_(r),n]),I1=e=>u(zp(e),([r,n])=>[r_(r),n]),S1=e=>u(Yp(["'",'"'],e),([r,n])=>[n_(r),n]),b1=e=>u(u(u(_("keyof",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[u_(r),n]),JI=(e,r=[])=>u(u(u(_("[",e),([n,o])=>u(ie(o),([i,s])=>u(_("]",s),([c,l])=>[[n,i,c],l]))),([n,o])=>[n,o],()=>u(u(_("[",e),([n,o])=>u(_("]",o),([i,s])=>[[n,i],s])),([n,o])=>[n,o],()=>[])),([n,o])=>JI(o,[...r,n]),()=>[r,e]),O1=e=>u(JI(e),([r,n])=>[l_(r),n]),A1=e=>u(u(u(_("extends",e),([r,n])=>u(ie(n),([o,i])=>u(_("?",i),([s,c])=>u(ie(c),([l,m])=>u(_(":",m),([f,h])=>u(ie(h),([E,I])=>[[r,o,s,l,f,E],I])))))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[m_(r),n]),x1=e=>u(u(u(_("(",e),([r,n])=>u(ie(n),([o,i])=>u(_(")",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u(VI(e),([r,n])=>[r,n],()=>u(QI(e),([r,n])=>[r,n],()=>u(s1(e),([r,n])=>[r,n],()=>u(a1(e),([r,n])=>[r,n],()=>u(c1(e),([r,n])=>[r,n],()=>u(WI(e),([r,n])=>[r,n],()=>u(p1(e),([r,n])=>[r,n],()=>u(u1(e),([r,n])=>[r,n],()=>u(l1(e),([r,n])=>[r,n],()=>u(m1(e),([r,n])=>[r,n],()=>u(d1(e),([r,n])=>[r,n],()=>u(ZI(e),([r,n])=>[r,n],()=>u(f1(e),([r,n])=>[r,n],()=>u(g1(e),([r,n])=>[r,n],()=>u(E1(e),([r,n])=>[r,n],()=>u(_1(e),([r,n])=>[r,n],()=>u(I1(e),([r,n])=>[r,n],()=>u(S1(e),([r,n])=>[r,n],()=>u(y1(e),([r,n])=>[r,n],()=>u(T1(e),([r,n])=>[r,n],()=>u(D1(e),([r,n])=>[r,n],()=>u(F1(e),([r,n])=>[r,n],()=>u(z1(e),([r,n])=>[r,n],()=>u(K1(e),([r,n])=>[r,n],()=>u(W1(e),([r,n])=>[r,n],()=>u(i1(e),([r,n])=>[r,n],()=>u(Z1(e),([r,n])=>[r,n],()=>[])))))))))))))))))))))))))))),([r,n])=>[d_(r),n]),R1=e=>u(u(u(_("with",e),([r,n])=>u(hS(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[f_(r),n]),eS=e=>u(u(b1(e),([r,n])=>u(x1(n),([o,i])=>u(O1(i),([s,c])=>u(A1(c),([l,m])=>u(R1(m),([f,h])=>[[r,o,s,l,f],h]))))),([r,n])=>[g_(r),n]),tS=e=>u(u(u(_("&",e),([r,n])=>u(eS(n),([o,i])=>u(tS(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[r,n]),rS=e=>u(u(eS(e),([r,n])=>u(tS(n),([o,i])=>[[r,o],i])),([r,n])=>[h_(r),n]),nS=e=>u(u(u(_("|",e),([r,n])=>u(rS(n),([o,i])=>u(nS(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[r,n]),Vp=e=>u(u(rS(e),([r,n])=>u(nS(n),([o,i])=>[[r,o],i])),([r,n])=>[y_(r),n]),C1=e=>u(u(_("readonly",e),([r,n])=>u(Vp(n),([o,i])=>[[r,o],i])),([r,n])=>[T_(r),n]),P1=e=>u(u(_("|",e),([r,n])=>u(Vp(n),([o,i])=>[[r,o],i])),([r,n])=>[E_(r),n]),U1=e=>u(u(Um(e),([r,n])=>u(_("=",n),([o,i])=>u(ie(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[__(r),n]),N1=e=>u(u(u(_("infer",e),([r,n])=>u(je(n),([o,i])=>u(_("extends",i),([s,c])=>u(Vp(c),([l,m])=>[[r,o,s,l],m])))),([r,n])=>[r,n],()=>u(u(_("infer",e),([r,n])=>u(je(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>[])),([r,n])=>[I_(r),n]),ie=e=>u(u(N1(e),([r,n])=>[r,n],()=>u(P1(e),([r,n])=>[r,n],()=>u(C1(e),([r,n])=>[r,n],()=>u(Vp(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),w1=e=>u(zp(e),([r,n])=>[S_(r),n]),v1=e=>u(je(e),([r,n])=>[r,n]),L1=e=>u(Yp(["'",'"'],e),([r,n])=>[r,n]),k1=e=>u(u(_("[",e),([r,n])=>u(je(n),([o,i])=>u(_(":",i),([s,c])=>u(u(WI(c),([l,m])=>[l,m],()=>u(QI(c),([l,m])=>[l,m],()=>u(VI(c),([l,m])=>[l,m],()=>u(ZI(c),([l,m])=>[l,m],()=>[])))),([l,m])=>u(_("]",m),([f,h])=>[[r,o,s,l,f],h]))))),([r,n])=>[b_(r),n]),oS=e=>u(u(w1(e),([r,n])=>[r,n],()=>u(v1(e),([r,n])=>[r,n],()=>u(L1(e),([r,n])=>[r,n],()=>u(k1(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),iS=e=>u(u(u(_("readonly",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[O_(r),n]),sS=e=>u(u(u(_("?",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[A_(r),n]),aS=e=>u(u(iS(e),([r,n])=>u(oS(n),([o,i])=>u(sS(i),([s,c])=>u(_(":",c),([l,m])=>u(ie(m),([f,h])=>[[r,o,s,l,f],h]))))),([r,n])=>[x_(r),n]),Qp=e=>u(u(u(_(",",e),([r,n])=>u(_(`
29
29
  `,n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_(";",e),([r,n])=>u(_(`
30
30
  `,n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_(",",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u(u(_(";",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u(u(_(`
31
- `,e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))))),([r,n])=>[r,n]),iS=(e,r=[])=>u(u(Vp(e),([n,o])=>u(oS(o),([i,a])=>[[n,i],a])),([n,o])=>iS(o,[...r,n]),()=>[r,e]),P1=e=>u(u(u(oS(e),([r,n])=>u(iS(n),([o,i])=>u(u(Vp(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[O_(r),n]),vm=e=>u(u(_("{",e),([r,n])=>u(P1(n),([o,i])=>u(_("}",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[x_(r),n]),U1=e=>u(vm(e),([r,n])=>[R_(r),n]),w1=e=>u(u(u(je(e),([r,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(_("readonly",c),([l,m])=>u(ne(m),([f,h])=>[[r,o,a,l,f],h]))))),([r,n])=>[r,n],()=>u(u(je(e),([r,n])=>u(_(":",n),([o,i])=>u(_("readonly",i),([a,c])=>u(ne(c),([l,m])=>[[r,o,a,l],m])))),([r,n])=>[r,n],()=>u(u(je(e),([r,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(ne(c),([l,m])=>[[r,o,a,l],m])))),([r,n])=>[r,n],()=>u(u(je(e),([r,n])=>u(_(":",n),([o,i])=>u(ne(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>[])))),([r,n])=>[C_(r),n]),$I=e=>u(u(w1(e),([r,n])=>[r,n],()=>u(u(rS(e),([r,n])=>u(ne(n),([o,i])=>u(nS(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>[])),([r,n])=>[P_(r),n]),aS=e=>u(u(u(_("...",e),([r,n])=>u($I(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u($I(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[])),([r,n])=>[U_(r),n]),sS=(e,r=[])=>u(u(_(",",e),([n,o])=>u(aS(o),([i,a])=>[[n,i],a])),([n,o])=>sS(o,[...r,n]),()=>[r,e]),v1=e=>u(u(u(aS(e),([r,n])=>u(sS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[w_(r),n]),N1=e=>u(u(_("[",e),([r,n])=>u(v1(n),([o,i])=>u(_("]",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[v_(r),n]),L1=e=>u(u(je(e),([r,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(_("readonly",c),([l,m])=>u(ne(m),([f,h])=>[[r,o,a,l,f],h]))))),([r,n])=>[N_(r),n]),k1=e=>u(u(je(e),([r,n])=>u(_(":",n),([o,i])=>u(_("readonly",i),([a,c])=>u(ne(c),([l,m])=>[[r,o,a,l],m])))),([r,n])=>[L_(r),n]),M1=e=>u(u(je(e),([r,n])=>u(_("?",n),([o,i])=>u(_(":",i),([a,c])=>u(ne(c),([l,m])=>[[r,o,a,l],m])))),([r,n])=>[k_(r),n]),D1=e=>u(u(je(e),([r,n])=>u(_(":",n),([o,i])=>u(ne(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[M_(r),n]),FI=e=>u(u(L1(e),([r,n])=>[r,n],()=>u(k1(e),([r,n])=>[r,n],()=>u(M1(e),([r,n])=>[r,n],()=>u(D1(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),cS=e=>u(u(u(_("...",e),([r,n])=>u(FI(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(FI(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[])),([r,n])=>[D_(r),n]),pS=(e,r=[])=>u(u(_(",",e),([n,o])=>u(cS(o),([i,a])=>[[n,i],a])),([n,o])=>pS(o,[...r,n]),()=>[r,e]),uS=e=>u(u(u(cS(e),([r,n])=>u(pS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[G_(r),n]),G1=e=>u(u(_("(",e),([r,n])=>u(uS(n),([o,i])=>u(_(")",i),([a,c])=>u(_("=>",c),([l,m])=>u(ne(m),([f,h])=>[[r,o,a,l,f],h]))))),([r,n])=>[$_(r),n]),$1=e=>u(u(_("new",e),([r,n])=>u(_("(",n),([o,i])=>u(uS(i),([a,c])=>u(_(")",c),([l,m])=>u(_("=>",m),([f,h])=>u(ne(h),([E,I])=>[[r,o,a,l,f,E],I])))))),([r,n])=>[F_(r),n]),F1=e=>u(u(u(_("+",e),([r,n])=>u(_("readonly",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_("-",e),([r,n])=>u(_("readonly",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_("readonly",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])))),([r,n])=>[j_(r),n]),j1=e=>u(u(u(_("+",e),([r,n])=>u(_("?",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_("-",e),([r,n])=>u(_("?",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_("?",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])))),([r,n])=>[q_(r),n]),q1=e=>u(u(u(_("as",e),([r,n])=>u(ne(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[B_(r),n]),B1=e=>u(u(_("{",e),([r,n])=>u(F1(n),([o,i])=>u(_("[",i),([a,c])=>u(je(c),([l,m])=>u(_("in",m),([f,h])=>u(ne(h),([E,I])=>u(q1(I),([g,T])=>u(_("]",T),([O,b])=>u(j1(b),([R,P])=>u(_(":",P),([de,mn])=>u(ne(mn),([Kr,zr])=>u(HI(zr),([c0,p0])=>u(_("}",p0),([u0,l0])=>[[r,o,a,l,f,E,g,O,R,de,Kr,c0,u0],l0]))))))))))))),([r,n])=>[H_(r),n]),H1=e=>u(je(e),([r,n])=>[K_(r),n]),K1=e=>u(xm(e),([r,n])=>[z_(r),n]),z1=e=>u(Kp(e),([r,n])=>[Y_(r),n]),Y1=e=>u(u(_("true",e),([r,n])=>[r,n],()=>u(_("false",e),([r,n])=>[r,n],()=>[])),([r,n])=>[V_(r),n]),V1=e=>u(zp(['"',"'"],e),([r,n])=>[r,n]),Q1=e=>u(_("null",e),([r,n])=>[Q_(r),n]),W1=e=>u(_("undefined",e),([r,n])=>[void 0,n]),lS=e=>u(u(tS(e),([r,n])=>u(_(":",n),([o,i])=>u(Nm(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[W_(r),n]),mS=(e,r=[])=>u(u(Vp(e),([n,o])=>u(lS(o),([i,a])=>[[n,i],a])),([n,o])=>mS(o,[...r,n]),()=>[r,e]),Z1=e=>u(u(u(lS(e),([r,n])=>u(mS(n),([o,i])=>u(u(Vp(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[Z_(r),n]),dS=e=>u(u(_("{",e),([r,n])=>u(Z1(n),([o,i])=>u(_("}",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[X_(r),n]),fS=(e,r=[])=>u(u(_(",",e),([n,o])=>u(Nm(o),([i,a])=>[[n,i],a])),([n,o])=>fS(o,[...r,n]),()=>[r,e]),X1=e=>u(u(u(Nm(e),([r,n])=>u(fS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[J_(r),n]),J1=e=>u(u(_("[",e),([r,n])=>u(X1(n),([o,i])=>u(_("]",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[eI(r),n]),Nm=e=>u(u(K1(e),([r,n])=>[r,n],()=>u(z1(e),([r,n])=>[r,n],()=>u(Y1(e),([r,n])=>[r,n],()=>u(V1(e),([r,n])=>[r,n],()=>u(Q1(e),([r,n])=>[r,n],()=>u(W1(e),([r,n])=>[r,n],()=>u(dS(e),([r,n])=>[r,n],()=>u(J1(e),([r,n])=>[r,n],()=>[])))))))),([r,n])=>[r,n]),eF=e=>u(_("-?(?:0|[1-9][0-9]*)n",e),([r,n])=>[tI(r),n]),tF=e=>u(_(".*",e),([r,n])=>[rI(r),n]),rF=e=>u(_("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([r,n])=>[nI(r),n]),nF=e=>u(_("-?(?:0|[1-9][0-9]*)",e),([r,n])=>[oI(r),n]),oF=e=>u(_("(?!)",e),([r,n])=>[iI(r),n]),iF=e=>u(GI(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([r,n])=>[aI(r),n]),aF=e=>u(u(eF(e),([r,n])=>[r,n],()=>u(tF(e),([r,n])=>[r,n],()=>u(rF(e),([r,n])=>[r,n],()=>u(nF(e),([r,n])=>[r,n],()=>u(oF(e),([r,n])=>[r,n],()=>u(sF(e),([r,n])=>[r,n],()=>u(iF(e),([r,n])=>[r,n],()=>[]))))))),([r,n])=>[r,n]),sF=e=>u(u(_("(",e),([r,n])=>u(Lm(n),([o,i])=>u(_(")",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[sI(r),n]),gS=e=>u(u(u(Pm(e),([r,n])=>u(_("|",n),([o,i])=>u(gS(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u(u(Pm(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[]))),([r,n])=>[cI(r),n]),Pm=e=>u(u(aF(e),([r,n])=>u(Lm(n),([o,i])=>[[r,o],i])),([r,n])=>[pI(r),n]),Lm=e=>u(u(gS(e),([r,n])=>[r,n],()=>u(Pm(e),([r,n])=>[r,n],()=>[])),([r,n])=>[r,n]),KT=e=>u(u(_("^",e),([r,n])=>u(Lm(n),([o,i])=>u(_("$",i),([a,c])=>[[r,o,a],c]))),([r,n])=>[uI(r),n]),hS=(e,r=[])=>u(u(_(",",e),([n,o])=>u(ne(o),([i,a])=>[[n,i],a])),([n,o])=>hS(o,[...r,n]),()=>[r,e]),cF=e=>u(u(u(ne(e),([r,n])=>u(hS(n),([o,i])=>u(u(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[lI(r),n]),yS=e=>u(u(u(_("extends",e),([r,n])=>u(cF(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[mI(r),n]),pF=e=>u(u(_("interface",e),([r,n])=>u(je(n),([o,i])=>u(Um(i),([a,c])=>u(yS(c),([l,m])=>u(vm(m),([f,h])=>[[r,o,a,l,f],h]))))),([r,n])=>[dI(r),n]),uF=e=>u(u(_("interface",e),([r,n])=>u(je(n),([o,i])=>u(yS(i),([a,c])=>u(vm(c),([l,m])=>[[r,o,a,l],m])))),([r,n])=>[fI(r),n]),lF=e=>u(u(_("type",e),([r,n])=>u(je(n),([o,i])=>u(Um(i),([a,c])=>u(_("=",c),([l,m])=>u(ne(m),([f,h])=>[[r,o,a,l,f],h]))))),([r,n])=>[gI(r),n]),mF=e=>u(u(_("type",e),([r,n])=>u(je(n),([o,i])=>u(_("=",i),([a,c])=>u(ne(c),([l,m])=>[[r,o,a,l],m])))),([r,n])=>[hI(r),n]),dF=e=>u(u(u(_("export",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[yI(r),n]),TS=e=>u(u(u(_(";",e),([r,n])=>u(_(`
31
+ `,e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))))),([r,n])=>[r,n]),cS=(e,r=[])=>u(u(Qp(e),([n,o])=>u(aS(o),([i,s])=>[[n,i],s])),([n,o])=>cS(o,[...r,n]),()=>[r,e]),M1=e=>u(u(u(aS(e),([r,n])=>u(cS(n),([o,i])=>u(u(Qp(i),([s,c])=>[[s],c],()=>[[],i]),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[R_(r),n]),wm=e=>u(u(_("{",e),([r,n])=>u(M1(n),([o,i])=>u(_("}",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[P_(r),n]),D1=e=>u(wm(e),([r,n])=>[U_(r),n]),G1=e=>u(u(u(je(e),([r,n])=>u(_("?",n),([o,i])=>u(_(":",i),([s,c])=>u(_("readonly",c),([l,m])=>u(ie(m),([f,h])=>[[r,o,s,l,f],h]))))),([r,n])=>[r,n],()=>u(u(je(e),([r,n])=>u(_(":",n),([o,i])=>u(_("readonly",i),([s,c])=>u(ie(c),([l,m])=>[[r,o,s,l],m])))),([r,n])=>[r,n],()=>u(u(je(e),([r,n])=>u(_("?",n),([o,i])=>u(_(":",i),([s,c])=>u(ie(c),([l,m])=>[[r,o,s,l],m])))),([r,n])=>[r,n],()=>u(u(je(e),([r,n])=>u(_(":",n),([o,i])=>u(ie(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>[])))),([r,n])=>[N_(r),n]),qI=e=>u(u(G1(e),([r,n])=>[r,n],()=>u(u(iS(e),([r,n])=>u(ie(n),([o,i])=>u(sS(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>[])),([r,n])=>[w_(r),n]),pS=e=>u(u(u(_("...",e),([r,n])=>u(qI(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(qI(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[])),([r,n])=>[v_(r),n]),uS=(e,r=[])=>u(u(_(",",e),([n,o])=>u(pS(o),([i,s])=>[[n,i],s])),([n,o])=>uS(o,[...r,n]),()=>[r,e]),$1=e=>u(u(u(pS(e),([r,n])=>u(uS(n),([o,i])=>u(u(_(",",i),([s,c])=>[[s],c],()=>[[],i]),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[L_(r),n]),F1=e=>u(u(_("[",e),([r,n])=>u($1(n),([o,i])=>u(_("]",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[k_(r),n]),j1=e=>u(u(je(e),([r,n])=>u(_("?",n),([o,i])=>u(_(":",i),([s,c])=>u(_("readonly",c),([l,m])=>u(ie(m),([f,h])=>[[r,o,s,l,f],h]))))),([r,n])=>[M_(r),n]),q1=e=>u(u(je(e),([r,n])=>u(_(":",n),([o,i])=>u(_("readonly",i),([s,c])=>u(ie(c),([l,m])=>[[r,o,s,l],m])))),([r,n])=>[D_(r),n]),B1=e=>u(u(je(e),([r,n])=>u(_("?",n),([o,i])=>u(_(":",i),([s,c])=>u(ie(c),([l,m])=>[[r,o,s,l],m])))),([r,n])=>[G_(r),n]),H1=e=>u(u(je(e),([r,n])=>u(_(":",n),([o,i])=>u(ie(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[$_(r),n]),BI=e=>u(u(j1(e),([r,n])=>[r,n],()=>u(q1(e),([r,n])=>[r,n],()=>u(B1(e),([r,n])=>[r,n],()=>u(H1(e),([r,n])=>[r,n],()=>[])))),([r,n])=>[r,n]),lS=e=>u(u(u(_("...",e),([r,n])=>u(BI(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(BI(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[])),([r,n])=>[F_(r),n]),mS=(e,r=[])=>u(u(_(",",e),([n,o])=>u(lS(o),([i,s])=>[[n,i],s])),([n,o])=>mS(o,[...r,n]),()=>[r,e]),dS=e=>u(u(u(lS(e),([r,n])=>u(mS(n),([o,i])=>u(u(_(",",i),([s,c])=>[[s],c],()=>[[],i]),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[j_(r),n]),K1=e=>u(u(_("(",e),([r,n])=>u(dS(n),([o,i])=>u(_(")",i),([s,c])=>u(_("=>",c),([l,m])=>u(ie(m),([f,h])=>[[r,o,s,l,f],h]))))),([r,n])=>[q_(r),n]),z1=e=>u(u(_("new",e),([r,n])=>u(_("(",n),([o,i])=>u(dS(i),([s,c])=>u(_(")",c),([l,m])=>u(_("=>",m),([f,h])=>u(ie(h),([E,I])=>[[r,o,s,l,f,E],I])))))),([r,n])=>[B_(r),n]),Y1=e=>u(u(u(_("+",e),([r,n])=>u(_("readonly",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_("-",e),([r,n])=>u(_("readonly",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_("readonly",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])))),([r,n])=>[H_(r),n]),V1=e=>u(u(u(_("+",e),([r,n])=>u(_("?",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_("-",e),([r,n])=>u(_("?",n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_("?",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])))),([r,n])=>[K_(r),n]),Q1=e=>u(u(u(_("as",e),([r,n])=>u(ie(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[z_(r),n]),W1=e=>u(u(_("{",e),([r,n])=>u(Y1(n),([o,i])=>u(_("[",i),([s,c])=>u(je(c),([l,m])=>u(_("in",m),([f,h])=>u(ie(h),([E,I])=>u(Q1(I),([g,T])=>u(_("]",T),([O,b])=>u(V1(b),([R,P])=>u(_(":",P),([de,dn])=>u(ie(dn),([zr,Yr])=>u(YI(Yr),([g0,h0])=>u(_("}",h0),([y0,T0])=>[[r,o,s,l,f,E,g,O,R,de,zr,g0,y0],T0]))))))))))))),([r,n])=>[Y_(r),n]),Z1=e=>u(je(e),([r,n])=>[V_(r),n]),X1=e=>u(xm(e),([r,n])=>[Q_(r),n]),J1=e=>u(zp(e),([r,n])=>[W_(r),n]),eF=e=>u(u(_("true",e),([r,n])=>[r,n],()=>u(_("false",e),([r,n])=>[r,n],()=>[])),([r,n])=>[Z_(r),n]),tF=e=>u(Yp(['"',"'"],e),([r,n])=>[r,n]),rF=e=>u(_("null",e),([r,n])=>[X_(r),n]),nF=e=>u(_("undefined",e),([r,n])=>[void 0,n]),fS=e=>u(u(oS(e),([r,n])=>u(_(":",n),([o,i])=>u(vm(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[J_(r),n]),gS=(e,r=[])=>u(u(Qp(e),([n,o])=>u(fS(o),([i,s])=>[[n,i],s])),([n,o])=>gS(o,[...r,n]),()=>[r,e]),oF=e=>u(u(u(fS(e),([r,n])=>u(gS(n),([o,i])=>u(u(Qp(i),([s,c])=>[[s],c],()=>[[],i]),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[eI(r),n]),hS=e=>u(u(_("{",e),([r,n])=>u(oF(n),([o,i])=>u(_("}",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[tI(r),n]),yS=(e,r=[])=>u(u(_(",",e),([n,o])=>u(vm(o),([i,s])=>[[n,i],s])),([n,o])=>yS(o,[...r,n]),()=>[r,e]),iF=e=>u(u(u(vm(e),([r,n])=>u(yS(n),([o,i])=>u(u(_(",",i),([s,c])=>[[s],c],()=>[[],i]),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[rI(r),n]),sF=e=>u(u(_("[",e),([r,n])=>u(iF(n),([o,i])=>u(_("]",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[nI(r),n]),vm=e=>u(u(X1(e),([r,n])=>[r,n],()=>u(J1(e),([r,n])=>[r,n],()=>u(eF(e),([r,n])=>[r,n],()=>u(tF(e),([r,n])=>[r,n],()=>u(rF(e),([r,n])=>[r,n],()=>u(nF(e),([r,n])=>[r,n],()=>u(hS(e),([r,n])=>[r,n],()=>u(sF(e),([r,n])=>[r,n],()=>[])))))))),([r,n])=>[r,n]),aF=e=>u(_("-?(?:0|[1-9][0-9]*)n",e),([r,n])=>[oI(r),n]),cF=e=>u(_(".*",e),([r,n])=>[iI(r),n]),pF=e=>u(_("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([r,n])=>[sI(r),n]),uF=e=>u(_("-?(?:0|[1-9][0-9]*)",e),([r,n])=>[aI(r),n]),lF=e=>u(_("(?!)",e),([r,n])=>[cI(r),n]),mF=e=>u(jI(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([r,n])=>[pI(r),n]),dF=e=>u(u(aF(e),([r,n])=>[r,n],()=>u(cF(e),([r,n])=>[r,n],()=>u(pF(e),([r,n])=>[r,n],()=>u(uF(e),([r,n])=>[r,n],()=>u(lF(e),([r,n])=>[r,n],()=>u(fF(e),([r,n])=>[r,n],()=>u(mF(e),([r,n])=>[r,n],()=>[]))))))),([r,n])=>[r,n]),fF=e=>u(u(_("(",e),([r,n])=>u(Lm(n),([o,i])=>u(_(")",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[uI(r),n]),TS=e=>u(u(u(Pm(e),([r,n])=>u(_("|",n),([o,i])=>u(TS(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u(u(Pm(e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[]))),([r,n])=>[lI(r),n]),Pm=e=>u(u(dF(e),([r,n])=>u(Lm(n),([o,i])=>[[r,o],i])),([r,n])=>[mI(r),n]),Lm=e=>u(u(TS(e),([r,n])=>[r,n],()=>u(Pm(e),([r,n])=>[r,n],()=>[])),([r,n])=>[r,n]),VT=e=>u(u(_("^",e),([r,n])=>u(Lm(n),([o,i])=>u(_("$",i),([s,c])=>[[r,o,s],c]))),([r,n])=>[dI(r),n]),ES=(e,r=[])=>u(u(_(",",e),([n,o])=>u(ie(o),([i,s])=>[[n,i],s])),([n,o])=>ES(o,[...r,n]),()=>[r,e]),gF=e=>u(u(u(ie(e),([r,n])=>u(ES(n),([o,i])=>u(u(_(",",i),([s,c])=>[[s],c],()=>[[],i]),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[fI(r),n]),_S=e=>u(u(u(_("extends",e),([r,n])=>u(gF(n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[gI(r),n]),hF=e=>u(u(_("interface",e),([r,n])=>u(je(n),([o,i])=>u(Um(i),([s,c])=>u(_S(c),([l,m])=>u(wm(m),([f,h])=>[[r,o,s,l,f],h]))))),([r,n])=>[hI(r),n]),yF=e=>u(u(_("interface",e),([r,n])=>u(je(n),([o,i])=>u(_S(i),([s,c])=>u(wm(c),([l,m])=>[[r,o,s,l],m])))),([r,n])=>[yI(r),n]),TF=e=>u(u(_("type",e),([r,n])=>u(je(n),([o,i])=>u(Um(i),([s,c])=>u(_("=",c),([l,m])=>u(ie(m),([f,h])=>[[r,o,s,l,f],h]))))),([r,n])=>[TI(r),n]),EF=e=>u(u(_("type",e),([r,n])=>u(je(n),([o,i])=>u(_("=",i),([s,c])=>u(ie(c),([l,m])=>[[r,o,s,l],m])))),([r,n])=>[EI(r),n]),_F=e=>u(u(u(_("export",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[_I(r),n]),IS=e=>u(u(u(_(";",e),([r,n])=>u(_(`
32
32
  `,n),([o,i])=>[[r,o],i])),([r,n])=>[r,n],()=>u(u(_(";",e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>u(u(_(`
33
- `,e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]),ES=(e,r=[])=>u(u(TS(e),([n,o])=>u(km(o),([i,a])=>[[n,i],a])),([n,o])=>ES(o,[...r,n]),()=>[r,e]),fF=e=>u(u(u(km(e),([r,n])=>u(ES(n),([o,i])=>u(u(TS(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[TI(r),n]),km=e=>u(u(dF(e),([r,n])=>u(u(pF(n),([o,i])=>[o,i],()=>u(uF(n),([o,i])=>[o,i],()=>u(lF(n),([o,i])=>[o,i],()=>u(mF(n),([o,i])=>[o,i],()=>[])))),([o,i])=>u(HI(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[EI(r),n]),gF=e=>u(u(km(e),([r,n])=>u(fF(n),([o,i])=>[[r,o],i])),([r,n])=>[_I(r),n]),_S=e=>u(u(gF(e),([r,n])=>[r,n],()=>u(b1(e),([r,n])=>[r,n],()=>u(ne(e),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]);function IS(e){let r=wm(`\`${e}\``);return s.IsEqual(r.length,2)?r[0]:ye()}function yF(e){return e.join("|")}function TF(e){return e.slice(1,e.length-1)}function EF(e,r,n){return On(r,`${n}${e}`)}function _F(e,r){return On(e,`${r}${$T}`)}function IF(e,r){return On(e,`${r}${ip}`)}function SF(e,r){return On(e,`${r}${pp}`)}function bF(e,r){return Va(q([Y("false"),Y("true")]),e,r)}function OF(e,r){return On(e,`${r}${up}`)}function AF(e,r,n){return On(r,`${n}${TF(e)}`)}function xF(e,r,n){let o=Qa(e,{});return Va(o,r,n)}function RF(e,r,n){let o=Lt(e);return Va(o,r,n)}function SS(e,r,n,o=[]){return s.ShiftLeft(e,(i,a)=>SS(a,r,n,[...o,Va(i,[],"")]),()=>On(r,`${n}(${yF(o)})`))}function Va(e,r,n){return We(e)?RF(e.enum,r,n):ct(e)?IF(r,n):Z(e)?EF(e.const,r,n):Dt(e)?_F(r,n):Ot(e)?bF(r,n):we(e)?SF(r,n):tt(e)?OF(r,n):Ie(e)?AF(e.pattern,r,n):OS(e)?xF(e.parameters[0],r,n):C(e)?SS(e.anyOf,r,n):dT}function On(e,r){return s.ShiftLeft(e,(n,o)=>Va(n,o,r),()=>r)}function CF(e){return`^${On(e,"")}$`}function bS(e){let r=CF(e);return mp(r)}function Qa(e,r){return K(e)?y.Update(bS(e),{},r):Ip(e,r)}function AS(e,r,n,o){let i=Kt(e,r,n);return Qa(i,o)}function Ip(e,r={}){return N("TemplateLiteral",[e],r)}function OS(e){return Le(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function xS(e){return Qa(e,{})}function PF(e){let r=IS(e);return xS(r)}function RS(e,r={}){let n=s.IsString(e)?PF(e):xS(e);return y.Update(n,{},r)}function Ie(e){return w(e,"TemplateLiteral")}var F={};Xt(F,{ExtendsFalse:()=>B,ExtendsTrue:()=>U,ExtendsUnion:()=>Mm,IsExtendsFalse:()=>UF,IsExtendsTrue:()=>PS,IsExtendsTrueLike:()=>ui,IsExtendsUnion:()=>CS,Match:()=>Re});function Mm(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function CS(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function U(e){return y.Create({"~kind":"ExtendsTrue"},{inferred:e})}function PS(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function B(){return y.Create({"~kind":"ExtendsFalse"},{})}function UF(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function ui(e){return CS(e)||PS(e)}function Re(e,r,n){return ui(e)?r(e.inferred):n()}function wF(e,r,n,o){return Re(te(e,n,o),i=>U(y.Assign(y.Assign(e,i),{[r]:n})),()=>B())}function vF(e,r){return U(e)}function NF(e,r,n,o,i){return Re(te(e,r,n),a=>Re(te(a,r,o),c=>U(c),()=>B()),()=>Re(te(e,r,i),a=>U(a),()=>B()))}function LF(e,r,n){let o=Lt(n);return te(e,r,o)}function US(e,r,n){return s.ShiftLeft(n,(o,i)=>Re(te(e,r,o),a=>US(a,r,i),()=>B()),()=>U(e))}function kF(e,r,n){let o=_t(n);return te(e,r,o)}function wS(e,r,n){return s.ShiftLeft(n,(o,i)=>Re(te(e,r,o),a=>U(a),()=>wS(e,r,i)),()=>B())}function ue(e,r,n){return Je(n)?vF(e,r):$e(n)?NF(e,r,n.if,n.then,n.else):We(n)?LF(e,r,n.enum):Qe(n)?wF(e,n.name,r,n.extends):G(n)?US(e,r,n.allOf):Ie(n)?kF(e,r,n.pattern):C(n)?wS(e,r,n.anyOf):ot(n)?U(e):B()}function vS(e,r,n){return Qe(n)?ue(e,r,n):Je(n)?U(e):ot(n)?U(e):Mm(e)}function MF(e,r){let n=oo(e),o=oo(r);return n&&o||!n&&o?!0:!(n&&!o)}function NS(e,r,n,o){return J(o)?MF(r,o)?te(e,n,o.items):B():ue(e,r,o)}function LS(e,r,n){return Dt(n)?U(e):ue(e,r,n)}function kS(e,r,n){return Ot(n)?U(e):ue(e,r,n)}function DF(e,r,n,o,i){let a=Qe(o)?r:o,c=Qe(o)?o:r,l=nt(r),m=nt(o);return!l&&m?B():Re(te(e,a,c),f=>Wa(f,n,i),()=>B())}function GF(e,r,n,o){return s.ShiftLeft(o,(i,a)=>DF(e,r,n,i,a),()=>nt(r)?U(e):B())}function $F(e,r,n){return s.ShiftLeft(r,(o,i)=>GF(e,o,i,n),()=>U(e))}function Wa(e,r,n){return $F(e,r,n)}function Qp(e,r,n){return Ft(n)?U(e):te(e,r,n)}function MS(e,r,n,o){return Je(o)?U(e):ot(o)?U(e):Ye(o)?Re(Wa(e,r,o.parameters),i=>Qp(i,n,o.instanceType),()=>B()):B()}function DS(e,r,n,o,i){return Re(te(e,r,i),()=>te(e,n,i),()=>te(e,o,i))}function GS(e,r,n){let o=Lt(r);return te(e,o,n)}function $S(e,r,n,o){return Je(o)?U(e):ot(o)?U(e):Ve(o)?Re(Wa(e,r,o.parameters),i=>Qp(i,n,o.returnType),()=>B()):B()}function FS(e,r,n){return ct(n)?U(e):we(n)?U(e):ue(e,r,n)}function jS(e,r,n){let o=ke(r);return te(e,o,n)}function Wp(e,r,n){return r===n?U(e):B()}function FF(e,r,n){return Z(n)?Wp(e,r,n.const):Dt(n)?U(e):ue(e,Y(r),n)}function jF(e,r,n){return Z(n)?Wp(e,r,n.const):Ot(n)?U(e):ue(e,Y(r),n)}function qF(e,r,n){return Z(n)?Wp(e,r,n.const):we(n)?U(e):ue(e,Y(r),n)}function BF(e,r,n){return Z(n)?Wp(e,r,n.const):tt(n)?U(e):ue(e,Y(r),n)}function qS(e,r,n){return s.IsBigInt(r.const)?FF(e,r.const,n):s.IsBoolean(r.const)?jF(e,r.const,n):s.IsNumber(r.const)?qF(e,r.const,n):s.IsString(r.const)?BF(e,r.const,n):ye()}function BS(e,r,n){return Qe(n)?ue(e,r,n):U(e)}function HS(e,r,n){return xr(n)?U(e):ue(e,r,n)}function KS(e,r,n){return we(n)?U(e):ue(e,r,n)}function HF(e,r,n){return nt(r)?nt(n)?U(e):B():U(e)}function KF(e,r,n){return Qe(n)&&dr(n.extends)?B():Re(te(e,r,n),o=>HF(o,r,n),()=>B())}function zF(e,r){return e.reduce((n,o)=>o in r?ui(r[o])?{...n,...r[o].inferred}:ye():ye(),{})}function YF(e,r,n){let o={};for(let c of s.Keys(n))o[c]=c in r?KF({},r[c],n[c]):nt(n[c])?Qe(n[c])?U(y.Assign(e,{[n[c].name]:n[c].extends})):U(e):B();let i=s.Values(o).every(c=>ui(c)),a=i?zF(s.Keys(o),o):{};return i?U(a):B()}function VF(e,r,n){let o=YF(e,r,n);return ui(o)?U(y.Assign(e,o.inferred)):B()}function QF(e,r,n){return VF(e,r,n)}function WF(e,r){return s.Keys(r).reduce((n,o)=>({...n,[o]:s.HasPropertyKey(e,o)?C(n[o])?q([...n[o].anyOf,r[o]]):q([e[o],r[o]]):r[o]}),e)}function zS(e,r,n,o){return s.ShiftLeft(r,(i,a)=>Re(te({},e[i],n),c=>zS(e,a,n,WF(o,c)),()=>B()),()=>U(o))}function ZF(e,r,n,o){let i=s.Keys(r);return zS(r,i,o,e)}function YS(e,r,n){return he(n)?ZF(e,r,pt(n),xe(n)):$(n)?QF(e,r,n.properties):ue(e,D(r),n)}function XF(e,r){return s.IsEqual(s.Keys(r).length,0)?U(e):B()}function JF(e,r,n,o,i){return te(e,n,i)}function VS(e,r,n,o){return he(o)?JF(e,yp(r),n,yp(pt(o)),xe(o)):$(o)?XF(e,o.properties):Je(o)?U(e):ot(o)?U(e):B()}function QS(e,r,n){return tt(n)?U(e):ue(e,r,n)}function WS(e,r,n){return Rr(n)?U(e):ue(e,r,n)}function ZS(e,r,n){let o=_t(r);return te(e,o,n)}function Dm(e,r){return y.Create({"~kind":"Inferrable"},{name:e,type:r},{})}function Za(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"name")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"Inferrable")&&s.IsString(e.name)&&s.IsObject(e.type)}function Gm(e){return In(e)?Qe(e.items)?J(e.items.extends)?Dm(e.items.name,e.items.extends.items):ot(e.items.extends)?Dm(e.items.name,e.items.extends):void 0:ye():void 0}function Zp(e){return Qe(e)?Dm(e.name,e.extends):void 0}function $m(e,r,n=[]){return s.ShiftLeft(e,(o,i)=>Re(te({},o,r),()=>$m(i,r,[...n,o]),()=>{}),()=>n)}function XS(e,r,n,o){let i=$m(n,o);return s.IsArray(i)?U(y.Assign(e,{[r]:Fe(i)})):B()}function Xp(e,r,n,o){let i=$m(n,o);return s.IsArray(i)?U(y.Assign(e,{[r]:q(i)})):B()}function ej(e){return[...e].reverse()}function Fm(e,r){return r?ej(e):e}function tj(e){let r=e.length>0?e[0]:void 0,n=Le(r)?Gm(r):void 0;return Le(n)}function rj(e,r,n,o,i,a){return Re(te(e,n,i),c=>JS(c,r,o,a),()=>B())}function nj(e,r,n,o,i){let a=Gm(o);return Za(a)?XS(e,a.name,Fm(n,r),a.type):s.ShiftLeft(n,(c,l)=>rj(e,r,c,l,o,i),()=>B())}function oj(e,r,n,o){return s.ShiftLeft(o,(i,a)=>nj(e,r,n,i,a),()=>s.IsEqual(n.length,0)?U(e):B())}function JS(e,r,n,o){return oj(e,r,n,o)}function ij(e,r,n){let o=An(e,Oe([],[]),n),i=tj(o);return JS(e,i,Fm(r,i),Fm(o,i))}function eb(e,r,n){let o=Zp(n);return Za(o)?Xp(e,o.name,r,o.type):s.ShiftLeft(r,(i,a)=>Re(te(e,i,n),c=>eb(c,a,n),()=>B()),()=>U(e))}function tb(e,r,n){let o=An(e,Oe([],[]),r);return V(n)?ij(e,o,n.items):J(n)?eb(e,o,n.items):ue(e,Fe(o),n)}function rb(e,r,n){return Ft(n)?U(e):gr(n)?U(e):ue(e,r,n)}function nb(e,r,n){return s.ShiftLeft(n,(o,i)=>Re(te(e,r,o),a=>U(a),()=>nb(e,r,i)),()=>B())}function jm(e,r,n){return s.ShiftLeft(r,(o,i)=>Re(nb(e,o,n),a=>jm(a,i,n),()=>B()),()=>U(e))}function ob(e,r,n){let o=Zp(n);return Za(o)?Xp(e,o.name,r,o.type):C(n)?jm(e,r,n.anyOf):jm(e,r,[n])}function ib(e,r,n){return Qe(n)?ue(e,r,n):Je(n)?U(e):ot(n)?U(e):B()}function ab(e,r,n){return Ft(n)?U(e):ue(e,r,n)}function te(e,r,n){return Je(r)?vS(e,r,n):J(r)?NS(e,r,r.items,n):Dt(r)?LS(e,r,n):Ot(r)?kS(e,r,n):Ye(r)?MS(e,r.parameters,r.instanceType,n):$e(r)?DS(e,r.if,r.then,r.else,n):We(r)?GS(e,r.enum,n):Ve(r)?$S(e,r.parameters,r.returnType,n):ct(r)?FS(e,r,n):G(r)?jS(e,r.allOf,n):Z(r)?qS(e,r,n):dr(r)?BS(e,r,n):xr(r)?HS(e,r,n):we(r)?KS(e,r,n):$(r)?YS(e,r.properties,n):he(r)?VS(e,pt(r),xe(r),n):tt(r)?QS(e,r,n):Rr(r)?WS(e,r,n):Ie(r)?ZS(e,r.pattern,n):V(r)?tb(e,r.items,n):gr(r)?rb(e,r,n):C(r)?ob(e,r.anyOf,n):ot(r)?ib(e,r,n):Ft(r)?ab(e,r,n):B()}function aj(e,r){return ke([...e,D(r)])}function qm(e,r,n){return K(e)?y.Update(aj(e,r),{},n):Ba(e,r,n)}function sb(e,r,n,o,i){let a=Kt(e,r,n),c=Xa(e,r,o);return qm(a,c,i)}function Ba(e,r,n={}){return N("Interface",[e,r],n)}function li(e){return Le(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function cb(e,r,n={}){return qm(e,r,n)}function sj(e,r,n){return e.includes(n)?!0:Ja([...e,n],r,r[n])}function pb(e,r,n){let o=ep(n);return mo(e,r,o)}function mo(e,r,n){return s.ShiftLeft(n,(o,i)=>Ja(e,r,o)?!0:mo(e,r,i),()=>!1)}function Ja(e,r,n){return me(n)?sj(e,r,n.$ref):J(n)?Ja(e,r,n.items):Ye(n)?mo(e,r,[...n.parameters,n.instanceType]):Ve(n)?mo(e,r,[...n.parameters,n.returnType]):li(n)?pb(e,r,n.parameters[1]):G(n)?mo(e,r,n.allOf):$(n)?pb(e,r,n.properties):C(n)?mo(e,r,n.anyOf):V(n)?mo(e,r,n.items):he(n)?Ja(e,r,xe(n)):!1}function ub(e,r,n){return Ja(e,r,n)}function cj(e,r){return r.reduce((n,o)=>ub([o],e,e[o])?[...n,o]:n,[])}function lb(e){let r=Jc(e);return cj(e,r)}function pj(e,r,n){return n.includes(r)?n:r in e?es(e,e[r],[...n,r]):ye()}function mb(e,r,n){let o=ep(r);return mi(e,o,n)}function mi(e,r,n){return r.reduce((o,i)=>es(e,i,o),n)}function es(e,r,n){return me(r)?pj(e,r.$ref,n):J(r)?es(e,r.items,n):Ye(r)?mi(e,[...r.parameters,r.instanceType],n):Ve(r)?mi(e,[...r.parameters,r.returnType],n):li(r)?mb(e,r.parameters[1],n):G(r)?mi(e,r.allOf,n):$(r)?mb(e,r.properties,n):C(r)?mi(e,r.anyOf,n):V(r)?mi(e,r.items,n):he(r)?es(e,xe(r),n):n}function db(e,r,n){return es(e,n,[r])}function uj(e){return Xo()}function lj(e){return s.Keys(e).reduce((r,n)=>({...r,[n]:fo(e[n])}),{})}function ts(e){return e.reduce((r,n)=>[...r,fo(n)],[])}function fo(e){return me(e)?uj(e.$ref):J(e)?vt(fo(e.items),Wo(e)):Ye(e)?Ir(ts(e.parameters),fo(e.instanceType)):Ve(e)?Sr(ts(e.parameters),fo(e.returnType)):G(e)?dt(ts(e.allOf)):$(e)?D(lj(e.properties)):he(e)?ii(_n(e),fo(xe(e))):C(e)?q(ts(e.anyOf)):V(e)?Fe(ts(e.items)):e}function mj(e,r){return r in e?fo(e[r]):et()}function fb(e){return mj(e.$defs,e.$ref)}function dj(e,r,n){let o=Kt(e,Oe([],[]),r),i=Xa({},Oe([],[]),n);return ke([...o,D(i)])}function fj(e,r){return s.Keys(e).filter(o=>r.includes(o)).reduce((o,i)=>{let a=e[i],c=li(a)?dj(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function gb(e,r,n){let o=db(e,r,n),i=fj(e,o);return Or(i,r)}function hb(e,r){return r in e?me(e[r])?hb(e,e[r].$ref):e[r]:ge()}function Cr(e,r){return hb(e,r)}function yb(e){return _e(e)?fb(e):tp(e)?et():e}function ht(e,r,n){let o=yb(r),i=yb(n);return te(e,o,i)}var Ga="equal",gj="disjoint",$a="left-inside",Fa="right-inside";function po(e,r){let n=[ot(e)?F.ExtendsFalse():ht({},e,r),ot(e)?F.ExtendsTrue({}):ht({},r,e)];return F.IsExtendsTrueLike(n[0])&&F.IsExtendsTrueLike(n[1])?Ga:F.IsExtendsTrueLike(n[0])&&F.IsExtendsFalse(n[1])?$a:F.IsExtendsFalse(n[0])&&F.IsExtendsTrueLike(n[1])?Fa:gj}function hj(e,r){return r.filter(n=>po(e,n)!==Fa)}function yj(e,r){let n=r.some(o=>{let i=po(e,o);return s.IsEqual(i,$a)||s.IsEqual(i,Ga)});return s.IsEqual(n,!1)}function Tj(e,r){let n=Jt(e);return Je(n)?[n]:yj(n,r)?[...hj(n,r),n]:r}function Ej(e){return e.reduce((r,n)=>$(n)?[...r,n]:dr(n)?r:Tj(n,r),[])}function _m(e){let r=Ej(e);return oi(r)}function Bm(e,r){return y.Update(Jt(e),{},r)}function Tb(e,r,n,o){let i=A(e,r,n);return Bm(i,o)}function rs(e,r=[]){return gn(e)&&s.IsEqual(e.action,"Conditional")?me(e.parameters[0])?rs(e.parameters[2],rs(e.parameters[3],[...r,e.parameters[0].$ref])):rs(e.parameters[2],rs(e.parameters[3],r)):gn(e)&&s.IsEqual(e.action,"Mapped")&&gn(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&me(e.parameters[1].parameters[0])?[...r,e.parameters[1].parameters[0].$ref]:r}function _j(e,r){return e.reduce((n,o)=>[...n,r.includes(o.name)],[])}function Ib(e,r,n=[]){return s.ShiftLeft(e,(o,i)=>s.ShiftLeft(r,(a,c)=>Ib(i,c,[...n,[a,o]]),()=>n),()=>n)}function Ij(e){return Ie(e)?_t(e.pattern):We(e)?Lt(e.enum):e}function Sj(e){let r=Ij(e);return C(r)?[...r.anyOf]:[r]}function bj(e,r){return e.reduce((n,o)=>[...n,[...o,r]],[])}function Eb(e,r){return r.reduce((n,o)=>[...n,...bj(e,o)],[])}function _b(e){return e.reduce((r,n)=>s.IsEqual(n[0],!0)?Eb(r,Sj(n[1])):Eb(r,[n[1]]),[[]])}function Sb(e,r,n){let o=rs(n),i=_j(e,o),a=Ib(r,i);return gn(n)&&s.IsEqual(n.action,"Conditional")||gn(n)&&s.IsEqual(n.action,"Mapped")?_b(a):[r]}function Oj(){return["(not-resolvable)",ge()]}function Aj(){return["(not-generic)",ge()]}function xj(e,r,n){return[e,hn(r,n)]}function Rj(e,r,n){return r in e?bb(e,r,e[r],n):Oj()}function bb(e,r,n,o){return Zo(n)?xj(r,n.parameters,n.expression):me(n)?Rj(e,n.$ref,o):Aj()}function Ob(e,r,n){return bb(e,"(anonymous)",r,n)}function Cj(e,r,n){if(Qe(r)||di(r)||F.IsExtendsTrueLike(ht({},r,n)))return;let o={parameter:e,expect:n,actual:r};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:o})}function Ab(e,r,n,o,i){let a=A(e,r,i);return Cj(n,a,o),y.Assign(e,{[n]:a})}function Pj(e,r,n,o,i){let a=A(e,r,n.extends),c=A(e,r,n.equals);return s.ShiftLeft(i,(l,m)=>Hm(Ab(e,r,n.name,a,l),r,o,m),()=>Hm(Ab(e,r,n.name,a,c),r,o,[]))}function Hm(e,r,n,o){return s.ShiftLeft(n,(i,a)=>Pj(e,r,i,a,o),()=>e)}function xb(e,r,n,o){return Hm(e,r,n,o)}var Km=0,zm=0;function Uj(){if(!s.IsLessThan(zm,at.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function wj(){Uj(),zm++,Km++}function vj(){Km--,s.IsEqual(Km,0)&&(zm=0)}function Nj(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function Lj(e,r){return s.IsEqual(Nj(e),r)}function kj(e,r,n,o,i,a){wj();try{let c=xb(e,r,o,a),l=A(c,Oe([...r.callstack,n.$ref],r.visited),i);return A(c,Oe([],[]),l)}finally{vj()}}function Mj(e,r,n,o,i,a){return a.reduce((c,l)=>{let m=kj(e,r,n,o,i,l);return[...c,m]},[])}function Dj(e,r,n,o,i,a){let c=Sb(o,a,i),l=Mj(e,r,n,o,i,c);return s.IsEqual(l.length,1)?l[0]:$t(l)}function Jp(e,r,n,o){let i=Kt(e,r,o),a=Ob(e,n,o),c=a[0],l=a[1];return Zo(l)?Lj(r,c)?Ha(st(c),i):Dj(e,r,st(c),l.parameters,l.expression,i):Ha(n,i)}function Ha(e,r){return y.Create({"~kind":"Call"},{type:"call",target:e,arguments:r},{})}function Rb(e,r){return Jp({},Oe([],[]),e,r)}function di(e){return w(e,"Call")}function Gj(e){return y.Discard(e,["~immutable"])}function Cb(e,r){return y.Update(Gj(e),{},r)}function Pb(e,r,n,o){let i=A(e,r,n);return Cb(i,o)}function Ub(e,r){return e(r)}function wb(e,r){return s.IsString(r)?Y(Ub(e,r)):Y(r)}function vb(e,r){let n=_t(r);return Qr(e,n)}function Nb(e,r){let n=r.map(o=>Qr(e,o));return q(n)}function Qr(e,r){return Z(r)?wb(e,r.const):Ie(r)?vb(e,r.pattern):C(r)?Nb(e,r.anyOf):r}function Sp(e,r={}){return N("Capitalize",[e],r)}function Lb(e,r={}){return Ym(e,r)}function bp(e,r={}){return N("Lowercase",[e],r)}function kb(e,r={}){return Vm(e,r)}function Op(e,r={}){return N("Uncapitalize",[e],r)}function Mb(e,r={}){return Qm(e,r)}function Ap(e,r={}){return N("Uppercase",[e],r)}function Db(e,r={}){return Wm(e,r)}var $j=e=>e[0].toUpperCase()+e.slice(1),Fj=e=>e.toLowerCase(),jj=e=>e[0].toLowerCase()+e.slice(1),qj=e=>e.toUpperCase();function Ym(e,r){return K([e])?y.Update(Qr($j,e),{},r):Sp(e,r)}function Vm(e,r){return K([e])?y.Update(Qr(Fj,e),{},r):bp(e,r)}function Qm(e,r){return K([e])?y.Update(Qr(jj,e),{},r):Op(e,r)}function Wm(e,r){return K([e])?y.Update(Qr(qj,e),{},r):Ap(e,r)}function Gb(e,r,n,o){let i=A(e,r,n);return Ym(i,o)}function $b(e,r,n,o){let i=A(e,r,n);return Vm(i,o)}function Fb(e,r,n,o){let i=A(e,r,n);return Qm(i,o)}function jb(e,r,n,o){let i=A(e,r,n);return Wm(i,o)}function xp(e,r,n,o,i={}){return N("Conditional",[e,r,n,o],i)}function qb(e,r,n,o,i={}){return Zm({},Oe([],[]),e,r,n,o,i)}function Bj(e,r,n,o,i,a){let c=ht(e,n,o);return F.IsExtendsUnion(c)?q([A(c.inferred,r,i),A(e,r,a)]):F.IsExtendsTrue(c)?A(c.inferred,r,i):A(e,r,a)}function Zm(e,r,n,o,i,a,c){return K([n,o])?y.Update(Bj(e,r,n,o,i,a),{},c):xp(n,o,i,a,c)}function Bb(e,r,n,o,i,a,c){let l=A(e,r,n),m=A(e,r,o);return Zm(e,r,l,m,i,a,c)}function Rp(e,r={}){return N("ConstructorParameters",[e],r)}function Hb(e,r={}){return Xm(e,r)}function Hj(e){let r=Ye(e)?e.parameters:[],n=An({},Oe([],[]),r);return Fe(n)}function Xm(e,r){return K([e])?y.Update(Hj(e),{},r):Rp(e,r)}function Kb(e,r,n,o){let i=A(e,r,n);return Xm(i,o)}function Cp(e,r,n={}){return N("Exclude",[e,r],n)}function zb(e,r,n={}){return ns(e,r,n)}function ns(e,r,n){return K([e,r])?y.Update(fp(e,r),{},n):Cp(e,r,n)}function Yb(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return ns(a,c,i)}function Pp(e,r,n={}){return N("Extract",[e,r],n)}function Vb(e,r,n={}){return Jm(e,r,n)}function Kj(e,r){let n=ht({},e,r);return F.IsExtendsTrueLike(n)?[e]:[]}function zj(e,r){return e.reduce((n,o)=>[...n,...Kj(o,r)],[])}function Qb(e,r){let n=Jt(e),o=C(n)?n.anyOf:[n],i=zj(o,r);return $t(i)}function Jm(e,r,n){return K([e,r])?y.Update(Qb(e,r),{},n):Pp(e,r,n)}function Wb(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return Jm(a,c,i)}function Yj(e){return e.reduce((r,n)=>ap(n)?[...r,Y(n)]:r,[])}function fi(e){let r=Yj(e);return q(r)}function Ka(e,r,n={}){return N("Index",[e,r],n)}function Zb(e,r,n={}){let o=s.IsArray(r)?fi(r):r;return ed(e,o,n)}function Xb(e,r){let n=Cr(e,r);return zt(n)}function Jb(e,r,n){let o=fr(e,r,n);return zt(o)}function Vj(e,r){let n=s.Keys(e).filter(h=>!s.HasPropertyKey(r,h)),o=s.Keys(r).filter(h=>!s.HasPropertyKey(e,h)),i=s.Keys(e).filter(h=>s.HasPropertyKey(r,h)),a=n.reduce((h,E)=>({...h,[E]:e[E]}),{}),c=o.reduce((h,E)=>({...h,[E]:r[E]}),{}),l=i.reduce((h,E)=>({...h,[E]:ke([e[E],r[E]])}),{}),m=y.Assign(a,c);return y.Assign(m,l)}function eO(e){return e.reduce((r,n)=>Vj(r,zt(n)),{})}function tO(e){let r=aE(Fe(e));return zt(r)}function Qj(e,r){return s.Keys(e).filter(i=>i in r).reduce((i,a)=>({...i,[a]:$t([e[a],r[a]])}),{})}function rO(e,r){return s.ShiftLeft(e,(n,o)=>rO(o,Qj(r,zt(n))),()=>r)}function nO(e){return s.ShiftLeft(e,(r,n)=>rO(n,zt(r)),()=>ye())}function zt(e){return _e(e)?Xb(e.$defs,e.$ref):$e(e)?Jb(e.if,e.then,e.else):G(e)?eO(e.allOf):C(e)?nO(e.anyOf):V(e)?tO(e.items):$(e)?e.properties:{}}function gi(e){let r=zt(e);return D(r)}var Wj=new RegExp("^(?:0|[1-9][0-9]*)$");function hi(e){let r=`${e}`;return Wj.test(r)?parseInt(r):e}function Zj(e){return Y(hi(e))}function oO(e){return e.map(r=>iO(r))}function iO(e){return G(e)?dt(oO(e.allOf)):C(e)?q(oO(e.anyOf)):Z(e)?Zj(e.const):e}function aO(e,r){let n=iO(r),o=ht({},n,Gt());return F.IsExtendsTrueLike(o)?e:Z(r)&&s.IsEqual(r.const,"length")?Gt():ge()}function sO(e,r){let n=Cr(e,r);return jt(n)}function cO(e,r,n){let o=fr(e,r,n);return jt(o)}function pO(e){let r=Lt(e);return jt(r)}function uO(e){let r=ke(e);return jt(r)}function lO(e){return[`${e}`]}function mO(e){let r=_t(e);return jt(r)}function dO(e){return e.reduce((r,n)=>[...r,...jt(n)],[])}function jt(e){return _e(e)?sO(e.$defs,e.$ref):$e(e)?cO(e.if,e.then,e.else):We(e)?pO(e.enum):G(e)?uO(e.allOf):Z(e)?lO(e.const):Ie(e)?mO(e.pattern):C(e)?dO(e.anyOf):[]}function yi(e){return jt(e)}function os(e,r){return r.map(n=>is(e,n))}function is(e,r){return J(r)?vt(is(e,r.items)):Ye(r)?Ir(os(e,r.parameters),is(e,r.instanceType)):Ve(r)?Sr(os(e,r.parameters),is(e,r.returnType)):V(r)?Fe(os(e,r.items)):C(r)?q(os(e,r.anyOf)):G(r)?dt(os(e,r.allOf)):Ep(r)?D(e):r}function fO(e,r){return is(e,r)}function Xj(e,r){let n=r in e?e[r]:ge();return fO(e,n)}function gO(e,r){return r.reduce((n,o)=>[...n,Xj(e,o)],[])}function Jj(e,r){let n=yi(r),o=gO(e,n);return $t(o)}var eq=new RegExp(En);function tq(e){return e.filter(n=>eq.test(n))}function rq(e){let r=Jc(e),n=tq(r),o=gO(e,n);return $t(o)}function hO(e,r){return we(r)?rq(e):Jj(e,r)}function nq(e){return Y(hi(e))}function yO(e){return e.map(r=>td(r))}function td(e){return G(e)?dt(yO(e.allOf)):C(e)?q(yO(e.anyOf)):Z(e)?nq(e.const):e}function oq(e,r){return e.reduceRight((n,o,i)=>{let a=ht({},Y(i),r);return F.IsExtendsTrueLike(a)?[o,...n]:n},[])}function iq(e,r){let n=td(r),o=oq(e,n);return Yr(o)}function aq(e){return Yr(e)}function TO(e,r){return Z(r)&&s.IsEqual(r.const,"length")?Y(e.length):we(r)||ct(r)?aq(e):iq(e,r)}function EO(e,r){return J(e)?aO(e.items,r):$(e)?hO(e.properties,r):V(e)?TO(e.items,r):ge()}function sq(e){return _e(e)||$e(e)||G(e)||C(e)?gi(e):e}function ed(e,r,n){return K([e,r])?y.Update(EO(sq(e),r),{},n):Ka(e,r,n)}function _O(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return ed(a,c,i)}function Up(e,r={}){return N("InstanceType",[e],r)}function IO(e,r={}){return rd(e,r)}function cq(e){return Ye(e)?e.instanceType:ge()}function rd(e,r){return K([e])?y.Update(cq(e),{},r):Up(e,r)}function SO(e,r,n,o={}){let i=A(e,r,n);return rd(i,o)}function za(e,r={}){return N("KeyOf",[e],r)}function bO(e,r={}){return nd(e,r)}function OO(){return q([Gt(),At(),ri()])}function AO(e){return Gt()}function pq(e){return e.reduce((n,o)=>ap(o)?[...n,Y(hi(o))]:ye(),[])}function xO(e){let r=s.Keys(e),n=pq(r);return Yr(n)}function RO(e){return _n(e)}function CO(e){let r=e.map((n,o)=>Y(o));return Yr(r)}function PO(e){return Je(e)?OO():J(e)?AO(e.items):$(e)?xO(e.properties):he(e)?RO(e):V(e)?CO(e.items):ge()}function uq(e){return _e(e)||$e(e)||G(e)||C(e)?gi(e):e}function nd(e,r){return K([e])?y.Update(PO(uq(e)),{},r):za(e,r)}function UO(e,r,n,o){let i=A(e,r,n);return nd(i,o)}function qa(e,r,n,o,i={}){return N("Mapped",[e,r,n,o],i)}function wO(e,r,n,o,i={}){return od({},Oe([],[]),e,r,n,o,i)}function lq(e){let r=_t(e);return eu(r)}function mq(e){return e.reduce((r,n)=>[...r,...eu(n)],[])}function dq(e){let r=Lt(e);return eu(r)}function fq(e){return s.IsNumber(e)?[Y(`${e}`)]:[Y(e)]}function eu(e){return We(e)?dq(e.enum):Z(e)?fq(e.const):Ie(e)?lq(e.pattern):C(e)?mq(e.anyOf):[e]}function vO(e){return eu(e)}function gq(e){return Ie(e)?_t(e.pattern):e}function hq(e,r,n,o,i,a){let c=y.Assign(e,{[n.name]:o}),l=A(c,r,i),m=gq(l),f=A(c,r,a);return sp(m)||cp(m)?{[m.const]:f}:{}}function yq(e,r,n,o,i,a){return o.reduce((c,l)=>[...c,hq(e,r,n,l,i,a)],[])}function Tq(e){return e.reduce((r,n)=>[...r,D(n)],[])}function NO(e,r,n,o,i,a){let c=vO(o),l=yq(e,r,n,c,i,a),m=Tq(l);return ke(m)}function od(e,r,n,o,i,a,c){return K([o])?y.Update(NO(e,r,n,o,i,a),{},c):qa(n,o,i,a,c)}function LO(e,r,n,o,i,a,c){let l=A(e,r,o);return od(e,r,n,l,i,a,c)}function Eq(e,r,n){let o=y.Assign(e,r);return s.Keys(r).filter(a=>n.includes(a)).reduce((a,c)=>({...a,[c]:gb(o,c,r[c])}),{})}function _q(e,r,n){let o=y.Assign(e,r);return s.Keys(r).filter(a=>!n.includes(a)).reduce((a,c)=>({...a,[c]:A(o,Oe([],[]),r[c])}),{})}function Iq(e,r,n){let o=lb(r),i=Eq(e,r,o),a=_q(e,r,o),c={...i,...a};return y.Update(c,{},n)}function tu(e,r,n,o){return Iq(e,n,o)}function wp(e,r={}){return N("NonNullable",[e],r)}function kO(e,r={}){return id(e,r)}function Sq(e){let r=q([ti(),ai()]);return ns(e,r,{})}function id(e,r){return K([e])?y.Update(Sq(e),{},r):wp(e,r)}function MO(e,r,n,o){let i=A(e,r,n);return id(i,o)}function vp(e,r,n={}){return N("Omit",[e,r],n)}function DO(e,r,n={}){let o=s.IsArray(r)?fi(r):r;return ad(e,o,n)}function ru(e){let r=gi(e);return $(r)?r.properties:ye()}function bq(e,r){return s.Keys(e).reduce((o,i)=>r.includes(i)?o:{...o,[i]:e[i]},{})}function GO(e,r){let n=ru(e),o=yi(r),i=bq(n,o);return D(i)}function ad(e,r,n){return K([e,r])?y.Update(GO(e,r),{},n):vp(e,r,n)}function $O(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return ad(a,c,i)}function Np(e,r={}){return N("Parameters",[e],r)}function FO(e,r={}){return sd(e,r)}function Oq(e){let r=Ve(e)?e.parameters:[],n=An({},Oe([],[]),r);return Fe(n)}function sd(e,r){return K([e])?y.Update(Oq(e),{},r):Np(e,r)}function jO(e,r,n,o){let i=A(e,r,n);return sd(i,o)}function Lp(e,r={}){return N("Partial",[e],r)}function qO(e,r={}){return cd(e,r)}function BO(e,r){let n=Cr(e,r),o=Pr(n);return Or(y.Assign(e,{[r]:o}),r)}function HO(e,r,n){let o=fr(e,r,n);return Pr(o)}function KO(e){let r=ke(e);return Pr(r)}function zO(e){let r=e.map(n=>Pr(n));return q(r)}function YO(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:eo(e[i])}),{});return D(r)}function Pr(e){return _e(e)?BO(e.$defs,e.$ref):$e(e)?HO(e.if,e.then,e.else):G(e)?KO(e.allOf):C(e)?zO(e.anyOf):$(e)?YO(e.properties):D({})}function cd(e,r){return K([e])?y.Update(Pr(e),{},r):Lp(e,r)}function VO(e,r,n,o){let i=A(e,r,n);return cd(i,o)}function kp(e,r,n={}){return N("Pick",[e,r],n)}function QO(e,r,n={}){let o=s.IsArray(r)?fi(r):r;return pd(e,o,n)}function Aq(e,r){return s.Keys(e).reduce((o,i)=>r.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function WO(e,r){let n=ru(e),o=yi(r),i=Aq(n,o);return D(i)}function pd(e,r,n){return K([e,r])?y.Update(WO(e,r),{},n):kp(e,r,n)}function ZO(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return pd(a,c,i)}function Mp(e,r={}){return N("ReadonlyObject",[e],r)}function ud(e,r={}){return ld(e,r)}var XO=ud;function JO(e){return ei(vt(e))}function eA(e,r){let n=Cr(e,r),o=Ur(n);return Or(y.Assign(e,{[r]:o}),r)}function tA(e,r,n){let o=fr(e,r,n);return Ur(o)}function rA(e){let r=ke(e);return Ur(r)}function nA(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:io(e[i])}),{});return D(r)}function oA(e){return ei(Fe(e))}function iA(e){let r=e.map(n=>Ur(n));return q(r)}function Ur(e){return J(e)?JO(e.items):_e(e)?eA(e.$defs,e.$ref):$e(e)?tA(e.if,e.then,e.else):G(e)?rA(e.allOf):$(e)?nA(e.properties):V(e)?oA(e.items):C(e)?iA(e.anyOf):e}function ld(e,r){return K([e])?y.Update(Ur(e),{},r):Mp(e)}function aA(e,r,n,o){let i=A(e,r,n);return ld(i,o)}function sA(e,r,n,o){return r.visited.includes(o)?n:o in e?A(e,Oe(r.callstack,[...r.visited,o]),e[o]):n}function cA(e,r){let n=Cr(e,r),o=wr(n);return Or(y.Assign(e,{[r]:o}),r)}function pA(e,r,n){let o=fr(e,r,n);return wr(o)}function uA(e){let r=ke(e);return wr(r)}function lA(e){let r=e.map(n=>wr(n));return q(r)}function mA(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:dp(e[i])}),{});return D(r)}function wr(e){return _e(e)?cA(e.$defs,e.$ref):$e(e)?pA(e.if,e.then,e.else):G(e)?uA(e.allOf):C(e)?lA(e.anyOf):$(e)?mA(e.properties):D({})}function Dp(e,r={}){return N("Required",[e],r)}function dA(e,r={}){return md(e,r)}function md(e,r){return K([e])?y.Update(wr(e),{},r):Dp(e,r)}function fA(e,r,n,o){let i=A(e,r,n);return md(i,o)}function Gp(e,r={}){return N("ReturnType",[e],r)}function gA(e,r={}){return dd(e,r)}function xq(e){return Ve(e)?e.returnType:ge()}function dd(e,r){return K([e])?y.Update(xq(e),{},r):Gp(e,r)}function hA(e,r,n,o={}){let i=A(e,r,n);return dd(i,o)}function $p(e,r){return N("With",[e,r],{})}function nu(e,r){return fd(e,r)}function fd(e,r){return K([e])?y.Update(e,{},r):$p(e,r)}function yA(e,r,n,o){let i=A(e,r,n);return fd(i,o)}function Rq(e){return In(e)?V(e.items)?gd(e.items.items):Qe(e.items)?[e]:me(e.items)?[e]:[ge()]:[e]}function gd(e){return e.reduce((n,o)=>[...n,...Rq(o)],[])}function Oe(e,r){return{callstack:e,visited:r}}function K(e){return s.ShiftLeft(e,(r,n)=>me(r)?!1:K(n),()=>!0)}function Xa(e,r,n){return s.Keys(n).reduce((o,i)=>({...o,[i]:A(e,r,n[i])}),{})}function An(e,r,n){let o=Kt(e,r,n);return gd(o)}function Kt(e,r,n){return n.map(o=>A(e,r,o))}function Cq(e,r){let n=nt(e)?Ua(r,{}):r,o=ao(e)?Pa(n,{}):n;return oo(e)?as(o,{}):o}function Pq(e,r,n,o,i){return s.IsEqual(n,"AddImmutable")?TA(e,r,o[0],i):s.IsEqual(n,"RemoveImmutable")?Pb(e,r,o[0],i):s.IsEqual(n,"AddReadonly")?pT(e,r,o[0],i):s.IsEqual(n,"RemoveReadonly")?tE(e,r,o[0],i):s.IsEqual(n,"AddOptional")?uT(e,r,o[0],i):s.IsEqual(n,"RemoveOptional")?oE(e,r,o[0],i):s.IsEqual(n,"Capitalize")?Gb(e,r,o[0],i):s.IsEqual(n,"Conditional")?Bb(e,r,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?Kb(e,r,o[0],i):s.IsEqual(n,"Evaluate")?Tb(e,r,o[0],i):s.IsEqual(n,"Exclude")?Yb(e,r,o[0],o[1],i):s.IsEqual(n,"Extract")?Wb(e,r,o[0],o[1],i):s.IsEqual(n,"Index")?_O(e,r,o[0],o[1],i):s.IsEqual(n,"InstanceType")?SO(e,r,o[0],i):s.IsEqual(n,"Interface")?sb(e,r,o[0],o[1],i):s.IsEqual(n,"KeyOf")?UO(e,r,o[0],i):s.IsEqual(n,"Lowercase")?$b(e,r,o[0],i):s.IsEqual(n,"Mapped")?LO(e,r,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?tu(e,r,o[0],i):s.IsEqual(n,"NonNullable")?MO(e,r,o[0],i):s.IsEqual(n,"Pick")?ZO(e,r,o[0],o[1],i):s.IsEqual(n,"Parameters")?jO(e,r,o[0],i):s.IsEqual(n,"Partial")?VO(e,r,o[0],i):s.IsEqual(n,"Omit")?$O(e,r,o[0],o[1],i):s.IsEqual(n,"ReadonlyObject")?aA(e,r,o[0],i):s.IsEqual(n,"Record")?IE(e,r,o[0],o[1],i):s.IsEqual(n,"Required")?fA(e,r,o[0],i):s.IsEqual(n,"ReturnType")?hA(e,r,o[0],i):s.IsEqual(n,"TemplateLiteral")?AS(e,r,o[0],i):s.IsEqual(n,"Uncapitalize")?Fb(e,r,o[0],i):s.IsEqual(n,"Uppercase")?jb(e,r,o[0],i):s.IsEqual(n,"With")?yA(e,r,o[0],o[1]):N(n,o,i)}function Uq(e,r,n){let o=me(n)?sA(e,r,n,n.$ref):J(n)?vt(A(e,r,n.items),Wo(n)):di(n)?Jp(e,r,n.target,n.arguments):Ye(n)?Ir(Kt(e,r,n.parameters),A(e,r,n.instanceType),lT(n)):Ve(n)?Sr(Kt(e,r,n.parameters),A(e,r,n.returnType),mT(n)):$e(n)?to(A(e,r,n.if),A(e,r,n.then),A(e,r,n.else),TT(n)):G(n)?dt(Kt(e,r,n.allOf),bT(n)):$(n)?D(Xa(e,r,n.properties),hT(n)):he(n)?hp(pt(n),A(e,r,xe(n))):In(n)?uo(A(e,r,n.items)):V(n)?Fe(An(e,r,n.items),eE(n)):C(n)?q(Kt(e,r,n.anyOf),HT(n)):n;return Cq(n,o)}function A(e,r,n){return gn(n)?Pq(e,r,n.action,n.parameters,n.options):Uq(e,r,n)}function er(e,r){return A(e,Oe([],[]),r)}function wq(e){return y.Update(e,{"~immutable":!0},{})}function as(e,r){return y.Update(wq(e),{},r)}function TA(e,r,n,o){let i=A(e,r,n);return as(i,o)}function II(e,r={}){return N("AddImmutable",[e],r)}function ei(e,r={}){return as(e,r)}function SI(e,r={}){return N("Evaluate",[e],r)}function yt(e,r={}){return Bm(e,r)}function bI(e,r={}){return N("Module",[e],r)}function EA(e,r={}){return tu({},Oe([],[]),e,r)}function vq(e,r){let n=po(e,r);return s.IsEqual(n,"right-inside")||s.IsEqual(n,"disjoint")?1:0}function _A(e,r,n=[]){return s.ShiftLeft(r,(o,i)=>s.IsEqual(vq(e,o),1)?_A(e,i,[...n,o]):[...n,e,...r],()=>[...n,e])}function IA(e,r=[]){return s.ShiftLeft(e,(n,o)=>IA(o,_A(n,r)),()=>r)}function SA(e){return IA(e)}function bA(...e){let[r,n,o]=ie.Match(e,{2:(c,l)=>s.IsString(c)?[{},c,l]:[c,l,{}],3:(c,l,m)=>[c,l,m],1:c=>[{},c,{}]}),i=_S(n),a=s.IsArray(i)&&s.IsEqual(i.length,2)?A(r,Oe([],[]),i[0]):ge();return y.Update(a,{},o)}var t={};Xt(t,{Any:()=>Xo,Array:()=>vt,BigInt:()=>La,Boolean:()=>op,Call:()=>Rb,Capitalize:()=>Lb,Codec:()=>rp,Conditional:()=>qb,Constructor:()=>Ir,ConstructorParameters:()=>Hb,Cyclic:()=>Or,Decode:()=>LT,DecodeBuilder:()=>Na,Dependent:()=>to,Encode:()=>kT,EncodeBuilder:()=>va,Enum:()=>ST,Evaluate:()=>yt,Exclude:()=>zb,Extends:()=>ht,ExtendsResult:()=>F,Extract:()=>Vb,Function:()=>Sr,Generic:()=>hn,Identifier:()=>ka,Immutable:()=>MT,Index:()=>Zb,Infer:()=>wa,InstanceType:()=>IO,Instantiate:()=>er,Integer:()=>so,Interface:()=>cb,Intersect:()=>dt,IsAny:()=>Je,IsArray:()=>J,IsBigInt:()=>Dt,IsBoolean:()=>Ot,IsCall:()=>di,IsCodec:()=>no,IsConstructor:()=>Ye,IsCyclic:()=>_e,IsDependent:()=>$e,IsEnum:()=>We,IsEnumValue:()=>IT,IsFunction:()=>Ve,IsGeneric:()=>Zo,IsIdentifier:()=>FT,IsImmutable:()=>oo,IsInfer:()=>Qe,IsInteger:()=>ct,IsIntersect:()=>G,IsKind:()=>w,IsLiteral:()=>Z,IsNever:()=>dr,IsNull:()=>xr,IsNumber:()=>we,IsObject:()=>$,IsOptional:()=>nt,IsParameter:()=>BT,IsReadonly:()=>ao,IsRecord:()=>he,IsRef:()=>me,IsRefine:()=>np,IsRest:()=>In,IsSchema:()=>Le,IsString:()=>tt,IsSymbol:()=>Rr,IsTemplateLiteral:()=>Ie,IsThis:()=>Ep,IsTuple:()=>V,IsUndefined:()=>gr,IsUnion:()=>C,IsUnknown:()=>ot,IsUnsafe:()=>tp,IsVoid:()=>Ft,KeyOf:()=>bO,Literal:()=>Y,Lowercase:()=>kb,Mapped:()=>wO,Module:()=>EA,Never:()=>ge,NonNullable:()=>kO,Null:()=>ti,Number:()=>Gt,Object:()=>D,Omit:()=>DO,Optional:()=>fT,Parameter:()=>co,Parameters:()=>FO,Partial:()=>qO,Pick:()=>QO,Readonly:()=>DT,ReadonlyObject:()=>ud,ReadonlyType:()=>XO,Record:()=>ii,RecordKey:()=>_n,RecordPattern:()=>pt,RecordValue:()=>xe,Ref:()=>st,Refine:()=>GT,Required:()=>dA,Rest:()=>uo,ReturnType:()=>gA,Script:()=>bA,String:()=>At,Symbol:()=>ri,TemplateLiteral:()=>RS,This:()=>Tp,Tuple:()=>Fe,Uncapitalize:()=>Mb,Undefined:()=>ai,Union:()=>q,Unknown:()=>et,Unsafe:()=>yT,Uppercase:()=>Db,Void:()=>_p,With:()=>nu});var OA="Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported.";var Nq=dn(xA());var RA="lowercase-email",go="iana-timezone",hd="simple-time",yd="simple-date-time";var Lq=(e,r)=>RegExp(`^${e.source}(${r.source}${e.source})*$`),kq=/[a-zA-Z0-9-_]+/,Mq=/\./,XUe=Lq(kq,Mq);var CA="lowercase-domain";var Ti="kebab-case";var PA="camel-case";var Dq=new Set;function x(e,r,n={}){let o=r.map(i=>{let a=i;return a.$id?(Dq.add(i),t.Ref(a.$id)):i});return t.Unsafe({...n,type:"object",discriminator:{propertyName:e},required:[e],oneOf:o})}function ce(e,r){return t.Object({values:t.Array(e,{maxItems:r.maxItems,description:"Values compared by this filter. When `exclude` is omitted or false, rows matching any value are kept; when `exclude` is true, matching rows are removed."}),exclude:t.Optional(t.Boolean({description:"If true, exclude rows matching these values instead of including them"}))},{description:r.description})}function Yt(e,r={}){return x("type",[t.Object({type:t.Literal("ids"),ids:t.Array(p({allowEmpty:!1}),{minItems:1,uniqueItems:!0,...r.maxIds!==void 0&&{maxItems:r.maxIds}})}),t.Object({type:t.Literal("all"),filters:t.Optional(e)})])}function Wr(e){return t.Object({value:p({allowEmpty:!1,description:e.valueDescription}),exclude:t.Optional(t.Boolean({description:"If true, exclude rows matching this value instead of including them"}))},{description:e.description})}var _i=1e3,iu=100,ae={limit:t.Optional(t.Integer({minimum:1,maximum:_i,description:"Maximum number of items to return in this page."})),offset:t.Optional(t.Integer({minimum:0,description:"Zero-based index of the first matching item to return. Increase it with `limit` to request later pages. If `limit` is provided without `offset`, the offset defaults to 0."}))},Gq=["asc","desc"],Q=t.Enum(Gq,{description:"Sort direction: ascending or descending."}),qe={...ae,limit:t.Optional(t.Integer({minimum:1,maximum:_i,default:iu,description:`Maximum number of items to return in this page. Omit to use the public API default of ${iu}.`}))},$q=t.Object({totalCount:t.Integer({description:"Total number of items matching the query before `limit` and `offset` are applied."}),pageCount:t.Integer({description:"Total number of pages available for the requested `limit`."})},{description:"Counts describing the full result set that the returned page was taken from, for computing how many further pages remain."}),owe=t.Object({pagination:$q},{$id:"ResponseMetadata",description:"Metadata accompanying `data` on paginated operations, describing the full result set the page was taken from."});function Se(e,r={}){return t.Optional(t.Union([t.Null(),e],r))}function S(e={}){return t.Unsafe({...e,type:"string"})}var Ei=250;function p({allowEmpty:e=!0,type:r="short",description:n,default:o}={}){let i=e?0:1,a={...n===void 0?{}:{description:n},...o===void 0?{}:{default:o}};switch(r){case"camel-case":return t.String({format:PA,minLength:i,maxLength:Ei,...a});case"kebab-case":return t.String({format:Ti,minLength:i,maxLength:Ei,...a});case"email":return t.String({format:RA,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return t.String({format:CA,minLength:i,maxLength:Ei,...a});case"tsuga-query":return t.String({format:"tsuga-query",minLength:i,maxLength:1e4,...a});case"tags-query":return t.String({format:"tags-query",minLength:i,maxLength:1e4,errorMessage:{format:`${OA} The query you provided is invalid: \${0}`},...a});case"date-time":return t.String({format:"date-time",...a});case"uri":return t.String({format:"uri",...a});case"user-password":return t.String({format:"user-password",minLength:12,maxLength:Ei,...a});case"long":return t.String({minLength:i,maxLength:5e4,...a});case"short":return t.String({minLength:i,maxLength:Ei,...a});case"tsuga-formula":return t.String({format:"tsuga-formula",minLength:i,maxLength:Ei,errorMessage:{format:"Must be a simple mathematical formula, and all variables in it should refer to queries (q1, q2, etc.). The formula you provided is invalid: ${0}"},...a});case"time":return t.String({format:"time",...a});case"readonly-sql-query":return t.String({format:"readonly-sql-query",minLength:i,maxLength:5e4,errorMessage:{format:"Must be a readonly SQL query - only SELECT statements are allowed."},...a});default:Ze(r)}}var ss=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],au=t.Array(t.Enum(ss,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var Td=["CLUSTER_DB_QUERY_INVALID_CONNECTION_PARAMS","CLUSTER_DB_QUERY_INVALID_CREDENTIALS","CLUSTER_DB_QUERY_PERMISSION_DENIED","CLUSTER_DB_QUERY_QUERY_SYNTAX_ERROR","CLUSTER_DB_QUERY_DATABASE_UNREACHABLE","CLUSTER_DB_QUERY_CONNECTION_FAILED","CLUSTER_DB_QUERY_QUERY_EXECUTION_FAILED","CLUSTER_DB_QUERY_QUERY_TIMEOUT","CLUSTER_DB_QUERY_CONNECTION_TIMEOUT"],ywe=t.Enum(Td),Fq=["CLUSTER_AGGREGATION_STRUCTURE"];var Twe=t.Object({code:t.Enum(Td),message:t.String()}),wA=[...Td,...Fq,"ABORT_ERROR","BAD_REQUEST","CUSTOM_ROLE_IN_USE","CUSTOM_ROLE_NAME_CONFLICT","DUPLICATE_KEY_VIOLATION","FOREIGN_KEY_VIOLATION","FST_ERR_VALIDATION","GROK_RULE_VALIDATION_ERROR","INVALID_INPUT","FORBIDDEN","MISSING_PERMISSION","PRIVILEGE_ESCALATION","RATE_LIMITED","RESERVED_TAG_POLICY_ERROR","RESOURCE_NOT_FOUND","INVALID_INVITATION","TAG_POLICY_ALREADY_EXISTS_ERROR","TAG_POLICY_VALIDATION_ERROR","UNAUTHORIZED","URL_NOT_FOUND"],vA=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var jq=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],qq=[...wA,...vA,...jq],Bq=t.Object({assetId:t.Optional(t.String({description:"Identifier of the asset that violated the policy. Set from the existing asset for update and bulk requests. Omitted on create requests before the asset exists."})),assetName:t.String({description:"Name of the asset that violated the policy. Set from submitted data or the existing asset row. Returned for every violation."}),assetType:t.Enum(ss,{description:"Type of Tsuga asset validated by the policy. Set by the route that ran tag-policy validation. Returned for every violation."}),tagPolicyId:t.String({description:"Identifier of the active tag policy that was violated. Generated by Tsuga when the policy is created. Returned for every violation."}),tagKey:t.String({description:"Tag key required or constrained by the violated policy. Set by the tag policy. Returned for every violation."}),message:t.String({description:"Human-readable reason this policy failed for the asset. Generated by Tsuga's tag-policy validator. Returned for every violation."})},{description:"A single tag-policy violation, identifying the offending asset, the policy and tag key involved, and why validation failed."}),Hq=x("type",[t.Object({type:t.Literal("invalid-syntax",{description:"Discriminator identifying a rule the grok parser could not parse at all."}),error:t.Object({offset:t.Integer({description:"Byte offset in the rule where parsing failed."}),detail:t.String({description:"Parser detail message."})},{description:"Position and parser message for the syntax failure."})},{$id:"GrokInvalidSyntax"}),t.Object({type:t.Literal("unknown-pattern",{description:"Discriminator identifying a rule that references a pattern name the grok engine does not provide."}),error:t.Object({offset:t.Integer({description:"Byte offset of the unknown pattern."}),unknownPattern:t.String({description:"The pattern name that is not supported."})},{description:"Position and name of the unsupported pattern."})},{$id:"GrokUnknownPattern"}),t.Object({type:t.Literal("invalid-filter",{description:"Discriminator identifying a rule whose filter is a known filter used incorrectly."}),error:t.Object({offset:t.Integer({description:"Byte offset of the invalid filter."}),invalidFilter:t.String({description:"The filter that is invalid."}),message:t.String({description:"Why the filter is invalid."})},{description:"Position, text, and reason for the invalid filter."})},{$id:"GrokInvalidFilter"}),t.Object({type:t.Literal("unknown-filter",{description:"Discriminator identifying a rule that references a filter name the grok engine does not implement."}),error:t.Object({offset:t.Integer({description:"Byte offset of the unknown filter."}),unknownFilter:t.String({description:"The filter name that is not implemented."}),message:t.String({description:"Details about the unsupported filter."})},{description:"Position and name of the unimplemented filter."})},{$id:"GrokUnknownFilter"})],{description:"Full structured detail of a grok rule that failed to compile, discriminated by `type`."}),Kq=t.Object({rule:t.String({description:"The rule that failed to compile."}),ruleIndex:t.Integer({description:"0-based index of the failing rule in the submitted `rules` array."}),error:Hq},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),NA=x("type",[t.Object({type:t.Literal("tag_policy_violation",{description:"Discriminator identifying tag-policy validation details. Set by Tsuga to `tag_policy_violation`. Returned when the error code is `TAG_POLICY_VALIDATION_ERROR`."}),violations:t.Array(Bq,{description:"Tag-policy violations that caused the request to fail. Built from active policies applicable to the submitted asset type and owner team. Returned on tag-policy validation errors; can contain multiple policies and multiple assets for bulk requests."})},{$id:"TagPolicyViolationDetails"}),t.Object({type:t.Literal("grok_rule_error",{description:"Discriminator identifying grok rule validation details. Set by Tsuga to `grok_rule_error`. Returned when the error code is `GROK_RULE_VALIDATION_ERROR`."}),ruleErrors:t.Array(Kq,{description:"Grok rules that failed to compile, with full structured detail. One entry per invalid rule."})},{$id:"GrokRuleErrorDetails"})],{description:"Structured details for a client error. Set by Tsuga only for error types with machine-readable remediation data, and omitted for every other client error."}),Ewe=t.Object({code:t.Optional(t.Enum(qq,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"}),details:t.Optional(NA)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),_we=t.Object({code:t.Optional(t.Enum(wA,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"}),details:t.Optional(NA)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),Iwe=t.Object({code:t.Optional(t.Enum(vA,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),Swe=t.Object({requestId:t.String({description:"Identifier used to trace the lifecycle of this API request"}),error:t.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),bwe=t.Object({requestId:t.String({description:"Identifier used to trace the lifecycle of this API request"}),error:t.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function d({body:e,description:r,method:n,operationId:o,params:i,tags:a,query:c,paginated:l,response:m,url:f}){return i?{buildUrl:E=>f.replace(/:[a-zA-Z_]+/g,I=>E[I.slice(1)]),method:n,params:i,response:m,templateUrl:f,...e===void 0?{}:{body:e},...r===void 0?{}:{description:r},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}:{method:n,response:m,url:f,templateUrl:f,...e===void 0?{}:{body:e},...r===void 0?{}:{description:r},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}}function LA(e,r){if(!r||typeof r!="object")return e;let n=new URLSearchParams;return Object.entries(r).forEach(([o,i])=>{Array.isArray(i)?i.length>0&&i.forEach(a=>{a!==void 0&&(typeof a=="string"||typeof a=="number"||typeof a=="boolean")&&n.append(o,String(a))}):(typeof i=="boolean"||typeof i=="string"||typeof i=="number")&&n.append(o,String(i))}),`${e}?${n.toString()}`}var v=t.Object({success:t.Literal(!0,{description:"Always `true` when the delete request completed and the resource was removed."})},{$id:"DeleteResponse",description:"Confirmation that the targeted resource was deleted.",example:{success:!0}});var cu="tsuga-cli";var ho="/v0/oauth",kA=d({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${ho}/authorize`,method:"GET",query:t.Partial(t.Object({response_type:t.String({description:"Must be `code`"}),client_id:t.String({description:"First-party client id or CIMD document URL"}),redirect_uri:t.String({description:"Client redirect URI"}),code_challenge:t.String({description:"PKCE code challenge"}),code_challenge_method:t.String({description:"Must be `S256`"}),state:t.String({description:"Opaque client state, echoed back"}),resource:t.String({description:"RFC 8707 resource indicator"})})),response:t.Object({},{description:"Never returned: this endpoint redirects (302) or renders an HTML error (400)"})}),MA=d({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${ho}/token`,method:"POST",body:t.Partial(t.Object({grant_type:t.String({description:"`authorization_code` or `refresh_token`"}),code:t.String({description:"Authorization code being exchanged"}),code_verifier:t.String({description:"PKCE code verifier"}),redirect_uri:t.String({description:"Must match the redirect URI used on /authorize"}),client_id:t.String({description:"Client id, when sent by the client"}),refresh_token:t.String({description:"Refresh token, for `grant_type=refresh_token`"})})),response:t.Object({access_token:t.String(),token_type:t.Literal("Bearer"),expires_in:t.Number({description:"Access token lifetime in seconds"}),refresh_token:t.String()})}),$we=d({description:"Resolve a signed authorization request handle for the consent page",url:`${ho}/authorization-request`,method:"GET",query:t.Object({handle:t.String()}),response:t.Object({clientId:t.String(),clientName:t.String(),redirectUri:t.String()})}),Fwe=d({description:"Approve or deny an OAuth authorization request from the consent page",url:`${ho}/approve`,method:"POST",body:t.Object({handle:t.String({description:"The signed authorization request handle"}),approve:t.Boolean()}),response:t.Object({redirectTo:t.String({description:"The client's redirect URI carrying either the code or the denial"})})}),jwe=d({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${ho}/introspect`,method:"POST",body:t.Object({token:t.String()}),response:t.Object({active:t.Boolean(),userId:t.Optional(t.String()),orgId:t.Optional(t.String())})}),zq=["pending","active","revoked"],Yq=t.Object({id:t.String(),createdAt:S(),clientId:t.String({description:"Client ID Metadata Document URL or first-party client id"}),clientName:t.String({description:"Display name derived from the client identity"}),userId:t.String(),status:t.Enum(zq),lastUsedAt:t.Optional(S())}),qwe=d({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${ho}/grants`,method:"GET",query:t.Object({allUsers:t.Optional(t.Boolean({description:"Admins only: list grants of every user in the org"}))}),response:t.Array(Yq)}),Bwe=d({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${ho}/grants/:id`,method:"DELETE",params:t.Object({id:t.String()}),response:v});function DA(e,r){let n=new URL(kA.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:cu,redirect_uri:r.redirectUri,code_challenge:r.challenge,code_challenge_method:"S256",state:r.state}).toString(),n.href}var cs=class extends Error{constructor(n,o){super(n);this.code=o;this.name="OAuthTokenError"}};function Vq(e){if(!e)return{};try{let r=JSON.parse(e);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}async function GA(e,r){let n=await fetch(new URL(MA.url,e).href,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(r).toString()}),o=await n.text(),i=Vq(o);if(n.status!==200){let a=i.error??`HTTP ${n.status}`;throw new cs(`OAuth token request failed (${a}${i.error_description?`: ${i.error_description}`:""})`,a)}if(typeof i.access_token!="string"||i.access_token===""||typeof i.refresh_token!="string"||i.refresh_token===""||typeof i.expires_in!="number")throw new Error("OAuth token response was missing required fields");return{accessToken:i.access_token,refreshToken:i.refresh_token,expiresAt:new Date(Date.now()+i.expires_in*cm)}}async function $A(e,r){return GA(e,{grant_type:"authorization_code",client_id:cu,code:r.code,code_verifier:r.verifier,redirect_uri:r.redirectUri})}async function pu(e,r){return GA(e,{grant_type:"refresh_token",client_id:cu,refresh_token:r})}var Qq="Your session expired. Run `tsuga auth login` to sign in again.",Wq="Your session could not be renewed: the refresh token was already used, revoked or expired. A refresh token is single-use, so the server revokes the whole session when one is replayed - run `tsuga auth login` to sign in again.",Zq=5*Aa;function FA(e,r){let n=new Date(e.accessExpiresAt).getTime();return Number.isNaN(n)||n<=r.getTime()+Zq}function ps(e){return`\u2022\u2022\u2022\u2022${e.slice(-4)}`}function uu(e){let r;try{r=JSON.parse(e)}catch{return}if(typeof r!="object"||r===null)return;let{accessToken:n,accessExpiresAt:o,refreshToken:i}=r;if(!(typeof n!="string"||n==="")&&!(typeof o!="string"||o==="")&&!(i!==void 0&&typeof i!="string"))return{accessToken:n,accessExpiresAt:o,...i===void 0?{}:{refreshToken:i}}}function Ed(e){return{accessToken:e.accessToken,accessExpiresAt:e.expiresAt.toISOString(),refreshToken:e.refreshToken}}function jA(e){if(e.overrideKey)return{kind:"operation-api-key",token:e.overrideKey};if(e.operationApiKey)return{kind:"operation-api-key",token:e.operationApiKey};if(e.userAuth)return{kind:"user-session",userAuth:e.userAuth}}function qA(e){if(e)switch(e.kind){case"operation-api-key":return e.token;case"user-session":return e.userAuth.accessToken;default:Ze(e)}}async function lu({userAuth:e,now:r,reload:n,refresh:o,persist:i}){if(!FA(e,r))return e;let a=n()??e;if(!FA(a,r))return a;if(!a.refreshToken)throw new Error(Qq);let c;try{c=await o(a.refreshToken)}catch(m){throw m instanceof cs&&m.code==="invalid_grant"?new Error(Wq,{cause:m}):new Error(`Could not renew your session: ${m instanceof Error?m.message:String(m)}. Retry the command.`,{cause:m})}let l=Ed(c);try{i(l)}catch(m){console.error(`Warning: could not save the renewed session (${m instanceof Error?m.message:String(m)}). Run \`tsuga auth login\` before the next command.`)}return l}var _d={r:8,g:203,b:0},Id={r:0,g:130,b:0},Sd=["\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 ","\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557"," \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551"," \u2588\u2588\u2551 \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551"," \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551"," \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D"];function bd(e,r,n){return Math.round(e+(r-e)*n)}function Xq(e,r){let n=bd(_d.r,Id.r,r),o=bd(_d.g,Id.g,r),i=bd(_d.b,Id.b,r);return`\x1B[38;2;${n};${o};${i}m${e}\x1B[0m`}function Jq(e){if(!e)return`
33
+ `,e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]),SS=(e,r=[])=>u(u(IS(e),([n,o])=>u(km(o),([i,s])=>[[n,i],s])),([n,o])=>SS(o,[...r,n]),()=>[r,e]),IF=e=>u(u(u(km(e),([r,n])=>u(SS(n),([o,i])=>u(u(IS(i),([s,c])=>[[s],c],()=>[[],i]),([s,c])=>[[r,o,s],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[II(r),n]),km=e=>u(u(_F(e),([r,n])=>u(u(hF(n),([o,i])=>[o,i],()=>u(yF(n),([o,i])=>[o,i],()=>u(TF(n),([o,i])=>[o,i],()=>u(EF(n),([o,i])=>[o,i],()=>[])))),([o,i])=>u(YI(i),([s,c])=>[[r,o,s],c]))),([r,n])=>[SI(r),n]),SF=e=>u(u(km(e),([r,n])=>u(IF(n),([o,i])=>[[r,o],i])),([r,n])=>[bI(r),n]),bS=e=>u(u(SF(e),([r,n])=>[r,n],()=>u(U1(e),([r,n])=>[r,n],()=>u(ie(e),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]);function OS(e){let r=Nm(`\`${e}\``);return a.IsEqual(r.length,2)?r[0]:ye()}function OF(e){return e.join("|")}function AF(e){return e.slice(1,e.length-1)}function xF(e,r,n){return An(r,`${n}${e}`)}function RF(e,r){return An(e,`${r}${qT}`)}function CF(e,r){return An(e,`${r}${sp}`)}function PF(e,r){return An(e,`${r}${up}`)}function UF(e,r){return Qs(q([V("false"),V("true")]),e,r)}function NF(e,r){return An(e,`${r}${lp}`)}function wF(e,r,n){return An(r,`${n}${AF(e)}`)}function vF(e,r,n){let o=Ws(e,{});return Qs(o,r,n)}function LF(e,r,n){let o=Mt(e);return Qs(o,r,n)}function AS(e,r,n,o=[]){return a.ShiftLeft(e,(i,s)=>AS(s,r,n,[...o,Qs(i,[],"")]),()=>An(r,`${n}(${OF(o)})`))}function Qs(e,r,n){return Ze(e)?LF(e.enum,r,n):ct(e)?CF(r,n):Z(e)?xF(e.const,r,n):Dt(e)?RF(r,n):xt(e)?UF(r,n):Ne(e)?PF(r,n):tt(e)?NF(r,n):Ie(e)?wF(e.pattern,r,n):RS(e)?vF(e.parameters[0],r,n):C(e)?AS(e.anyOf,r,n):hT}function An(e,r){return a.ShiftLeft(e,(n,o)=>Qs(n,o,r),()=>r)}function kF(e){return`^${An(e,"")}$`}function xS(e){let r=kF(e);return dp(r)}function Ws(e,r){return z(e)?y.Update(xS(e),{},r):Sp(e,r)}function CS(e,r,n,o){let i=Yt(e,r,n);return Ws(i,o)}function Sp(e,r={}){return v("TemplateLiteral",[e],r)}function RS(e){return Le(e)&&a.HasPropertyKey(e,"action")&&a.IsEqual(e.action,"TemplateLiteral")}function PS(e){return Ws(e,{})}function MF(e){let r=OS(e);return PS(r)}function US(e,r={}){let n=a.IsString(e)?MF(e):PS(e);return y.Update(n,{},r)}function Ie(e){return N(e,"TemplateLiteral")}var F={};rr(F,{ExtendsFalse:()=>B,ExtendsTrue:()=>U,ExtendsUnion:()=>Mm,IsExtendsFalse:()=>DF,IsExtendsTrue:()=>wS,IsExtendsTrueLike:()=>mi,IsExtendsUnion:()=>NS,Match:()=>Re});function Mm(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function NS(e){return a.IsObject(e)&&a.HasPropertyKey(e,"~kind")&&a.HasPropertyKey(e,"inferred")&&a.IsEqual(e["~kind"],"ExtendsUnion")&&a.IsObject(e.inferred)}function U(e){return y.Create({"~kind":"ExtendsTrue"},{inferred:e})}function wS(e){return a.IsObject(e)&&a.HasPropertyKey(e,"~kind")&&a.HasPropertyKey(e,"inferred")&&a.IsEqual(e["~kind"],"ExtendsTrue")&&a.IsObject(e.inferred)}function B(){return y.Create({"~kind":"ExtendsFalse"},{})}function DF(e){return a.IsObject(e)&&a.HasPropertyKey(e,"~kind")&&a.IsEqual(e["~kind"],"ExtendsFalse")}function mi(e){return NS(e)||wS(e)}function Re(e,r,n){return mi(e)?r(e.inferred):n()}function GF(e,r,n,o){return Re(re(e,n,o),i=>U(y.Assign(y.Assign(e,i),{[r]:n})),()=>B())}function $F(e,r){return U(e)}function FF(e,r,n,o,i){return Re(re(e,r,n),s=>Re(re(s,r,o),c=>U(c),()=>B()),()=>Re(re(e,r,i),s=>U(s),()=>B()))}function jF(e,r,n){let o=Mt(n);return re(e,r,o)}function vS(e,r,n){return a.ShiftLeft(n,(o,i)=>Re(re(e,r,o),s=>vS(s,r,i),()=>B()),()=>U(e))}function qF(e,r,n){let o=_t(n);return re(e,r,o)}function LS(e,r,n){return a.ShiftLeft(n,(o,i)=>Re(re(e,r,o),s=>U(s),()=>LS(e,r,i)),()=>B())}function ue(e,r,n){return Je(n)?$F(e,r):$e(n)?FF(e,r,n.if,n.then,n.else):Ze(n)?jF(e,r,n.enum):We(n)?GF(e,n.name,r,n.extends):G(n)?vS(e,r,n.allOf):Ie(n)?qF(e,r,n.pattern):C(n)?LS(e,r,n.anyOf):ot(n)?U(e):B()}function kS(e,r,n){return We(n)?ue(e,r,n):Je(n)?U(e):ot(n)?U(e):Mm(e)}function BF(e,r){let n=io(e),o=io(r);return n&&o||!n&&o?!0:!(n&&!o)}function MS(e,r,n,o){return J(o)?BF(r,o)?re(e,n,o.items):B():ue(e,r,o)}function DS(e,r,n){return Dt(n)?U(e):ue(e,r,n)}function GS(e,r,n){return xt(n)?U(e):ue(e,r,n)}function HF(e,r,n,o,i){let s=We(o)?r:o,c=We(o)?o:r,l=nt(r),m=nt(o);return!l&&m?B():Re(re(e,s,c),f=>Zs(f,n,i),()=>B())}function KF(e,r,n,o){return a.ShiftLeft(o,(i,s)=>HF(e,r,n,i,s),()=>nt(r)?U(e):B())}function zF(e,r,n){return a.ShiftLeft(r,(o,i)=>KF(e,o,i,n),()=>U(e))}function Zs(e,r,n){return zF(e,r,n)}function Wp(e,r,n){return Ft(n)?U(e):re(e,r,n)}function $S(e,r,n,o){return Je(o)?U(e):ot(o)?U(e):Ve(o)?Re(Zs(e,r,o.parameters),i=>Wp(i,n,o.instanceType),()=>B()):B()}function FS(e,r,n,o,i){return Re(re(e,r,i),()=>re(e,n,i),()=>re(e,o,i))}function jS(e,r,n){let o=Mt(r);return re(e,o,n)}function qS(e,r,n,o){return Je(o)?U(e):ot(o)?U(e):Qe(o)?Re(Zs(e,r,o.parameters),i=>Wp(i,n,o.returnType),()=>B()):B()}function BS(e,r,n){return ct(n)?U(e):Ne(n)?U(e):ue(e,r,n)}function HS(e,r,n){let o=ke(r);return re(e,o,n)}function Zp(e,r,n){return r===n?U(e):B()}function YF(e,r,n){return Z(n)?Zp(e,r,n.const):Dt(n)?U(e):ue(e,V(r),n)}function VF(e,r,n){return Z(n)?Zp(e,r,n.const):xt(n)?U(e):ue(e,V(r),n)}function QF(e,r,n){return Z(n)?Zp(e,r,n.const):Ne(n)?U(e):ue(e,V(r),n)}function WF(e,r,n){return Z(n)?Zp(e,r,n.const):tt(n)?U(e):ue(e,V(r),n)}function KS(e,r,n){return a.IsBigInt(r.const)?YF(e,r.const,n):a.IsBoolean(r.const)?VF(e,r.const,n):a.IsNumber(r.const)?QF(e,r.const,n):a.IsString(r.const)?WF(e,r.const,n):ye()}function zS(e,r,n){return We(n)?ue(e,r,n):U(e)}function YS(e,r,n){return Rr(n)?U(e):ue(e,r,n)}function VS(e,r,n){return Ne(n)?U(e):ue(e,r,n)}function ZF(e,r,n){return nt(r)?nt(n)?U(e):B():U(e)}function XF(e,r,n){return We(n)&&dr(n.extends)?B():Re(re(e,r,n),o=>ZF(o,r,n),()=>B())}function JF(e,r){return e.reduce((n,o)=>o in r?mi(r[o])?{...n,...r[o].inferred}:ye():ye(),{})}function ej(e,r,n){let o={};for(let c of a.Keys(n))o[c]=c in r?XF({},r[c],n[c]):nt(n[c])?We(n[c])?U(y.Assign(e,{[n[c].name]:n[c].extends})):U(e):B();let i=a.Values(o).every(c=>mi(c)),s=i?JF(a.Keys(o),o):{};return i?U(s):B()}function tj(e,r,n){let o=ej(e,r,n);return mi(o)?U(y.Assign(e,o.inferred)):B()}function rj(e,r,n){return tj(e,r,n)}function nj(e,r){return a.Keys(r).reduce((n,o)=>({...n,[o]:a.HasPropertyKey(e,o)?C(n[o])?q([...n[o].anyOf,r[o]]):q([e[o],r[o]]):r[o]}),e)}function QS(e,r,n,o){return a.ShiftLeft(r,(i,s)=>Re(re({},e[i],n),c=>QS(e,s,n,nj(o,c)),()=>B()),()=>U(o))}function oj(e,r,n,o){let i=a.Keys(r);return QS(r,i,o,e)}function WS(e,r,n){return he(n)?oj(e,r,pt(n),xe(n)):$(n)?rj(e,r,n.properties):ue(e,D(r),n)}function ij(e,r){return a.IsEqual(a.Keys(r).length,0)?U(e):B()}function sj(e,r,n,o,i){return re(e,n,i)}function ZS(e,r,n,o){return he(o)?sj(e,Tp(r),n,Tp(pt(o)),xe(o)):$(o)?ij(e,o.properties):Je(o)?U(e):ot(o)?U(e):B()}function XS(e,r,n){return tt(n)?U(e):ue(e,r,n)}function JS(e,r,n){return Cr(n)?U(e):ue(e,r,n)}function eb(e,r,n){let o=_t(r);return re(e,o,n)}function Dm(e,r){return y.Create({"~kind":"Inferrable"},{name:e,type:r},{})}function Xs(e){return a.IsObject(e)&&a.HasPropertyKey(e,"~kind")&&a.HasPropertyKey(e,"name")&&a.HasPropertyKey(e,"type")&&a.IsEqual(e["~kind"],"Inferrable")&&a.IsString(e.name)&&a.IsObject(e.type)}function Gm(e){return Sn(e)?We(e.items)?J(e.items.extends)?Dm(e.items.name,e.items.extends.items):ot(e.items.extends)?Dm(e.items.name,e.items.extends):void 0:ye():void 0}function Xp(e){return We(e)?Dm(e.name,e.extends):void 0}function $m(e,r,n=[]){return a.ShiftLeft(e,(o,i)=>Re(re({},o,r),()=>$m(i,r,[...n,o]),()=>{}),()=>n)}function tb(e,r,n,o){let i=$m(n,o);return a.IsArray(i)?U(y.Assign(e,{[r]:Fe(i)})):B()}function Jp(e,r,n,o){let i=$m(n,o);return a.IsArray(i)?U(y.Assign(e,{[r]:q(i)})):B()}function aj(e){return[...e].reverse()}function Fm(e,r){return r?aj(e):e}function cj(e){let r=e.length>0?e[0]:void 0,n=Le(r)?Gm(r):void 0;return Le(n)}function pj(e,r,n,o,i,s){return Re(re(e,n,i),c=>rb(c,r,o,s),()=>B())}function uj(e,r,n,o,i){let s=Gm(o);return Xs(s)?tb(e,s.name,Fm(n,r),s.type):a.ShiftLeft(n,(c,l)=>pj(e,r,c,l,o,i),()=>B())}function lj(e,r,n,o){return a.ShiftLeft(o,(i,s)=>uj(e,r,n,i,s),()=>a.IsEqual(n.length,0)?U(e):B())}function rb(e,r,n,o){return lj(e,r,n,o)}function mj(e,r,n){let o=xn(e,Oe([],[]),n),i=cj(o);return rb(e,i,Fm(r,i),Fm(o,i))}function nb(e,r,n){let o=Xp(n);return Xs(o)?Jp(e,o.name,r,o.type):a.ShiftLeft(r,(i,s)=>Re(re(e,i,n),c=>nb(c,s,n),()=>B()),()=>U(e))}function ob(e,r,n){let o=xn(e,Oe([],[]),r);return Q(n)?mj(e,o,n.items):J(n)?nb(e,o,n.items):ue(e,Fe(o),n)}function ib(e,r,n){return Ft(n)?U(e):gr(n)?U(e):ue(e,r,n)}function sb(e,r,n){return a.ShiftLeft(n,(o,i)=>Re(re(e,r,o),s=>U(s),()=>sb(e,r,i)),()=>B())}function jm(e,r,n){return a.ShiftLeft(r,(o,i)=>Re(sb(e,o,n),s=>jm(s,i,n),()=>B()),()=>U(e))}function ab(e,r,n){let o=Xp(n);return Xs(o)?Jp(e,o.name,r,o.type):C(n)?jm(e,r,n.anyOf):jm(e,r,[n])}function cb(e,r,n){return We(n)?ue(e,r,n):Je(n)?U(e):ot(n)?U(e):B()}function pb(e,r,n){return Ft(n)?U(e):ue(e,r,n)}function re(e,r,n){return Je(r)?kS(e,r,n):J(r)?MS(e,r,r.items,n):Dt(r)?DS(e,r,n):xt(r)?GS(e,r,n):Ve(r)?$S(e,r.parameters,r.instanceType,n):$e(r)?FS(e,r.if,r.then,r.else,n):Ze(r)?jS(e,r.enum,n):Qe(r)?qS(e,r.parameters,r.returnType,n):ct(r)?BS(e,r,n):G(r)?HS(e,r.allOf,n):Z(r)?KS(e,r,n):dr(r)?zS(e,r,n):Rr(r)?YS(e,r,n):Ne(r)?VS(e,r,n):$(r)?WS(e,r.properties,n):he(r)?ZS(e,pt(r),xe(r),n):tt(r)?XS(e,r,n):Cr(r)?JS(e,r,n):Ie(r)?eb(e,r.pattern,n):Q(r)?ob(e,r.items,n):gr(r)?ib(e,r,n):C(r)?ab(e,r.anyOf,n):ot(r)?cb(e,r,n):Ft(r)?pb(e,r,n):B()}function dj(e,r){return ke([...e,D(r)])}function qm(e,r,n){return z(e)?y.Update(dj(e,r),{},n):Hs(e,r,n)}function ub(e,r,n,o,i){let s=Yt(e,r,n),c=Js(e,r,o);return qm(s,c,i)}function Hs(e,r,n={}){return v("Interface",[e,r],n)}function di(e){return Le(e)&&a.HasPropertyKey(e,"action")&&a.IsEqual(e.action,"Interface")}function lb(e,r,n={}){return qm(e,r,n)}function fj(e,r,n){return e.includes(n)?!0:ea([...e,n],r,r[n])}function mb(e,r,n){let o=tp(n);return fo(e,r,o)}function fo(e,r,n){return a.ShiftLeft(n,(o,i)=>ea(e,r,o)?!0:fo(e,r,i),()=>!1)}function ea(e,r,n){return me(n)?fj(e,r,n.$ref):J(n)?ea(e,r,n.items):Ve(n)?fo(e,r,[...n.parameters,n.instanceType]):Qe(n)?fo(e,r,[...n.parameters,n.returnType]):di(n)?mb(e,r,n.parameters[1]):G(n)?fo(e,r,n.allOf):$(n)?mb(e,r,n.properties):C(n)?fo(e,r,n.anyOf):Q(n)?fo(e,r,n.items):he(n)?ea(e,r,xe(n)):!1}function db(e,r,n){return ea(e,r,n)}function gj(e,r){return r.reduce((n,o)=>db([o],e,e[o])?[...n,o]:n,[])}function fb(e){let r=ep(e);return gj(e,r)}function hj(e,r,n){return n.includes(r)?n:r in e?ta(e,e[r],[...n,r]):ye()}function gb(e,r,n){let o=tp(r);return fi(e,o,n)}function fi(e,r,n){return r.reduce((o,i)=>ta(e,i,o),n)}function ta(e,r,n){return me(r)?hj(e,r.$ref,n):J(r)?ta(e,r.items,n):Ve(r)?fi(e,[...r.parameters,r.instanceType],n):Qe(r)?fi(e,[...r.parameters,r.returnType],n):di(r)?gb(e,r.parameters[1],n):G(r)?fi(e,r.allOf,n):$(r)?gb(e,r.properties,n):C(r)?fi(e,r.anyOf,n):Q(r)?fi(e,r.items,n):he(r)?ta(e,xe(r),n):n}function hb(e,r,n){return ta(e,n,[r])}function yj(e){return ei()}function Tj(e){return a.Keys(e).reduce((r,n)=>({...r,[n]:go(e[n])}),{})}function ra(e){return e.reduce((r,n)=>[...r,go(n)],[])}function go(e){return me(e)?yj(e.$ref):J(e)?Lt(go(e.items),Xo(e)):Ve(e)?Sr(ra(e.parameters),go(e.instanceType)):Qe(e)?br(ra(e.parameters),go(e.returnType)):G(e)?dt(ra(e.allOf)):$(e)?D(Tj(e.properties)):he(e)?ai(In(e),go(xe(e))):C(e)?q(ra(e.anyOf)):Q(e)?Fe(ra(e.items)):e}function Ej(e,r){return r in e?go(e[r]):et()}function yb(e){return Ej(e.$defs,e.$ref)}function _j(e,r,n){let o=Yt(e,Oe([],[]),r),i=Js({},Oe([],[]),n);return ke([...o,D(i)])}function Ij(e,r){return a.Keys(e).filter(o=>r.includes(o)).reduce((o,i)=>{let s=e[i],c=di(s)?_j(e,s.parameters[0],s.parameters[1]):s;return{...o,[i]:c}},{})}function Tb(e,r,n){let o=hb(e,r,n),i=Ij(e,o);return Ar(i,r)}function Eb(e,r){return r in e?me(e[r])?Eb(e,e[r].$ref):e[r]:ge()}function Pr(e,r){return Eb(e,r)}function _b(e){return _e(e)?yb(e):rp(e)?et():e}function ht(e,r,n){let o=_b(r),i=_b(n);return re(e,o,i)}var $s="equal",Sj="disjoint",Fs="left-inside",js="right-inside";function uo(e,r){let n=[ot(e)?F.ExtendsFalse():ht({},e,r),ot(e)?F.ExtendsTrue({}):ht({},r,e)];return F.IsExtendsTrueLike(n[0])&&F.IsExtendsTrueLike(n[1])?$s:F.IsExtendsTrueLike(n[0])&&F.IsExtendsFalse(n[1])?Fs:F.IsExtendsFalse(n[0])&&F.IsExtendsTrueLike(n[1])?js:Sj}function bj(e,r){return r.filter(n=>uo(e,n)!==js)}function Oj(e,r){let n=r.some(o=>{let i=uo(e,o);return a.IsEqual(i,Fs)||a.IsEqual(i,$s)});return a.IsEqual(n,!1)}function Aj(e,r){let n=nr(e);return Je(n)?[n]:Oj(n,r)?[...bj(n,r),n]:r}function xj(e){return e.reduce((r,n)=>$(n)?[...r,n]:dr(n)?r:Aj(n,r),[])}function _m(e){let r=xj(e);return si(r)}function Bm(e,r){return y.Update(nr(e),{},r)}function Ib(e,r,n,o){let i=A(e,r,n);return Bm(i,o)}function na(e,r=[]){return hn(e)&&a.IsEqual(e.action,"Conditional")?me(e.parameters[0])?na(e.parameters[2],na(e.parameters[3],[...r,e.parameters[0].$ref])):na(e.parameters[2],na(e.parameters[3],r)):hn(e)&&a.IsEqual(e.action,"Mapped")&&hn(e.parameters[1])&&a.IsEqual(e.parameters[1].action,"KeyOf")&&me(e.parameters[1].parameters[0])?[...r,e.parameters[1].parameters[0].$ref]:r}function Rj(e,r){return e.reduce((n,o)=>[...n,r.includes(o.name)],[])}function Ob(e,r,n=[]){return a.ShiftLeft(e,(o,i)=>a.ShiftLeft(r,(s,c)=>Ob(i,c,[...n,[s,o]]),()=>n),()=>n)}function Cj(e){return Ie(e)?_t(e.pattern):Ze(e)?Mt(e.enum):e}function Pj(e){let r=Cj(e);return C(r)?[...r.anyOf]:[r]}function Uj(e,r){return e.reduce((n,o)=>[...n,[...o,r]],[])}function Sb(e,r){return r.reduce((n,o)=>[...n,...Uj(e,o)],[])}function bb(e){return e.reduce((r,n)=>a.IsEqual(n[0],!0)?Sb(r,Pj(n[1])):Sb(r,[n[1]]),[[]])}function Ab(e,r,n){let o=na(n),i=Rj(e,o),s=Ob(r,i);return hn(n)&&a.IsEqual(n.action,"Conditional")||hn(n)&&a.IsEqual(n.action,"Mapped")?bb(s):[r]}function Nj(){return["(not-resolvable)",ge()]}function wj(){return["(not-generic)",ge()]}function vj(e,r,n){return[e,yn(r,n)]}function Lj(e,r,n){return r in e?xb(e,r,e[r],n):Nj()}function xb(e,r,n,o){return Jo(n)?vj(r,n.parameters,n.expression):me(n)?Lj(e,n.$ref,o):wj()}function Rb(e,r,n){return xb(e,"(anonymous)",r,n)}function kj(e,r,n){if(We(r)||gi(r)||F.IsExtendsTrueLike(ht({},r,n)))return;let o={parameter:e,expect:n,actual:r};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:o})}function Cb(e,r,n,o,i){let s=A(e,r,i);return kj(n,s,o),y.Assign(e,{[n]:s})}function Mj(e,r,n,o,i){let s=A(e,r,n.extends),c=A(e,r,n.equals);return a.ShiftLeft(i,(l,m)=>Hm(Cb(e,r,n.name,s,l),r,o,m),()=>Hm(Cb(e,r,n.name,s,c),r,o,[]))}function Hm(e,r,n,o){return a.ShiftLeft(n,(i,s)=>Mj(e,r,i,s,o),()=>e)}function Pb(e,r,n,o){return Hm(e,r,n,o)}var Km=0,zm=0;function Dj(){if(!a.IsLessThan(zm,st.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function Gj(){Dj(),zm++,Km++}function $j(){Km--,a.IsEqual(Km,0)&&(zm=0)}function Fj(e){return a.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function jj(e,r){return a.IsEqual(Fj(e),r)}function qj(e,r,n,o,i,s){Gj();try{let c=Pb(e,r,o,s),l=A(c,Oe([...r.callstack,n.$ref],r.visited),i);return A(c,Oe([],[]),l)}finally{$j()}}function Bj(e,r,n,o,i,s){return s.reduce((c,l)=>{let m=qj(e,r,n,o,i,l);return[...c,m]},[])}function Hj(e,r,n,o,i,s){let c=Ab(o,s,i),l=Bj(e,r,n,o,i,c);return a.IsEqual(l.length,1)?l[0]:$t(l)}function eu(e,r,n,o){let i=Yt(e,r,o),s=Rb(e,n,o),c=s[0],l=s[1];return Jo(l)?jj(r,c)?Ks(at(c),i):Hj(e,r,at(c),l.parameters,l.expression,i):Ks(n,i)}function Ks(e,r){return y.Create({"~kind":"Call"},{type:"call",target:e,arguments:r},{})}function Ub(e,r){return eu({},Oe([],[]),e,r)}function gi(e){return N(e,"Call")}function Kj(e){return y.Discard(e,["~immutable"])}function Nb(e,r){return y.Update(Kj(e),{},r)}function wb(e,r,n,o){let i=A(e,r,n);return Nb(i,o)}function vb(e,r){return e(r)}function Lb(e,r){return a.IsString(r)?V(vb(e,r)):V(r)}function kb(e,r){let n=_t(r);return Wr(e,n)}function Mb(e,r){let n=r.map(o=>Wr(e,o));return q(n)}function Wr(e,r){return Z(r)?Lb(e,r.const):Ie(r)?kb(e,r.pattern):C(r)?Mb(e,r.anyOf):r}function bp(e,r={}){return v("Capitalize",[e],r)}function Db(e,r={}){return Ym(e,r)}function Op(e,r={}){return v("Lowercase",[e],r)}function Gb(e,r={}){return Vm(e,r)}function Ap(e,r={}){return v("Uncapitalize",[e],r)}function $b(e,r={}){return Qm(e,r)}function xp(e,r={}){return v("Uppercase",[e],r)}function Fb(e,r={}){return Wm(e,r)}var zj=e=>e[0].toUpperCase()+e.slice(1),Yj=e=>e.toLowerCase(),Vj=e=>e[0].toLowerCase()+e.slice(1),Qj=e=>e.toUpperCase();function Ym(e,r){return z([e])?y.Update(Wr(zj,e),{},r):bp(e,r)}function Vm(e,r){return z([e])?y.Update(Wr(Yj,e),{},r):Op(e,r)}function Qm(e,r){return z([e])?y.Update(Wr(Vj,e),{},r):Ap(e,r)}function Wm(e,r){return z([e])?y.Update(Wr(Qj,e),{},r):xp(e,r)}function jb(e,r,n,o){let i=A(e,r,n);return Ym(i,o)}function qb(e,r,n,o){let i=A(e,r,n);return Vm(i,o)}function Bb(e,r,n,o){let i=A(e,r,n);return Qm(i,o)}function Hb(e,r,n,o){let i=A(e,r,n);return Wm(i,o)}function Rp(e,r,n,o,i={}){return v("Conditional",[e,r,n,o],i)}function Kb(e,r,n,o,i={}){return Zm({},Oe([],[]),e,r,n,o,i)}function Wj(e,r,n,o,i,s){let c=ht(e,n,o);return F.IsExtendsUnion(c)?q([A(c.inferred,r,i),A(e,r,s)]):F.IsExtendsTrue(c)?A(c.inferred,r,i):A(e,r,s)}function Zm(e,r,n,o,i,s,c){return z([n,o])?y.Update(Wj(e,r,n,o,i,s),{},c):Rp(n,o,i,s,c)}function zb(e,r,n,o,i,s,c){let l=A(e,r,n),m=A(e,r,o);return Zm(e,r,l,m,i,s,c)}function Cp(e,r={}){return v("ConstructorParameters",[e],r)}function Yb(e,r={}){return Xm(e,r)}function Zj(e){let r=Ve(e)?e.parameters:[],n=xn({},Oe([],[]),r);return Fe(n)}function Xm(e,r){return z([e])?y.Update(Zj(e),{},r):Cp(e,r)}function Vb(e,r,n,o){let i=A(e,r,n);return Xm(i,o)}function Pp(e,r,n={}){return v("Exclude",[e,r],n)}function Qb(e,r,n={}){return oa(e,r,n)}function oa(e,r,n){return z([e,r])?y.Update(gp(e,r),{},n):Pp(e,r,n)}function Wb(e,r,n,o,i){let s=A(e,r,n),c=A(e,r,o);return oa(s,c,i)}function Up(e,r,n={}){return v("Extract",[e,r],n)}function Zb(e,r,n={}){return Jm(e,r,n)}function Xj(e,r){let n=ht({},e,r);return F.IsExtendsTrueLike(n)?[e]:[]}function Jj(e,r){return e.reduce((n,o)=>[...n,...Xj(o,r)],[])}function Xb(e,r){let n=nr(e),o=C(n)?n.anyOf:[n],i=Jj(o,r);return $t(i)}function Jm(e,r,n){return z([e,r])?y.Update(Xb(e,r),{},n):Up(e,r,n)}function Jb(e,r,n,o,i){let s=A(e,r,n),c=A(e,r,o);return Jm(s,c,i)}function eq(e){return e.reduce((r,n)=>ap(n)?[...r,V(n)]:r,[])}function hi(e){let r=eq(e);return q(r)}function zs(e,r,n={}){return v("Index",[e,r],n)}function eO(e,r,n={}){let o=a.IsArray(r)?hi(r):r;return ed(e,o,n)}function tO(e,r){let n=Pr(e,r);return Vt(n)}function rO(e,r,n){let o=fr(e,r,n);return Vt(o)}function tq(e,r){let n=a.Keys(e).filter(h=>!a.HasPropertyKey(r,h)),o=a.Keys(r).filter(h=>!a.HasPropertyKey(e,h)),i=a.Keys(e).filter(h=>a.HasPropertyKey(r,h)),s=n.reduce((h,E)=>({...h,[E]:e[E]}),{}),c=o.reduce((h,E)=>({...h,[E]:r[E]}),{}),l=i.reduce((h,E)=>({...h,[E]:ke([e[E],r[E]])}),{}),m=y.Assign(s,c);return y.Assign(m,l)}function nO(e){return e.reduce((r,n)=>tq(r,Vt(n)),{})}function oO(e){let r=pE(Fe(e));return Vt(r)}function rq(e,r){return a.Keys(e).filter(i=>i in r).reduce((i,s)=>({...i,[s]:$t([e[s],r[s]])}),{})}function iO(e,r){return a.ShiftLeft(e,(n,o)=>iO(o,rq(r,Vt(n))),()=>r)}function sO(e){return a.ShiftLeft(e,(r,n)=>iO(n,Vt(r)),()=>ye())}function Vt(e){return _e(e)?tO(e.$defs,e.$ref):$e(e)?rO(e.if,e.then,e.else):G(e)?nO(e.allOf):C(e)?sO(e.anyOf):Q(e)?oO(e.items):$(e)?e.properties:{}}function yi(e){let r=Vt(e);return D(r)}var nq=new RegExp("^(?:0|[1-9][0-9]*)$");function Ti(e){let r=`${e}`;return nq.test(r)?parseInt(r):e}function oq(e){return V(Ti(e))}function aO(e){return e.map(r=>cO(r))}function cO(e){return G(e)?dt(aO(e.allOf)):C(e)?q(aO(e.anyOf)):Z(e)?oq(e.const):e}function pO(e,r){let n=cO(r),o=ht({},n,Gt());return F.IsExtendsTrueLike(o)?e:Z(r)&&a.IsEqual(r.const,"length")?Gt():ge()}function uO(e,r){let n=Pr(e,r);return jt(n)}function lO(e,r,n){let o=fr(e,r,n);return jt(o)}function mO(e){let r=Mt(e);return jt(r)}function dO(e){let r=ke(e);return jt(r)}function fO(e){return[`${e}`]}function gO(e){let r=_t(e);return jt(r)}function hO(e){return e.reduce((r,n)=>[...r,...jt(n)],[])}function jt(e){return _e(e)?uO(e.$defs,e.$ref):$e(e)?lO(e.if,e.then,e.else):Ze(e)?mO(e.enum):G(e)?dO(e.allOf):Z(e)?fO(e.const):Ie(e)?gO(e.pattern):C(e)?hO(e.anyOf):[]}function Ei(e){return jt(e)}function ia(e,r){return r.map(n=>sa(e,n))}function sa(e,r){return J(r)?Lt(sa(e,r.items)):Ve(r)?Sr(ia(e,r.parameters),sa(e,r.instanceType)):Qe(r)?br(ia(e,r.parameters),sa(e,r.returnType)):Q(r)?Fe(ia(e,r.items)):C(r)?q(ia(e,r.anyOf)):G(r)?dt(ia(e,r.allOf)):_p(r)?D(e):r}function yO(e,r){return sa(e,r)}function iq(e,r){let n=r in e?e[r]:ge();return yO(e,n)}function TO(e,r){return r.reduce((n,o)=>[...n,iq(e,o)],[])}function sq(e,r){let n=Ei(r),o=TO(e,n);return $t(o)}var aq=new RegExp(_n);function cq(e){return e.filter(n=>aq.test(n))}function pq(e){let r=ep(e),n=cq(r),o=TO(e,n);return $t(o)}function EO(e,r){return Ne(r)?pq(e):sq(e,r)}function uq(e){return V(Ti(e))}function _O(e){return e.map(r=>td(r))}function td(e){return G(e)?dt(_O(e.allOf)):C(e)?q(_O(e.anyOf)):Z(e)?uq(e.const):e}function lq(e,r){return e.reduceRight((n,o,i)=>{let s=ht({},V(i),r);return F.IsExtendsTrueLike(s)?[o,...n]:n},[])}function mq(e,r){let n=td(r),o=lq(e,n);return Vr(o)}function dq(e){return Vr(e)}function IO(e,r){return Z(r)&&a.IsEqual(r.const,"length")?V(e.length):Ne(r)||ct(r)?dq(e):mq(e,r)}function SO(e,r){return J(e)?pO(e.items,r):$(e)?EO(e.properties,r):Q(e)?IO(e.items,r):ge()}function fq(e){return _e(e)||$e(e)||G(e)||C(e)?yi(e):e}function ed(e,r,n){return z([e,r])?y.Update(SO(fq(e),r),{},n):zs(e,r,n)}function bO(e,r,n,o,i){let s=A(e,r,n),c=A(e,r,o);return ed(s,c,i)}function Np(e,r={}){return v("InstanceType",[e],r)}function OO(e,r={}){return rd(e,r)}function gq(e){return Ve(e)?e.instanceType:ge()}function rd(e,r){return z([e])?y.Update(gq(e),{},r):Np(e,r)}function AO(e,r,n,o={}){let i=A(e,r,n);return rd(i,o)}function Ys(e,r={}){return v("KeyOf",[e],r)}function xO(e,r={}){return nd(e,r)}function RO(){return q([Gt(),Rt(),oi()])}function CO(e){return Gt()}function hq(e){return e.reduce((n,o)=>ap(o)?[...n,V(Ti(o))]:ye(),[])}function PO(e){let r=a.Keys(e),n=hq(r);return Vr(n)}function UO(e){return In(e)}function NO(e){let r=e.map((n,o)=>V(o));return Vr(r)}function wO(e){return Je(e)?RO():J(e)?CO(e.items):$(e)?PO(e.properties):he(e)?UO(e):Q(e)?NO(e.items):ge()}function yq(e){return _e(e)||$e(e)||G(e)||C(e)?yi(e):e}function nd(e,r){return z([e])?y.Update(wO(yq(e)),{},r):Ys(e,r)}function vO(e,r,n,o){let i=A(e,r,n);return nd(i,o)}function Bs(e,r,n,o,i={}){return v("Mapped",[e,r,n,o],i)}function LO(e,r,n,o,i={}){return od({},Oe([],[]),e,r,n,o,i)}function Tq(e){let r=_t(e);return tu(r)}function Eq(e){return e.reduce((r,n)=>[...r,...tu(n)],[])}function _q(e){let r=Mt(e);return tu(r)}function Iq(e){return a.IsNumber(e)?[V(`${e}`)]:[V(e)]}function tu(e){return Ze(e)?_q(e.enum):Z(e)?Iq(e.const):Ie(e)?Tq(e.pattern):C(e)?Eq(e.anyOf):[e]}function kO(e){return tu(e)}function Sq(e){return Ie(e)?_t(e.pattern):e}function bq(e,r,n,o,i,s){let c=y.Assign(e,{[n.name]:o}),l=A(c,r,i),m=Sq(l),f=A(c,r,s);return cp(m)||pp(m)?{[m.const]:f}:{}}function Oq(e,r,n,o,i,s){return o.reduce((c,l)=>[...c,bq(e,r,n,l,i,s)],[])}function Aq(e){return e.reduce((r,n)=>[...r,D(n)],[])}function MO(e,r,n,o,i,s){let c=kO(o),l=Oq(e,r,n,c,i,s),m=Aq(l);return ke(m)}function od(e,r,n,o,i,s,c){return z([o])?y.Update(MO(e,r,n,o,i,s),{},c):Bs(n,o,i,s,c)}function DO(e,r,n,o,i,s,c){let l=A(e,r,o);return od(e,r,n,l,i,s,c)}function xq(e,r,n){let o=y.Assign(e,r);return a.Keys(r).filter(s=>n.includes(s)).reduce((s,c)=>({...s,[c]:Tb(o,c,r[c])}),{})}function Rq(e,r,n){let o=y.Assign(e,r);return a.Keys(r).filter(s=>!n.includes(s)).reduce((s,c)=>({...s,[c]:A(o,Oe([],[]),r[c])}),{})}function Cq(e,r,n){let o=fb(r),i=xq(e,r,o),s=Rq(e,r,o),c={...i,...s};return y.Update(c,{},n)}function ru(e,r,n,o){return Cq(e,n,o)}function wp(e,r={}){return v("NonNullable",[e],r)}function GO(e,r={}){return id(e,r)}function Pq(e){let r=q([ni(),ci()]);return oa(e,r,{})}function id(e,r){return z([e])?y.Update(Pq(e),{},r):wp(e,r)}function $O(e,r,n,o){let i=A(e,r,n);return id(i,o)}function vp(e,r,n={}){return v("Omit",[e,r],n)}function FO(e,r,n={}){let o=a.IsArray(r)?hi(r):r;return sd(e,o,n)}function nu(e){let r=yi(e);return $(r)?r.properties:ye()}function Uq(e,r){return a.Keys(e).reduce((o,i)=>r.includes(i)?o:{...o,[i]:e[i]},{})}function jO(e,r){let n=nu(e),o=Ei(r),i=Uq(n,o);return D(i)}function sd(e,r,n){return z([e,r])?y.Update(jO(e,r),{},n):vp(e,r,n)}function qO(e,r,n,o,i){let s=A(e,r,n),c=A(e,r,o);return sd(s,c,i)}function Lp(e,r={}){return v("Parameters",[e],r)}function BO(e,r={}){return ad(e,r)}function Nq(e){let r=Qe(e)?e.parameters:[],n=xn({},Oe([],[]),r);return Fe(n)}function ad(e,r){return z([e])?y.Update(Nq(e),{},r):Lp(e,r)}function HO(e,r,n,o){let i=A(e,r,n);return ad(i,o)}function kp(e,r={}){return v("Partial",[e],r)}function KO(e,r={}){return cd(e,r)}function zO(e,r){let n=Pr(e,r),o=Ur(n);return Ar(y.Assign(e,{[r]:o}),r)}function YO(e,r,n){let o=fr(e,r,n);return Ur(o)}function VO(e){let r=ke(e);return Ur(r)}function QO(e){let r=e.map(n=>Ur(n));return q(r)}function WO(e){let r=a.Keys(e).reduce((o,i)=>({...o,[i]:to(e[i])}),{});return D(r)}function Ur(e){return _e(e)?zO(e.$defs,e.$ref):$e(e)?YO(e.if,e.then,e.else):G(e)?VO(e.allOf):C(e)?QO(e.anyOf):$(e)?WO(e.properties):D({})}function cd(e,r){return z([e])?y.Update(Ur(e),{},r):kp(e,r)}function ZO(e,r,n,o){let i=A(e,r,n);return cd(i,o)}function Mp(e,r,n={}){return v("Pick",[e,r],n)}function XO(e,r,n={}){let o=a.IsArray(r)?hi(r):r;return pd(e,o,n)}function wq(e,r){return a.Keys(e).reduce((o,i)=>r.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function JO(e,r){let n=nu(e),o=Ei(r),i=wq(n,o);return D(i)}function pd(e,r,n){return z([e,r])?y.Update(JO(e,r),{},n):Mp(e,r,n)}function eA(e,r,n,o,i){let s=A(e,r,n),c=A(e,r,o);return pd(s,c,i)}function Dp(e,r={}){return v("ReadonlyObject",[e],r)}function ud(e,r={}){return ld(e,r)}var tA=ud;function rA(e){return ri(Lt(e))}function nA(e,r){let n=Pr(e,r),o=Nr(n);return Ar(y.Assign(e,{[r]:o}),r)}function oA(e,r,n){let o=fr(e,r,n);return Nr(o)}function iA(e){let r=ke(e);return Nr(r)}function sA(e){let r=a.Keys(e).reduce((o,i)=>({...o,[i]:so(e[i])}),{});return D(r)}function aA(e){return ri(Fe(e))}function cA(e){let r=e.map(n=>Nr(n));return q(r)}function Nr(e){return J(e)?rA(e.items):_e(e)?nA(e.$defs,e.$ref):$e(e)?oA(e.if,e.then,e.else):G(e)?iA(e.allOf):$(e)?sA(e.properties):Q(e)?aA(e.items):C(e)?cA(e.anyOf):e}function ld(e,r){return z([e])?y.Update(Nr(e),{},r):Dp(e)}function pA(e,r,n,o){let i=A(e,r,n);return ld(i,o)}function uA(e,r,n,o){return r.visited.includes(o)?n:o in e?A(e,Oe(r.callstack,[...r.visited,o]),e[o]):n}function lA(e,r){let n=Pr(e,r),o=wr(n);return Ar(y.Assign(e,{[r]:o}),r)}function mA(e,r,n){let o=fr(e,r,n);return wr(o)}function dA(e){let r=ke(e);return wr(r)}function fA(e){let r=e.map(n=>wr(n));return q(r)}function gA(e){let r=a.Keys(e).reduce((o,i)=>({...o,[i]:fp(e[i])}),{});return D(r)}function wr(e){return _e(e)?lA(e.$defs,e.$ref):$e(e)?mA(e.if,e.then,e.else):G(e)?dA(e.allOf):C(e)?fA(e.anyOf):$(e)?gA(e.properties):D({})}function Gp(e,r={}){return v("Required",[e],r)}function hA(e,r={}){return md(e,r)}function md(e,r){return z([e])?y.Update(wr(e),{},r):Gp(e,r)}function yA(e,r,n,o){let i=A(e,r,n);return md(i,o)}function $p(e,r={}){return v("ReturnType",[e],r)}function TA(e,r={}){return dd(e,r)}function vq(e){return Qe(e)?e.returnType:ge()}function dd(e,r){return z([e])?y.Update(vq(e),{},r):$p(e,r)}function EA(e,r,n,o={}){let i=A(e,r,n);return dd(i,o)}function Fp(e,r){return v("With",[e,r],{})}function ou(e,r){return fd(e,r)}function fd(e,r){return z([e])?y.Update(e,{},r):Fp(e,r)}function _A(e,r,n,o){let i=A(e,r,n);return fd(i,o)}function Lq(e){return Sn(e)?Q(e.items)?gd(e.items.items):We(e.items)?[e]:me(e.items)?[e]:[ge()]:[e]}function gd(e){return e.reduce((n,o)=>[...n,...Lq(o)],[])}function Oe(e,r){return{callstack:e,visited:r}}function z(e){return a.ShiftLeft(e,(r,n)=>me(r)?!1:z(n),()=>!0)}function Js(e,r,n){return a.Keys(n).reduce((o,i)=>({...o,[i]:A(e,r,n[i])}),{})}function xn(e,r,n){let o=Yt(e,r,n);return gd(o)}function Yt(e,r,n){return n.map(o=>A(e,r,o))}function kq(e,r){let n=nt(e)?Ns(r,{}):r,o=ao(e)?Us(n,{}):n;return io(e)?aa(o,{}):o}function Mq(e,r,n,o,i){return a.IsEqual(n,"AddImmutable")?IA(e,r,o[0],i):a.IsEqual(n,"RemoveImmutable")?wb(e,r,o[0],i):a.IsEqual(n,"AddReadonly")?mT(e,r,o[0],i):a.IsEqual(n,"RemoveReadonly")?oE(e,r,o[0],i):a.IsEqual(n,"AddOptional")?dT(e,r,o[0],i):a.IsEqual(n,"RemoveOptional")?aE(e,r,o[0],i):a.IsEqual(n,"Capitalize")?jb(e,r,o[0],i):a.IsEqual(n,"Conditional")?zb(e,r,o[0],o[1],o[2],o[3],i):a.IsEqual(n,"ConstructorParameters")?Vb(e,r,o[0],i):a.IsEqual(n,"Evaluate")?Ib(e,r,o[0],i):a.IsEqual(n,"Exclude")?Wb(e,r,o[0],o[1],i):a.IsEqual(n,"Extract")?Jb(e,r,o[0],o[1],i):a.IsEqual(n,"Index")?bO(e,r,o[0],o[1],i):a.IsEqual(n,"InstanceType")?AO(e,r,o[0],i):a.IsEqual(n,"Interface")?ub(e,r,o[0],o[1],i):a.IsEqual(n,"KeyOf")?vO(e,r,o[0],i):a.IsEqual(n,"Lowercase")?qb(e,r,o[0],i):a.IsEqual(n,"Mapped")?DO(e,r,o[0],o[1],o[2],o[3],i):a.IsEqual(n,"Module")?ru(e,r,o[0],i):a.IsEqual(n,"NonNullable")?$O(e,r,o[0],i):a.IsEqual(n,"Pick")?eA(e,r,o[0],o[1],i):a.IsEqual(n,"Parameters")?HO(e,r,o[0],i):a.IsEqual(n,"Partial")?ZO(e,r,o[0],i):a.IsEqual(n,"Omit")?qO(e,r,o[0],o[1],i):a.IsEqual(n,"ReadonlyObject")?pA(e,r,o[0],i):a.IsEqual(n,"Record")?OE(e,r,o[0],o[1],i):a.IsEqual(n,"Required")?yA(e,r,o[0],i):a.IsEqual(n,"ReturnType")?EA(e,r,o[0],i):a.IsEqual(n,"TemplateLiteral")?CS(e,r,o[0],i):a.IsEqual(n,"Uncapitalize")?Bb(e,r,o[0],i):a.IsEqual(n,"Uppercase")?Hb(e,r,o[0],i):a.IsEqual(n,"With")?_A(e,r,o[0],o[1]):v(n,o,i)}function Dq(e,r,n){let o=me(n)?uA(e,r,n,n.$ref):J(n)?Lt(A(e,r,n.items),Xo(n)):gi(n)?eu(e,r,n.target,n.arguments):Ve(n)?Sr(Yt(e,r,n.parameters),A(e,r,n.instanceType),fT(n)):Qe(n)?br(Yt(e,r,n.parameters),A(e,r,n.returnType),gT(n)):$e(n)?ro(A(e,r,n.if),A(e,r,n.then),A(e,r,n.else),IT(n)):G(n)?dt(Yt(e,r,n.allOf),xT(n)):$(n)?D(Js(e,r,n.properties),ET(n)):he(n)?yp(pt(n),A(e,r,xe(n))):Sn(n)?lo(A(e,r,n.items)):Q(n)?Fe(xn(e,r,n.items),nE(n)):C(n)?q(Yt(e,r,n.anyOf),YT(n)):n;return kq(n,o)}function A(e,r,n){return hn(n)?Mq(e,r,n.action,n.parameters,n.options):Dq(e,r,n)}function or(e,r){return A(e,Oe([],[]),r)}function Gq(e){return y.Update(e,{"~immutable":!0},{})}function aa(e,r){return y.Update(Gq(e),{},r)}function IA(e,r,n,o){let i=A(e,r,n);return aa(i,o)}function OI(e,r={}){return v("AddImmutable",[e],r)}function ri(e,r={}){return aa(e,r)}function AI(e,r={}){return v("Evaluate",[e],r)}function yt(e,r={}){return Bm(e,r)}function xI(e,r={}){return v("Module",[e],r)}function SA(e,r={}){return ru({},Oe([],[]),e,r)}function $q(e,r){let n=uo(e,r);return a.IsEqual(n,"right-inside")||a.IsEqual(n,"disjoint")?1:0}function bA(e,r,n=[]){return a.ShiftLeft(r,(o,i)=>a.IsEqual($q(e,o),1)?bA(e,i,[...n,o]):[...n,e,...r],()=>[...n,e])}function OA(e,r=[]){return a.ShiftLeft(e,(n,o)=>OA(o,bA(n,r)),()=>r)}function AA(e){return OA(e)}function xA(...e){let[r,n,o]=ae.Match(e,{2:(c,l)=>a.IsString(c)?[{},c,l]:[c,l,{}],3:(c,l,m)=>[c,l,m],1:c=>[{},c,{}]}),i=bS(n),s=a.IsArray(i)&&a.IsEqual(i.length,2)?A(r,Oe([],[]),i[0]):ge();return y.Update(s,{},o)}var t={};rr(t,{Any:()=>ei,Array:()=>Lt,BigInt:()=>ks,Boolean:()=>ip,Call:()=>Ub,Capitalize:()=>Db,Codec:()=>np,Conditional:()=>Kb,Constructor:()=>Sr,ConstructorParameters:()=>Yb,Cyclic:()=>Ar,Decode:()=>DT,DecodeBuilder:()=>Ls,Dependent:()=>ro,Encode:()=>GT,EncodeBuilder:()=>vs,Enum:()=>AT,Evaluate:()=>yt,Exclude:()=>Qb,Extends:()=>ht,ExtendsResult:()=>F,Extract:()=>Zb,Function:()=>br,Generic:()=>yn,Identifier:()=>Ms,Immutable:()=>$T,Index:()=>eO,Infer:()=>ws,InstanceType:()=>OO,Instantiate:()=>or,Integer:()=>co,Interface:()=>lb,Intersect:()=>dt,IsAny:()=>Je,IsArray:()=>J,IsBigInt:()=>Dt,IsBoolean:()=>xt,IsCall:()=>gi,IsCodec:()=>oo,IsConstructor:()=>Ve,IsCyclic:()=>_e,IsDependent:()=>$e,IsEnum:()=>Ze,IsEnumValue:()=>OT,IsFunction:()=>Qe,IsGeneric:()=>Jo,IsIdentifier:()=>BT,IsImmutable:()=>io,IsInfer:()=>We,IsInteger:()=>ct,IsIntersect:()=>G,IsKind:()=>N,IsLiteral:()=>Z,IsNever:()=>dr,IsNull:()=>Rr,IsNumber:()=>Ne,IsObject:()=>$,IsOptional:()=>nt,IsParameter:()=>zT,IsReadonly:()=>ao,IsRecord:()=>he,IsRef:()=>me,IsRefine:()=>op,IsRest:()=>Sn,IsSchema:()=>Le,IsString:()=>tt,IsSymbol:()=>Cr,IsTemplateLiteral:()=>Ie,IsThis:()=>_p,IsTuple:()=>Q,IsUndefined:()=>gr,IsUnion:()=>C,IsUnknown:()=>ot,IsUnsafe:()=>rp,IsVoid:()=>Ft,KeyOf:()=>xO,Literal:()=>V,Lowercase:()=>Gb,Mapped:()=>LO,Module:()=>SA,Never:()=>ge,NonNullable:()=>GO,Null:()=>ni,Number:()=>Gt,Object:()=>D,Omit:()=>FO,Optional:()=>yT,Parameter:()=>po,Parameters:()=>BO,Partial:()=>KO,Pick:()=>XO,Readonly:()=>FT,ReadonlyObject:()=>ud,ReadonlyType:()=>tA,Record:()=>ai,RecordKey:()=>In,RecordPattern:()=>pt,RecordValue:()=>xe,Ref:()=>at,Refine:()=>jT,Required:()=>hA,Rest:()=>lo,ReturnType:()=>TA,Script:()=>xA,String:()=>Rt,Symbol:()=>oi,TemplateLiteral:()=>US,This:()=>Ep,Tuple:()=>Fe,Uncapitalize:()=>$b,Undefined:()=>ci,Union:()=>q,Unknown:()=>et,Unsafe:()=>_T,Uppercase:()=>Fb,Void:()=>Ip,With:()=>ou});var RA="Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported.";var Fq=fn(PA());var UA="lowercase-email",ho="iana-timezone",hd="simple-time",yd="simple-date-time";var jq=(e,r)=>RegExp(`^${e.source}(${r.source}${e.source})*$`),qq=/[a-zA-Z0-9-_]+/,Bq=/\./,fNe=jq(qq,Bq);var NA="lowercase-domain";var _i="kebab-case";var wA="camel-case";var Hq=new Set;function x(e,r,n={}){let o=r.map(i=>{let s=i;return s.$id?(Hq.add(i),t.Ref(s.$id)):i});return t.Unsafe({...n,type:"object",discriminator:{propertyName:e},required:[e],oneOf:o})}function ee(e,r){return t.Object({values:t.Array(e,{maxItems:r.maxItems,description:"Values compared by this filter. When `exclude` is omitted or false, rows matching any value are kept; when `exclude` is true, matching rows are removed."}),exclude:t.Optional(t.Boolean({description:"If true, exclude rows matching these values instead of including them"}))},{description:r.description})}function Qt(e,r={}){return x("type",[t.Object({type:t.Literal("ids"),ids:t.Array(p({allowEmpty:!1}),{minItems:1,uniqueItems:!0,...r.maxIds!==void 0&&{maxItems:r.maxIds}})}),t.Object({type:t.Literal("all"),filters:t.Optional(e)})])}function hr(e){return t.Object({value:p({allowEmpty:!1,description:e.valueDescription}),exclude:t.Optional(t.Boolean({description:"If true, exclude rows matching this value instead of including them"}))},{description:e.description})}var Si=1e3,su=100,ne={limit:t.Optional(t.Integer({minimum:1,maximum:Si,description:"Maximum number of items to return in this page."})),offset:t.Optional(t.Integer({minimum:0,description:"Zero-based index of the first matching item to return. Increase it with `limit` to request later pages. If `limit` is provided without `offset`, the offset defaults to 0."}))},Kq=["asc","desc"],K=t.Enum(Kq,{description:"Sort direction: ascending or descending."}),qe={...ne,limit:t.Optional(t.Integer({minimum:1,maximum:Si,default:su,description:`Maximum number of items to return in this page. Omit to use the public API default of ${su}.`}))},zq=t.Object({totalCount:t.Integer({description:"Total number of items matching the query before `limit` and `offset` are applied."}),pageCount:t.Integer({description:"Total number of pages available for the requested `limit`."})},{description:"Counts describing the full result set that the returned page was taken from, for computing how many further pages remain."}),_Ne=t.Object({pagination:zq},{$id:"ResponseMetadata",description:"Metadata accompanying `data` on paginated operations, describing the full result set the page was taken from."});function Se(e,r={}){return t.Optional(t.Union([t.Null(),e],r))}function S(e={}){return t.Unsafe({...e,type:"string"})}var Ii=250;function p({allowEmpty:e=!0,type:r="short",description:n,default:o}={}){let i=e?0:1,s={...n===void 0?{}:{description:n},...o===void 0?{}:{default:o}};switch(r){case"camel-case":return t.String({format:wA,minLength:i,maxLength:Ii,...s});case"kebab-case":return t.String({format:_i,minLength:i,maxLength:Ii,...s});case"email":return t.String({format:UA,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...s});case"lowercase-domain":return t.String({format:NA,minLength:i,maxLength:Ii,...s});case"tsuga-query":return t.String({format:"tsuga-query",minLength:i,maxLength:1e4,...s});case"tags-query":return t.String({format:"tags-query",minLength:i,maxLength:1e4,errorMessage:{format:`${RA} The query you provided is invalid: \${0}`},...s});case"date-time":return t.String({format:"date-time",...s});case"uri":return t.String({format:"uri",...s});case"user-password":return t.String({format:"user-password",minLength:12,maxLength:Ii,...s});case"long":return t.String({minLength:i,maxLength:5e4,...s});case"short":return t.String({minLength:i,maxLength:Ii,...s});case"tsuga-formula":return t.String({format:"tsuga-formula",minLength:i,maxLength:Ii,errorMessage:{format:"Must be a simple mathematical formula, and all variables in it should refer to queries (q1, q2, etc.). The formula you provided is invalid: ${0}"},...s});case"time":return t.String({format:"time",...s});case"readonly-sql-query":return t.String({format:"readonly-sql-query",minLength:i,maxLength:5e4,errorMessage:{format:"Must be a readonly SQL query - only SELECT statements are allowed."},...s});default:Ye(r)}}var ca=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],au=t.Array(t.Enum(ca,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var Td=["CLUSTER_DB_QUERY_INVALID_CONNECTION_PARAMS","CLUSTER_DB_QUERY_INVALID_CREDENTIALS","CLUSTER_DB_QUERY_PERMISSION_DENIED","CLUSTER_DB_QUERY_QUERY_SYNTAX_ERROR","CLUSTER_DB_QUERY_DATABASE_UNREACHABLE","CLUSTER_DB_QUERY_CONNECTION_FAILED","CLUSTER_DB_QUERY_QUERY_EXECUTION_FAILED","CLUSTER_DB_QUERY_QUERY_TIMEOUT","CLUSTER_DB_QUERY_CONNECTION_TIMEOUT"],vNe=t.Enum(Td),Yq=["CLUSTER_AGGREGATION_STRUCTURE"];var LNe=t.Object({code:t.Enum(Td),message:t.String()}),LA=[...Td,...Yq,"ABORT_ERROR","BAD_REQUEST","CUSTOM_ROLE_IN_USE","CUSTOM_ROLE_NAME_CONFLICT","DUPLICATE_KEY_VIOLATION","FOREIGN_KEY_VIOLATION","FST_ERR_VALIDATION","GROK_RULE_VALIDATION_ERROR","INVALID_INPUT","FORBIDDEN","MISSING_PERMISSION","PRIVILEGE_ESCALATION","RATE_LIMITED","RESERVED_TAG_POLICY_ERROR","RESOURCE_NOT_FOUND","INVALID_INVITATION","TAG_POLICY_ALREADY_EXISTS_ERROR","TAG_POLICY_VALIDATION_ERROR","UNAUTHORIZED","URL_NOT_FOUND"],kA=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var Vq=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],Qq=[...LA,...kA,...Vq],Wq=t.Object({assetId:t.Optional(t.String({description:"Identifier of the asset that violated the policy. Set from the existing asset for update and bulk requests. Omitted on create requests before the asset exists."})),assetName:t.String({description:"Name of the asset that violated the policy. Set from submitted data or the existing asset row. Returned for every violation."}),assetType:t.Enum(ca,{description:"Type of Tsuga asset validated by the policy. Set by the route that ran tag-policy validation. Returned for every violation."}),tagPolicyId:t.String({description:"Identifier of the active tag policy that was violated. Generated by Tsuga when the policy is created. Returned for every violation."}),tagKey:t.String({description:"Tag key required or constrained by the violated policy. Set by the tag policy. Returned for every violation."}),message:t.String({description:"Human-readable reason this policy failed for the asset. Generated by Tsuga's tag-policy validator. Returned for every violation."})},{description:"A single tag-policy violation, identifying the offending asset, the policy and tag key involved, and why validation failed."}),Zq=x("type",[t.Object({type:t.Literal("invalid-syntax",{description:"Discriminator identifying a rule the grok parser could not parse at all."}),error:t.Object({offset:t.Integer({description:"Byte offset in the rule where parsing failed."}),detail:t.String({description:"Parser detail message."})},{description:"Position and parser message for the syntax failure."})},{$id:"GrokInvalidSyntax"}),t.Object({type:t.Literal("unknown-pattern",{description:"Discriminator identifying a rule that references a pattern name the grok engine does not provide."}),error:t.Object({offset:t.Integer({description:"Byte offset of the unknown pattern."}),unknownPattern:t.String({description:"The pattern name that is not supported."})},{description:"Position and name of the unsupported pattern."})},{$id:"GrokUnknownPattern"}),t.Object({type:t.Literal("invalid-filter",{description:"Discriminator identifying a rule whose filter is a known filter used incorrectly."}),error:t.Object({offset:t.Integer({description:"Byte offset of the invalid filter."}),invalidFilter:t.String({description:"The filter that is invalid."}),message:t.String({description:"Why the filter is invalid."})},{description:"Position, text, and reason for the invalid filter."})},{$id:"GrokInvalidFilter"}),t.Object({type:t.Literal("unknown-filter",{description:"Discriminator identifying a rule that references a filter name the grok engine does not implement."}),error:t.Object({offset:t.Integer({description:"Byte offset of the unknown filter."}),unknownFilter:t.String({description:"The filter name that is not implemented."}),message:t.String({description:"Details about the unsupported filter."})},{description:"Position and name of the unimplemented filter."})},{$id:"GrokUnknownFilter"})],{description:"Full structured detail of a grok rule that failed to compile, discriminated by `type`."}),Xq=t.Object({rule:t.String({description:"The rule that failed to compile."}),ruleIndex:t.Integer({description:"0-based index of the failing rule in the submitted `rules` array."}),error:Zq},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),MA=x("type",[t.Object({type:t.Literal("tag_policy_violation",{description:"Discriminator identifying tag-policy validation details. Set by Tsuga to `tag_policy_violation`. Returned when the error code is `TAG_POLICY_VALIDATION_ERROR`."}),violations:t.Array(Wq,{description:"Tag-policy violations that caused the request to fail. Built from active policies applicable to the submitted asset type and owner team. Returned on tag-policy validation errors; can contain multiple policies and multiple assets for bulk requests."})},{$id:"TagPolicyViolationDetails"}),t.Object({type:t.Literal("grok_rule_error",{description:"Discriminator identifying grok rule validation details. Set by Tsuga to `grok_rule_error`. Returned when the error code is `GROK_RULE_VALIDATION_ERROR`."}),ruleErrors:t.Array(Xq,{description:"Grok rules that failed to compile, with full structured detail. One entry per invalid rule."})},{$id:"GrokRuleErrorDetails"})],{description:"Structured details for a client error. Set by Tsuga only for error types with machine-readable remediation data, and omitted for every other client error."}),kNe=t.Object({code:t.Optional(t.Enum(Qq,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"}),details:t.Optional(MA)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),MNe=t.Object({code:t.Optional(t.Enum(LA,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"}),details:t.Optional(MA)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),DNe=t.Object({code:t.Optional(t.Enum(kA,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),GNe=t.Object({requestId:t.String({description:"Identifier used to trace the lifecycle of this API request"}),error:t.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),$Ne=t.Object({requestId:t.String({description:"Identifier used to trace the lifecycle of this API request"}),error:t.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function d({body:e,description:r,method:n,operationId:o,params:i,tags:s,query:c,paginated:l,response:m,url:f}){return i?{buildUrl:E=>f.replace(/:[a-zA-Z_]+/g,I=>E[I.slice(1)]),method:n,params:i,response:m,templateUrl:f,...e===void 0?{}:{body:e},...r===void 0?{}:{description:r},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...s===void 0?{}:{tags:s}}:{method:n,response:m,url:f,templateUrl:f,...e===void 0?{}:{body:e},...r===void 0?{}:{description:r},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...s===void 0?{}:{tags:s}}}function DA(e,r){if(!r||typeof r!="object")return e;let n=new URLSearchParams;return Object.entries(r).forEach(([o,i])=>{Array.isArray(i)?i.length>0&&i.forEach(s=>{s!==void 0&&(typeof s=="string"||typeof s=="number"||typeof s=="boolean")&&n.append(o,String(s))}):(typeof i=="boolean"||typeof i=="string"||typeof i=="number")&&n.append(o,String(i))}),`${e}?${n.toString()}`}var w=t.Object({success:t.Literal(!0,{description:"Always `true` when the delete request completed and the resource was removed."})},{$id:"DeleteResponse",description:"Confirmation that the targeted resource was deleted.",example:{success:!0}});var pu="tsuga-cli";var yo="/v0/oauth",GA=d({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${yo}/authorize`,method:"GET",query:t.Partial(t.Object({response_type:t.String({description:"Must be `code`"}),client_id:t.String({description:"First-party client id or CIMD document URL"}),redirect_uri:t.String({description:"Client redirect URI"}),code_challenge:t.String({description:"PKCE code challenge"}),code_challenge_method:t.String({description:"Must be `S256`"}),state:t.String({description:"Opaque client state, echoed back"}),resource:t.String({description:"RFC 8707 resource indicator"})})),response:t.Object({},{description:"Never returned: this endpoint redirects (302) or renders an HTML error (400)"})}),$A=d({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${yo}/token`,method:"POST",body:t.Partial(t.Object({grant_type:t.String({description:"`authorization_code` or `refresh_token`"}),code:t.String({description:"Authorization code being exchanged"}),code_verifier:t.String({description:"PKCE code verifier"}),redirect_uri:t.String({description:"Must match the redirect URI used on /authorize"}),client_id:t.String({description:"Client id, when sent by the client"}),refresh_token:t.String({description:"Refresh token, for `grant_type=refresh_token`"})})),response:t.Object({access_token:t.String(),token_type:t.Literal("Bearer"),expires_in:t.Number({description:"Access token lifetime in seconds"}),refresh_token:t.String()})}),twe=d({description:"Resolve a signed authorization request handle for the consent page",url:`${yo}/authorization-request`,method:"GET",query:t.Object({handle:t.String()}),response:t.Object({clientId:t.String(),clientName:t.String(),redirectUri:t.String()})}),rwe=d({description:"Approve or deny an OAuth authorization request from the consent page",url:`${yo}/approve`,method:"POST",body:t.Object({handle:t.String({description:"The signed authorization request handle"}),approve:t.Boolean()}),response:t.Object({redirectTo:t.String({description:"The client's redirect URI carrying either the code or the denial"})})}),nwe=d({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${yo}/introspect`,method:"POST",body:t.Object({token:t.String()}),response:t.Object({active:t.Boolean(),userId:t.Optional(t.String()),orgId:t.Optional(t.String())})}),Jq=["pending","active","revoked"],eB=t.Object({id:t.String(),createdAt:S(),clientId:t.String({description:"Client ID Metadata Document URL or first-party client id"}),clientName:t.String({description:"Display name derived from the client identity"}),userId:t.String(),status:t.Enum(Jq),lastUsedAt:t.Optional(S())}),owe=d({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${yo}/grants`,method:"GET",query:t.Object({allUsers:t.Optional(t.Boolean({description:"Admins only: list grants of every user in the org"}))}),response:t.Array(eB)}),iwe=d({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${yo}/grants/:id`,method:"DELETE",params:t.Object({id:t.String()}),response:w});function FA(e,r){let n=new URL(GA.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:pu,redirect_uri:r.redirectUri,code_challenge:r.challenge,code_challenge_method:"S256",state:r.state}).toString(),n.href}var pa=class extends Error{constructor(n,o){super(n);this.code=o;this.name="OAuthTokenError"}};function tB(e){if(!e)return{};try{let r=JSON.parse(e);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}async function jA(e,r){let n=await fetch(new URL($A.url,e).href,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(r).toString()}),o=await n.text(),i=tB(o);if(n.status!==200){let s=i.error??`HTTP ${n.status}`;throw new pa(`OAuth token request failed (${s}${i.error_description?`: ${i.error_description}`:""})`,s)}if(typeof i.access_token!="string"||i.access_token===""||typeof i.refresh_token!="string"||i.refresh_token===""||typeof i.expires_in!="number")throw new Error("OAuth token response was missing required fields");return{accessToken:i.access_token,refreshToken:i.refresh_token,expiresAt:new Date(Date.now()+i.expires_in*cm)}}async function qA(e,r){return jA(e,{grant_type:"authorization_code",client_id:pu,code:r.code,code_verifier:r.verifier,redirect_uri:r.redirectUri})}async function uu(e,r){return jA(e,{grant_type:"refresh_token",client_id:pu,refresh_token:r})}var rB="Your session expired. Run `tsuga auth login` to sign in again.",nB="Your session could not be renewed: the refresh token was already used, revoked or expired. A refresh token is single-use, so the server revokes the whole session when one is replayed - run `tsuga auth login` to sign in again.",oB=5*xs;function BA(e,r){let n=new Date(e.accessExpiresAt).getTime();return Number.isNaN(n)||n<=r.getTime()+oB}function ua(e){return`\u2022\u2022\u2022\u2022${e.slice(-4)}`}function lu(e){let r;try{r=JSON.parse(e)}catch{return}if(typeof r!="object"||r===null)return;let{accessToken:n,accessExpiresAt:o,refreshToken:i}=r;if(!(typeof n!="string"||n==="")&&!(typeof o!="string"||o==="")&&!(i!==void 0&&typeof i!="string"))return{accessToken:n,accessExpiresAt:o,...i===void 0?{}:{refreshToken:i}}}function Ed(e){return{accessToken:e.accessToken,accessExpiresAt:e.expiresAt.toISOString(),refreshToken:e.refreshToken}}function HA(e){if(e.overrideKey)return{kind:"operation-api-key",token:e.overrideKey};if(e.operationApiKey)return{kind:"operation-api-key",token:e.operationApiKey};if(e.userAuth)return{kind:"user-session",userAuth:e.userAuth}}function KA(e){if(e)switch(e.kind){case"operation-api-key":return e.token;case"user-session":return e.userAuth.accessToken;default:Ye(e)}}async function mu({userAuth:e,now:r,reload:n,refresh:o,persist:i}){if(!BA(e,r))return e;let s=n()??e;if(!BA(s,r))return s;if(!s.refreshToken)throw new Error(rB);let c;try{c=await o(s.refreshToken)}catch(m){throw m instanceof pa&&m.code==="invalid_grant"?new Error(nB,{cause:m}):new Error(`Could not renew your session: ${m instanceof Error?m.message:String(m)}. Retry the command.`,{cause:m})}let l=Ed(c);try{i(l)}catch(m){console.error(`Warning: could not save the renewed session (${m instanceof Error?m.message:String(m)}). Run \`tsuga auth login\` before the next command.`)}return l}var _d={r:8,g:203,b:0},Id={r:0,g:130,b:0},Sd=["\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 ","\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557"," \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551"," \u2588\u2588\u2551 \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551"," \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551"," \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D"];function bd(e,r,n){return Math.round(e+(r-e)*n)}function iB(e,r){let n=bd(_d.r,Id.r,r),o=bd(_d.g,Id.g,r),i=bd(_d.b,Id.b,r);return`\x1B[38;2;${n};${o};${i}m${e}\x1B[0m`}function sB(e){if(!e)return`
34
34
 
35
35
  ${Sd.join(`
36
36
  `)}`;let r=Sd.length-1;return`
37
37
 
38
- ${Sd.map((o,i)=>Xq(o,r===0?0:i/r)).join(`
39
- `)}`}function BA(){return Jq(process.stdout.isTTY&&!process.env.NO_COLOR)}var sR=require("node:crypto");var Od=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],Ad=["light","dark"];var eB={light:{red:{text:"foreground.red",background:"avatar.background.red"},orange:{text:"foreground.orange",background:"avatar.background.orange"},amber:{text:"foreground.amber",background:"avatar.background.amber"},yellow:{text:"foreground.yellow",background:"avatar.background.yellow"},green:{text:"foreground.green",background:"avatar.background.green"},emerald:{text:"foreground.emerald",background:"avatar.background.emerald"},teal:{text:"foreground.teal",background:"avatar.background.teal"},cyan:{text:"foreground.cyan",background:"avatar.background.cyan"},sky:{text:"foreground.sky",background:"avatar.background.sky"},blue:{text:"foreground.blue",background:"avatar.background.blue"},indigo:{text:"foreground.indigo",background:"avatar.background.indigo"},purple:{text:"foreground.purple",background:"avatar.background.purple"},pink:{text:"foreground.pink",background:"avatar.background.pink"}},dark:{red:{text:"avatar.foreground.foreground",background:"avatar.solid-background.red"},orange:{text:"avatar.foreground.foreground",background:"avatar.solid-background.orange"},amber:{text:"avatar.foreground.foreground",background:"avatar.solid-background.amber"},yellow:{text:"avatar.foreground.foreground",background:"avatar.solid-background.yellow"},green:{text:"avatar.foreground.foreground",background:"avatar.solid-background.green"},emerald:{text:"avatar.foreground.foreground",background:"avatar.solid-background.emerald"},teal:{text:"avatar.foreground.foreground",background:"avatar.solid-background.teal"},cyan:{text:"avatar.foreground.foreground",background:"avatar.solid-background.cyan"},sky:{text:"avatar.foreground.foreground",background:"avatar.solid-background.sky"},blue:{text:"avatar.foreground.foreground",background:"avatar.solid-background.blue"},indigo:{text:"avatar.foreground.foreground",background:"avatar.solid-background.indigo"},purple:{text:"avatar.foreground.foreground",background:"avatar.solid-background.purple"},pink:{text:"avatar.foreground.foreground",background:"avatar.solid-background.pink"}},gradient:{red:"var(--chakra-colors-gradient-red)",orange:"var(--chakra-colors-gradient-orange)",amber:"var(--chakra-colors-gradient-amber)",yellow:"var(--chakra-colors-gradient-yellow)",green:"var(--chakra-colors-gradient-green)",emerald:"var(--chakra-colors-gradient-emerald)",teal:"var(--chakra-colors-gradient-teal)",cyan:"var(--chakra-colors-gradient-cyan)",sky:"var(--chakra-colors-gradient-sky)",blue:"var(--chakra-colors-gradient-blue)",indigo:"var(--chakra-colors-gradient-indigo)",purple:"var(--chakra-colors-gradient-purple)",pink:"var(--chakra-colors-gradient-pink)"}},HA=["activity-heart","activity","airplay","airpods","alarm-clock","anchor","annotation-dots","annotation-heart","annotation-question","annotation","announcement-03","asterisk-01","atom-01","atom-02","award-03","award-04","award-05","backpack","bank-note-01","bank-note-02","bank-note-03","battery-charging-01","beaker-01","beaker-02","bell-03","bell-04","bell-ringing-03","bell-ringing-04","bluetooth-connect","bluetooth-on","book-closed","book-open-01","book-open-02","bookmark","briefcase-01","briefcase-02","brush-01","brush-02","brush-03","building-01","building-02","building-03","building-08","bus","calculator","calendar-check-01","calendar-date","calendar-heart-01","calendar","camera-01","camera-lens","car-01","certificate-01","certificate-02","check-heart","clipboard-attachment","clipboard-check","clipboard-download","clipboard","clock-snooze","clock-stopwatch","cloud-01","cloud-lightning","cloud-moon","cloud-raining-01","cloud-raining-03","cloud-raining-05","cloud-raining-06","cloud-snowing-01","cloud-sun-01","cloud-sun-02","cloud-sun-03","code-browser","code-circle-01","code-circle-02","code-circle-03","code-square-01","code-square-02","coins-hand","coins-stacked-01","colors","compass-01","compass-02","compass-03","compass","credit-card-01","credit-card-02","cube-02","cube-04","cube-outline","currency-bitcoin-circle","currency-dollar-circle","currency-ethereum-circle","currency-euro-circle","currency-pound-circle","currency-ruble-circle","currency-rupee-circle","currency-yen-circle","cursor-click-01","cursor-click-02","diamond-01","diamond-02","dice-1","dice-2","dice-3","dice-4","dice-5","dice-6","disc-01","disc-02","droplets-01","droplets-02","droplets-03","dropper","face-content","face-frown","face-happy","face-neutral","face-sad","face-smile","face-wink","feather","file-02","file-05","file-06","file-heart-01","file-heart-02","file-search-01","file-search-02","file-search-03","film-01","film-02","fingerprint-03","fingerprint-04","flag-01","flag-04","flash-off","flash","gaming-pad-01","gaming-pad-02","gift-01","glasses-01","glasses-02","globe-03","globe-04","globe-05","globe-06","globe-slated-01","globe-slated-02","graduation-hat-01","graduation-hat-02","hash-01","hash-02","headphones-01","headphones-02","heart-circle","heart-hand","heart-hexagon","heart-octagon","heart-rounded","heart-square","hearts","hexagon-01","hexagon-02","home-03","home-smile","hourglass-01","hourglass-02","hourglass-03","hurricane-01","hurricane-02","hurricane-03","image-01","image-02","image-03","image-04","image-05","keyboard-01","laptop-01","life-buoy-01","life-buoy-02","lightbulb-02","lightbulb-03","lightbulb-04","lock-keyhole-circle","lock-keyhole-square","luggage-01","luggage-02","luggage-03","magic-wand-01","magic-wand-02","map-01","map-02","mark","marker-pin-01","marker-pin-04","marker-pin-05","marker-pin-06","medical-circle","medical-cross","medical-square","message-chat-square","message-notification-square","message-smile-square","message-text-square-02","microphone-01","microphone-02","microscope","modem-01","modem-02","monitor-03","monitor-04","monitor-05","moon-01","moon-eclipse","moon-star","music-note-01","music-note-02","music-note-plus","octagon","palette","paperclip","pentagon","phone-01","phone-02","phone-call-01","phone","piggy-bank-01","pin-01","pin-02","plane","play-circle","play-square","podcast","power-02","presentation-chart-01","printer","receipt","recording-01","recording-02","recording-03","rocket-01","rocket-02","roller-brush","rss-01","rss-02","ruler","scales-01","scales-02","server-06","shield-01","shield-02","shield-03","shield-dollar","shield-zap","shopping-bag-01","shopping-cart-01","signal-01","signal-02","signal-03","simcard","sliders-01","sliders-02","snowflake-01","snowflake-02","speaker-01","speaker-02","speaker-03","speedometer-01","speedometer-02","speedometer-03","speedometer-04","square","stand","star-03","star-07","sticker-circle","sticker-square","sun-setting-01","sun-setting-02","sun-setting-03","sun","sunrise","sunset","tablet-01","tag-01","tag-02","tag-03","target-01","target-02","target-03","target-04","target-05","terminal-browser","terminal-circle","terminal-square","thermometer-02","thermometer-03","thermometer-cold","thermometer-warm","thumbs-down","thumbs-up","ticket-01","tool-01","tool-02","train","tram","translate-01","triangle","trophy-01","trophy-02","truck-01","truck-02","tv-02","umbrella-01","umbrella-02","umbrella-03","virus","voicemail","wallet-01","wallet-02","wallet-05","watch-circle","watch-square","waves","webcam-01","webcam-02","wind-01","wind-02","wind-03","youtube","zap-circle","zap-fast","zap"];var Jwe=eB.light.red.background;var tB=["allowed-domains","cluster-integration-config","custom-role","custom-usage-tag","database","databricks-connection","explorer-saved-view","github-connection","host","inventory","llm-provider","monitor-alert","monitor-debugging","oauth-grant","org","retention-policy","saml-config","sensitive-data-scanner-rule","service","service-target","team-remap-config","user-self","widget-share"],rB=["adaptive-notification-rule","audit-log","cloud-account","dashboard-folder","dashboard-report","dashboard-share","dashboard","ingestion-api-key","investigation","log-route","metric-route","monitor","notebook","notification-integration","notification-rule","notification-silence","operation-api-key","quality-report","rum-public-token","sandbox-environment","slo","tag-policy","team-members","team","user-data","user-invitation","user-permissions"],nB=["log","metric","trace","rum"],xd=[...rB,...nB],ive=[...tB,...xd];var Ii=["admin","public_editor","public_viewer","teams_only"],tr=["admin","editor","viewer"];var yo="/v0/team-membership",Rd="Role granted to the user inside this team. `admin` gives full team control, including managing assets, members, and settings. `editor` can view and update most team assets (dashboards, monitors, etc.) but cannot manage members or settings. `viewer` can view team data but cannot make changes.",Cd=t.Object({id:t.String({description:"Tsuga-generated team membership ID assigned when the membership is created."}),userId:t.String({description:"User ID that belongs to the team."}),teamId:t.String({description:"Team ID that contains the user."}),roleKey:t.Enum(tr,{description:Rd})}),KA=t.Object({userId:p({allowEmpty:!1,description:"User ID to add to or update in the team."}),teamId:p({allowEmpty:!1,description:"Team ID receiving the membership change."}),roleKey:t.Enum(tr,{description:Rd})}),oB=t.Object({userId:p({allowEmpty:!1,description:"User ID to remove from the team."}),teamId:p({allowEmpty:!1,description:"Team ID to remove the user from."})}),iB=t.Optional(t.Object({userId:t.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this user ID."})),teamId:t.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this team ID."}))})),ave=d({tags:["access-control"],url:yo,method:"GET",query:iB,response:t.Array(Cd)}),sve=d({tags:["access-control"],url:yo,method:"POST",body:KA,response:Cd}),cve=d({tags:["access-control"],url:yo,method:"PUT",body:KA,response:Cd}),pve=d({tags:["access-control"],url:yo,method:"DELETE",body:oB,response:v}),mu=500,zA=t.Object({teamId:p({allowEmpty:!1,description:"Team ID receiving all requested memberships."}),members:t.Array(t.Object({userId:t.Optional(p({allowEmpty:!1,description:"Existing user ID to add to the team."})),userEmail:t.Optional(p({allowEmpty:!1,type:"email",description:"Existing user email to resolve and add to the team."})),roleKey:t.Enum(tr,{description:Rd})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:mu,description:"Users to add to the team. Each item must include either `userId` or `userEmail`, not both. Duplicate identifiers (including a `userId` and `userEmail` that resolve to the same user) are rejected. Items are processed independently: an unresolved user does not stop other items from being added."})},{description:"Bulk team-membership creation request. Provide one target team and the users to add by ID or email, with a role for each user."}),aB={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(zA,{examples:[aB]});var YA=t.Object({results:t.Array(t.Object({userId:t.String({description:"Resolved user ID for this bulk add result. For `user_not_found`, this is the submitted user ID or email that Tsuga could not resolve."}),status:t.Enum(["added","already_member","user_not_found"],{description:"`added` means the membership was created, `already_member` means no change was needed, and `user_not_found` means Tsuga could not resolve the requested user."})}))},{description:"Per-user result summary for a bulk team-membership add request."}),sB={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(YA,{examples:[sB]});var uve=d({tags:["access-control"],url:`${yo}/bulk-add`,method:"POST",body:zA,response:YA}),lve=d({tags:["access-control"],url:`${yo}/bulk-update-user-roles`,method:"PUT",body:t.Object({userIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:mu}),teamId:p({allowEmpty:!1}),role:t.Enum(tr)}),response:t.Object({})}),VA=t.Object({teamId:p({allowEmpty:!1,description:"Team ID to remove the requested users from."}),userIds:t.Optional(t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:mu,description:"User IDs to remove from the team. Items are processed independently: a user who is not a member or cannot be resolved does not stop the other items from being removed."})),userEmails:t.Optional(t.Array(p({allowEmpty:!1,type:"email"}),{minItems:1,maxItems:mu,description:"User emails to resolve and remove from the team."}))},{oneOf:[{required:["userIds"]},{required:["userEmails"]}],description:"Bulk team-membership removal request. Provide one target team and either `userIds` or `userEmails`, not both, with no duplicates."}),cB={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(VA,{examples:[cB]});var QA=t.Object({results:t.Array(t.Object({userId:t.String({description:"Resolved user ID for this bulk remove result. For `user_not_found`, this is the submitted user ID or email that Tsuga could not resolve."}),status:t.Enum(["removed","not_member","user_not_found"],{description:"`removed` means the membership was deleted, `not_member` means no membership existed, and `user_not_found` means Tsuga could not resolve the requested user."})}))},{description:"Per-user result summary for a bulk team-membership removal request."}),pB={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(QA,{examples:[pB]});var mve=d({tags:["access-control"],url:`${yo}/bulk-remove`,method:"DELETE",body:VA,response:QA});var uB="^\\S(.*\\S)?$",lB=50,mB=128,dB=256,fB=t.Object({key:t.String({description:"Tag key attached to the resource. Consumers can use key/value tags for filtering, ownership context, and policy checks."}),value:t.String({description:"Tag value attached to the resource for this key. Tsuga returns the value exactly as stored."})},{title:"Tag"}),gB=t.Object({key:t.String({maxLength:mB,description:"Tag key to attach to the resource."}),value:t.String({maxLength:dB,pattern:uB,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),kt=t.Array(fB,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),Mt=t.Array(gB,{title:"Tags",maxItems:lB,description:"Key/value tags to apply to the resource. Tag policies may require specific keys or values."}),ve=t.Optional(kt),De=t.Optional(Mt);var xn="/v0/teams",gu=["public","private"],du={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},hB=t.Enum([du.NAME,du.CREATED_AT,du.MEMBER_COUNT,du.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),hu=t.Object({color:t.Enum(Od,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:t.Enum(Ad,{description:"Avatar rendering mode selected for the team."}),iconName:t.Enum(HA,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),Si=t.Object({color:t.Enum(Od),mode:t.Enum(Ad)}),WA=100,ZA=250,Rn=t.Object({id:t.String({description:"Unique identifier of the team. Generated by Tsuga and stable for the team lifetime."}),name:t.String({description:"Human-readable team name displayed throughout Tsuga and used in team search."}),description:t.Optional(t.String({description:"Optional free-text description of the team."})),visibility:t.Enum(gu,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:ve,createdAt:S({description:"Timestamp when Tsuga created the team."}),updatedAt:S({description:"Timestamp when Tsuga last updated the team metadata."}),memberCount:t.Optional(t.Number({description:"Number of members currently in the team"})),avatar:t.Optional(hu)}),yu=t.Object({name:t.String({minLength:1,maxLength:WA,format:Ti,description:`Name to assign to the team. Must be kebab-case (lowercase letters, numbers, and dashes only) and unique in the organization. Maximum length is ${WA} characters.`}),description:Se(t.String({maxLength:ZA}),{description:`Optional team description. Maximum length is ${ZA} characters.`}),visibility:t.Enum(gu,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:De,avatar:Se(hu)}),yB=t.Object({id:t.String(),name:t.String(),email:t.String(),role:t.Enum(tr),joinedTeamAt:S(),orgRole:t.Enum(Ii),avatar:t.Optional(Si)}),XA=t.Object({searchQuery:t.Optional(p({description:"Substring matched against team names and descriptions."})),visibility:t.Optional(t.Enum(gu,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:t.Optional(t.Boolean({description:"If true, return only teams that include the authenticated user."}))}),Ove=d({tags:["teams"],url:xn,method:"GET",paginated:!0,response:t.Array(Rn),query:t.Object({...ae,includeMemberCount:t.Optional(t.Boolean()),...XA.properties,sortBy:t.Optional(hB),sortDirection:t.Optional(Q)})}),Ave=d({tags:["teams"],url:`${xn}/:id`,method:"GET",params:t.Object({id:p()}),response:Rn}),fu={NAME:"name",ROLE:"role",ORG_ROLE:"orgRole",JOINED_TEAM_AT:"joinedTeamAt"},TB=t.Enum([fu.NAME,fu.ROLE,fu.ORG_ROLE,fu.JOINED_TEAM_AT]),xve=d({tags:["teams"],url:`${xn}/:id/members`,method:"GET",paginated:!0,params:t.Object({id:p()}),query:t.Object({...ae,searchQuery:t.Optional(p({description:"Substring matched against member names and emails."})),teamRole:t.Optional(t.Array(t.Enum(tr),{maxItems:tr.length,uniqueItems:!0,description:"Restrict results to members with one of these team roles."})),sortBy:t.Optional(TB),sortDirection:t.Optional(Q)}),response:t.Array(yB)}),Rve=d({tags:["teams"],url:`${xn}/:id/assets`,method:"GET",params:t.Object({id:p()}),response:t.Object({apiKeyCount:t.Number(),logRouteCount:t.Number(),monitorCount:t.Number(),notificationRuleCount:t.Number(),dashboardCount:t.Number(),sloCount:t.Number()})}),Cve=d({tags:["teams"],url:xn,method:"POST",body:yu,response:Rn}),Pve=d({tags:["teams"],url:`${xn}/:id`,method:"PUT",params:t.Object({id:p()}),body:yu,response:Rn}),EB=x("type",[t.Object({type:t.Literal("ids"),teamIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:100})}),t.Object({type:t.Literal("all"),filters:t.Optional(XA)})]),Uve=d({tags:["teams"],url:`${xn}/bulk-update`,method:"POST",body:t.Object({selection:EB,config:t.Object({visibility:t.Enum(gu)})}),response:t.Object({})}),wve=d({tags:["teams"],url:`${xn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v});var _B=t.Enum(["agent","cli","mcp-codemode","mcp-server","tadmin","terraform-provider","web-frontend"],{description:"Tsuga client surface that performed the operation. Use this to distinguish UI, CLI, MCP, and Terraform-originated changes."}),pe=x("type",[t.Object({type:t.Literal("user",{description:"The resource was created or updated by a user."}),id:t.String({description:"Unique identifier of the user actor."}),name:t.String({description:"Display name of the user actor at the time of response."}),avatar:t.Optional(Si)}),t.Object({type:t.Literal("operation-api-key",{description:"The resource was created or updated by an operation API key."}),id:t.String({description:"Unique identifier of the operation API key actor."}),name:t.String({description:"Display name of the operation API key actor."}),source:t.Optional(_B)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var Pd=["all","owning-team-and-public","owning-team-only"],Cn=t.Enum(Pd,{description:"`all` allows the resource to query all permitted telemetry, `owning-team-and-public` limits it to the owning team plus public data, and `owning-team-only` limits it to the owning team."});var us="/v0/operation-api-keys";var IB=100,Tu=t.Enum(Pd,{description:"Team-access boundary for the operation API key. Set when the key is created or updated. `all` can reach all teams, `owning-team-and-public` can reach the owning team and public teams, and `owning-team-only` can reach only the owning team."}),Pn=e=>t.Literal("read",{description:e}),rt=e=>t.Enum(["read","write"],{description:e}),Eu=t.Partial(t.Object({investigations:rt("Investigations, the records collecting the timeline and findings of an incident analysis."),dashboard:rt("Dashboards and the graphs they contain."),"dashboard-folder":rt("Folders organizing dashboards."),documentation:Pn("Tsuga documentation and API reference pages, which are public content rather than account data."),"ingestion-api-key":rt("Ingestion API keys, used to send telemetry data to Tsuga."),"rum-public-token":rt("RUM public tokens, embedded in web and mobile applications to send real user monitoring telemetry."),inventory:Pn("Cloud resources discovered by inventory scans."),"cloud-account":rt("Cloud accounts Tsuga scans to discover resources."),logs:Pn("Ingested log events, through search and aggregation endpoints."),"log-route":rt("Log routes, which select newly ingested logs and apply processors to them."),metrics:Pn("Ingested metrics, through query and aggregation endpoints."),"metric-route":rt("Metric routes, which select newly ingested metrics by name and apply processors to them."),monitor:rt("Monitors, the alert definitions evaluated against telemetry."),"allowed-domains":rt("Email domains whose users are allowed to join the organization."),"quality-report":Pn("Telemetry quality reports."),service:Pn("Services of the catalog, inferred from telemetry."),"service-target":rt("Notification targets attached to a service."),slo:rt("Service level objectives and the alerts attached to them."),"notification-rule":rt("Notification rules, which route alert transitions to notification targets."),"notification-integration":rt("Notification integrations, containing the credentials Tsuga uses when sending notifications."),"notification-silence":rt("Notification silences, which suppress matching notification delivery."),"custom-usage-tag":rt("Custom usage tags, the telemetry tag keys tracked as usage dimensions."),"retention-policy":rt("Retention policies applied to logs, metrics, and traces."),"tag-policy":rt("Tag policies, which enforce tag requirements on Tsuga-managed assets and telemetry data."),team:rt("Teams and their settings."),"team-membership":rt("Team memberships, each pairing a user with a team role."),traces:Pn("Ingested spans, through search and aggregation endpoints."),rum:Pn("Ingested RUM events, through aggregation endpoints."),user:rt("User accounts of the organization."),"user-invitation":rt("Invitations for people who do not belong to the organization yet.")}),{description:"Resource types the key can act on, each mapped to `read` or `write`. `write` also grants read access. A resource type absent from the map is not accessible to the key at all."}),Ud=t.Object({id:t.String(),name:t.String(),owner:t.String(),tags:ve,scope:Tu,permissions:Eu,keyLastCharacters:t.String(),updatedAt:S(),createdAt:S(),creator:t.Optional(pe),updater:t.Optional(pe),expiresAt:t.Optional(S()),lastUsedAt:t.Optional(S())}),JA=t.Object({name:t.String({minLength:1,maxLength:IB}),owner:p({allowEmpty:!1}),tags:De,scope:Tu,permissions:Eu,expiresAt:Se(p({allowEmpty:!1,type:"date-time"}))}),zve=d({tags:["operation-api-keys"],url:us,method:"POST",body:JA,response:t.Intersect([Ud,t.Object({key:t.String()})])}),Yve=d({tags:["operation-api-keys"],url:us,method:"GET",response:t.Array(Ud)}),Vve=d({tags:["operation-api-keys"],url:`${us}/:id`,method:"PUT",params:t.Object({id:p()}),body:JA,response:Ud}),Qve=d({tags:["operation-api-keys"],url:`${us}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),Wve=d({tags:["operation-api-keys"],url:`${us}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p({allowEmpty:!1}),{uniqueItems:!0})}),response:t.Object({})});var SB=["logs","metrics","traces","profiling","analytics","dashboards","notebooks","ongoing-alerts","slo","monitor","notification-rules","notification-silences","notification-integrations","investigations","routes","sensitive-data-scanner","ai-sandboxes","inventory","services","rum","browser-views","mobile","sessions","host-catalog","kubernetes","ecs","serverless"],ex=t.Enum(SB,{description:"Stable nav item key within a main sidebar category."}),tx=t.Array(ex,{description:"Nav item keys shown in the primary sidebar for this category, in display order."}),rx=t.Optional(t.Array(ex,{description:"Nav item keys for this category that are folded away (e.g. View more). Omitted or empty means none."})),nx="Stable category id. Unknown or renamed ids are ignored by the client catalog.",ox="Sidebar categories in display order. Unknown or renamed ids are ignored by the client catalog.",ix=t.Object({categories:t.Array(t.Object({id:t.String({description:nx}),visible:tx,folded:rx}),{description:ox})}),ax=t.Object({categories:t.Array(t.Object({id:p({allowEmpty:!1,description:nx}),visible:tx,folded:rx}),{description:ox})});var sx=["YYYY-MM-DD","DD-MM-YYYY","MM-DD-YYYY"],cx=["12h","24h"],OB=t.Union([t.Object({type:t.Literal("home")}),t.Object({type:t.Literal("explorer")}),t.Object({type:t.Literal("metrics")}),t.Object({type:t.Literal("traces")}),t.Object({type:t.Literal("analytics")}),t.Object({type:t.Literal("dashboards"),id:t.String()}),t.Object({type:t.Literal("ongoing-alerts")}),t.Object({type:t.Literal("services")}),t.Object({type:t.Literal("rum-views")}),t.Null()]),AB=t.Union([x("type",[t.Object({type:t.Literal("home")}),t.Object({type:t.Literal("explorer")}),t.Object({type:t.Literal("metrics")}),t.Object({type:t.Literal("traces")}),t.Object({type:t.Literal("analytics")}),t.Object({type:t.Literal("dashboards"),id:p()}),t.Object({type:t.Literal("ongoing-alerts")}),t.Object({type:t.Literal("services")}),t.Object({type:t.Literal("rum-views")})]),t.Null()]),Un=t.Object({email:t.String({description:"Lowercase email address for the user. Use this for display and invitation matching, not as a stable identifier."}),id:t.String({description:"Unique identifier of the user. Generated by Tsuga and stable for the user lifetime."}),name:t.String({description:"Display name of the user."}),role:t.Enum(Ii,{description:"Organization role for the user: `admin`, `public_editor`, `public_viewer`, or `teams_only`."}),orgId:t.String({description:"Identifier of the Tsuga organization the user belongs to."}),orgName:t.Optional(t.String({description:"Display name of the Tsuga organization the user belongs to. Absent when the organization record cannot be resolved."})),avatar:t.Optional(Si),defaultView:t.Optional(OB),timezone:t.Optional(t.Union([t.String(),t.Null()],{description:"IANA timezone used to display dates and times (e.g. `Europe/Paris`). Absent or `null` means the timezone is auto-detected from the browser."})),dateFormat:t.Optional(t.Union([t.Enum(sx),t.Null()],{description:"Preferred format for displaying dates: `YYYY-MM-DD`, `DD-MM-YYYY`, or `MM-DD-YYYY`. Absent or `null` means the Tsuga default format."})),hourFormat:t.Optional(t.Union([t.Enum(cx),t.Null()],{description:"Preferred format for displaying times: `12h` (AM/PM) or `24h`. Absent or `null` means the Tsuga default format."})),favoriteDashboards:t.Optional(t.Array(t.String(),{description:"Dashboard IDs the user marked as favorites."})),favoriteFolders:t.Optional(t.Array(t.String(),{description:"Dashboard folder IDs the user marked as favorites."})),filterDataByTeams:t.Optional(t.Boolean({description:"Whether the user wants data across the application filtered to the teams they belong to. Set by the user in their profile settings."})),sidebarNavLayout:t.Optional(ix),fromSso:t.Boolean({description:"Whether the user account was provisioned or authenticated through SSO."}),createdAt:S({description:"Timestamp when Tsuga created the user."}),updatedAt:S({description:"Timestamp when Tsuga last updated the user."}),teamIds:t.Optional(t.Array(t.String(),{description:"Team IDs the user currently belongs to."}))}),px=t.Intersect([Rn,t.Object({userRole:t.Enum(tr)})]),ux=t.Object({status:t.Literal("authenticated"),token:t.String(),user:Un}),lx=x("status",[ux,t.Object({status:t.Literal("mfa-required"),mfaToken:t.String({description:"Short-lived token accepted only by the TOTP login endpoints; it grants no other access."}),totpEnrolled:t.Boolean({description:"False when the user still has to set up an authenticator app."})})]),lNe=d({tags:["users"],url:"/v0/login",method:"POST",body:t.Object({email:p({type:"email"}),password:p({type:"long"})}),response:lx}),mx="/v0/login/totp",mNe=d({tags:["users"],url:`${mx}/setup`,method:"POST",body:t.Object({mfaToken:p({type:"long"})}),response:t.Object({mfaToken:t.String({description:"Replaces the login MFA token; pass it when verifying the first code."}),secret:t.String({description:"Base32 secret for manual entry in the authenticator app."})})}),dNe=d({tags:["users"],url:mx,method:"POST",body:t.Object({mfaToken:p({type:"long"}),code:t.String({pattern:`^[0-9]{${6}}$`,description:"The 6-digit code shown by the authenticator app."})}),response:ux}),fNe=d({tags:["users"],url:"/v0/forgot-password",method:"POST",body:t.Object({email:p({type:"email"})}),response:t.Object({})}),gNe=d({tags:["users"],url:"/v0/reset-password",method:"POST",body:t.Object({resetToken:p(),password:p({type:"user-password"})}),response:t.Object({})}),xB=["active","expired"],hNe=d({tags:["users"],url:"/v0/reset-password-status/:resetToken",method:"GET",params:t.Object({resetToken:p()}),response:t.Object({status:t.Enum(xB)})}),yNe=d({tags:["users"],url:"/v0/change-password",method:"POST",body:t.Object({currentPassword:p({type:"long"}),newPassword:p({type:"user-password"})}),response:t.Object({})}),To="/v0/users",wd="/v0/current-user",TNe=d({tags:["users"],url:wd,method:"GET",response:Un}),ENe=d({tags:["users"],url:`${wd}/teams`,method:"GET",response:t.Array(px)}),_Ne=d({tags:["users"],url:"/v0/logout",method:"POST",response:t.Object({})}),INe=d({tags:["users"],method:"PATCH",url:wd,body:t.Partial(t.Object({avatar:t.Union([Si,t.Null()]),defaultView:AB,timezone:t.Union([t.String({format:go}),t.Null()]),dateFormat:t.Union([t.Enum(sx),t.Null()]),hourFormat:t.Union([t.Enum(cx),t.Null()]),favoriteDashboards:t.Array(p({allowEmpty:!1})),favoriteFolders:t.Array(p({allowEmpty:!1})),filterDataByTeams:t.Boolean(),sidebarNavLayout:t.Union([ax,t.Null()]),name:p()}),{minProperties:1}),response:Un}),SNe=d({tags:["users"],url:To,method:"GET",response:t.Array(Un),query:t.Optional(t.Object({includeTeamIds:t.Optional(t.Boolean())}))}),ls={NAME:"name",ROLE:"role",LOGIN_METHOD:"fromSso",TEAMS:"teams",CREATED_AT:"createdAt"},dx=t.Partial(t.Object({searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring to match against the member name or email."})},{description:"Substring matched against the member name or email"})},{description:"Optional filters applied to narrow the returned members"})),RB=t.Partial(t.Object({...ae,includeTeamIds:t.Boolean({description:"When true, include the IDs of the teams each member belongs to."}),filters:dx,sort:t.Object({by:t.Enum([ls.NAME,ls.ROLE,ls.LOGIN_METHOD,ls.TEAMS,ls.CREATED_AT],{description:"Field to sort the returned members by"}),direction:Q},{description:"Optional sorting applied to the returned members"})})),bNe=d({tags:["users"],url:`${To}/query`,method:"POST",paginated:!0,response:t.Array(Un),body:RB}),{teamIds:ONe,...CB}=Un.properties,PB=t.Object({...CB,teams:t.Optional(t.Array(px))}),ANe=d({tags:["users"],url:`${To}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),query:t.Optional(t.Object({includeTeamRoles:t.Optional(t.Boolean())})),response:PB}),UB=Yt(dx),xNe=d({tags:["users"],method:"PUT",url:`${To}/bulk-update-role`,body:t.Object({selection:UB,role:t.Enum(Ii)}),response:t.Object({})}),RNe=d({tags:["users"],url:`${To}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),CNe=d({tags:["users"],url:`${To}/:id/totp`,method:"DELETE",params:t.Object({id:p()}),response:v}),PNe=d({tags:["users"],url:`${To}/all-emails`,method:"GET",response:t.Array(t.String())}),fx=["pending","accepted","expired","revoked"],wB=t.Enum(fx),Eo="/v0/invitations",vB=10,NB=t.Object({email:p({type:"email",description:"Lowercase email address to invite into the organization."}),teamId:p({description:"Team ID to add the invited user to after acceptance."}),teamRole:t.Enum(tr,{description:"Role the invited user receives in the target team once accepted: `admin`, `editor`, or `viewer`."}),userRole:t.Enum(Ii,{description:"Organization role the invited user receives after acceptance: `admin`, `public_editor`, `public_viewer`, or `teams_only`."})}),UNe=d({tags:["invitations"],url:`${Eo}/create`,method:"POST",body:t.Array(NB,{maxItems:vB}),response:t.Object({success:t.Boolean(),message:t.String()})}),wNe=d({tags:["invitations"],url:`${Eo}/resend/:id`,params:t.Object({id:p()}),method:"POST",response:t.Object({success:t.Boolean(),message:t.String()})}),gx=t.Partial(t.Object({searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring to match against the invitation email, team name, or status."})},{description:"Substring matched against the invitation email, team name, or status"})},{description:"Optional filters applied to narrow the returned invitations"})),LB=Yt(gx),vNe=d({tags:["invitations"],url:`${Eo}/bulk-resend`,method:"POST",body:t.Object({selection:LB}),response:t.Object({success:t.Boolean(),message:t.String()})}),NNe=d({tags:["invitations"],url:Eo,method:"POST",body:t.Object({secret:p()}),response:t.Object({status:wB,email:t.String(),teamName:t.Optional(t.String()),avatar:t.Optional(hu)})}),LNe=d({tags:["invitations"],url:`${Eo}/accept`,method:"POST",body:t.Object({name:p({type:"short"}),password:p({type:"user-password"}),secret:p()}),response:lx}),kNe=d({tags:["invitations"],url:`${Eo}/revoke/:id`,params:t.Object({id:p()}),method:"POST",response:t.Object({success:t.Boolean(),message:t.String()})}),kB=t.Object({id:t.String({description:"Unique identifier of the invitation. Generated by Tsuga."}),email:t.String({description:"Email address invited to join the organization."}),teamId:t.Optional(t.String({description:"Team ID assigned when the invitation is accepted."})),teamRole:t.Optional(t.Enum(tr,{description:"Team role assigned when the invitation is accepted: `admin`, `editor`, or `viewer`."})),createdBy:t.Optional(t.String({description:"User ID that created the invitation."})),status:t.Enum(fx,{description:"Invitation lifecycle status: `pending`, `accepted`, `expired`, or `revoked`. `expired` can be computed from `expiresAt` when invitations are listed."}),expiresAt:S({description:"Timestamp when the invitation expires if not accepted."}),createdAt:S({description:"Timestamp when Tsuga created the invitation."}),updatedAt:S({description:"Timestamp when Tsuga last updated the invitation."})}),_u={EMAIL:"email",TEAM:"team",STATUS:"status",CREATED_AT:"createdAt"},MB=t.Partial(t.Object({...ae,filters:gx,sort:t.Object({by:t.Enum([_u.EMAIL,_u.TEAM,_u.STATUS,_u.CREATED_AT],{description:"Field to sort the returned invitations by"}),direction:Q},{description:"Optional sorting applied to the returned invitations"})})),MNe=d({tags:["invitations"],url:`${Eo}/query`,method:"POST",paginated:!0,response:t.Array(kB),body:MB});var DB=`/${"v1"}/me`,hx=t.Object({type:t.Literal("operation-api-key",{description:"Credential type for this response variant. Set by Tsuga from the bearer token used on the request. Returned as `operation-api-key` when the request authenticated with an operation API key."}),id:t.String({description:"Unique identifier of the operation API key. Generated by Tsuga when the key is created. Use this as the stable key identifier when correlating API calls with audit logs or key-management records."}),name:t.String({description:"Display name of the operation API key. Set by the user who created or last updated the key. Returned for every operation-key-authenticated request so clients can show which saved key is active."}),owner:t.String({description:"Identifier of the team that owns the operation API key. Set when the key is created or updated. Combined with `scope`, it determines which team-owned resources the key can reach."}),scope:Tu,permissions:Eu,keyLastCharacters:t.String({description:"Last characters of the operation API key secret. Set by Tsuga from the generated secret and returned because the full secret is only shown once at creation. Use this to distinguish saved keys without exposing the secret."}),expiresAt:t.Optional(S({description:"Timestamp after which the operation API key stops authenticating. Set when the key is created or updated. Returned only for keys that have an expiration date."}))},{$id:"OperationApiKeyIdentity",description:"Identity and effective access for the operation API key used on the request. Returned when the bearer token is an operation API key. See [API keys](/documentation/account-and-settings/api-keys)."}),GB={type:"operation-api-key",id:"key-123-abc",name:"ci-deploy",owner:"team-123-abc",scope:"owning-team-and-public",permissions:{dashboard:"write",logs:"read",monitor:"read"},keyLastCharacters:"a9f2",expiresAt:"2026-12-01T00:00:00.000Z"};Object.assign(hx,{examples:[GB]});var yx=t.Object({type:t.Literal("user",{description:"Credential type for this response variant. Set by Tsuga from the bearer token used on the request. Returned as `user` when the request authenticated with a user OAuth access token."}),...t.Pick(Un,["id","email","name","role","orgId","orgName"]).properties},{$id:"UserIdentity",description:"Identity for the user OAuth access token used on the request. Returned when the bearer token is a user access token. Access follows the user organization role rather than an operation-key permission map. See [Members](/documentation/account-and-settings/members)."}),$B={type:"user",id:"user-123-abc",email:"john@tsuga.com",name:"John Doe",role:"public_viewer",orgId:"org-123-abc",orgName:"Acme Inc."};Object.assign(yx,{examples:[$B]});var FB=x("type",[hx,yx],{description:"Identity and access for the credential used on the request. Returned for any valid public API credential and discriminated by `type` because the API accepts both operation API keys and user OAuth access tokens."}),Tx=d({description:"Retrieves the identity and access of the credential the request authenticated with. Use this to check which scope and permissions an operation API key carries before calling other endpoints, or to confirm which user an OAuth access token belongs to. Any valid public API credential can call this endpoint without additional resource permissions.",operationId:"getMe",tags:["public","authentication"],url:DB,method:"GET",response:FB});var ms=require("node:crypto");function jB(e){return(0,ms.createHash)("sha256").update(e).digest("base64url")}function Ex(){let e=(0,ms.randomBytes)(32).toString("base64url");return{verifier:e,challenge:jB(e)}}var Ox=require("node:child_process"),Ax=require("node:http"),Ld=require("node:os");var qB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function vd(e){return e.replace(/[&<>"']/g,r=>qB[r]??r)}var BB=[":root{color-scheme:light dark;--bg:#f9fafb;--card:#fff;--fg:#1f2937;--fg-muted:#6b7280;","--logo-1:#08cb00;--logo-2:#008200;--brand:#08cb00;--bloom:#e5e7eb}","@media(prefers-color-scheme:dark){:root{--bg:#18181b;--card:#202023;--fg:#e4e4e7;","--fg-muted:#a1a1aa;--logo-1:#fff;--logo-2:#fff;--bloom:#52525b}}","*{box-sizing:border-box}","body{margin:0;min-height:100vh;display:flex;align-items:flex-start;justify-content:center;","padding:24px;padding-top:14vh;font-family:Inter,system-ui,-apple-system,'Segoe UI',sans-serif;","color:var(--fg);background-color:var(--bg);background-image:","radial-gradient(72% 78% at 104% 112%,var(--brand) -20%,transparent 64%),","radial-gradient(46% 46% at 94% -4%,var(--brand) -20%,transparent 64%),","radial-gradient(48% 58% at -8% 68%,var(--bloom) -20%,transparent 64%)}","main{display:flex;flex-direction:column;align-items:center;text-align:center;gap:24px;","width:100%;max-width:480px;padding:32px;border-radius:8px;backdrop-filter:blur(8px);","background-color:color-mix(in srgb,var(--card) 55%,transparent);","box-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1)}",".tile{display:flex;padding:6px;border-radius:6px;background-color:var(--card);","box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)}",".tile svg{display:block;width:32px;height:32px}",".copy{display:flex;flex-direction:column;gap:8px}","h1{margin:0;font-size:29px;font-weight:600;line-height:1.2}","p{margin:0;font-size:14px;line-height:20px;color:var(--fg-muted)}"].join(""),HB=['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 111.94 133.41" aria-hidden="true">','<path fill="var(--logo-2)" d="M40.66,54.06c-11.32,8.54-25.39,13.61-40.66,13.61v-23.36c17.9,0,','33.3-10.6,40.29-25.87v28.28c0,2.48.13,4.93.37,7.34Z"/>','<path fill="var(--logo-2)" d="M67.65,103.01v30.4h-23.36v-35.58c-11.87,10.29-27.34,16.54-44.29,','16.54v-23.36c19.33,0,35.76-12.37,41.8-29.63,3.5,16.76,12.87,31.39,25.85,41.63Z"/>','<rect fill="var(--logo-1)" x="44.29" width="23.36" height=".02"/>','<path fill="var(--logo-1)" d="M111.94,67.67c-16.83,0-32.21-6.14-44.05-16.3,2.32,22.28,21.16,',"39.64,44.05,39.64v23.36c-37.36,0-67.65-30.29-67.65-67.65V.02h23.36c0,24.47,19.83,44.29,44.29,",'44.29v23.36Z"/></svg>'].join("");function Nd(e,r){let n=vd(e);return['<!doctype html><html lang="en"><head><meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1">',`<title>${n}</title><style>${BB}</style></head><body><main>`,`<span class="tile">${HB}</span>`,`<div class="copy"><h1>${n}</h1><p>${vd(r)}</p></div>`,"</main></body></html>"].join("")}function z(e){process.stdout.write(`${e}
40
- `)}function W(e){z(JSON.stringify(e,null,2))}function Ix(e){process.stderr.write(`${e}
41
- `)}var _x=["json","tsv","csv"];function ds(e){let r=_x.find(n=>n===e);if(r!==void 0)return r;throw new Error(`--output must be one of: ${_x.join(", ")} (got: ${e})`)}function fs(e){let r=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(r.length===0)throw new Error("--fields must contain at least one field name");return r}function Sx(e,r){let n=e;for(let o of r.split(".")){if(n===null||typeof n!="object"||!Object.hasOwn(n,o))return;n=n[o]}return n}function gs(e,r){let n=Object.create(null);for(let o of r){let i=Sx(e,o);if(i===void 0)continue;let a=o.split("."),c=a.pop();if(c===void 0)continue;let l=n;for(let m of a)(typeof l[m]!="object"||l[m]===null)&&(l[m]=Object.create(null)),l=l[m];l[c]=i}return n}function bx(e){return e==null?null:typeof e=="string"?e:JSON.stringify(e)}var KB={"\\":"\\\\"," ":"\\t","\r":"\\r","\n":"\\n"};function zB(e){let r=bx(e);return r===null?"":r.replace(/[\\\t\r\n]/g,n=>KB[n]??n)}function YB(e){let r=bx(e);return r===null?"":/[,"\n\r]/.test(r)?`"${r.replaceAll('"','""')}"`:r}function hs(e,r,n){if(r.length===0)return"";let o=e==="csv"?",":" ",i=e==="csv"?YB:zB,a=n.map(l=>i(l)).join(o),c=r.map(l=>n.map(m=>i(Sx(l,m))).join(o));return[a,...c].join(`
42
- `)}var xx="/oauth/callback",QB=5*Aa,WB=Nd("Login complete","You can close this tab and return to the terminal."),Iu=Nd("Login failed","Return to the terminal for details.");function ZB(e){return(0,Ld.platform)()==="darwin"?["open",[e]]:(0,Ld.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function XB(e){let[r,n]=ZB(e),o=(0,Ox.spawnSync)(r,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function JB(e,r,n){return new Promise((o,i)=>{let a=setTimeout(()=>{i(new Error("Timed out waiting for the browser to complete login (5 minutes)."))},QB),c=(l,m,f,h)=>{l.writeHead(m,{"Content-Type":"text/html"}),l.end(f),clearTimeout(a),h()};e.on("request",(l,m)=>{let f=new URL(l.url??"/",n);if(f.pathname!==xx){m.writeHead(404,{"Content-Type":"text/html"}),m.end(Iu);return}let h=f.searchParams.get("error");if(h){let I=f.searchParams.get("error_description")??"";c(m,400,Iu,()=>i(new Error(`Authorization failed: ${h}${I?` (${I})`:""}`)));return}if(f.searchParams.get("state")!==r){c(m,400,Iu,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let E=f.searchParams.get("code");if(!E){c(m,400,Iu,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(m,200,WB,()=>o(E))})})}async function Rx(e){let r=(0,Ax.createServer)();r.on("connection",a=>a.unref()),await new Promise((a,c)=>{r.once("error",c),r.listen(0,"127.0.0.1",()=>{r.off("error",c),a()})});let{port:n}=r.address(),o=`http://127.0.0.1:${n}`,i=`${o}${xx}`;try{let a=e.buildAuthorizeUrl(i);return XB(a)?z("Opening your browser to complete login..."):(z("Visit this URL in your browser to complete login:"),z(` ${a}`)),{code:await JB(r,e.state,o),redirectUri:i}}finally{r.close()}}var rr=require("node:fs"),qd=require("node:os"),Io=require("node:path");var Px=dn(require("os"),1),ys=dn(require("path"),1),wn=Px.default.homedir(),{env:_o}=process,Cx=_o.XDG_DATA_HOME||(wn?ys.default.join(wn,".local","share"):void 0),Su=_o.XDG_CONFIG_HOME||(wn?ys.default.join(wn,".config"):void 0),rLe=_o.XDG_STATE_HOME||(wn?ys.default.join(wn,".local","state"):void 0),Ux=_o.XDG_CACHE_HOME||(wn?ys.default.join(wn,".cache"):void 0),nLe=_o.XDG_RUNTIME_DIR||void 0,eH=(_o.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");Cx&&eH.unshift(Cx);var tH=(_o.XDG_CONFIG_DIRS||"/etc/xdg").split(":");Su&&tH.unshift(Su);var wx=new Set(["api.tsuga.com","api.tsuga-staging.com"]),rH=new Set(["localhost","127.0.0.1","[::1]"]);function kd(e){let r=e.replace(/\/+$/,"");if(!URL.canParse(r))throw new Error(`TSUGA_API_URL is not a URL: ${r}`);if(/[\s"'\\]/.test(r))throw new Error(`TSUGA_API_URL holds whitespace, quotes or a backslash: ${JSON.stringify(r)}`);let n=new URL(r);if(!rH.has(n.hostname)&&(n.protocol!=="https:"||!wx.has(n.hostname)))throw new Error(`Refusing to send credentials to ${r}. Set TSUGA_API_URL to ${[...wx].map(o=>`https://${o}`).join(", ")}, or a localhost URL.`);return r}var vx=require("node:child_process"),Nx=require("node:fs");var vn="tsuga-cli";var Lx="/usr/bin/secret-tool",nH="Tsuga CLI session",kx="the login keyring";function oH(){try{return(0,Nx.lstatSync)(Lx).isFile()}catch{return!1}}var iH=["DBUS_SESSION_BUS_ADDRESS","XDG_RUNTIME_DIR"];function aH(){let e={};for(let r of iH){let n=process.env[r];n!==void 0&&(e[r]=n)}return e}function Md(e,r){if(!(process.platform!=="linux"||!oH()))try{return{status:0,stdout:(0,vx.execFileSync)(Lx,e,{env:aH(),input:r,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function Dd(e){let r=Md(["lookup","service",vn,"account",e]);if(r&&r.status===0)return uu(r.stdout)}function Mx(e,r){let n=Md(["store","--label",nH,"service",vn,"account",e],`${JSON.stringify(r)}
43
- `);return!(!n||n.status!==0)}function Dx(e){return Md(["clear","service",vn,"account",e]),Dd(e)===void 0}var Gx=require("node:child_process"),$x=require("node:fs");var Fx="/usr/bin/security",jx="the macOS Keychain";function Gd(){if(process.platform!=="darwin")return!1;try{return(0,$x.lstatSync)(Fx).isFile()}catch{return!1}}function $d(e,r){try{return{status:0,stdout:(0,Gx.execFileSync)(Fx,e,{env:{},input:r,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function Fd(e){if(!Gd())return;let r=$d(["find-generic-password","-s",vn,"-a",e,"-w"]);if(r.status===0)return uu(r.stdout)}function qx(e,r){if(!Gd())return!1;let n=Buffer.from(JSON.stringify(r),"utf-8").toString("hex");return $d(["-i"],`add-generic-password -U -s ${vn} -a ${e} -X ${n}
44
- `).status===0}function Bx(e){return Gd()?($d(["delete-generic-password","-s",vn,"-a",e]),Fd(e)===void 0):!0}var sH={friendlyLocationName:jx,read:Fd,save:qx,remove:Bx},cH={friendlyLocationName:kx,read:Dd,save:Mx,remove:Dx},bu=class e extends Error{constructor(r){super(r),this.name="SecretStoreError"}static stillHoldsSession(r){return new e(`The session is still in ${r.friendlyLocationName}. Unlock it and run \`tsuga auth logout\` again.`)}};function Ts(){return process.platform==="darwin"?sH:process.platform==="linux"?cH:void 0}function Hx(e){return Ts()?.read(e)}function Kx(e,r){return Ts()?.save(e,r)??!1}function zx(e){let r=Ts();return r&&!r.remove(e)?r:void 0}var Yx=(0,Io.join)(Su??(0,Io.join)((0,qd.homedir)(),".config"),"tsuga"),bi=(0,Io.join)(Yx,"config.json"),Vx=(0,Io.join)(Ux??(0,Io.join)((0,qd.homedir)(),".cache"),"tsuga"),jd=(0,Io.join)(Vx,"update-check.json"),Es=kd("https://api.tsuga.com");function Qx(e){return qA(e.credential)}function Au(){if(!(0,rr.existsSync)(bi))return{};try{let e=JSON.parse((0,rr.readFileSync)(bi,"utf-8")),{operationApiKey:r,userAuth:n,...o}=e;return!r&&!n?e:{...o,credentials:{...e.credentials,[Es]:{...r?{operationApiKey:r}:{},...n?{userAuth:n}:{},...e.credentials?.[Es]}}}}catch{throw new Error(`Config file corrupted: ${bi}
45
- Re-authenticate with \`tsuga auth login\` or \`tsuga auth operation-key <OPERATION_API_KEY>\`.`)}}function _s(){try{return Au()}catch{return{}}}function Oi(e){(0,rr.mkdirSync)(Yx,{recursive:!0,mode:448}),(0,rr.writeFileSync)(bi,`${JSON.stringify(e,null,2)}
46
- `,{mode:384})}function Bd(e,r=Nn()){let n=e.credentials?.[r]??{};if(n.operationApiKey)return n;let o=Hx(r);return o?{...n,userAuth:o}:n}function Ou(e,r,n=Nn()){return{...e,credentials:{...e.credentials,[n]:r}}}function Nn(){return kd(process.env.TSUGA_API_URL?.trim()||Es)}function Ai(e){let r=Au(),n=Nn(),o=process.env.TSUGA_OPERATION_API_KEY,i=o?{}:Bd(r,n),a=jA({overrideKey:o,operationApiKey:i.operationApiKey,userAuth:i.userAuth}),c=r.defaults??{},l=e.clusterId?.trim()||process.env.TSUGA_CLUSTER_ID?.trim()||c.cluster?.trim()||void 0;return{apiUrl:n,credential:a,clusterId:l,defaults:c}}function Is(){return Bd(Au()).userAuth}function Wx(e,r){let n=_s(),o=Nn(),{operationApiKey:i}=n.credentials?.[o]??{},a=r&&i?{operationApiKey:i}:{},c=Ts();return c&&Kx(o,e)?(Oi(Ou(n,a,o)),c.friendlyLocationName):(Oi(Ou(n,{...a,userAuth:e},o)),bi)}function Zx(e){return Wx(e,!1)}function xu(e){Wx(e,!0)}function Xx(e){let r=_s();Oi(Ou(r,{operationApiKey:e}))}function Jx(){let e=Nn(),r=zx(e),n=_s(),o=Bd(n,e);if(Oi(Ou(n,o.operationApiKey?{operationApiKey:o.operationApiKey}:{},e)),r)throw bu.stillHoldsSession(r)}function Ru(){return bi}var eR={from:"-30m",to:"now",query:"*","max-results":"100"};function nr(e){return(Au().defaults??{})[e]??eR[e]}function tR(e,r){let n=_s();Oi({...n,defaults:{...n.defaults,[e]:r}})}function rR(){let{defaults:e,...r}=_s();Oi(r)}function nR(e,r){let n=[`API URL: ${e.apiUrl}`],{credential:o}=e;if(o){let a=o.kind;switch(a){case"operation-api-key":n.push(`Operation API key: ${o.token.slice(0,12)}...${o.token.slice(-4)}`);break;case"user-session":n.push(`User session: ${ps(o.userAuth.accessToken)} (expires ${o.userAuth.accessExpiresAt})`);break;default:Ze(a)}}else n.push("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");n.push(`Config: ${r}`),n.push(""),n.push("Defaults (custom overrides marked with *):");let i={...eR,...e.defaults};for(let[a,c]of Object.entries(i)){let l=a in e.defaults?" *":"";n.push(` ${a}: ${c}${l}`)}return`${n.join(`
38
+ ${Sd.map((o,i)=>iB(o,r===0?0:i/r)).join(`
39
+ `)}`}function zA(){return sB(process.stdout.isTTY&&!process.env.NO_COLOR)}var uR=require("node:crypto");var Od=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],Ad=["light","dark"];var aB={light:{red:{text:"foreground.red",background:"avatar.background.red"},orange:{text:"foreground.orange",background:"avatar.background.orange"},amber:{text:"foreground.amber",background:"avatar.background.amber"},yellow:{text:"foreground.yellow",background:"avatar.background.yellow"},green:{text:"foreground.green",background:"avatar.background.green"},emerald:{text:"foreground.emerald",background:"avatar.background.emerald"},teal:{text:"foreground.teal",background:"avatar.background.teal"},cyan:{text:"foreground.cyan",background:"avatar.background.cyan"},sky:{text:"foreground.sky",background:"avatar.background.sky"},blue:{text:"foreground.blue",background:"avatar.background.blue"},indigo:{text:"foreground.indigo",background:"avatar.background.indigo"},purple:{text:"foreground.purple",background:"avatar.background.purple"},pink:{text:"foreground.pink",background:"avatar.background.pink"}},dark:{red:{text:"avatar.foreground.foreground",background:"avatar.solid-background.red"},orange:{text:"avatar.foreground.foreground",background:"avatar.solid-background.orange"},amber:{text:"avatar.foreground.foreground",background:"avatar.solid-background.amber"},yellow:{text:"avatar.foreground.foreground",background:"avatar.solid-background.yellow"},green:{text:"avatar.foreground.foreground",background:"avatar.solid-background.green"},emerald:{text:"avatar.foreground.foreground",background:"avatar.solid-background.emerald"},teal:{text:"avatar.foreground.foreground",background:"avatar.solid-background.teal"},cyan:{text:"avatar.foreground.foreground",background:"avatar.solid-background.cyan"},sky:{text:"avatar.foreground.foreground",background:"avatar.solid-background.sky"},blue:{text:"avatar.foreground.foreground",background:"avatar.solid-background.blue"},indigo:{text:"avatar.foreground.foreground",background:"avatar.solid-background.indigo"},purple:{text:"avatar.foreground.foreground",background:"avatar.solid-background.purple"},pink:{text:"avatar.foreground.foreground",background:"avatar.solid-background.pink"}},gradient:{red:"var(--chakra-colors-gradient-red)",orange:"var(--chakra-colors-gradient-orange)",amber:"var(--chakra-colors-gradient-amber)",yellow:"var(--chakra-colors-gradient-yellow)",green:"var(--chakra-colors-gradient-green)",emerald:"var(--chakra-colors-gradient-emerald)",teal:"var(--chakra-colors-gradient-teal)",cyan:"var(--chakra-colors-gradient-cyan)",sky:"var(--chakra-colors-gradient-sky)",blue:"var(--chakra-colors-gradient-blue)",indigo:"var(--chakra-colors-gradient-indigo)",purple:"var(--chakra-colors-gradient-purple)",pink:"var(--chakra-colors-gradient-pink)"}},YA=["activity-heart","activity","airplay","airpods","alarm-clock","anchor","annotation-dots","annotation-heart","annotation-question","annotation","announcement-03","asterisk-01","atom-01","atom-02","award-03","award-04","award-05","backpack","bank-note-01","bank-note-02","bank-note-03","battery-charging-01","beaker-01","beaker-02","bell-03","bell-04","bell-ringing-03","bell-ringing-04","bluetooth-connect","bluetooth-on","book-closed","book-open-01","book-open-02","bookmark","briefcase-01","briefcase-02","brush-01","brush-02","brush-03","building-01","building-02","building-03","building-08","bus","calculator","calendar-check-01","calendar-date","calendar-heart-01","calendar","camera-01","camera-lens","car-01","certificate-01","certificate-02","check-heart","clipboard-attachment","clipboard-check","clipboard-download","clipboard","clock-snooze","clock-stopwatch","cloud-01","cloud-lightning","cloud-moon","cloud-raining-01","cloud-raining-03","cloud-raining-05","cloud-raining-06","cloud-snowing-01","cloud-sun-01","cloud-sun-02","cloud-sun-03","code-browser","code-circle-01","code-circle-02","code-circle-03","code-square-01","code-square-02","coins-hand","coins-stacked-01","colors","compass-01","compass-02","compass-03","compass","credit-card-01","credit-card-02","cube-02","cube-04","cube-outline","currency-bitcoin-circle","currency-dollar-circle","currency-ethereum-circle","currency-euro-circle","currency-pound-circle","currency-ruble-circle","currency-rupee-circle","currency-yen-circle","cursor-click-01","cursor-click-02","diamond-01","diamond-02","dice-1","dice-2","dice-3","dice-4","dice-5","dice-6","disc-01","disc-02","droplets-01","droplets-02","droplets-03","dropper","face-content","face-frown","face-happy","face-neutral","face-sad","face-smile","face-wink","feather","file-02","file-05","file-06","file-heart-01","file-heart-02","file-search-01","file-search-02","file-search-03","film-01","film-02","fingerprint-03","fingerprint-04","flag-01","flag-04","flash-off","flash","gaming-pad-01","gaming-pad-02","gift-01","glasses-01","glasses-02","globe-03","globe-04","globe-05","globe-06","globe-slated-01","globe-slated-02","graduation-hat-01","graduation-hat-02","hash-01","hash-02","headphones-01","headphones-02","heart-circle","heart-hand","heart-hexagon","heart-octagon","heart-rounded","heart-square","hearts","hexagon-01","hexagon-02","home-03","home-smile","hourglass-01","hourglass-02","hourglass-03","hurricane-01","hurricane-02","hurricane-03","image-01","image-02","image-03","image-04","image-05","keyboard-01","laptop-01","life-buoy-01","life-buoy-02","lightbulb-02","lightbulb-03","lightbulb-04","lock-keyhole-circle","lock-keyhole-square","luggage-01","luggage-02","luggage-03","magic-wand-01","magic-wand-02","map-01","map-02","mark","marker-pin-01","marker-pin-04","marker-pin-05","marker-pin-06","medical-circle","medical-cross","medical-square","message-chat-square","message-notification-square","message-smile-square","message-text-square-02","microphone-01","microphone-02","microscope","modem-01","modem-02","monitor-03","monitor-04","monitor-05","moon-01","moon-eclipse","moon-star","music-note-01","music-note-02","music-note-plus","octagon","palette","paperclip","pentagon","phone-01","phone-02","phone-call-01","phone","piggy-bank-01","pin-01","pin-02","plane","play-circle","play-square","podcast","power-02","presentation-chart-01","printer","receipt","recording-01","recording-02","recording-03","rocket-01","rocket-02","roller-brush","rss-01","rss-02","ruler","scales-01","scales-02","server-06","shield-01","shield-02","shield-03","shield-dollar","shield-zap","shopping-bag-01","shopping-cart-01","signal-01","signal-02","signal-03","simcard","sliders-01","sliders-02","snowflake-01","snowflake-02","speaker-01","speaker-02","speaker-03","speedometer-01","speedometer-02","speedometer-03","speedometer-04","square","stand","star-03","star-07","sticker-circle","sticker-square","sun-setting-01","sun-setting-02","sun-setting-03","sun","sunrise","sunset","tablet-01","tag-01","tag-02","tag-03","target-01","target-02","target-03","target-04","target-05","terminal-browser","terminal-circle","terminal-square","thermometer-02","thermometer-03","thermometer-cold","thermometer-warm","thumbs-down","thumbs-up","ticket-01","tool-01","tool-02","train","tram","translate-01","triangle","trophy-01","trophy-02","truck-01","truck-02","tv-02","umbrella-01","umbrella-02","umbrella-03","virus","voicemail","wallet-01","wallet-02","wallet-05","watch-circle","watch-square","waves","webcam-01","webcam-02","wind-01","wind-02","wind-03","youtube","zap-circle","zap-fast","zap"];var gwe=aB.light.red.background;var cB=["allowed-domains","cluster-integration-config","custom-role","custom-usage-tag","database","databricks-connection","explorer-saved-view","github-connection","host","inventory","llm-provider","monitor-alert","monitor-debugging","oauth-grant","org","retention-policy","saml-config","sensitive-data-scanner-rule","service","service-target","team-remap-config","user-self","widget-share"],pB=["adaptive-notification-rule","audit-log","cloud-account","dashboard-folder","dashboard-report","dashboard-share","dashboard","ingestion-api-key","investigation","log-route","metric-route","monitor","notebook","notification-integration","notification-rule","notification-silence","operation-api-key","quality-report","rum-public-token","sandbox-environment","slo","tag-policy","team-members","team","user-data","user-invitation","user-permissions"],uB=["log","metric","trace","rum"],xd=[...pB,...uB],Iwe=[...cB,...xd];var bi=["admin","public_editor","public_viewer","teams_only"],ir=["admin","editor","viewer"];var To="/v0/team-membership",Rd="Role granted to the user inside this team. `admin` gives full team control, including managing assets, members, and settings. `editor` can view and update most team assets (dashboards, monitors, etc.) but cannot manage members or settings. `viewer` can view team data but cannot make changes.",Cd=t.Object({id:t.String({description:"Tsuga-generated team membership ID assigned when the membership is created."}),userId:t.String({description:"User ID that belongs to the team."}),teamId:t.String({description:"Team ID that contains the user."}),roleKey:t.Enum(ir,{description:Rd})}),VA=t.Object({userId:p({allowEmpty:!1,description:"User ID to add to or update in the team."}),teamId:p({allowEmpty:!1,description:"Team ID receiving the membership change."}),roleKey:t.Enum(ir,{description:Rd})}),lB=t.Object({userId:p({allowEmpty:!1,description:"User ID to remove from the team."}),teamId:p({allowEmpty:!1,description:"Team ID to remove the user from."})}),mB=t.Optional(t.Object({userId:t.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this user ID."})),teamId:t.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this team ID."}))})),Swe=d({tags:["access-control"],url:To,method:"GET",query:mB,response:t.Array(Cd)}),bwe=d({tags:["access-control"],url:To,method:"POST",body:VA,response:Cd}),Owe=d({tags:["access-control"],url:To,method:"PUT",body:VA,response:Cd}),Awe=d({tags:["access-control"],url:To,method:"DELETE",body:lB,response:w}),du=500,QA=t.Object({teamId:p({allowEmpty:!1,description:"Team ID receiving all requested memberships."}),members:t.Array(t.Object({userId:t.Optional(p({allowEmpty:!1,description:"Existing user ID to add to the team."})),userEmail:t.Optional(p({allowEmpty:!1,type:"email",description:"Existing user email to resolve and add to the team."})),roleKey:t.Enum(ir,{description:Rd})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:du,description:"Users to add to the team. Each item must include either `userId` or `userEmail`, not both. Duplicate identifiers (including a `userId` and `userEmail` that resolve to the same user) are rejected. Items are processed independently: an unresolved user does not stop other items from being added."})},{description:"Bulk team-membership creation request. Provide one target team and the users to add by ID or email, with a role for each user."}),dB={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(QA,{examples:[dB]});var WA=t.Object({results:t.Array(t.Object({userId:t.String({description:"Resolved user ID for this bulk add result. For `user_not_found`, this is the submitted user ID or email that Tsuga could not resolve."}),status:t.Enum(["added","already_member","user_not_found"],{description:"`added` means the membership was created, `already_member` means no change was needed, and `user_not_found` means Tsuga could not resolve the requested user."})}))},{description:"Per-user result summary for a bulk team-membership add request."}),fB={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(WA,{examples:[fB]});var xwe=d({tags:["access-control"],url:`${To}/bulk-add`,method:"POST",body:QA,response:WA}),Rwe=d({tags:["access-control"],url:`${To}/bulk-update-user-roles`,method:"PUT",body:t.Object({userIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:du}),teamId:p({allowEmpty:!1}),role:t.Enum(ir)}),response:t.Object({})}),ZA=t.Object({teamId:p({allowEmpty:!1,description:"Team ID to remove the requested users from."}),userIds:t.Optional(t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:du,description:"User IDs to remove from the team. Items are processed independently: a user who is not a member or cannot be resolved does not stop the other items from being removed."})),userEmails:t.Optional(t.Array(p({allowEmpty:!1,type:"email"}),{minItems:1,maxItems:du,description:"User emails to resolve and remove from the team."}))},{oneOf:[{required:["userIds"]},{required:["userEmails"]}],description:"Bulk team-membership removal request. Provide one target team and either `userIds` or `userEmails`, not both, with no duplicates."}),gB={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(ZA,{examples:[gB]});var XA=t.Object({results:t.Array(t.Object({userId:t.String({description:"Resolved user ID for this bulk remove result. For `user_not_found`, this is the submitted user ID or email that Tsuga could not resolve."}),status:t.Enum(["removed","not_member","user_not_found"],{description:"`removed` means the membership was deleted, `not_member` means no membership existed, and `user_not_found` means Tsuga could not resolve the requested user."})}))},{description:"Per-user result summary for a bulk team-membership removal request."}),hB={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(XA,{examples:[hB]});var Cwe=d({tags:["access-control"],url:`${To}/bulk-remove`,method:"DELETE",body:ZA,response:XA});var yB="^\\S(.*\\S)?$",TB=50,EB=128,_B=256,IB=t.Object({key:t.String({description:"Tag key attached to the resource. Consumers can use key/value tags for filtering, ownership context, and policy checks."}),value:t.String({description:"Tag value attached to the resource for this key. Tsuga returns the value exactly as stored."})},{title:"Tag"}),SB=t.Object({key:t.String({maxLength:EB,description:"Tag key to attach to the resource."}),value:t.String({maxLength:_B,pattern:yB,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),It=t.Array(IB,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),St=t.Array(SB,{title:"Tags",maxItems:TB,description:"Key/value tags to apply to the resource. Tag policies may require specific keys or values."}),we=t.Optional(It),De=t.Optional(St);var Rn="/v0/teams",hu=["public","private"],fu={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},bB=t.Enum([fu.NAME,fu.CREATED_AT,fu.MEMBER_COUNT,fu.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),yu=t.Object({color:t.Enum(Od,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:t.Enum(Ad,{description:"Avatar rendering mode selected for the team."}),iconName:t.Enum(YA,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),Oi=t.Object({color:t.Enum(Od),mode:t.Enum(Ad)}),JA=100,ex=250,Cn=t.Object({id:t.String({description:"Unique identifier of the team. Generated by Tsuga and stable for the team lifetime."}),name:t.String({description:"Human-readable team name displayed throughout Tsuga and used in team search."}),description:t.Optional(t.String({description:"Optional free-text description of the team."})),visibility:t.Enum(hu,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:we,createdAt:S({description:"Timestamp when Tsuga created the team."}),updatedAt:S({description:"Timestamp when Tsuga last updated the team metadata."}),memberCount:t.Optional(t.Number({description:"Number of members currently in the team"})),avatar:t.Optional(yu)}),Tu=t.Object({name:t.String({minLength:1,maxLength:JA,format:_i,description:`Name to assign to the team. Must be kebab-case (lowercase letters, numbers, and dashes only) and unique in the organization. Maximum length is ${JA} characters.`}),description:Se(t.String({maxLength:ex}),{description:`Optional team description. Maximum length is ${ex} characters.`}),visibility:t.Enum(hu,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:De,avatar:Se(yu)}),OB=t.Object({id:t.String(),name:t.String(),email:t.String(),role:t.Enum(ir),joinedTeamAt:S(),orgRole:t.Enum(bi),avatar:t.Optional(Oi)}),tx=t.Object({searchQuery:t.Optional(p({description:"Substring matched against team names and descriptions."})),visibility:t.Optional(t.Enum(hu,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:t.Optional(t.Boolean({description:"If true, return only teams that include the authenticated user."}))}),Fwe=d({tags:["teams"],url:Rn,method:"GET",paginated:!0,response:t.Array(Cn),query:t.Object({...ne,includeMemberCount:t.Optional(t.Boolean()),...tx.properties,sortBy:t.Optional(bB),sortDirection:t.Optional(K)})}),jwe=d({tags:["teams"],url:`${Rn}/:id`,method:"GET",params:t.Object({id:p()}),response:Cn}),gu={NAME:"name",ROLE:"role",ORG_ROLE:"orgRole",JOINED_TEAM_AT:"joinedTeamAt"},AB=t.Enum([gu.NAME,gu.ROLE,gu.ORG_ROLE,gu.JOINED_TEAM_AT]),qwe=d({tags:["teams"],url:`${Rn}/:id/members`,method:"GET",paginated:!0,params:t.Object({id:p()}),query:t.Object({...ne,searchQuery:t.Optional(p({description:"Substring matched against member names and emails."})),teamRole:t.Optional(t.Array(t.Enum(ir),{maxItems:ir.length,uniqueItems:!0,description:"Restrict results to members with one of these team roles."})),sortBy:t.Optional(AB),sortDirection:t.Optional(K)}),response:t.Array(OB)}),Bwe=d({tags:["teams"],url:`${Rn}/:id/assets`,method:"GET",params:t.Object({id:p()}),response:t.Object({apiKeyCount:t.Number(),logRouteCount:t.Number(),monitorCount:t.Number(),notificationRuleCount:t.Number(),dashboardCount:t.Number(),sloCount:t.Number()})}),Hwe=d({tags:["teams"],url:Rn,method:"POST",body:Tu,response:Cn}),Kwe=d({tags:["teams"],url:`${Rn}/:id`,method:"PUT",params:t.Object({id:p()}),body:Tu,response:Cn}),xB=x("type",[t.Object({type:t.Literal("ids"),teamIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:100})}),t.Object({type:t.Literal("all"),filters:t.Optional(tx)})]),zwe=d({tags:["teams"],url:`${Rn}/bulk-update`,method:"POST",body:t.Object({selection:xB,config:t.Object({visibility:t.Enum(hu)})}),response:t.Object({})}),Ywe=d({tags:["teams"],url:`${Rn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w});var RB=t.Enum(["agent","cli","mcp-codemode","mcp-server","tadmin","terraform-provider","web-frontend"],{description:"Tsuga client surface that performed the operation. Use this to distinguish UI, CLI, MCP, and Terraform-originated changes."}),pe=x("type",[t.Object({type:t.Literal("user",{description:"The resource was created or updated by a user."}),id:t.String({description:"Unique identifier of the user actor."}),name:t.String({description:"Display name of the user actor at the time of response."}),avatar:t.Optional(Oi)}),t.Object({type:t.Literal("operation-api-key",{description:"The resource was created or updated by an operation API key."}),id:t.String({description:"Unique identifier of the operation API key actor."}),name:t.String({description:"Display name of the operation API key actor."}),source:t.Optional(RB)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var Pd=["all","owning-team-and-public","owning-team-only"],Pn=t.Enum(Pd,{description:"`all` allows the resource to query all permitted telemetry, `owning-team-and-public` limits it to the owning team plus public data, and `owning-team-only` limits it to the owning team."});var la="/v0/operation-api-keys";var CB=100,Eu=t.Enum(Pd,{description:"Team-access boundary for the operation API key. Set when the key is created or updated. `all` can reach all teams, `owning-team-and-public` can reach the owning team and public teams, and `owning-team-only` can reach only the owning team."}),Un=e=>t.Literal("read",{description:e}),rt=e=>t.Enum(["read","write"],{description:e}),_u=t.Partial(t.Object({investigations:rt("Investigations, the records collecting the timeline and findings of an incident analysis."),dashboard:rt("Dashboards and the graphs they contain."),"dashboard-folder":rt("Folders organizing dashboards."),documentation:Un("Tsuga documentation and API reference pages, which are public content rather than account data."),"ingestion-api-key":rt("Ingestion API keys, used to send telemetry data to Tsuga."),"rum-public-token":rt("RUM public tokens, embedded in web and mobile applications to send real user monitoring telemetry."),inventory:Un("Cloud resources discovered by inventory scans."),"cloud-account":rt("Cloud accounts Tsuga scans to discover resources."),logs:Un("Ingested log events, through search and aggregation endpoints."),"log-route":rt("Log routes, which select newly ingested logs and apply processors to them."),metrics:Un("Ingested metrics, through query and aggregation endpoints."),"metric-route":rt("Metric routes, which select newly ingested metrics by name and apply processors to them."),monitor:rt("Monitors, the alert definitions evaluated against telemetry."),"allowed-domains":rt("Email domains whose users are allowed to join the organization."),"quality-report":Un("Telemetry quality reports."),service:Un("Services of the catalog, inferred from telemetry."),"service-target":rt("Notification targets attached to a service."),slo:rt("Service level objectives and the alerts attached to them."),"notification-rule":rt("Notification rules, which route alert transitions to notification targets."),"notification-integration":rt("Notification integrations, containing the credentials Tsuga uses when sending notifications."),"notification-silence":rt("Notification silences, which suppress matching notification delivery."),"custom-usage-tag":rt("Custom usage tags, the telemetry tag keys tracked as usage dimensions."),"retention-policy":rt("Retention policies applied to logs, metrics, and traces."),"tag-policy":rt("Tag policies, which enforce tag requirements on Tsuga-managed assets and telemetry data."),team:rt("Teams and their settings."),"team-membership":rt("Team memberships, each pairing a user with a team role."),traces:Un("Ingested spans, through search and aggregation endpoints."),rum:Un("Ingested RUM events, through aggregation endpoints."),user:rt("User accounts of the organization."),"user-invitation":rt("Invitations for people who do not belong to the organization yet.")}),{description:"Resource types the key can act on, each mapped to `read` or `write`. `write` also grants read access. A resource type absent from the map is not accessible to the key at all."}),Ud=t.Object({id:t.String(),name:t.String(),owner:t.String(),tags:we,scope:Eu,permissions:_u,keyLastCharacters:t.String(),updatedAt:S(),createdAt:S(),creator:t.Optional(pe),updater:t.Optional(pe),expiresAt:t.Optional(S()),lastUsedAt:t.Optional(S())}),rx=t.Object({name:t.String({minLength:1,maxLength:CB}),owner:p({allowEmpty:!1}),tags:De,scope:Eu,permissions:_u,expiresAt:Se(p({allowEmpty:!1,type:"date-time"}))}),cve=d({tags:["operation-api-keys"],url:la,method:"POST",body:rx,response:t.Intersect([Ud,t.Object({key:t.String()})])}),pve=d({tags:["operation-api-keys"],url:la,method:"GET",response:t.Array(Ud)}),uve=d({tags:["operation-api-keys"],url:`${la}/:id`,method:"PUT",params:t.Object({id:p()}),body:rx,response:Ud}),lve=d({tags:["operation-api-keys"],url:`${la}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),mve=d({tags:["operation-api-keys"],url:`${la}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p({allowEmpty:!1}),{uniqueItems:!0})}),response:t.Object({})});var PB=["logs","metrics","traces","profiling","analytics","dashboards","notebooks","ongoing-alerts","slo","monitor","notification-rules","notification-silences","notification-integrations","investigations","routes","sensitive-data-scanner","ai-sandboxes","inventory","services","rum","browser-views","mobile","sessions","host-catalog","kubernetes","ecs","serverless"],nx=t.Enum(PB,{description:"Stable nav item key within a main sidebar category."}),ox=t.Array(nx,{description:"Nav item keys shown in the primary sidebar for this category, in display order."}),ix=t.Optional(t.Array(nx,{description:"Nav item keys for this category that are folded away (e.g. View more). Omitted or empty means none."})),sx="Stable category id. Unknown or renamed ids are ignored by the client catalog.",ax="Sidebar categories in display order. Unknown or renamed ids are ignored by the client catalog.",cx=t.Object({categories:t.Array(t.Object({id:t.String({description:sx}),visible:ox,folded:ix}),{description:ax})}),px=t.Object({categories:t.Array(t.Object({id:p({allowEmpty:!1,description:sx}),visible:ox,folded:ix}),{description:ax})});var ux=["YYYY-MM-DD","DD-MM-YYYY","MM-DD-YYYY"],lx=["12h","24h"],NB=t.Union([t.Object({type:t.Literal("home")}),t.Object({type:t.Literal("explorer")}),t.Object({type:t.Literal("metrics")}),t.Object({type:t.Literal("traces")}),t.Object({type:t.Literal("analytics")}),t.Object({type:t.Literal("dashboards"),id:t.String()}),t.Object({type:t.Literal("ongoing-alerts")}),t.Object({type:t.Literal("services")}),t.Object({type:t.Literal("rum-views")}),t.Null()]),wB=t.Union([x("type",[t.Object({type:t.Literal("home")}),t.Object({type:t.Literal("explorer")}),t.Object({type:t.Literal("metrics")}),t.Object({type:t.Literal("traces")}),t.Object({type:t.Literal("analytics")}),t.Object({type:t.Literal("dashboards"),id:p()}),t.Object({type:t.Literal("ongoing-alerts")}),t.Object({type:t.Literal("services")}),t.Object({type:t.Literal("rum-views")})]),t.Null()]),Zr=t.Object({email:t.String({description:"Lowercase email address for the user. Use this for display and invitation matching, not as a stable identifier."}),id:t.String({description:"Unique identifier of the user. Generated by Tsuga and stable for the user lifetime."}),name:t.String({description:"Display name of the user."}),role:t.Enum(bi,{description:"Organization role for the user: `admin`, `public_editor`, `public_viewer`, or `teams_only`."}),orgId:t.String({description:"Identifier of the Tsuga organization the user belongs to."}),orgName:t.Optional(t.String({description:"Display name of the Tsuga organization the user belongs to. Absent when the organization record cannot be resolved."})),avatar:t.Optional(Oi),defaultView:t.Optional(NB),timezone:t.Optional(t.Union([t.String(),t.Null()],{description:"IANA timezone used to display dates and times (e.g. `Europe/Paris`). Absent or `null` means the timezone is auto-detected from the browser."})),dateFormat:t.Optional(t.Union([t.Enum(ux),t.Null()],{description:"Preferred format for displaying dates: `YYYY-MM-DD`, `DD-MM-YYYY`, or `MM-DD-YYYY`. Absent or `null` means the Tsuga default format."})),hourFormat:t.Optional(t.Union([t.Enum(lx),t.Null()],{description:"Preferred format for displaying times: `12h` (AM/PM) or `24h`. Absent or `null` means the Tsuga default format."})),favoriteDashboards:t.Optional(t.Array(t.String(),{description:"Dashboard IDs the user marked as favorites. Not pruned when a dashboard is deleted, so an ID may no longer resolve."})),favoriteFolders:t.Optional(t.Array(t.String(),{description:"Dashboard folder IDs the user marked as favorites. Not pruned when a folder is deleted, so an ID may no longer resolve."})),filterDataByTeams:t.Optional(t.Boolean({description:"Whether the user wants data across the application filtered to the teams they belong to. Set by the user in their profile settings."})),sidebarNavLayout:t.Optional(cx),fromSso:t.Boolean({description:"Whether the user account was provisioned or authenticated through SSO."}),createdAt:S({description:"Timestamp when Tsuga created the user."}),updatedAt:S({description:"Timestamp when Tsuga last updated the user."}),teamIds:t.Optional(t.Array(t.String(),{description:"Team IDs the user currently belongs to."}))}),mx=t.Intersect([Cn,t.Object({userRole:t.Enum(ir)})]),dx=t.Object({status:t.Literal("authenticated"),token:t.String(),user:Zr}),fx=x("status",[dx,t.Object({status:t.Literal("mfa-required"),mfaToken:t.String({description:"Short-lived token accepted only by the TOTP login endpoints; it grants no other access."}),totpEnrolled:t.Boolean({description:"False when the user still has to set up an authenticator app."})})]),Rve=d({tags:["users"],url:"/v0/login",method:"POST",body:t.Object({email:p({type:"email"}),password:p({type:"long"})}),response:fx}),gx="/v0/login/totp",Cve=d({tags:["users"],url:`${gx}/setup`,method:"POST",body:t.Object({mfaToken:p({type:"long"})}),response:t.Object({mfaToken:t.String({description:"Replaces the login MFA token; pass it when verifying the first code."}),secret:t.String({description:"Base32 secret for manual entry in the authenticator app."})})}),Pve=d({tags:["users"],url:gx,method:"POST",body:t.Object({mfaToken:p({type:"long"}),code:t.String({pattern:`^[0-9]{${6}}$`,description:"The 6-digit code shown by the authenticator app."})}),response:dx}),Uve=d({tags:["users"],url:"/v0/forgot-password",method:"POST",body:t.Object({email:p({type:"email"})}),response:t.Object({})}),Nve=d({tags:["users"],url:"/v0/reset-password",method:"POST",body:t.Object({resetToken:p(),password:p({type:"user-password"})}),response:t.Object({})}),vB=["active","expired"],wve=d({tags:["users"],url:"/v0/reset-password-status/:resetToken",method:"GET",params:t.Object({resetToken:p()}),response:t.Object({status:t.Enum(vB)})}),vve=d({tags:["users"],url:"/v0/change-password",method:"POST",body:t.Object({currentPassword:p({type:"long"}),newPassword:p({type:"user-password"})}),response:t.Object({})}),Eo="/v0/users",Nd="/v0/current-user",Lve=d({tags:["users"],url:Nd,method:"GET",response:Zr}),kve=d({tags:["users"],url:`${Nd}/teams`,method:"GET",response:t.Array(mx)}),Mve=d({tags:["users"],url:"/v0/logout",method:"POST",response:t.Object({})}),Dve=d({tags:["users"],method:"PATCH",url:Nd,body:t.Partial(t.Object({avatar:t.Union([Oi,t.Null()]),defaultView:wB,timezone:t.Union([t.String({format:ho}),t.Null()]),dateFormat:t.Union([t.Enum(ux),t.Null()]),hourFormat:t.Union([t.Enum(lx),t.Null()]),favoriteDashboards:t.Array(p({allowEmpty:!1})),favoriteFolders:t.Array(p({allowEmpty:!1})),filterDataByTeams:t.Boolean(),sidebarNavLayout:t.Union([px,t.Null()]),name:p()}),{minProperties:1}),response:Zr}),Gve=d({tags:["users"],url:Eo,method:"GET",response:t.Array(Zr),query:t.Optional(t.Object({includeTeamIds:t.Optional(t.Boolean())}))}),ma={NAME:"name",ROLE:"role",LOGIN_METHOD:"fromSso",TEAMS:"teams",CREATED_AT:"createdAt"},hx=t.Partial(t.Object({searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring to match against the member name or email."})},{description:"Substring matched against the member name or email"})},{description:"Optional filters applied to narrow the returned members"})),LB=t.Partial(t.Object({...ne,includeTeamIds:t.Boolean({description:"When true, include the IDs of the teams each member belongs to."}),filters:hx,sort:t.Object({by:t.Enum([ma.NAME,ma.ROLE,ma.LOGIN_METHOD,ma.TEAMS,ma.CREATED_AT],{description:"Field to sort the returned members by"}),direction:K},{description:"Optional sorting applied to the returned members"})})),$ve=d({tags:["users"],url:`${Eo}/query`,method:"POST",paginated:!0,response:t.Array(Zr),body:LB}),{teamIds:Fve,...kB}=Zr.properties,MB=t.Object({...kB,teams:t.Optional(t.Array(mx))}),jve=d({tags:["users"],url:`${Eo}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),query:t.Optional(t.Object({includeTeamRoles:t.Optional(t.Boolean())})),response:MB}),DB=Qt(hx),qve=d({tags:["users"],method:"PUT",url:`${Eo}/bulk-update-role`,body:t.Object({selection:DB,role:t.Enum(bi)}),response:t.Object({})}),Bve=d({tags:["users"],url:`${Eo}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),Hve=d({tags:["users"],url:`${Eo}/:id/totp`,method:"DELETE",params:t.Object({id:p()}),response:w}),Kve=d({tags:["users"],url:`${Eo}/all-emails`,method:"GET",response:t.Array(t.String())}),yx=["pending","accepted","expired","revoked"],GB=t.Enum(yx),_o="/v0/invitations",$B=10,FB=t.Object({email:p({type:"email",description:"Lowercase email address to invite into the organization."}),teamId:p({description:"Team ID to add the invited user to after acceptance."}),teamRole:t.Enum(ir,{description:"Role the invited user receives in the target team once accepted: `admin`, `editor`, or `viewer`."}),userRole:t.Enum(bi,{description:"Organization role the invited user receives after acceptance: `admin`, `public_editor`, `public_viewer`, or `teams_only`."})}),zve=d({tags:["invitations"],url:`${_o}/create`,method:"POST",body:t.Array(FB,{maxItems:$B}),response:t.Object({success:t.Boolean(),message:t.String()})}),Yve=d({tags:["invitations"],url:`${_o}/resend/:id`,params:t.Object({id:p()}),method:"POST",response:t.Object({success:t.Boolean(),message:t.String()})}),Tx=t.Partial(t.Object({searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring to match against the invitation email, team name, or status."})},{description:"Substring matched against the invitation email, team name, or status"})},{description:"Optional filters applied to narrow the returned invitations"})),jB=Qt(Tx),Vve=d({tags:["invitations"],url:`${_o}/bulk-resend`,method:"POST",body:t.Object({selection:jB}),response:t.Object({success:t.Boolean(),message:t.String()})}),Qve=d({tags:["invitations"],url:_o,method:"POST",body:t.Object({secret:p()}),response:t.Object({status:GB,email:t.String(),teamName:t.Optional(t.String()),avatar:t.Optional(yu)})}),Wve=d({tags:["invitations"],url:`${_o}/accept`,method:"POST",body:t.Object({name:p({type:"short"}),password:p({type:"user-password"}),secret:p()}),response:fx}),Zve=d({tags:["invitations"],url:`${_o}/revoke/:id`,params:t.Object({id:p()}),method:"POST",response:t.Object({success:t.Boolean(),message:t.String()})}),qB=t.Object({id:t.String({description:"Unique identifier of the invitation. Generated by Tsuga."}),email:t.String({description:"Email address invited to join the organization."}),teamId:t.Optional(t.String({description:"Team ID assigned when the invitation is accepted."})),teamRole:t.Optional(t.Enum(ir,{description:"Team role assigned when the invitation is accepted: `admin`, `editor`, or `viewer`."})),createdBy:t.Optional(t.String({description:"User ID that created the invitation."})),status:t.Enum(yx,{description:"Invitation lifecycle status: `pending`, `accepted`, `expired`, or `revoked`. `expired` can be computed from `expiresAt` when invitations are listed."}),expiresAt:S({description:"Timestamp when the invitation expires if not accepted."}),createdAt:S({description:"Timestamp when Tsuga created the invitation."}),updatedAt:S({description:"Timestamp when Tsuga last updated the invitation."})}),Iu={EMAIL:"email",TEAM:"team",STATUS:"status",CREATED_AT:"createdAt"},BB=t.Partial(t.Object({...ne,filters:Tx,sort:t.Object({by:t.Enum([Iu.EMAIL,Iu.TEAM,Iu.STATUS,Iu.CREATED_AT],{description:"Field to sort the returned invitations by"}),direction:K},{description:"Optional sorting applied to the returned invitations"})})),Xve=d({tags:["invitations"],url:`${_o}/query`,method:"POST",paginated:!0,response:t.Array(qB),body:BB});var HB=`/${"v1"}/me`,Ex=t.Object({type:t.Literal("operation-api-key",{description:"Credential type for this response variant. Set by Tsuga from the bearer token used on the request. Returned as `operation-api-key` when the request authenticated with an operation API key."}),id:t.String({description:"Unique identifier of the operation API key. Generated by Tsuga when the key is created. Use this as the stable key identifier when correlating API calls with audit logs or key-management records."}),name:t.String({description:"Display name of the operation API key. Set by the user who created or last updated the key. Returned for every operation-key-authenticated request so clients can show which saved key is active."}),owner:t.String({description:"Identifier of the team that owns the operation API key. Set when the key is created or updated. Combined with `scope`, it determines which team-owned resources the key can reach."}),scope:Eu,permissions:_u,keyLastCharacters:t.String({description:"Last characters of the operation API key secret. Set by Tsuga from the generated secret and returned because the full secret is only shown once at creation. Use this to distinguish saved keys without exposing the secret."}),expiresAt:t.Optional(S({description:"Timestamp after which the operation API key stops authenticating. Set when the key is created or updated. Returned only for keys that have an expiration date."}))},{$id:"OperationApiKeyIdentity",description:"Identity and effective access for the operation API key used on the request. Returned when the bearer token is an operation API key. See [API keys](/documentation/account-and-settings/api-keys)."}),KB={type:"operation-api-key",id:"key-123-abc",name:"ci-deploy",owner:"team-123-abc",scope:"owning-team-and-public",permissions:{dashboard:"write",logs:"read",monitor:"read"},keyLastCharacters:"a9f2",expiresAt:"2026-12-01T00:00:00.000Z"};Object.assign(Ex,{examples:[KB]});var _x=t.Object({type:t.Literal("user",{description:"Credential type for this response variant. Set by Tsuga from the bearer token used on the request. Returned as `user` when the request authenticated with a user OAuth access token."}),...t.Pick(Zr,["id","email","name","role","orgId","orgName"]).properties,...t.Required(t.Pick(Zr,["favoriteDashboards","favoriteFolders"])).properties},{$id:"UserIdentity",description:"Identity for the user OAuth access token used on the request. Returned when the bearer token is a user access token. Access follows the user organization role rather than an operation-key permission map. See [Members](/documentation/account-and-settings/members)."}),zB={type:"user",id:"user-123-abc",email:"john@tsuga.com",name:"John Doe",role:"public_viewer",orgId:"org-123-abc",orgName:"Acme Inc.",favoriteDashboards:["dashboard-123-abc"],favoriteFolders:["folder-123-abc"]};Object.assign(_x,{examples:[zB]});var YB=x("type",[Ex,_x],{description:"Identity and access for the credential used on the request. Returned for any valid public API credential and discriminated by `type` because the API accepts both operation API keys and user OAuth access tokens."}),Ix=d({description:"Retrieves the identity and access of the credential the request authenticated with. Use this to check which scope and permissions an operation API key carries before calling other endpoints, or to confirm which user an OAuth access token belongs to. Any valid public API credential can call this endpoint without additional resource permissions.",operationId:"getMe",tags:["public","authentication"],url:HB,method:"GET",response:YB});var da=require("node:crypto");function VB(e){return(0,da.createHash)("sha256").update(e).digest("base64url")}function Sx(){let e=(0,da.randomBytes)(32).toString("base64url");return{verifier:e,challenge:VB(e)}}var Rx=require("node:child_process"),Cx=require("node:http"),Ld=require("node:os");var QB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function wd(e){return e.replace(/[&<>"']/g,r=>QB[r]??r)}var WB=[":root{color-scheme:light dark;--bg:#f9fafb;--card:#fff;--fg:#1f2937;--fg-muted:#6b7280;","--logo-1:#08cb00;--logo-2:#008200;--brand:#08cb00;--bloom:#e5e7eb}","@media(prefers-color-scheme:dark){:root{--bg:#18181b;--card:#202023;--fg:#e4e4e7;","--fg-muted:#a1a1aa;--logo-1:#fff;--logo-2:#fff;--bloom:#52525b}}","*{box-sizing:border-box}","body{margin:0;min-height:100vh;display:flex;align-items:flex-start;justify-content:center;","padding:24px;padding-top:14vh;font-family:Inter,system-ui,-apple-system,'Segoe UI',sans-serif;","color:var(--fg);background-color:var(--bg);background-image:","radial-gradient(72% 78% at 104% 112%,var(--brand) -20%,transparent 64%),","radial-gradient(46% 46% at 94% -4%,var(--brand) -20%,transparent 64%),","radial-gradient(48% 58% at -8% 68%,var(--bloom) -20%,transparent 64%)}","main{display:flex;flex-direction:column;align-items:center;text-align:center;gap:24px;","width:100%;max-width:480px;padding:32px;border-radius:8px;backdrop-filter:blur(8px);","background-color:color-mix(in srgb,var(--card) 55%,transparent);","box-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1)}",".tile{display:flex;padding:6px;border-radius:6px;background-color:var(--card);","box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)}",".tile svg{display:block;width:32px;height:32px}",".copy{display:flex;flex-direction:column;gap:8px}","h1{margin:0;font-size:29px;font-weight:600;line-height:1.2}","p{margin:0;font-size:14px;line-height:20px;color:var(--fg-muted)}"].join(""),ZB=['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 111.94 133.41" aria-hidden="true">','<path fill="var(--logo-2)" d="M40.66,54.06c-11.32,8.54-25.39,13.61-40.66,13.61v-23.36c17.9,0,','33.3-10.6,40.29-25.87v28.28c0,2.48.13,4.93.37,7.34Z"/>','<path fill="var(--logo-2)" d="M67.65,103.01v30.4h-23.36v-35.58c-11.87,10.29-27.34,16.54-44.29,','16.54v-23.36c19.33,0,35.76-12.37,41.8-29.63,3.5,16.76,12.87,31.39,25.85,41.63Z"/>','<rect fill="var(--logo-1)" x="44.29" width="23.36" height=".02"/>','<path fill="var(--logo-1)" d="M111.94,67.67c-16.83,0-32.21-6.14-44.05-16.3,2.32,22.28,21.16,',"39.64,44.05,39.64v23.36c-37.36,0-67.65-30.29-67.65-67.65V.02h23.36c0,24.47,19.83,44.29,44.29,",'44.29v23.36Z"/></svg>'].join("");function vd(e,r){let n=wd(e);return['<!doctype html><html lang="en"><head><meta charset="utf-8">','<meta name="viewport" content="width=device-width,initial-scale=1">',`<title>${n}</title><style>${WB}</style></head><body><main>`,`<span class="tile">${ZB}</span>`,`<div class="copy"><h1>${n}</h1><p>${wd(r)}</p></div>`,"</main></body></html>"].join("")}function Y(e){process.stdout.write(`${e}
40
+ `)}function W(e){Y(JSON.stringify(e,null,2))}function Ox(e){process.stderr.write(`${e}
41
+ `)}var bx=["json","tsv","csv"];function fa(e){let r=bx.find(n=>n===e);if(r!==void 0)return r;throw new Error(`--output must be one of: ${bx.join(", ")} (got: ${e})`)}function ga(e){let r=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(r.length===0)throw new Error("--fields must contain at least one field name");return r}function Ax(e,r){let n=e;for(let o of r.split(".")){if(n===null||typeof n!="object"||!Object.hasOwn(n,o))return;n=n[o]}return n}function ha(e,r){let n=Object.create(null);for(let o of r){let i=Ax(e,o);if(i===void 0)continue;let s=o.split("."),c=s.pop();if(c===void 0)continue;let l=n;for(let m of s)(typeof l[m]!="object"||l[m]===null)&&(l[m]=Object.create(null)),l=l[m];l[c]=i}return n}function xx(e){return e==null?null:typeof e=="string"?e:JSON.stringify(e)}var XB={"\\":"\\\\"," ":"\\t","\r":"\\r","\n":"\\n"};function JB(e){let r=xx(e);return r===null?"":r.replace(/[\\\t\r\n]/g,n=>XB[n]??n)}function eH(e){let r=xx(e);return r===null?"":/[,"\n\r]/.test(r)?`"${r.replaceAll('"','""')}"`:r}function ya(e,r,n){if(r.length===0)return"";let o=e==="csv"?",":" ",i=e==="csv"?eH:JB,s=n.map(l=>i(l)).join(o),c=r.map(l=>n.map(m=>i(Ax(l,m))).join(o));return[s,...c].join(`
42
+ `)}var Px="/oauth/callback",rH=5*xs,nH=vd("Login complete","You can close this tab and return to the terminal."),Su=vd("Login failed","Return to the terminal for details.");function oH(e){return(0,Ld.platform)()==="darwin"?["open",[e]]:(0,Ld.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function iH(e){let[r,n]=oH(e),o=(0,Rx.spawnSync)(r,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function sH(e,r,n){return new Promise((o,i)=>{let s=setTimeout(()=>{i(new Error("Timed out waiting for the browser to complete login (5 minutes)."))},rH),c=(l,m,f,h)=>{l.writeHead(m,{"Content-Type":"text/html"}),l.end(f),clearTimeout(s),h()};e.on("request",(l,m)=>{let f=new URL(l.url??"/",n);if(f.pathname!==Px){m.writeHead(404,{"Content-Type":"text/html"}),m.end(Su);return}let h=f.searchParams.get("error");if(h){let I=f.searchParams.get("error_description")??"";c(m,400,Su,()=>i(new Error(`Authorization failed: ${h}${I?` (${I})`:""}`)));return}if(f.searchParams.get("state")!==r){c(m,400,Su,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let E=f.searchParams.get("code");if(!E){c(m,400,Su,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(m,200,nH,()=>o(E))})})}async function Ux(e){let r=(0,Cx.createServer)();r.on("connection",s=>s.unref()),await new Promise((s,c)=>{r.once("error",c),r.listen(0,"127.0.0.1",()=>{r.off("error",c),s()})});let{port:n}=r.address(),o=`http://127.0.0.1:${n}`,i=`${o}${Px}`;try{let s=e.buildAuthorizeUrl(i);return iH(s)?Y("Opening your browser to complete login..."):(Y("Visit this URL in your browser to complete login:"),Y(` ${s}`)),{code:await sH(r,e.state,o),redirectUri:i}}finally{r.close()}}var sr=require("node:fs"),qd=require("node:os"),So=require("node:path");var wx=fn(require("os"),1),Ta=fn(require("path"),1),Nn=wx.default.homedir(),{env:Io}=process,Nx=Io.XDG_DATA_HOME||(Nn?Ta.default.join(Nn,".local","share"):void 0),bu=Io.XDG_CONFIG_HOME||(Nn?Ta.default.join(Nn,".config"):void 0),TLe=Io.XDG_STATE_HOME||(Nn?Ta.default.join(Nn,".local","state"):void 0),vx=Io.XDG_CACHE_HOME||(Nn?Ta.default.join(Nn,".cache"):void 0),ELe=Io.XDG_RUNTIME_DIR||void 0,aH=(Io.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");Nx&&aH.unshift(Nx);var cH=(Io.XDG_CONFIG_DIRS||"/etc/xdg").split(":");bu&&cH.unshift(bu);var Lx=new Set(["api.tsuga.com","api.tsuga-staging.com"]),pH=new Set(["localhost","127.0.0.1","[::1]"]);function kd(e){let r=e.replace(/\/+$/,"");if(!URL.canParse(r))throw new Error(`TSUGA_API_URL is not a URL: ${r}`);if(/[\s"'\\]/.test(r))throw new Error(`TSUGA_API_URL holds whitespace, quotes or a backslash: ${JSON.stringify(r)}`);let n=new URL(r);if(!pH.has(n.hostname)&&(n.protocol!=="https:"||!Lx.has(n.hostname)))throw new Error(`Refusing to send credentials to ${r}. Set TSUGA_API_URL to ${[...Lx].map(o=>`https://${o}`).join(", ")}, or a localhost URL.`);return r}var kx=require("node:child_process"),Mx=require("node:fs");var wn="tsuga-cli";var Dx="/usr/bin/secret-tool",uH="Tsuga CLI session",Gx="the login keyring";function lH(){try{return(0,Mx.lstatSync)(Dx).isFile()}catch{return!1}}var mH=["DBUS_SESSION_BUS_ADDRESS","XDG_RUNTIME_DIR"];function dH(){let e={};for(let r of mH){let n=process.env[r];n!==void 0&&(e[r]=n)}return e}function Md(e,r){if(!(process.platform!=="linux"||!lH()))try{return{status:0,stdout:(0,kx.execFileSync)(Dx,e,{env:dH(),input:r,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function Dd(e){let r=Md(["lookup","service",wn,"account",e]);if(r&&r.status===0)return lu(r.stdout)}function $x(e,r){let n=Md(["store","--label",uH,"service",wn,"account",e],`${JSON.stringify(r)}
43
+ `);return!(!n||n.status!==0)}function Fx(e){return Md(["clear","service",wn,"account",e]),Dd(e)===void 0}var jx=require("node:child_process"),qx=require("node:fs");var Bx="/usr/bin/security",Hx="the macOS Keychain";function Gd(){if(process.platform!=="darwin")return!1;try{return(0,qx.lstatSync)(Bx).isFile()}catch{return!1}}function $d(e,r){try{return{status:0,stdout:(0,jx.execFileSync)(Bx,e,{env:{},input:r,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function Fd(e){if(!Gd())return;let r=$d(["find-generic-password","-s",wn,"-a",e,"-w"]);if(r.status===0)return lu(r.stdout)}function Kx(e,r){if(!Gd())return!1;let n=Buffer.from(JSON.stringify(r),"utf-8").toString("hex");return $d(["-i"],`add-generic-password -U -s ${wn} -a ${e} -X ${n}
44
+ `).status===0}function zx(e){return Gd()?($d(["delete-generic-password","-s",wn,"-a",e]),Fd(e)===void 0):!0}var fH={friendlyLocationName:Hx,read:Fd,save:Kx,remove:zx},gH={friendlyLocationName:Gx,read:Dd,save:$x,remove:Fx},Ou=class e extends Error{constructor(r){super(r),this.name="SecretStoreError"}static stillHoldsSession(r){return new e(`The session is still in ${r.friendlyLocationName}. Unlock it and run \`tsuga auth logout\` again.`)}};function Ea(){return process.platform==="darwin"?fH:process.platform==="linux"?gH:void 0}function Yx(e){return Ea()?.read(e)}function Vx(e,r){return Ea()?.save(e,r)??!1}function Qx(e){let r=Ea();return r&&!r.remove(e)?r:void 0}var Wx=(0,So.join)(bu??(0,So.join)((0,qd.homedir)(),".config"),"tsuga"),Ai=(0,So.join)(Wx,"config.json"),Zx=(0,So.join)(vx??(0,So.join)((0,qd.homedir)(),".cache"),"tsuga"),jd=(0,So.join)(Zx,"update-check.json"),_a=kd("https://api.tsuga.com");function Xx(e){return KA(e.credential)}function xu(){if(!(0,sr.existsSync)(Ai))return{};try{let e=JSON.parse((0,sr.readFileSync)(Ai,"utf-8")),{operationApiKey:r,userAuth:n,...o}=e;return!r&&!n?e:{...o,credentials:{...e.credentials,[_a]:{...r?{operationApiKey:r}:{},...n?{userAuth:n}:{},...e.credentials?.[_a]}}}}catch{throw new Error(`Config file corrupted: ${Ai}
45
+ Re-authenticate with \`tsuga auth login\` or \`tsuga auth operation-key <OPERATION_API_KEY>\`.`)}}function Ia(){try{return xu()}catch{return{}}}function xi(e){(0,sr.mkdirSync)(Wx,{recursive:!0,mode:448}),(0,sr.writeFileSync)(Ai,`${JSON.stringify(e,null,2)}
46
+ `,{mode:384})}function Bd(e,r=vn()){let n=e.credentials?.[r]??{};if(n.operationApiKey)return n;let o=Yx(r);return o?{...n,userAuth:o}:n}function Au(e,r,n=vn()){return{...e,credentials:{...e.credentials,[n]:r}}}function vn(){return kd(process.env.TSUGA_API_URL?.trim()||_a)}function Ri(e){let r=xu(),n=vn(),o=process.env.TSUGA_OPERATION_API_KEY,i=o?{}:Bd(r,n),s=HA({overrideKey:o,operationApiKey:i.operationApiKey,userAuth:i.userAuth}),c=r.defaults??{},l=e.clusterId?.trim()||process.env.TSUGA_CLUSTER_ID?.trim()||c.cluster?.trim()||void 0;return{apiUrl:n,credential:s,clusterId:l,defaults:c}}function Sa(){return Bd(xu()).userAuth}function Jx(e,r){let n=Ia(),o=vn(),{operationApiKey:i}=n.credentials?.[o]??{},s=r&&i?{operationApiKey:i}:{},c=Ea();return c&&Vx(o,e)?(xi(Au(n,s,o)),c.friendlyLocationName):(xi(Au(n,{...s,userAuth:e},o)),Ai)}function eR(e){return Jx(e,!1)}function Ru(e){Jx(e,!0)}function tR(e){let r=Ia();xi(Au(r,{operationApiKey:e}))}function rR(){let e=vn(),r=Qx(e),n=Ia(),o=Bd(n,e);if(xi(Au(n,o.operationApiKey?{operationApiKey:o.operationApiKey}:{},e)),r)throw Ou.stillHoldsSession(r)}function Cu(){return Ai}var nR={from:"-30m",to:"now",query:"*","max-results":"100"};function ar(e){return(xu().defaults??{})[e]??nR[e]}function oR(e,r){let n=Ia();xi({...n,defaults:{...n.defaults,[e]:r}})}function iR(){let{defaults:e,...r}=Ia();xi(r)}function sR(e,r){let n=[`API URL: ${e.apiUrl}`],{credential:o}=e;if(o){let s=o.kind;switch(s){case"operation-api-key":n.push(`Operation API key: ${o.token.slice(0,12)}...${o.token.slice(-4)}`);break;case"user-session":n.push(`User session: ${ua(o.userAuth.accessToken)} (expires ${o.userAuth.accessExpiresAt})`);break;default:Ye(s)}}else n.push("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");n.push(`Config: ${r}`),n.push(""),n.push("Defaults (custom overrides marked with *):");let i={...nR,...e.defaults};for(let[s,c]of Object.entries(i)){let l=s in e.defaults?" *":"";n.push(` ${s}: ${c}${l}`)}return`${n.join(`
47
47
  `)}
48
- `}function oR(){if((0,rr.existsSync)(jd))try{return JSON.parse((0,rr.readFileSync)(jd,"utf-8")).lastUpdateCheck}catch{return}}function iR(e){(0,rr.mkdirSync)(Vx,{recursive:!0,mode:448}),(0,rr.writeFileSync)(jd,`${JSON.stringify({lastUpdateCheck:e})}
49
- `,{mode:384})}async function pH(){let e=Nn(),{verifier:r,challenge:n}=Ex(),o=(0,sR.randomBytes)(16).toString("base64url"),{code:i,redirectUri:a}=await Rx({state:o,buildAuthorizeUrl:m=>DA(e,{redirectUri:m,challenge:n,state:o})}),c=await $A(e,{code:i,verifier:r,redirectUri:a}),l=Zx(Ed(c));z(`Logged in. Session token ${ps(c.accessToken)} saved to ${l}`)}async function uH(){let e=Nn(),r=Is();if(!r){let n=e===Es?"":` for ${e}`;process.stderr.write(`No user session${n}. Run \`tsuga auth login\`.
50
- `),process.exitCode=1;return}try{let n=await lu({userAuth:r,now:new Date,reload:Is,refresh:o=>pu(e,o),persist:xu});z(n.accessToken)}catch(n){process.stderr.write(`${n instanceof Error?n.message:String(n)}
51
- `),process.exitCode=1}}function Cu(e,r){let n=By(Hy({start:e,end:r}),{format:["years","months","days","hours","minutes"]});return n===""?"less than a minute":n}function lH(e){let r=ps(e.accessToken),n=new Date,o=new Date(e.accessExpiresAt),i=!!e.refreshToken;return Number.isNaN(o.getTime())?`Logged in as a user (token ${r}, expires ${e.accessExpiresAt}).`:o<=n?i?`Logged in as a user (token ${r}). Access token expired ${Cu(o,n)} ago, on ${e.accessExpiresAt}; the next command renews it automatically.`:`Logged in as a user (token ${r}). Session expired ${Cu(o,n)} ago, on ${e.accessExpiresAt}. Run \`tsuga auth login\` to sign in again.`:i?`Logged in as a user (token ${r}). Access token expires in ${Cu(n,o)}, on ${e.accessExpiresAt}; the session renews automatically.`:`Logged in as a user (token ${r}). Session expires in ${Cu(n,o)}, on ${e.accessExpiresAt}.`}function mH(){let{credential:e}=Ai({});if(!e){z("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");return}switch(e.kind){case"user-session":z(lH(e.userAuth));return;case"operation-api-key":z("Authenticated with an operation API key.");return;default:Ze(e)}}function dH(){Jx(),z("Local user session cleared.")}var fH={all:"all permitted telemetry","owning-team-and-public":"owning team plus public data","owning-team-only":"owning team only"};function Hd(e){let r=Math.max(...e.map(([n])=>n.length));return e.map(([n,o])=>` ${n.padEnd(r)} ${o}`)}function gH(e){let r=Object.entries(e).sort(([o],[i])=>o.localeCompare(i)),n=["write","read"].map(o=>[o,r.filter(([,i])=>i===o).map(([i])=>i).sort().join(", ")]).filter(([,o])=>o!=="");return n.length===0?["Permissions: none. This key cannot reach any resource."]:["Permissions:",...Hd(n)]}function hH(e){switch(e.type){case"operation-api-key":return["Authenticated as an operation API key.",...Hd([["Name",e.name],["Key",`\u2022\u2022\u2022\u2022${e.keyLastCharacters}`],["ID",e.id],["Owning team",e.owner],["Data scope",`${e.scope} (${fH[e.scope]})`],["Expires",e.expiresAt===void 0?"never":String(e.expiresAt)]]),"",...gH(e.permissions)].join(`
48
+ `}function aR(){if((0,sr.existsSync)(jd))try{return JSON.parse((0,sr.readFileSync)(jd,"utf-8")).lastUpdateCheck}catch{return}}function cR(e){(0,sr.mkdirSync)(Zx,{recursive:!0,mode:448}),(0,sr.writeFileSync)(jd,`${JSON.stringify({lastUpdateCheck:e})}
49
+ `,{mode:384})}async function hH(){let e=vn(),{verifier:r,challenge:n}=Sx(),o=(0,uR.randomBytes)(16).toString("base64url"),{code:i,redirectUri:s}=await Ux({state:o,buildAuthorizeUrl:m=>FA(e,{redirectUri:m,challenge:n,state:o})}),c=await qA(e,{code:i,verifier:r,redirectUri:s}),l=eR(Ed(c));Y(`Logged in. Session token ${ua(c.accessToken)} saved to ${l}`)}async function yH(){let e=vn(),r=Sa();if(!r){let n=e===_a?"":` for ${e}`;process.stderr.write(`No user session${n}. Run \`tsuga auth login\`.
50
+ `),process.exitCode=1;return}try{let n=await mu({userAuth:r,now:new Date,reload:Sa,refresh:o=>uu(e,o),persist:Ru});Y(n.accessToken)}catch(n){process.stderr.write(`${n instanceof Error?n.message:String(n)}
51
+ `),process.exitCode=1}}function Pu(e,r){let n=zy(Yy({start:e,end:r}),{format:["years","months","days","hours","minutes"]});return n===""?"less than a minute":n}function TH(e){let r=ua(e.accessToken),n=new Date,o=new Date(e.accessExpiresAt),i=!!e.refreshToken;return Number.isNaN(o.getTime())?`Logged in as a user (token ${r}, expires ${e.accessExpiresAt}).`:o<=n?i?`Logged in as a user (token ${r}). Access token expired ${Pu(o,n)} ago, on ${e.accessExpiresAt}; the next command renews it automatically.`:`Logged in as a user (token ${r}). Session expired ${Pu(o,n)} ago, on ${e.accessExpiresAt}. Run \`tsuga auth login\` to sign in again.`:i?`Logged in as a user (token ${r}). Access token expires in ${Pu(n,o)}, on ${e.accessExpiresAt}; the session renews automatically.`:`Logged in as a user (token ${r}). Session expires in ${Pu(n,o)}, on ${e.accessExpiresAt}.`}function EH(){let{credential:e}=Ri({});if(!e){Y("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");return}switch(e.kind){case"user-session":Y(TH(e.userAuth));return;case"operation-api-key":Y("Authenticated with an operation API key.");return;default:Ye(e)}}function _H(){rR(),Y("Local user session cleared.")}var IH={all:"all permitted telemetry","owning-team-and-public":"owning team plus public data","owning-team-only":"owning team only"};function Hd(e){let r=Math.max(...e.map(([n])=>n.length));return e.map(([n,o])=>` ${n.padEnd(r)} ${o}`)}function SH(e){let r=Object.entries(e).sort(([o],[i])=>o.localeCompare(i)),n=["write","read"].map(o=>[o,r.filter(([,i])=>i===o).map(([i])=>i).sort().join(", ")]).filter(([,o])=>o!=="");return n.length===0?["Permissions: none. This key cannot reach any resource."]:["Permissions:",...Hd(n)]}function bH(e){switch(e.type){case"operation-api-key":return["Authenticated as an operation API key.",...Hd([["Name",e.name],["Key",`\u2022\u2022\u2022\u2022${e.keyLastCharacters}`],["ID",e.id],["Owning team",e.owner],["Data scope",`${e.scope} (${IH[e.scope]})`],["Expires",e.expiresAt===void 0?"never":String(e.expiresAt)]]),"",...SH(e.permissions)].join(`
52
52
  `);case"user":return["Authenticated as a user.",...Hd([["Name",e.name],["Email",e.email],["ID",e.id],["Role",e.role]]),"","Access follows the organization role, not a per-resource permission map."].join(`
53
- `);default:Ze(e)}}var aR=["text","json"];function yH(e){let r=aR.find(n=>n===e);if(r!==void 0)return r;throw new Error(`--output must be one of: ${aR.join(", ")} (got: ${e})`)}function cR(e,r){let n=e.command("auth").description("Manage authentication: user login (OAuth) or operation API key");n.action(()=>n.help()),n.command("login").description("Log in as a user with a browser authorization flow and save the session (replaces any saved operation API key)").action(pH),n.command("logout").description("Clear the saved user session").action(dH),n.command("token").description("Print the saved user access token to stdout").action(uH),n.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(o=>{Xx(o),z(`Operation API key saved to ${Ru()}`)}),n.command("status").description("Show the current authentication method").action(mH),n.command("whoami").description("Ask Tsuga which credential this CLI authenticates as, and print its scope and permissions").option("-o, --output <FORMAT>","Output format: text | json","text").action(async o=>{let i=yH(o.output),a=await r()(Tx);if(i==="json"){W(a);return}z(hH(a))})}var TH={"sandbox-environment":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"github-connection":{read:["admin"],write:["admin"]},"llm-provider":{read:["admin"],write:["admin"]},investigation:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"ingestion-api-key":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"rum-public-token":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"widget-share":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"dashboard-share":{read:["public_viewer","public_editor","admin"],write:["admin"]},"audit-log":{read:["public_viewer","public_editor","admin"],write:[]},"custom-role":{read:["admin"],write:["admin"]},"custom-usage-tag":{read:["public_viewer","public_editor","admin"],write:["admin"]},"cluster-integration-config":{read:["admin"],write:["admin"]},"explorer-saved-view":{read:["public_viewer","public_editor","admin"],write:["public_viewer","public_editor","admin"]},"operation-api-key":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"cloud-account":{read:["public_viewer","public_editor","admin"],write:["admin"]},dashboard:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"dashboard-folder":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"dashboard-report":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},notebook:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},inventory:{read:["public_viewer","public_editor","admin"],write:[]},log:{read:["public_viewer","public_editor","admin"],write:[]},"log-route":{read:["public_viewer","public_editor","admin"],write:["admin","public_editor"]},"metric-route":{read:["public_viewer","public_editor","admin"],write:["admin","public_editor"]},metric:{read:["public_viewer","public_editor","admin"],write:[]},trace:{read:["public_viewer","public_editor","admin"],write:[]},rum:{read:["public_viewer","public_editor","admin"],write:[]},monitor:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"monitor-alert":{read:["public_viewer","public_editor","admin"],write:[]},"monitor-debugging":{read:["admin"],write:[]},"notification-integration":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"notification-rule":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"adaptive-notification-rule":{read:["public_viewer","public_editor","admin"],write:["admin"]},"notification-silence":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"saml-config":{read:["admin"],write:["admin"]},org:{read:["public_viewer","public_editor","admin"],write:["admin"]},"allowed-domains":{read:["public_viewer","public_editor","admin"],write:["admin"]},"quality-report":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"sensitive-data-scanner-rule":{read:["public_viewer","public_editor","admin"],write:["admin"]},slo:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"retention-policy":{read:["public_viewer","public_editor","admin"],write:["admin"]},"databricks-connection":{read:["public_viewer","public_editor","admin"],write:["admin"]},service:{read:["public_viewer","public_editor","admin"],write:[]},"service-target":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},host:{read:["public_viewer","public_editor","admin"],write:[]},database:{read:["public_viewer","public_editor","admin"],write:[]},"tag-policy":{read:["public_viewer","public_editor","admin"],write:["admin"]},team:{read:["public_viewer","public_editor","admin"],write:["admin"]},"team-members":{read:["public_viewer","public_editor","admin"],write:["admin"]},"team-remap-config":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-data":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-invitation":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-permissions":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-self":{read:["public_viewer","public_editor","admin"],write:["public_viewer","public_editor","admin"]},"oauth-grant":{read:[],write:[]}},EH={"sandbox-environment":{read:["viewer","editor","admin"],write:["editor","admin"]},"github-connection":{read:["admin"],write:[]},"llm-provider":{read:[],write:[]},investigation:{read:["viewer","editor","admin"],write:["editor","admin"]},"ingestion-api-key":{read:["viewer","editor","admin"],write:["editor","admin"]},"rum-public-token":{read:["viewer","editor","admin"],write:["editor","admin"]},"widget-share":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"dashboard-share":{read:["viewer","editor","admin"],write:["admin"]},"audit-log":{read:["viewer","editor","admin"],write:[]},"custom-role":{read:[],write:[]},"custom-usage-tag":{read:[],write:[]},"cluster-integration-config":{read:[],write:[]},"explorer-saved-view":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"operation-api-key":{read:["viewer","editor","admin"],write:["admin"]},"cloud-account":{read:["viewer","editor","admin"],write:[]},dashboard:{read:["viewer","editor","admin"],write:["editor","admin"]},"dashboard-folder":{read:["viewer","editor","admin"],write:["editor","admin"]},"dashboard-report":{read:["viewer","editor","admin"],write:["editor","admin"]},notebook:{read:["viewer","editor","admin"],write:["editor","admin"]},inventory:{read:["viewer","editor","admin"],write:[]},log:{read:["viewer","editor","admin"],write:[]},"log-route":{read:["viewer","editor","admin"],write:["editor","admin"]},"metric-route":{read:["viewer","editor","admin"],write:["editor","admin"]},metric:{read:["viewer","editor","admin"],write:[]},trace:{read:["viewer","editor","admin"],write:[]},rum:{read:["viewer","editor","admin"],write:[]},monitor:{read:["viewer","editor","admin"],write:["editor","admin"]},"monitor-alert":{read:["viewer","editor","admin"],write:[]},"monitor-debugging":{read:["admin"],write:[]},"notification-integration":{read:["viewer","editor","admin"],write:["editor","admin"]},"notification-rule":{read:["viewer","editor","admin"],write:["editor","admin"]},"adaptive-notification-rule":{read:["viewer","editor","admin"],write:[]},"notification-silence":{read:["viewer","editor","admin"],write:["editor","admin"]},"saml-config":{read:[],write:[]},org:{read:["viewer","editor","admin"],write:[]},"allowed-domains":{read:["viewer","editor","admin"],write:[]},"quality-report":{read:["viewer","editor","admin"],write:["editor","admin"]},"sensitive-data-scanner-rule":{read:["viewer","editor","admin"],write:[]},slo:{read:["viewer","editor","admin"],write:["editor","admin"]},"retention-policy":{read:[],write:[]},"databricks-connection":{read:[],write:[]},service:{read:["viewer","editor","admin"],write:[]},"service-target":{read:["viewer","editor","admin"],write:["editor","admin"]},host:{read:["viewer","editor","admin"],write:[]},database:{read:["viewer","editor","admin"],write:[]},"tag-policy":{read:[],write:[]},team:{read:["viewer","editor","admin"],write:["admin"]},"team-members":{read:["viewer","editor","admin"],write:["admin"]},"team-remap-config":{read:[],write:[]},"user-data":{read:["viewer","editor","admin"],write:["admin"]},"user-invitation":{read:["viewer","editor","admin"],write:["admin"]},"user-permissions":{read:["viewer","editor","admin"],write:[]},"user-self":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"oauth-grant":{read:[],write:[]}},_H={user:TH,team:EH};function Kd(e){return pR(e,"team")}function zd(e){return pR(e,"user")}function pR(e,r){let n=[],o=_H[r];for(let[i,a]of Object.entries(o))for(let[c,l]of Object.entries(a))l.includes(e)&&n.push({actionType:c,resourceType:i});return n}var MLe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:zd("admin"),roleKey:"admin"},public_editor:{name:"Public editor",description:"Can view and edit assets in public teams, but not access private teams or critical settings.",permissions:zd("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:zd("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},DLe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:Kd("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:Kd("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:Kd("viewer"),roleKey:"viewer"}};var GLe=new Set(xd);var IH={documentation:void 0,investigations:"investigation",logs:"log",metrics:"metric","team-membership":"team-members",traces:"trace",user:"user-data","allowed-domains":"allowed-domains","cloud-account":"cloud-account","custom-usage-tag":"custom-usage-tag",dashboard:"dashboard","dashboard-folder":"dashboard-folder","ingestion-api-key":"ingestion-api-key",inventory:"inventory","log-route":"log-route","metric-route":"metric-route",monitor:"monitor","notification-integration":"notification-integration","notification-rule":"notification-rule","notification-silence":"notification-silence","quality-report":"quality-report","retention-policy":"retention-policy",rum:"rum","rum-public-token":"rum-public-token",service:"service","service-target":"service-target",slo:"slo","tag-policy":"tag-policy",team:"team","user-invitation":"user-invitation"},SH=Object.entries(IH),$Le=new Map(SH.flatMap(([e,r])=>r?[[r,e]]:[]));var L="context";var uR="trace_id",Pu=`${L}.team`,jLe=`${L}.env`,qLe=`${L}.api_key_id`,Uu=`${L}.service.name`,BLe=`${L}.service.version`,wu=`${L}.span.kind`,vu=`${L}.span.name`,Ln=`${L}.status.code`,HLe=`${L}.stack_trace`,bH="STATUS_CODE_ERROR",KLe=`${Ln}:${bH}`,Yd="resource.attributes.team",lR=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var Ss=`${L}.host.name`,OH=`${L}.instance`,AH=`${L}.instanceid`,xH=`${L}.instance_name`,zLe=`${L}.telemetry.sdk.language`,YLe=`${L}.process.runtime.name`,VLe=`${L}.scope.name`,QLe=`${L}.page.id`,WLe=`${L}.app.name`,ZLe=`${L}.page.attributes.view_id`,XLe=`${L}.cloud.provider`,JLe=`${L}.cloud.platform`,eke=`${L}.aws.ecs.task.arn`,tke=`${L}.aws.ecs.task.id`,rke=`${L}.aws.ecs.cluster.arn`,nke=`${L}.faas.name`,oke=`${L}.faas.invoked_provider`,ike=`${L}.gcp.label.service_name`,ake=`${L}.k8s.cluster.name`,ske=`${L}.k8s.cluster.uid`,cke=`${L}.k8s.namespace.name`,RH=`${L}.k8s.pod.name`,pke=`${L}.k8s.pod.uid`,uke=`${L}.k8s.container.name`,lke=`${L}.k8s.node.name`,mke=`${L}.k8s.node.uid`,CH=`${L}.k8s.deployment.name`,dke=`${L}.k8s.deployment.uid`,PH=`${L}.k8s.replicaset.name`,fke=`${L}.k8s.replicaset.uid`,UH=`${L}.k8s.statefulset.name`,gke=`${L}.k8s.statefulset.uid`,wH=`${L}.k8s.daemonset.name`,hke=`${L}.k8s.daemonset.uid`,yke=`${L}.k8s.job.name`,Tke=`${L}.k8s.job.uid`,Eke=`${L}.k8s.cronjob.name`,_ke=`${L}.k8s.cronjob.uid`,xi="status_code",Nu="span.name";var Lu="span.kind";var vH="db.system.name",NH="db.system",LH="db.namespace",kH="db.name";var Ike=`span_attributes.${LH}`,Ske=`span_attributes.${kH}`,bke=`span_attributes.${vH}`,Oke=`span_attributes.${NH}`;var Ake={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${L}.tag_policy_id`,dataSource:`${L}.data_source`}};var xke={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${L}.batch_kind`,batchKindMetricsFilter:`${L}.batch_kind:metrics`,sourceApiKeyId:`${L}.source_api_key_id`,sourceEnv:`${L}.source_env`,sourceTeam:`${L}.source_team`}};var Vd="__tsuga_metadata__",Rke=`${Vd}.signature`,Cke=`${Vd}.routes`,Pke=`${Vd}.trace_id_bucket`;var Mke=[xi,Ln,Ln.replace(`${L}.`,"")];var mR="__tsuga_cluster_id__",MH=t.Object({}),DH=t.Object({status:t.Literal("error"),message:t.String({description:"Why this cluster failed to answer the query."})});function Ri(e=MH){let r=x("status",[t.Object({...e.properties,status:t.Literal("ok")}),DH]);return Object.assign(hp(Ht,r),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var GH=5,bs=t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:GH,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var dR=t.Object({type:t.Literal("number"),number:t.String()}),$H=t.Object({type:t.Literal("string"),string:t.String()}),FH=t.Object({type:t.Literal("timestamp"),timestamp:t.String()}),Os=x("type",[dR,$H,FH]),jH=t.Object({by:t.Record(t.String(),Os),computed:t.Record(t.String(),dR)}),qH=t.Object({type:t.Literal("buckets"),buckets:t.Array(jH),clusterResponses:t.Optional(Ri())}),BH=t.Object({type:t.Literal("distribution"),bounds:t.Array(t.Number()),buckets:t.Array(t.Object({timestamp:t.Number(),counts:t.Array(t.Number())})),percentiles:t.Optional(t.Array(t.Number()))}),Ci=x("type",[qH,BH]);var gR=1456444800,hR=4927737600,HH=gR*1e3,KH=hR*1e3,ku=1704067200,Qd=ku*1e3,yR={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:ku,to:ku}]},zH={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:Qd,to:Qd}]},Mu=e=>t.Integer({description:e,examples:[ku],minimum:gR,maximum:hR,format:"int64"}),fR=e=>t.Integer({description:e,examples:[Qd],minimum:HH,maximum:KH,format:"int64"}),it=t.Object({from:t.Optional(Mu("Start of the query window as a Unix timestamp in seconds")),to:t.Optional(Mu("End of the query window as a Unix timestamp in seconds"))},yR),Tt=t.Object({from:Mu("Start of the query window as a Unix timestamp in seconds"),to:Mu("End of the query window as a Unix timestamp in seconds")},yR),kn=t.Object({from:fR("Start of the query window as a Unix timestamp in milliseconds"),to:fR("End of the query window as a Unix timestamp in milliseconds")},zH);var QH="/v0/aggregation",WH=t.Union([t.Literal("a"),t.Literal("d"),t.Literal("q"),t.Literal("w"),t.Literal("t")]),Wd=t.Object({parallelism:t.Number(),engine:WH,recordBatchCache:t.Optional(t.Boolean()),includeNullGroups:t.Optional(t.Boolean()),restartAwareGaugeSum:t.Optional(t.Boolean())}),Zd=["logs","metrics","traces"];var _R={logs:"Logs",metrics:"Metrics",traces:"Spans"},ZH=[...Zd,"connections","log-patterns","spans","rum"];var nMe={..._R,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},vr=[...Zd,"rum"];var oMe={..._R,rum:"RUM events"};var iMe=t.Enum(ZH,{description:"Data source being queried"}),aMe=t.Enum(Zd,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),Vt=t.Enum(vr,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),So=t.String({description:"Attribute containing the values to aggregate"}),bo=p({description:"Attribute containing the values to aggregate"}),XH=x("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(So)},{$id:"AggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:So},{$id:"AggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:So},{$id:"AggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:So},{$id:"AggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:So},{$id:"AggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:So},{$id:"AggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:So,percentile:t.Number({description:"Percentile to compute for the selected field."})},{$id:"AggregatePercentile",title:"Percentile"})],{title:"Aggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),JH=x("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(bo)},{$id:"InputAggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:bo},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:bo},{$id:"InputAggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:bo},{$id:"InputAggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:bo},{$id:"InputAggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:bo},{$id:"InputAggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:bo,percentile:t.Number({description:"Percentile to compute for the selected field."})},{$id:"InputAggregatePercentile",title:"Percentile"})],{title:"InputAggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),IR=t.Object({type:t.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),SR=t.Object({type:t.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),bR=t.Object({type:t.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),OR=t.Object({type:t.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),AR=t.Object({type:t.Literal("increase",{description:"`Increase` is designed for cumulative metrics. It computes the increase of cumulative metrics by automatically handling counter resets. When used with an aggregation such as `sum` it combines all series without requiring an explicit group-by."})},{$id:"FunctionIncrease",title:"Increase"}),xR=t.Object({type:t.Literal("power",{description:"Raises values to a specified power"}),exponent:t.Integer({description:"The exponent to raise values to"})},{$id:"FunctionPower",title:"Power"}),RR=t.Object({type:t.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),CR=t.Object({type:t.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),e2=t.Object({type:t.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:t.String({description:"Duration of the rolling window"})},{$id:"FunctionRolling",title:"Rolling"}),t2=t.Object({type:t.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:p({allowEmpty:!1,description:"Duration of the rolling window"})},{$id:"InputFunctionRolling",title:"Rolling"}),r2=t.Object({type:t.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:t.Integer({description:"The base of the logarithm"})},{$id:"FunctionLog",title:"Log"}),n2=t.Object({type:t.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:t.Integer({description:"The base of the logarithm",minimum:2})},{$id:"InputFunctionLog",title:"Log"}),o2=t.Object({type:t.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:t.Integer({description:"Number of seconds to offset"})},{$id:"FunctionTimeOffset",title:"TimeOffset"}),i2=t.Object({type:t.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:t.Integer({description:"Number of seconds to offset",minimum:1})},{$id:"InputFunctionTimeOffset",title:"TimeOffset"}),a2=x("type",[IR,SR,bR,OR,AR,e2,r2,xR,RR,CR,o2],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),s2=x("type",[IR,SR,bR,OR,AR,t2,n2,xR,RR,CR,i2],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var TR=t.Object({min:t.Number({description:"Lower bound of the distribution range."}),max:t.Number({description:"Upper bound of the distribution range."})}),c2=["linear","log"],Du=t.Enum(c2,{description:"Spacing of the bucket boundaries across the distribution range. `linear` splits the range into equal-width buckets; `log` widens each bucket logarithmically, giving finer resolution near the lower bound."}),ER=t.Integer({minimum:1}),p2=x("type",[t.Object({type:t.Literal("scalar")},{title:"Scalar",description:"Returns a single value"}),t.Object({type:t.Literal("timeseries"),aggregationWindow:p({description:'Time bucket size for aggregation (e.g. "10s", "60s", "1m")'})},{title:"Timeseries",description:"Returns a time series"}),t.Object({type:t.Literal("histogram"),by:t.Optional(p()),bucketCount:t.Optional(ER),bounds:t.Optional(TR),boundsScale:t.Optional(Du),percentiles:t.Optional(t.Array(t.Number({minimum:0,maximum:100,multipleOf:1}),{minItems:1}))},{title:"Histogram",description:"Returns a single distribution over the entire time range"}),t.Object({type:t.Literal("heatmap"),aggregationWindow:p({description:'Time bucket size for the heatmap (e.g. "10s", "60s", "1m")'}),by:t.Optional(p()),bucketCount:t.Optional(ER),bounds:t.Optional(TR)},{title:"Heatmap",description:"Returns a distribution per time window"})]),As=15,u2=["zero","null"],l2=t.Enum(u2,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),PR=t.Object({mode:t.Object({type:l2},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),m2=["avg","sum","min","max","last"],UR=t.Enum(m2,{description:"Per-series rollup applied within each time bucket before the cross-series aggregate. Use it on metric queries when `aggregate.type` is `sum` and no `rate`, `increase`, `last`, or `rolling` function is present. When omitted, Tsuga derives the rollup from the metric type."});var wR={aggregate:XH,functions:t.Optional(t.Array(a2,{description:"Post-processing functions applied to aggregation results"})),fill:t.Optional(PR),timeAggregate:t.Optional(UR)},vR={aggregate:JH,functions:t.Optional(t.Array(s2,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:t.Optional(PR),timeAggregate:t.Optional(UR)},d2={description:"Aggregations that may be combined together in the same query. Each item is referenced from `formula` as q1, q2, and so on, in submission order."},NR={maxItems:As,description:'Aggregations that may be combined together in the same query. Each item is referenced from `formula` as q1, q2, and so on, in submission order. For dataSource "metrics", each aggregate\'s `field` is the metric name, not an attribute; to count distinct values of an attribute use unique-count with field "<metricName>.context.<attribute>" (e.g. "system.cpu.utilization.context.host.name").'},LR=t.Array(t.Object({...wR,filter:t.Optional(t.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),d2),xs=t.Array(t.Object({...vR,filter:t.Optional(p({type:"tsuga-query",description:"Tsuga query filter to apply to the aggregation. Defaults to an empty string when omitted."}))},{title:"AggregationQuery"}),NR),Zr=t.Array(t.Object({...wR,filter:t.String({description:"Filter to apply to the aggregation"})},{title:"MonitorAggregationQuery",description:"Single aggregation query evaluated by a monitor or SLO."}),{description:"Aggregation queries used by alerting and SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."}),Mn=t.Array(t.Object({...vR,filter:p({type:"tsuga-query",description:"Tsuga query filter applied to this alerting or SLO aggregation query. Required by the API; use the query language for the selected data source."})},{title:"MonitorAggregationQuery",description:"Single aggregation query evaluated by a monitor."}),{...NR,description:"Aggregation queries used by alerting. Each query is referenced from formulas as q1, q2, and so on."}),kR=t.Array(t.Omit(Mn.items,["fill"],{title:"SloAggregationQuery",description:"Single aggregation query evaluated by an SLO."}),{minItems:1,maxItems:As,description:"Aggregation queries used by SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var Gu=t.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),Oo=p({type:"tsuga-formula",description:"Formula referencing query outputs, such as `q1 + q2`, to compute derived results. Defaults to `q1`. Formulas may reference only submitted queries (`q1` through `qN`); undefined query references return 400."}),f2=t.Object({fields:t.Array(t.String(),{description:"Telemetry attribute names used to group aggregation results."}),limit:t.Number({description:'Maximum number of distinct values of `fields` returned for this grouping level, ranked by aggregate value. Groups beyond the limit are truncated, not merged into an "other" group.'}),sortOrder:t.Optional(Q),replaceNullWith:t.Optional(t.String({description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),g2=t.Object({fields:t.Array(p(),{maxItems:1,description:"Telemetry attribute name to group aggregation results by. Currently limited to one field per grouping level."}),limit:t.Number({description:'Maximum number of distinct values of `fields` to return for this grouping level, ranked by aggregate value. Groups beyond the limit are truncated from the response, not merged into an "other" group.'}),sortOrder:t.Optional(Q),replaceNullWith:t.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),MR=7;var Pi=t.Array(f2,{description:"Nested grouping levels applied to the results, outermost first (e.g. group by service, then by level within each service). Each level splits results further, so the response contains one result per unique combination of group values."}),Xr=t.Array(g2,{maxItems:MR,description:"Nested grouping levels applied to aggregation results, outermost first (e.g. group by service, then by level within each service). Each level splits results further, so the response contains one result per unique combination of group values instead of one aggregated total. Defaults to an empty array (one ungrouped result) when omitted."});var sMe=d({tags:["aggregation"],url:`${QH}/multi-query`,method:"POST",body:t.Object({timeRange:kn,queries:xs,groupBy:t.Optional(Xr),returnType:p2,dataSource:Vt,formula:Oo,executionOptions:Wd,triggeredBy:t.Optional(t.Literal("refresh")),shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1})),clusterIds:t.Optional(bs),viewAs:t.Optional(t.Object({owner:p({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:Cn}))}),response:Ci});var Xd=2,Jd=2;var DR=[{key:"amex15_digits",name:"American Express card (1x15 digits)",category:"financial-data",example:"378282246310005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex4443_digits",name:"American Express card (4+4+4+3 digits)",category:"financial-data",example:"3782 8224 6310 005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex465_digits",name:"American Express card (4+6+5 digits)",category:"financial-data",example:"3782 822463 10005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex87_digits",name:"American Express card (8+7 digits)",category:"financial-data",example:"37828224 6310005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card14_digits",name:"Diners card (1x14 digits)",category:"financial-data",example:"30569309025904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card4442_digits",name:"Diners card (4+4+4+2 digits)",category:"financial-data",example:"3056 9309 0259 04",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card464_digits",name:"Diners card (4+6+4 digits)",category:"financial-data",example:"3056 930902 5904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card86_digits",name:"Diners card (8+6 digits)",category:"financial-data",example:"30569309 025904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card16_digits",name:"Discover card (1x16 digits)",category:"financial-data",example:"6011111111111117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card88_digits",name:"Discover card (2x8 digits)",category:"financial-data",example:"60111111 11111117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card4444_digits",name:"Discover card (4x4 digits)",category:"financial-data",example:"6011 1111 1111 1117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card16_digits",name:"JCB card (1x16 digits)",category:"financial-data",example:"3530111333300000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card88_digits",name:"JCB card (2x8 digits)",category:"financial-data",example:"35301113 33300000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card4444_digits",name:"JCB card (4x4 digits)",category:"financial-data",example:"3530 1113 3330 0000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card16_digits",name:"Maestro card (1x16 digits)",category:"financial-data",example:"6759649826438453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card88_digits",name:"Maestro card (2x8 digits)",category:"financial-data",example:"67596498 26438453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card4444_digits",name:"Maestro card (4x4 digits)",category:"financial-data",example:"6759 6498 2643 8453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard16_digits",name:"Mastercard (1x16 digits)",category:"financial-data",example:"5555555555554444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard88_digits",name:"MasterCard (2x8 digits)",category:"financial-data",example:"55555555 55554444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard4444_digits",name:"MasterCard (4x4 digits)",category:"financial-data",example:"5555 5555 5555 4444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa16_digits",name:"Visa (1x16 digits)",category:"financial-data",example:"4111111111111111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa19_digits",name:"Visa (1x19 digits)",category:"financial-data",example:"4111111111111111151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa88_digits",name:"Visa (2x8 digits)",category:"financial-data",example:"41111111 11111111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa883_digits",name:"Visa (8+8+3 digits)",category:"financial-data",example:"41111111 11111111 151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa4444_digits",name:"Visa (4x4 digits)",category:"financial-data",example:"4111 1111 1111 1111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa44443_digits",name:"Visa (4+4+4+4+3 digits)",category:"financial-data",example:"4111 1111 1111 1111 151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"dropbox_long_lived_api_token",name:"Dropbox long lived API token",category:"credential",example:"767cb868836AAAAAAAAAAszri2cnmzu5tr0yf-nvclmwfyiswl67qyqw-uzn-scg",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\\-_=]{43})"},{key:"dropbox_short_lived_api_token",name:"Dropbox short lived API token",category:"credential",example:"sl.nu0yvsrposcjeyjcpmbfrmqygllrxpahrgbt8flml9xroifbic",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:sl\\.[a-z0-9\\-=_]{50})"},{key:"french_nirpp",name:"French social security number (NIRPP)",category:"personal-information",example:"188073512757119",isUsingLuhnAlgorithm:!1,regexp:"([12])\\s*[0-9]{2}\\s*(0[1-9]|1[0-2])\\s*(2[AB]|[0-9]{2})\\s*([0-9]{3})\\s*([0-9]{3})(\\s*[0-9]{2})?"},{key:"ip_address",name:"IP address",category:"device-identifier",example:"81.55.13.53",isUsingLuhnAlgorithm:!1,regexp:""},{key:"social_security_number",name:"Social security number (XXX-XX-XXXX)",category:"personal-information",example:"437-02-2223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])-(?:0[1-9]|[1-9]0|[1-9][1-9])-(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"social_security_number_space",name:"Social security number (XXX XX XXXX)",category:"personal-information",example:"437 02 2223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])\\s+(?:0[1-9]|[1-9]0|[1-9][1-9])\\s+(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"social_security_number_digits",name:"Social security number (9 digits)",category:"personal-information",example:"437022223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])(?:0[1-9]|[1-9]0|[1-9][1-9])(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"email",name:"Email",category:"credential",example:"admin@tsuga.com",isUsingLuhnAlgorithm:!1,regexp:"[a-zA-Z0-9-_.]*[a-zA-Z0-9_](@[a-zA-Z0-9_]+)(\\.[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)?[a-zA-Z])(?-u:\\b)"},{key:"one_password_secret_key",name:"1Password secret key",category:"credential",example:"A3-O28NKC-F58GULWCN72-4NIKS-KGY7V-U7FAT",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)A3-[A-Z0-9]{6}-(?:(?:[A-Z0-9]{11})|(?:[A-Z0-9]{6}-[A-Z0-9]{5}))-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}(?-u:\\b)"},{key:"one_password_service_account_token",name:"1Password service account token",category:"credential",example:"ops_eyJdAZ/FoIyz0jAXpEQOrRdIE8ydVaYfAXeZXGFqHWfBOjnE/Vgf5kHIbwrNAp2WeFNPeFiVJPlLv1hmaTVums0ldq1Kv8JEglMqP3f0ATBuX/WRbKqXYS3Z1wSzxg6S0krW4df7ZplvK04+JhJimejyTEH5dYaxqsYDBSLxjeEq7JWsmHEuXj6WP5qQi7FB+5s+CwhWPWY/jDhUMB3fdowXbfv5VnWri3iYrfBh+bFeRe9KURhXGHRDE9hgs",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ops_eyJ[a-zA-Z0-9+/]{50}"},{key:"adafruit_api_key",name:"Adafruit API key",category:"credential",example:"jb9pb4unb2bhe7xqepmgwtl2jg7ti101",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{32})"},{key:"adobe_client_id",name:"Adobe client ID",category:"credential",example:"c4166853dfd2897ebe706d49ef13fe63",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"adobe_client_secret",name:"Adobe client secret",category:"credential",example:"p8e-bb6e1614324ae48e507d33af176db3b7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:p8e-[a-z0-9]{32})"},{key:"age_secret_key",name:"Age secret key",category:"credential",example:"AGE-SECRET-KEY-1QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}"},{key:"airtable_api_key",name:"Airtable API key",category:"credential",example:"19b73hbi0tc5cdy4w",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{17})"},{key:"algolia_api_key",name:"Algolia API key",category:"credential",example:"346155deb68d31c4018d73de73452947",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"alibaba_access_key_id",name:"Alibaba Cloud AccessKey ID",category:"credential",example:"LTAI7cc6804e4c2155cd52bd",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:LTAI[a-z0-9]{20})"},{key:"alibaba_secret_key",name:"Alibaba Cloud secret key",category:"credential",example:"suwixirhh10xhnko9bv0vfg2971u9p",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"anthropic_admin_api_key",name:"Anthropic admin API key",category:"credential",example:"sk-ant-admin01-abc12fake-456def789ghij-klmnopqrstuvwx-3456yza789bcde-12fakehijklmnopby56aaaogaopaaaabc123xyzAA",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-ant-admin01-[a-zA-Z0-9_-]{93}AA)"},{key:"anthropic_api_key",name:"Anthropic API key",category:"credential",example:"sk-ant-api03-abc123xyz-456def789ghij-klmnopqrstuvwx-3456yza789bcde-1234fghijklmnopby56aaaogaopaaaabc123xyzAA",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-ant-api03-[a-zA-Z0-9_-]{93}AA)"},{key:"artifactory_api_key",name:"Artifactory API key",category:"credential",example:"AKCpt771klpkqllt647fdf36fq43radbz2w2nyetvx4l90qyeef8kbgkmke63ul5vf6mqsy82",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AKCp[A-Za-z0-9]{69}(?-u:\\b)"},{key:"artifactory_reference_token",name:"Artifactory reference token",category:"credential",example:"cmVmdc6i6888t9viuobfd88e46pdonjjsvmme6np82qti7wzbj7l9m1ygtyl9wik",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)cmVmd[A-Za-z0-9]{59}(?-u:\\b)"},{key:"asana_client_id",name:"Asana client ID",category:"credential",example:"9760134337886314",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{16})"},{key:"asana_client_secret",name:"Asana client secret",category:"credential",example:"tcnc8mjrf5bad359nnz3j1z90gow67ji",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"atlassian_api_token",name:"Atlassian API token",category:"credential",example:"fdo4scsa4kh53jnenkfp5fbe",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:[a-z0-9]{20}[a-f0-9]{4})|(?-u:\\b)(?:ATATT3[A-Za-z0-9_-=]{50})"},{key:"authress_service_client_access_key",name:"Authress service client access key",category:"credential",example:"sc_scmz00n9xj.0ykp.acc_2k5vtnrec4.55vc9459s-gc5qlia7a67jvzm0bobn3g0ezimd3b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\\.[a-z0-9]{4,6}\\.(?-i:acc)[_-][a-z0-9-]{10,32}\\.[a-z0-9+/_=-]{30})"},{key:"aws_access_token",name:"AWS access token",category:"credential",example:"AKIALALEMEL33243OLIB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})(?-u:\\b)"},{key:"azure_ad_client_secret",name:"Azure AD client secret",category:"credential",example:"bP88Q~rcBcYjzzOhg1Hnn76Wm3jGgakZiZ.8vMgR",isUsingLuhnAlgorithm:!1,regexp:"(?:^|[\\\\'\"` \\r\\n\\t\\f\\v>=:(?:,)])(?:[a-zA-Z0-9_~.]{3}[0-9]Q~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'\"` \\r\\n\\t\\f\\v<),])"},{key:"bitbucket_client_id",name:"Bitbucket client ID",category:"credential",example:"yyxmjnl3kahirvct7sat2082pzqdyf09",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"bitbucket_client_secret",name:"Bitbucket client secret",category:"credential",example:"fylw1pominwz91e5guqjiugw6srutpl64vzch5rnt8xnt31ka7so9va73fscz836",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{64})"},{key:"beamer_api_token",name:"Beamer API token",category:"credential",example:"b_zhy-phuoqk13asco6az4u_0yhtklgswm4umkv95nv4gu",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:b_[a-z0-9=_\\-]{44})"},{key:"codecov_access_token",name:"Codecov access token",category:"credential",example:"r93iopllonuphk41qglet20y8cb83thm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"clickhouse_cloud_api_secret_key",name:"ClickHouse Cloud API secret key",category:"credential",example:"4b1dbRdW3rOcB7xLthrM4BTBGK1qPLkHigpN1bXD6z",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:4b1d[A-Za-z0-9]{38})(?-u:\\b)"},{key:"clojars_api_token",name:"Clojars API token",category:"credential",example:"CLOJARS_d1vd7t0blxaarzx25dxoda4hm5ox86st6o5ww7tnzsfz07wvu223bf0fmgim",isUsingLuhnAlgorithm:!1,regexp:"CLOJARS_[a-z0-9]{60}"},{key:"cloudflare_api_key",name:"Cloudflare API key",category:"credential",example:"ckg0h_dzkxnl627gy3nskpq9wzm4d5hc_vxk272h",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{40})"},{key:"cloudflare_global_api_key",name:"Cloudflare global API key",category:"credential",example:"1d003bb65ec73ad2691fb76631b6496e3c9d9",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{37})"},{key:"cloudflare_origin_ca_key",name:"Cloudflare Origin CA key",category:"credential",example:"v1.0-aaa334dc886f30631ba0a610-0d98ef66290d7e50aac7c27b5986c99e6f3f1084c881d8ac0eae5de1d1aa0644076ff57022069b3237d19afe60ad045f207ef2b16387ee37b749441b2ae2e9ebe5b4606e846475d4a5",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:v1\\.0-[a-f0-9]{24}-[a-f0-9]{50})"},{key:"cohere_api_token",name:"Cohere API token",category:"credential",example:"lpn59BQ4FNUabVJh1vCpIqZpQbaViELQrTa14p9D",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[a-zA-Z0-9]{40})"},{key:"confluent_access_token",name:"Confluent access token",category:"credential",example:"kkat92sclkukwvr2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{16})"},{key:"confluent_secret_key",name:"Confluent secret key",category:"credential",example:"64d4ppp37l9fjhadm8vv0awie6wjo4d6ourfcqvi2bcs2tm95x4f0e8gyb8z8usj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"contentful_delivery_api_token",name:"Contentful delivery API token",category:"credential",example:"eumospigka64wiwpavfmmblrq7x1hm6gz84wiiw2ff3",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{43})"},{key:"curl_auth_header",name:"Curl authorization header",category:"credential",example:"curl --header 'Authorization: 5eb4223e-5008-46e5-be67-c7b8f2732305'",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)curl(?-u:\\b)(?:.*?|.*?(?:[\\r\\n]{1,2}.*?){1,5})[ \\t\\n\\r](?:-H|--header)(?:=|[ \\t]{0,5})(?:"(?:Authorization:[ \\t]{0,5}(?:Basic[ \\t](?:[a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \\t](?:[a-zA-Z0-9_=~@.+/-]{8,})|(?:[a-zA-Z0-9_=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \\t]{0,5}(?:[a-zA-Z0-9_=~@.+/-]{8,}))"|'(?:Authorization:[ \\t]{0,5}(?:Basic[ \\t](?:[a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \\t](?:[a-zA-Z0-9_=~@.+/-]{8,})|(?:[a-zA-Z0-9_=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \\t]{0,5}(?:[a-zA-Z0-9_=~@.+/-]{8,}))')(?:(?-u:\\B)|[ \\r\\n\\t\\f\\v]|\\z)`},{key:"curl_auth_user",name:"Curl basic authentication",category:"credential",example:"curl -u elastic:P@ssw0rd$1",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)curl(?-u:\\b)(?:.*|.*(?:[\\r\\n]{1,2}.*){1,5})[ \\t\\n\\r](?:-u|--user)(?:=|[ \\t]{0,5})(?:"(:[^"]{3,}|[^:"]{3,}:|[^:"]{3,}:[^"]{3,})"|'(?:[^:']{3,}:[^']{3,})'|(?:(?:"[^"]{3,}"|'[^']{3,}'|[a-zA-Z0-9_$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[a-zA-Z0-9_\${}@.-]+)))(?:[ \\r\\n\\t\\f\\v]|\\z)`},{key:"databricks_api_token",name:"Databricks API token",category:"credential",example:"dapia2553f815d29a193fd09c2bb55201895",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dapi[a-f0-9]{32}(?:-[0-9])?)"},{key:"datadog_access_token",name:"Datadog access token",category:"credential",example:"ljgbhjnca2hy5yc2nv7cag1ag7ehx2hc6geparov",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{40})"},{key:"defined_networking_api_token",name:"Defined Networking API token",category:"credential",example:"dnkey-nowf_nwyqhvqt1gi66xnuuf2rb-bfxnr9_qydyxnxn1y8uijvhhp9owllbg-2czoe-7qs5_w5650xei",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:-[a-z0-9=_\\-]{26}-[a-z0-9=_\\-]{52})"},{key:"digitalocean_pat",name:"DigitalOcean personal access token",category:"credential",example:"dop_v1_ec8f4a856c1459bd442a275461e2f709506347de30b180851cde71f696e9fcc8",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dop_v1_[a-f0-9]{64})"},{key:"digitalocean_access_token",name:"DigitalOcean OAuth access token",category:"credential",example:"doo_v1_42b8ea6c4b0c373f88aff9d3fa87e123ab23b0d3c22ac6d4361a4e9c1e89eaa6",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:doo_v1_[a-f0-9]{64})"},{key:"digitalocean_refresh_token",name:"DigitalOcean OAuth refresh token",category:"credential",example:"dor_v1_4d9b3e6fbe65ab472e464dfa6377d702e80164442acdfbeb3ef032d917cb9984",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dor_v1_[a-f0-9]{64})"},{key:"discord_api_token",name:"Discord API token",category:"credential",example:"7eb855d9a40747182d0b0ea74df27aee31d05756a9933a815a3ccb5a46b2d61d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{64})"},{key:"discord_client_id",name:"Discord client ID",category:"credential",example:"763721114261247538",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{18})"},{key:"discord_client_secret",name:"Discord client secret",category:"credential",example:"13641266018325206246161633988007",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"doppler_api_token",name:"Doppler API token",category:"credential",example:"dp.pt.vgin8wwjy7sx66fyq99tavkm3y5g2jdxmsufh257dhj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)dp\\.pt\\.[a-z0-9]{43}"},{key:"dropbox_api_token",name:"Dropbox API token",category:"credential",example:"rdlztoij88rzrsk",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{15})"},{key:"droneci_access_token",name:"DroneCI access token",category:"credential",example:"v26gffr903rbti5v7m392ba0u7oarz36",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"duffel_api_token",name:"Duffel API token",category:"credential",example:"duffel_test_-yd6b3pc4jy593pt5kr2l3ynzkb5b_f619dshefiz=v",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)duffel_(?:test|live)_[a-z0-9_\\-=]{43}"},{key:"dynatrace_api_token",name:"Dynatrace API token",category:"credential",example:"dt0c01.ben820rdpb1so4kasfx3yn4a.zkje7lawif35udsin5t1mi1m1sne7wdzphlzrmdnu3j69gr4kgf5dwg4x5lb30zg",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)dt0c01\\.[a-z0-9]{24}\\.[a-z0-9]{64}"},{key:"easypost_api_token",name:"EasyPost API token",category:"credential",example:"EZAKBVScDZwZFv0nJXHBcxPGil7eztnPJOSmDFf2NGKQk6Dn7VqULciSRm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)EZAK[a-z0-9]{54}(?-u:\\b)"},{key:"easypost_test_api_token",name:"EasyPost test API token",category:"credential",example:"EZTKuxUXVU5HBS1K2iyh165t3VtivpdxMgIf5Y2P1oJxeFeaJGcwzVexds",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)EZTK[a-z0-9]{54}(?-u:\\b)"},{key:"etsy_access_token",name:"Etsy access token",category:"credential",example:"8ssp35lhprxpb3sjyergcz5z",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{24})"},{key:"facebook_secret",name:"Facebook secret",category:"credential",example:"c41c21ba4fb5ee05398db86ca83f06db",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"facebook_access_token",name:"Facebook access token",category:"credential",example:"911602140448729|AY-lRJZq9BoDLobvAiP25L7RcMg",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:[0-9]{15,16}(\\||%)[0-9a-z\\-_]{27,40})"},{key:"facebook_page_access_token",name:"Facebook page access token",category:"credential",example:"EAAM9GOnCB9kBO2frzOAWGN2zMnZClQshlWydZCrBNdodesbwimx1mfVJgqZBP5RSpMfUzWhtjTTXHG5I1UlvlwRZCgjm3ZBVGeTYiqAAoxyED6HaUdhpGVNoPUwAuAWWFsi9OvyYBQt22DGLqMIgD7VktuCTTZCWKasz81Q822FPhMTB9VFFyClNzQ0NLZClt9zxpsMMrUZCo1VU1rL3CKavir5QTfBjfCEzHNlWAUDUV2YZD",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:EAA[MC][a-z0-9]{50})"},{key:"fastly_api_token",name:"Fastly API token",category:"credential",example:"im7_ux24tyyxz_4y4mvzj22akpid830c",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"finicity_client_secret",name:"Finicity client secret",category:"credential",example:"roepymyr0ce7wxhjvgb2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{20})"},{key:"finicity_api_token",name:"Finicity API token",category:"credential",example:'= "cce089057c8b7fe7f2a8474b9a050816',isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"flickr_access_token",name:"Flickr access token",category:"credential",example:"damvt93tudulk6wrfp36sawndc9pa7bb",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"finnhub_access_token",name:"Finnhub access token",category:"credential",example:"x01lnfp13spcbsa0at32",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{20})"},{key:"flutterwave_public_key",name:"Flutterwave public key",category:"credential",example:"FLWPUBK_TEST-99484d505b4ee5c1181a2884f5fe3852-X",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWPUBK_TEST-[a-h0-9]{32}-X"},{key:"flutterwave_secret_key",name:"Flutterwave secret key",category:"credential",example:"FLWSECK_TEST-66187ac83488c2245f0d7e95fa37e833-X",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWSECK_TEST-[a-h0-9]{32}-X"},{key:"flutterwave_encryption_key",name:"Flutterwave encryption key",category:"credential",example:"FLWSECK_TEST-6262214a02e7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWSECK_TEST-[a-h0-9]{12}"},{key:"flyio_access_token",name:"Fly.io access token",category:"credential",example:"fo1_m-HT0NHLBSPwMJ2hIer4v3lxtWEC7grXNidQxJMrVVE",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:fo1_[a-zA-Z0-9_-]{43}|fm1[ar]_[a-zA-Z0-9+\\/]{50}))"},{key:"frameio_api_token",name:"Frame.io API token",category:"credential",example:"fio-u-4ov9vjtr2wwj8j1gob-8xrx2-1=z818psmitskgoq4=p-_k77d54034z55xk-lqh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)fio-u-[a-z0-9\\-_=]{64}"},{key:"freshbooks_access_token",name:"FreshBooks access token",category:"credential",example:"gqw118uwne1nddlt4yruvvs4jr9s0vrj5mxaswgb2amacod8lgnmrknsvbovsx1g",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"gocardless_api_token",name:"GoCardless API token",category:"credential",example:"live_-z4lwtrrk6p6=-v1ig_y_4ceplziwek0lw=oz-eu",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:live_[a-z0-9\\-_=]{40})"},{key:"gcp_api_key",name:"GCP API key",category:"credential",example:"AIzaYpvGqEzpgB7R353HD9CxN8LuhZ6d6UfuXLL",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:AIza[a-zA-Z0-9_-]{35})"},{key:"github_pat",name:"GitHub personal access token",category:"credential",example:"ghp_t7i9llxuukeb7apn4zlnyeyz5b0007rsfs54",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ghp_[0-9a-zA-Z]{36}"},{key:"github_fine_grained_pat",name:"GitHub fine-grained personal access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)github_pat_[a-zA-Z0-9_]{82}"},{key:"github_oauth",name:"GitHub OAuth token",category:"credential",example:"gho_anlrm6zqscqityoqozv503by66dobnem4yxh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gho_[0-9a-zA-Z]{36}"},{key:"github_app_token",name:"GitHub app token",category:"credential",example:"ghs_0zleityj4n1ulz178o9in1w97q1ifw8u3y8h",isUsingLuhnAlgorithm:!1,regexp:"(?:ghu|ghs)_[0-9a-zA-Z]{36}"},{key:"github_refresh_token",name:"GitHub refresh token",category:"credential",example:"ghr_inu1aa7qbgi46cf8nprbgh4kn03d0zk35raj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ghr_[0-9a-zA-Z]{36}"},{key:"gitlab_cicd_job_token",name:"GitLab CI/CD job token",category:"credential",example:"glcbt-7h2nr_6jmho0uoqkb1ww431kfl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glcbt-[0-9a-zA-Z]{1,5}_[0-9a-zA-Z_-]{20}"},{key:"gitlab_deploy_token",name:"GitLab deploy token",category:"credential",example:"gldt-7a3o70gqa8zkal0zdp4x",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gldt-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_feature_flag_client_token",name:"GitLab feature flag client token",category:"credential",example:"glffct-dsct62ndnvcj7alw5nas",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glffct-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_feed_token",name:"GitLab feed token",category:"credential",example:"glft-13956nvy00289v6xu0di",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glft-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_incoming_mail_token",name:"GitLab incoming mail token",category:"credential",example:"glimt-fcdt1a5jvj01si61jgkse2r20",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glimt-[0-9a-zA-Z_\\-]{25}"},{key:"gitlab_kubernetes_agent_token",name:"GitLab Kubernetes agent token",category:"credential",example:"glagent-8wxkulkbbuk7u6r3nvrefswdfw5o0v7vy81y4oky8rnfogm826",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glagent-[0-9a-zA-Z_\\-]{50}"},{key:"gitlab_oauth_app_secret",name:"GitLab OAuth app secret",category:"credential",example:"gloas-vawws2nw5kf6rizn49g41jc3jiy4xqioaihrwm1msltbdt4cbmo4x52tygcic7af",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gloas-[0-9a-zA-Z_\\-]{64}"},{key:"gitlab_pat",name:"GitLab personal access token",category:"credential",example:"glpat-2gl3ku1497ms4gzyv16i",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glpat-[a-zA-Z0-9_-]{20}"},{key:"gitlab_pat_routable",name:"GitLab personal access token (routable)",category:"credential",example:"glpat-2hf7vebpux9j56tdcqqsvap7vxc.chvjof35u",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glpat-[0-9a-zA-Z_-]{27}\\.[0-9a-z]{2}[0-9a-z]{7}(?-u:\\b)"},{key:"gitlab_ptt",name:"GitLab personal access token (temporary)",category:"credential",example:"glptt-b54e8b7b90cf006b79af110baa9b8d9183fd7048",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glptt-[0-9a-f]{40}"},{key:"gitlab_rrt",name:"GitLab registration token",category:"credential",example:"GR1348941vnauzmn2hj0zncvt0nfe",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)GR1348941[a-zA-Z0-9_-]{20}"},{key:"gitlab_runner_authentication_token",name:"GitLab runner authentication token",category:"credential",example:"glrt-xbd1w7c9clbxm52zdxkm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glrt-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_runner_authentication_token_routable",name:"GitLab runner authentication token (routable)",category:"credential",example:"glrt-t5_8d8ugbkfzddae0dw06tvm0x7qxc.mwcd1a7cn",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glrt-t[0-9]_[0-9a-zA-Z_\\-]{27}\\.[0-9a-z]{2}[0-9a-z]{7}(?-u:\\b)"},{key:"gitlab_scim_token",name:"GitLab SCIM token",category:"credential",example:"glsoat-9jb5zk1nvy800c1uqhh0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glsoat-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_session_cookie",name:"GitLab session cookie",category:"credential",example:"_gitlab_session=yjhub6vtrp60djn6rszuemeacsoqox97",isUsingLuhnAlgorithm:!1,regexp:"_gitlab_session=[0-9a-z]{32}"},{key:"gitter_access_token",name:"Gitter access token",category:"credential",example:"uazubes6trcd_1gym09opuf_8gj1rmvj6jwber4a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{40})"},{key:"grafana_api_key",name:"Grafana API key",category:"credential",example:"eyJrIjoiyl5shjvqja0xkfbu38m24vn5httsipr1h9fgjhodxzlkpravuiy8h7hom5kt8gtwuguh2v",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:eyJrIjoi[A-Za-z0-9]{70}={0,3})"},{key:"grafana_cloud_api_token",name:"Grafana cloud API token",category:"credential",example:"glc_cb7p4j2g1qu0sy84me72ufmn1z8mqk8y",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:glc_[A-Za-z0-9+/]{32}={0,3})"},{key:"grafana_service_account_token",name:"Grafana service account token",category:"credential",example:"glsa_rm3sadbwl8o2c13v4ipgkz04h66kiy6t_edaea401",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})"},{key:"harness_api_key",name:"Harness API key",category:"credential",example:"pat.vzcxr183pymw194fdq1q0v.qjqjarqkd9ydxqagjmq3f5iq.8nn5nyaow3h5mmgjh053",isUsingLuhnAlgorithm:!1,regexp:"(?:pat|sat)\\.[a-zA-Z0-9_-]{22}\\.[a-zA-Z0-9]{24}\\.[a-zA-Z0-9]{20}"},{key:"hashicorp_tf_api_token",name:"HashiCorp Terraform API token",category:"credential",example:"984d8033429986.atlasv1.799k5cihj_807yc1e8afvla8ackd1khsb50nfeswbxbr1re54y0wpzs2tjy=",isUsingLuhnAlgorithm:!1,regexp:"[a-z0-9]{14}\\.(?-i:atlasv1)\\.[a-z0-9\\-_=]{60,70}"},{key:"heroku_api_key",name:"Heroku API key",category:"credential",example:"9127f65b-8b3f-c0b7-a336-a4347e71bc51",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"heroku_api_key_v2",name:"Heroku API key v2",category:"credential",example:"HRKU-AAxPYvV6l2R3DvF0w9VJ4m8cz9oaygOHxpQvcw--iD51MszQZeakD9DZsclX",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(HRKU-AA[0-9a-zA-Z_-]{58}))"},{key:"hubspot_api_key",name:"HubSpot API key",category:"credential",example:"86cb6664-b191-db72-95a7-49adebe84b74",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})"},{key:"huggingface_access_token",name:"HuggingFace access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:hf_(?i:[a-z]{34}))"},{key:"huggingface_organization_api_token",name:"HuggingFace organization API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:api_org_(?i:[a-z]{34}))"},{key:"intercom_api_key",name:"Intercom API key",category:"credential",example:"zuc5c=ykf5gcwesqvmh2pji6k3extx0rbalsznte3sdo7iu7f-lumol2npfk",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{60})"},{key:"intra42_client_secret",name:"Intra42 client secret",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:s-s4t2(?:ud|af)-[abcdef0123456789]{64})"},{key:"jfrog_api_key",name:"JFrog API key",category:"credential",example:"lj7nrgoo0kr04kw312zvly7l0olsn37vhto5wdn3yqi5srxnc2axstp7a1kewkxi717w295kh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{73})"},{key:"jfrog_identity_token",name:"JFrog identity token",category:"credential",example:"xh0x2upbtkkg1pseg7ezmcyw2c3kt0bt05l5v8ynvkro6wagolhch0f7kppplt8b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"jwt",name:"JSON web token",category:"credential",example:"ey7gzQUpN8Kz7XY6Yin.ey1o36_XrBphAG8WMHQ.",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ey[a-zA-Z0-9]{17,}\\.ey[a-zA-Z0-9\\/\\\\_-]{17,}\\.(?:[a-zA-Z0-9\\/\\\\_-]{10,}={0,2})?)"},{key:"jwt_base64",name:"JSON web token base64",category:"credential",example:"ZXlKNE5YUWpVekkxTmlJNklsUjFUM0pDZVRKT1kxUnNSbE5YZFZvNFMyZzRWemhCYWxGaFoySTBabTVtVURGVGJFdE5Uemd0VTI4aWZRLmV5SnBjM01pT2lKcWIyVWlMQTBLSUNKbGVIQWlPakV6TURBNE1Ua3pPREFzRFFvZ0ltaDBkSEE2THk5bGVHRnRjR3hsTG1OdmJTOXBjMTl5YjI5MElqcDBjblZsZlEuZEJqZnRKZVo0Q1ZQLW1COTJLMjd1aGJVSlUxcDFyX3dXMWdGV0ZPRWpYaw==",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ZXlK(?:(?P<alg>aGJHY2lPaU)|(?P<apu>aGNIVWlPaU)|(?P<apv>aGNIWWlPaU)|(?P<aud>aGRXUWlPaU)|(?P<b64>aU5qUWlP)|(?P<crit>amNtbDBJanBi)|(?P<cty>amRIa2lPaU)|(?P<epk>bGNHc2lPbn)|(?P<enc>bGJtTWlPaU)|(?P<jku>cWEzVWlPaU)|(?P<jwk>cWQyc2lPb)|(?P<iss>cGMzTWlPaU)|(?P<iv>cGRpSTZJ)|(?P<kid>cmFXUWlP)|(?P<key_ops>clpYbGZiM0J6SWpwY)|(?P<kty>cmRIa2lPaUp)|(?P<nonce>dWIyNWpaU0k2)|(?P<p2c>d01tTWlP)|(?P<p2s>d01uTWlPaU)|(?P<ppt>d2NIUWlPaU)|(?P<sub>emRXSWlPaU)|(?P<svt>emRuUWlP)|(?P<tag>MFlXY2lPaU)|(?P<typ>MGVYQWlPaUp)|(?P<url>MWNtd2l)|(?P<use>MWMyVWlPaUp)|(?P<ver>MlpYSWlPaU)|(?P<version>MlpYSnphVzl1SWpv)|(?P<x>NElqb2)|(?P<x5c>NE5XTWlP)|(?P<x5t>NE5YUWlPaU)|(?P<x5ts256>NE5YUWpVekkxTmlJNkl)|(?P<x5u>NE5YVWlPaU)|(?P<zip>NmFYQWlPaU))[a-zA-Z0-9\\/\\\\_+\\-\\r\\n]{40,}={0,2}"},{key:"launchdarkly_access_token",name:"LaunchDarkly access token",category:"credential",example:"ezmej9s6yv4qwk2=yeb4kfi162p33b_2hzm7tr-0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{40})"},{key:"linear_api_key",name:"Linear API key",category:"credential",example:"lin_api_0n5n0k26vb4ka9je9dqdcwl1dae5mbpfhb48xio6",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)lin_api_[a-z0-9]{40}"},{key:"linear_client_secret",name:"Linear client secret",category:"credential",example:"7b956760f09b81684ed833c524f081de",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"linkedin_client_id",name:"LinkedIn client ID",category:"credential",example:"18u930hak0em0r",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{14})"},{key:"linkedin_client_secret",name:"LinkedIn client secret",category:"credential",example:"uvkxd9rw41ylk1zj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{16})"},{key:"lob_api_key",name:"Lob API key",category:"credential",example:"test_02efbb923a38370aac769e3bedc4d3398be",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:(live|test)_[a-f0-9]{35})"},{key:"lob_pub_api_key",name:"Lob publishable API key",category:"credential",example:"test_pub_df170d9f5be9244959713dfee686c42",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:(test|live)_pub_[a-f0-9]{31})"},{key:"mailchimp_api_key",name:"MailChimp API key",category:"credential",example:"81277fbbe2dd9c5e18d5f28cebcc558c-us20",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32}-us[0-9][0-9])"},{key:"mailgun_pub_key",name:"Mailgun public validation key",category:"credential",example:"pubkey-5011bae1a4b57dfa83762c24b0e1299d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:pubkey-[a-f0-9]{32})"},{key:"mailgun_private_api_token",name:"Mailgun private API token",category:"credential",example:"key-176f7ef066471ac351adab734d2c9fb2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:key-[a-f0-9]{32})"},{key:"mailgun_signing_key",name:"Mailgun webhook signing key",category:"credential",example:"24564bd3d54a469601d5ac5daecb9ad2-00001111-22223333",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8})"},{key:"mapbox_api_token",name:"MapBox API token",category:"credential",example:"pk.5ko18udoy3cilkpgyedje9limykwj8n7wmhug4967o9wze284mmpuuhjzgig.edjzuv7jwhc6lnv5b3p9nc",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:pk\\.[a-z0-9]{60}\\.[a-z0-9]{22})"},{key:"mattermost_access_token",name:"Mattermost access token",category:"credential",example:"rtw2hncbfhpbyyri90d3q2mo1m",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{26})"},{key:"maxmind_license_key",name:"MaxMind license key",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:[A-Za-z0-9]{6}_[A-Za-z0-9]{29}_mmk)"},{key:"cisco_meraki_api_key",name:"Cisco Meraki API key",category:"credential",example:"acea14a1470f7cf443a031dde64065ce81c77b2b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[0-9a-f]{40})"},{key:"messagebird_api_token",name:"MessageBird API token",category:"credential",example:"448q6im7yxutswabdko1n69ry",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{25})"},{key:"messagebird_client_id",name:"MessageBird client ID",category:"credential",example:"12345678-ABCD-ABCD-ABCD-1234567890AB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"netlify_access_token",name:"Netlify access token",category:"credential",example:"3j1sa0o20v0k-cjbjn3vh_4uqnkvb3w_px5no2in",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{40,46})"},{key:"new_relic_user_api_key",name:"New Relic user API key",category:"credential",example:"NRAK-zozcnrh45ornsbl1duyfhell59u",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRAK-[a-z0-9]{27})"},{key:"new_relic_user_api_id",name:"New Relic user API ID",category:"credential",example:"k0jze7delork84k8ke1z1dm275yw2aqf5uu2cy7x1uiloll3xab5203hiz9tx9xx",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"new_relic_browser_api_token",name:"New Relic browser API token",category:"credential",example:"NRJS-c7fa1261a97506e4a45",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRJS-[a-f0-9]{19})"},{key:"new_relic_insert_key",name:"New Relic insight insert key",category:"credential",example:"NRII-4168ab7eb2e051f37144ad884d32ab34",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRII-[a-z0-9-]{32})"},{key:"notion_api_token",name:"Notion API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ntn_[0-9]{11}[A-Za-z0-9]{32}[A-Za-z0-9]{3})"},{key:"npm_access_token",name:"npm access token",category:"credential",example:"npm_vz9e7fvsn7o2n2tddg6b01gs7g9wldlys4vm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:npm_[a-z0-9]{36})"},{key:"nytimes_access_token",name:"NYTimes access token",category:"credential",example:"ako7xzi0mx7w15ogdkew7ilq7h13x8rl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"octopus_deploy_api_key",name:"Octopus Deploy API key",category:"credential",example:"API-NFWN6F7X32BYDBU94IGY3V5ZQY",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:API-[A-Z0-9]{26})"},{key:"okta_access_token",name:"Okta access token",category:"credential",example:"003cKkRNNMy4ul7V8UDHEjEBGbnsQ6tejSHzfeBtcp",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:00[a-zA-Z0-9_=\\-]{40})"},{key:"openai_api_key",name:"OpenAI API key",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})(?-u:\\b)|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})"},{key:"openshift_user_token",name:"OpenShift user token",category:"credential",example:"sha256~OFL-TnR3jyLteu_rAuff3PUYNELVvByMRFYCcAkaJSR",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sha256~[a-zA-Z0-9_-]{43})(?:[^a-zA-Z0-9_-]|\\z)"},{key:"perplexity_api_key",name:"Perplexity API key",category:"credential",example:"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'",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pplx-[a-zA-Z0-9]{48})(?:[`'\" \\r\\n\\t\\f\\v;]|\\\\[nr]|$|(?-u:\\b))"},{key:"pgpassword_shell_assignment",name:"PGPASSWORD shell assignment",category:"credential",example:"PGPASSWORD='supersecret'",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)PGPASSWORD=(?:"[^"\\r\\n]+"|'[^'\\r\\n]+'|[^\\s'"]+)`},{key:"plaid_api_token",name:"Plaid API token",category:"credential",example:"access-development-4b0f8c31-83fe-e4c5-3d02-91e487b69d2d",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:access-(?:sandbox|development|production)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"plaid_client_id",name:"Plaid client ID",category:"credential",example:"TTPjxpFNiwOct5XLdxjXD0Ta",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{24})"},{key:"plaid_secret_key",name:"Plaid secret key",category:"credential",example:"ikhqm7a9k76l8f544dl0v8kxvm2w55",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"planetscale_password",name:"PlanetScale password",category:"credential",example:"pscale_pw_9gvu8z79m4b814z0vv8266w70h3i7jlq",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_pw_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"planetscale_api_token",name:"PlanetScale API token",category:"credential",example:"pscale_tkn_nwy9jkjgnry96ftecsx_=jrxc6pkmmew",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_tkn_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"planetscale_oauth_token",name:"PlanetScale OAuth token",category:"credential",example:"pscale_oauth_zx8v3gzfnfxbymj__l629i68jnz5gnff",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_oauth_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"postman_api_token",name:"Postman API token",category:"credential",example:"PMAK-525b84aa46e2c588620d8123-06f9ca36c4aad4305baafbe00716b7bc8f",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:PMAK-[a-f0-9]{24}\\-[a-f0-9]{34})"},{key:"prefect_api_token",name:"Prefect API token",category:"credential",example:"pnu_kttbffyfgffu2sfbxzxw8mbpgvvtxjljwe1p",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pnu_[a-zA-Z0-9]{36})"},{key:"privateai_api_token",name:"PrivateAI API token",category:"credential",example:"iwuxqzqilzbfnccncvjz6px23dnej11h",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"private_key",name:"Private key",category:"credential",example:`-----BEGIN PRIVATE KEY-----
53
+ `);default:Ye(e)}}var pR=["text","json"];function OH(e){let r=pR.find(n=>n===e);if(r!==void 0)return r;throw new Error(`--output must be one of: ${pR.join(", ")} (got: ${e})`)}function lR(e,r){let n=e.command("auth").description("Manage authentication: user login (OAuth) or operation API key");n.action(()=>n.help()),n.command("login").description("Log in as a user with a browser authorization flow and save the session (replaces any saved operation API key)").action(hH),n.command("logout").description("Clear the saved user session").action(_H),n.command("token").description("Print the saved user access token to stdout").action(yH),n.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(o=>{tR(o),Y(`Operation API key saved to ${Cu()}`)}),n.command("status").description("Show the current authentication method").action(EH),n.command("whoami").description("Ask Tsuga which credential this CLI authenticates as, and print its scope and permissions").option("-o, --output <FORMAT>","Output format: text | json","text").action(async o=>{let i=OH(o.output),s=await r()(Ix);if(i==="json"){W(s);return}Y(bH(s))})}var AH={"sandbox-environment":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"github-connection":{read:["admin"],write:["admin"]},"llm-provider":{read:["admin"],write:["admin"]},investigation:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"ingestion-api-key":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"rum-public-token":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"widget-share":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"dashboard-share":{read:["public_viewer","public_editor","admin"],write:["admin"]},"audit-log":{read:["public_viewer","public_editor","admin"],write:[]},"custom-role":{read:["admin"],write:["admin"]},"custom-usage-tag":{read:["public_viewer","public_editor","admin"],write:["admin"]},"cluster-integration-config":{read:["admin"],write:["admin"]},"explorer-saved-view":{read:["public_viewer","public_editor","admin"],write:["public_viewer","public_editor","admin"]},"operation-api-key":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"cloud-account":{read:["public_viewer","public_editor","admin"],write:["admin"]},dashboard:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"dashboard-folder":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"dashboard-report":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},notebook:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},inventory:{read:["public_viewer","public_editor","admin"],write:[]},log:{read:["public_viewer","public_editor","admin"],write:[]},"log-route":{read:["public_viewer","public_editor","admin"],write:["admin","public_editor"]},"metric-route":{read:["public_viewer","public_editor","admin"],write:["admin","public_editor"]},metric:{read:["public_viewer","public_editor","admin"],write:[]},trace:{read:["public_viewer","public_editor","admin"],write:[]},rum:{read:["public_viewer","public_editor","admin"],write:[]},monitor:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"monitor-alert":{read:["public_viewer","public_editor","admin"],write:[]},"monitor-debugging":{read:["admin"],write:[]},"notification-integration":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"notification-rule":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"adaptive-notification-rule":{read:["public_viewer","public_editor","admin"],write:["admin"]},"notification-silence":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"saml-config":{read:["admin"],write:["admin"]},org:{read:["public_viewer","public_editor","admin"],write:["admin"]},"allowed-domains":{read:["public_viewer","public_editor","admin"],write:["admin"]},"quality-report":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"sensitive-data-scanner-rule":{read:["public_viewer","public_editor","admin"],write:["admin"]},slo:{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},"retention-policy":{read:["public_viewer","public_editor","admin"],write:["admin"]},"databricks-connection":{read:["public_viewer","public_editor","admin"],write:["admin"]},service:{read:["public_viewer","public_editor","admin"],write:[]},"service-target":{read:["public_viewer","public_editor","admin"],write:["public_editor","admin"]},host:{read:["public_viewer","public_editor","admin"],write:[]},database:{read:["public_viewer","public_editor","admin"],write:[]},"tag-policy":{read:["public_viewer","public_editor","admin"],write:["admin"]},team:{read:["public_viewer","public_editor","admin"],write:["admin"]},"team-members":{read:["public_viewer","public_editor","admin"],write:["admin"]},"team-remap-config":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-data":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-invitation":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-permissions":{read:["public_viewer","public_editor","admin"],write:["admin"]},"user-self":{read:["public_viewer","public_editor","admin"],write:["public_viewer","public_editor","admin"]},"oauth-grant":{read:[],write:[]}},xH={"sandbox-environment":{read:["viewer","editor","admin"],write:["editor","admin"]},"github-connection":{read:["admin"],write:[]},"llm-provider":{read:[],write:[]},investigation:{read:["viewer","editor","admin"],write:["editor","admin"]},"ingestion-api-key":{read:["viewer","editor","admin"],write:["editor","admin"]},"rum-public-token":{read:["viewer","editor","admin"],write:["editor","admin"]},"widget-share":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"dashboard-share":{read:["viewer","editor","admin"],write:["admin"]},"audit-log":{read:["viewer","editor","admin"],write:[]},"custom-role":{read:[],write:[]},"custom-usage-tag":{read:[],write:[]},"cluster-integration-config":{read:[],write:[]},"explorer-saved-view":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"operation-api-key":{read:["viewer","editor","admin"],write:["admin"]},"cloud-account":{read:["viewer","editor","admin"],write:[]},dashboard:{read:["viewer","editor","admin"],write:["editor","admin"]},"dashboard-folder":{read:["viewer","editor","admin"],write:["editor","admin"]},"dashboard-report":{read:["viewer","editor","admin"],write:["editor","admin"]},notebook:{read:["viewer","editor","admin"],write:["editor","admin"]},inventory:{read:["viewer","editor","admin"],write:[]},log:{read:["viewer","editor","admin"],write:[]},"log-route":{read:["viewer","editor","admin"],write:["editor","admin"]},"metric-route":{read:["viewer","editor","admin"],write:["editor","admin"]},metric:{read:["viewer","editor","admin"],write:[]},trace:{read:["viewer","editor","admin"],write:[]},rum:{read:["viewer","editor","admin"],write:[]},monitor:{read:["viewer","editor","admin"],write:["editor","admin"]},"monitor-alert":{read:["viewer","editor","admin"],write:[]},"monitor-debugging":{read:["admin"],write:[]},"notification-integration":{read:["viewer","editor","admin"],write:["editor","admin"]},"notification-rule":{read:["viewer","editor","admin"],write:["editor","admin"]},"adaptive-notification-rule":{read:["viewer","editor","admin"],write:[]},"notification-silence":{read:["viewer","editor","admin"],write:["editor","admin"]},"saml-config":{read:[],write:[]},org:{read:["viewer","editor","admin"],write:[]},"allowed-domains":{read:["viewer","editor","admin"],write:[]},"quality-report":{read:["viewer","editor","admin"],write:["editor","admin"]},"sensitive-data-scanner-rule":{read:["viewer","editor","admin"],write:[]},slo:{read:["viewer","editor","admin"],write:["editor","admin"]},"retention-policy":{read:[],write:[]},"databricks-connection":{read:[],write:[]},service:{read:["viewer","editor","admin"],write:[]},"service-target":{read:["viewer","editor","admin"],write:["editor","admin"]},host:{read:["viewer","editor","admin"],write:[]},database:{read:["viewer","editor","admin"],write:[]},"tag-policy":{read:[],write:[]},team:{read:["viewer","editor","admin"],write:["admin"]},"team-members":{read:["viewer","editor","admin"],write:["admin"]},"team-remap-config":{read:[],write:[]},"user-data":{read:["viewer","editor","admin"],write:["admin"]},"user-invitation":{read:["viewer","editor","admin"],write:["admin"]},"user-permissions":{read:["viewer","editor","admin"],write:[]},"user-self":{read:["viewer","editor","admin"],write:["viewer","editor","admin"]},"oauth-grant":{read:[],write:[]}},RH={user:AH,team:xH};function Kd(e){return mR(e,"team")}function zd(e){return mR(e,"user")}function mR(e,r){let n=[],o=RH[r];for(let[i,s]of Object.entries(o))for(let[c,l]of Object.entries(s))l.includes(e)&&n.push({actionType:c,resourceType:i});return n}var XLe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:zd("admin"),roleKey:"admin"},public_editor:{name:"Public editor",description:"Can view and edit assets in public teams, but not access private teams or critical settings.",permissions:zd("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:zd("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},JLe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:Kd("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:Kd("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:Kd("viewer"),roleKey:"viewer"}};var eke=new Set(xd);var CH={documentation:void 0,investigations:"investigation",logs:"log",metrics:"metric","team-membership":"team-members",traces:"trace",user:"user-data","allowed-domains":"allowed-domains","cloud-account":"cloud-account","custom-usage-tag":"custom-usage-tag",dashboard:"dashboard","dashboard-folder":"dashboard-folder","ingestion-api-key":"ingestion-api-key",inventory:"inventory","log-route":"log-route","metric-route":"metric-route",monitor:"monitor","notification-integration":"notification-integration","notification-rule":"notification-rule","notification-silence":"notification-silence","quality-report":"quality-report","retention-policy":"retention-policy",rum:"rum","rum-public-token":"rum-public-token",service:"service","service-target":"service-target",slo:"slo","tag-policy":"tag-policy",team:"team","user-invitation":"user-invitation"},PH=Object.entries(CH),tke=new Map(PH.flatMap(([e,r])=>r?[[r,e]]:[]));var L="context";var dR="trace_id",Uu=`${L}.team`,nke=`${L}.env`,oke=`${L}.api_key_id`,Nu=`${L}.service.name`,ike=`${L}.service.version`,wu=`${L}.span.kind`,vu=`${L}.span.name`,Ln=`${L}.status.code`,ske=`${L}.stack_trace`,UH="STATUS_CODE_ERROR",ake=`${Ln}:${UH}`,Yd="resource.attributes.team",fR=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var ba=`${L}.host.name`,NH=`${L}.instance`,wH=`${L}.instanceid`,vH=`${L}.instance_name`,cke=`${L}.telemetry.sdk.language`,pke=`${L}.process.runtime.name`,uke=`${L}.scope.name`,lke=`${L}.page.id`,mke=`${L}.app.name`,dke=`${L}.page.attributes.view_id`,fke=`${L}.cloud.provider`,gke=`${L}.cloud.platform`,hke=`${L}.aws.ecs.task.arn`,yke=`${L}.aws.ecs.task.id`,Tke=`${L}.aws.ecs.cluster.arn`,Eke=`${L}.faas.name`,_ke=`${L}.faas.invoked_provider`,Ike=`${L}.gcp.label.service_name`,Ske=`${L}.k8s.cluster.name`,bke=`${L}.k8s.cluster.uid`,Oke=`${L}.k8s.namespace.name`,LH=`${L}.k8s.pod.name`,Ake=`${L}.k8s.pod.uid`,xke=`${L}.k8s.container.name`,Rke=`${L}.k8s.node.name`,Cke=`${L}.k8s.node.uid`,kH=`${L}.k8s.deployment.name`,Pke=`${L}.k8s.deployment.uid`,MH=`${L}.k8s.replicaset.name`,Uke=`${L}.k8s.replicaset.uid`,DH=`${L}.k8s.statefulset.name`,Nke=`${L}.k8s.statefulset.uid`,GH=`${L}.k8s.daemonset.name`,wke=`${L}.k8s.daemonset.uid`,vke=`${L}.k8s.job.name`,Lke=`${L}.k8s.job.uid`,kke=`${L}.k8s.cronjob.name`,Mke=`${L}.k8s.cronjob.uid`,Ci="status_code",Lu="span.name";var ku="span.kind";var $H="db.system.name",FH="db.system",jH="db.namespace",qH="db.name";var Dke=`span_attributes.${jH}`,Gke=`span_attributes.${qH}`,$ke=`span_attributes.${$H}`,Fke=`span_attributes.${FH}`;var jke={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${L}.tag_policy_id`,dataSource:`${L}.data_source`}};var qke={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${L}.batch_kind`,batchKindMetricsFilter:`${L}.batch_kind:metrics`,sourceApiKeyId:`${L}.source_api_key_id`,sourceEnv:`${L}.source_env`,sourceTeam:`${L}.source_team`}};var Vd="__tsuga_metadata__",Bke=`${Vd}.signature`,Hke=`${Vd}.routes`,Kke=`${Vd}.trace_id_bucket`;var Xke=[Ci,Ln,Ln.replace(`${L}.`,"")];var gR="__tsuga_cluster_id__",BH=t.Object({}),HH=t.Object({status:t.Literal("error"),message:t.String({description:"Why this cluster failed to answer the query."})});function Pi(e=BH){let r=x("status",[t.Object({...e.properties,status:t.Literal("ok")}),HH]);return Object.assign(yp(zt,r),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var KH=5,Oa=t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:KH,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var hR=t.Object({type:t.Literal("number"),number:t.String()}),zH=t.Object({type:t.Literal("string"),string:t.String()}),YH=t.Object({type:t.Literal("timestamp"),timestamp:t.String()}),Aa=x("type",[hR,zH,YH]),VH=t.Object({by:t.Record(t.String(),Aa),computed:t.Record(t.String(),hR)}),QH=t.Object({type:t.Literal("buckets"),buckets:t.Array(VH),clusterResponses:t.Optional(Pi())}),WH=t.Object({type:t.Literal("distribution"),bounds:t.Array(t.Number()),buckets:t.Array(t.Object({timestamp:t.Number(),counts:t.Array(t.Number())})),percentiles:t.Optional(t.Array(t.Number()))}),Ui=x("type",[QH,WH]);var TR=1456444800,ER=4927737600,ZH=TR*1e3,XH=ER*1e3,Mu=1704067200,Qd=Mu*1e3,_R={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:Mu,to:Mu}]},JH={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:Qd,to:Qd}]},Du=e=>t.Integer({description:e,examples:[Mu],minimum:TR,maximum:ER,format:"int64"}),yR=e=>t.Integer({description:e,examples:[Qd],minimum:ZH,maximum:XH,format:"int64"}),it=t.Object({from:t.Optional(Du("Start of the query window as a Unix timestamp in seconds")),to:t.Optional(Du("End of the query window as a Unix timestamp in seconds"))},_R),Tt=t.Object({from:Du("Start of the query window as a Unix timestamp in seconds"),to:Du("End of the query window as a Unix timestamp in seconds")},_R),kn=t.Object({from:yR("Start of the query window as a Unix timestamp in milliseconds"),to:yR("End of the query window as a Unix timestamp in milliseconds")},JH);var r2="/v0/aggregation",n2=t.Union([t.Literal("a"),t.Literal("d"),t.Literal("q"),t.Literal("w"),t.Literal("t")]),Wd=t.Object({parallelism:t.Number(),engine:n2,recordBatchCache:t.Optional(t.Boolean()),includeNullGroups:t.Optional(t.Boolean()),restartAwareGaugeSum:t.Optional(t.Boolean())}),Zd=["logs","metrics","traces"];var bR={logs:"Logs",metrics:"Metrics",traces:"Spans"},o2=[...Zd,"connections","log-patterns","spans","rum"];var EMe={...bR,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},vr=[...Zd,"rum"];var _Me={...bR,rum:"RUM events"};var IMe=t.Enum(o2,{description:"Data source being queried"}),SMe=t.Enum(Zd,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),Wt=t.Enum(vr,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),bo=t.String({description:"Attribute containing the values to aggregate"}),Oo=p({description:"Attribute containing the values to aggregate"}),i2=x("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(bo)},{$id:"AggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:bo},{$id:"AggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:bo},{$id:"AggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:bo},{$id:"AggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:bo},{$id:"AggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:bo},{$id:"AggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:bo,percentile:t.Number({description:"Percentile to compute for the selected field."})},{$id:"AggregatePercentile",title:"Percentile"})],{title:"Aggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),s2=x("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(Oo)},{$id:"InputAggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:Oo},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:Oo},{$id:"InputAggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:Oo},{$id:"InputAggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:Oo},{$id:"InputAggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:Oo},{$id:"InputAggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:Oo,percentile:t.Number({description:"Percentile to compute for the selected field."})},{$id:"InputAggregatePercentile",title:"Percentile"})],{title:"InputAggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),OR=t.Object({type:t.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),AR=t.Object({type:t.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),xR=t.Object({type:t.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),RR=t.Object({type:t.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),CR=t.Object({type:t.Literal("increase",{description:"`Increase` is designed for cumulative metrics. It computes the increase of cumulative metrics by automatically handling counter resets. When used with an aggregation such as `sum` it combines all series without requiring an explicit group-by."})},{$id:"FunctionIncrease",title:"Increase"}),PR=t.Object({type:t.Literal("power",{description:"Raises values to a specified power"}),exponent:t.Integer({description:"The exponent to raise values to"})},{$id:"FunctionPower",title:"Power"}),UR=t.Object({type:t.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),NR=t.Object({type:t.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),a2=t.Object({type:t.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:t.String({description:"Duration of the rolling window"})},{$id:"FunctionRolling",title:"Rolling"}),c2=t.Object({type:t.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:p({allowEmpty:!1,description:"Duration of the rolling window"})},{$id:"InputFunctionRolling",title:"Rolling"}),p2=t.Object({type:t.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:t.Integer({description:"The base of the logarithm"})},{$id:"FunctionLog",title:"Log"}),u2=t.Object({type:t.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:t.Integer({description:"The base of the logarithm",minimum:2})},{$id:"InputFunctionLog",title:"Log"}),l2=t.Object({type:t.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:t.Integer({description:"Number of seconds to offset"})},{$id:"FunctionTimeOffset",title:"TimeOffset"}),m2=t.Object({type:t.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:t.Integer({description:"Number of seconds to offset",minimum:1})},{$id:"InputFunctionTimeOffset",title:"TimeOffset"}),d2=x("type",[OR,AR,xR,RR,CR,a2,p2,PR,UR,NR,l2],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),f2=x("type",[OR,AR,xR,RR,CR,c2,u2,PR,UR,NR,m2],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var IR=t.Object({min:t.Number({description:"Lower bound of the distribution range."}),max:t.Number({description:"Upper bound of the distribution range."})}),g2=["linear","log"],Gu=t.Enum(g2,{description:"Spacing of the bucket boundaries across the distribution range. `linear` splits the range into equal-width buckets; `log` widens each bucket logarithmically, giving finer resolution near the lower bound."}),SR=t.Integer({minimum:1}),h2=x("type",[t.Object({type:t.Literal("scalar")},{title:"Scalar",description:"Returns a single value"}),t.Object({type:t.Literal("timeseries"),aggregationWindow:p({description:'Time bucket size for aggregation (e.g. "10s", "60s", "1m")'})},{title:"Timeseries",description:"Returns a time series"}),t.Object({type:t.Literal("histogram"),by:t.Optional(p()),bucketCount:t.Optional(SR),bounds:t.Optional(IR),boundsScale:t.Optional(Gu),percentiles:t.Optional(t.Array(t.Number({minimum:0,maximum:100,multipleOf:1}),{minItems:1}))},{title:"Histogram",description:"Returns a single distribution over the entire time range"}),t.Object({type:t.Literal("heatmap"),aggregationWindow:p({description:'Time bucket size for the heatmap (e.g. "10s", "60s", "1m")'}),by:t.Optional(p()),bucketCount:t.Optional(SR),bounds:t.Optional(IR)},{title:"Heatmap",description:"Returns a distribution per time window"})]),xa=15,y2=["zero","null"],T2=t.Enum(y2,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),wR=t.Object({mode:t.Object({type:T2},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),E2=["avg","sum","min","max","last"],vR=t.Enum(E2,{description:"Per-series rollup applied within each time bucket before the cross-series aggregate. Use it on metric queries when `aggregate.type` is `sum` and no `rate`, `increase`, `last`, or `rolling` function is present. When omitted, Tsuga derives the rollup from the metric type."});var LR={aggregate:i2,functions:t.Optional(t.Array(d2,{description:"Post-processing functions applied to aggregation results"})),fill:t.Optional(wR),timeAggregate:t.Optional(vR)},kR={aggregate:s2,functions:t.Optional(t.Array(f2,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:t.Optional(wR),timeAggregate:t.Optional(vR)},_2={description:"Aggregations that may be combined together in the same query. Each item is referenced from `formula` as q1, q2, and so on, in submission order."},MR={maxItems:xa,description:'Aggregations that may be combined together in the same query. Each item is referenced from `formula` as q1, q2, and so on, in submission order. For dataSource "metrics", each aggregate\'s `field` is the metric name, not an attribute; to count distinct values of an attribute use unique-count with field "<metricName>.context.<attribute>" (e.g. "system.cpu.utilization.context.host.name").'},DR=t.Array(t.Object({...LR,filter:t.Optional(t.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),_2),Ra=t.Array(t.Object({...kR,filter:t.Optional(p({type:"tsuga-query",description:"Tsuga query filter to apply to the aggregation. Defaults to an empty string when omitted."}))},{title:"AggregationQuery"}),MR),Xr=t.Array(t.Object({...LR,filter:t.String({description:"Filter to apply to the aggregation"})},{title:"MonitorAggregationQuery",description:"Single aggregation query evaluated by a monitor or SLO."}),{description:"Aggregation queries used by alerting and SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."}),Mn=t.Array(t.Object({...kR,filter:p({type:"tsuga-query",description:"Tsuga query filter applied to this alerting or SLO aggregation query. Required by the API; use the query language for the selected data source."})},{title:"MonitorAggregationQuery",description:"Single aggregation query evaluated by a monitor."}),{...MR,description:"Aggregation queries used by alerting. Each query is referenced from formulas as q1, q2, and so on."}),GR=t.Array(t.Omit(Mn.items,["fill"],{title:"SloAggregationQuery",description:"Single aggregation query evaluated by an SLO."}),{minItems:1,maxItems:xa,description:"Aggregation queries used by SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var $u=t.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),Ao=p({type:"tsuga-formula",description:"Formula referencing query outputs, such as `q1 + q2`, to compute derived results. Defaults to `q1`. Formulas may reference only submitted queries (`q1` through `qN`); undefined query references return 400."}),I2=t.Object({fields:t.Array(t.String(),{description:"Telemetry attribute names used to group aggregation results."}),limit:t.Number({description:'Maximum number of distinct values of `fields` returned for this grouping level, ranked by aggregate value. Groups beyond the limit are truncated, not merged into an "other" group.'}),sortOrder:t.Optional(K),replaceNullWith:t.Optional(t.String({description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),S2=t.Object({fields:t.Array(p(),{maxItems:1,description:"Telemetry attribute name to group aggregation results by. Currently limited to one field per grouping level."}),limit:t.Number({description:'Maximum number of distinct values of `fields` to return for this grouping level, ranked by aggregate value. Groups beyond the limit are truncated from the response, not merged into an "other" group.'}),sortOrder:t.Optional(K),replaceNullWith:t.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),$R=7;var Ni=t.Array(I2,{description:"Nested grouping levels applied to the results, outermost first (e.g. group by service, then by level within each service). Each level splits results further, so the response contains one result per unique combination of group values."}),Jr=t.Array(S2,{maxItems:$R,description:"Nested grouping levels applied to aggregation results, outermost first (e.g. group by service, then by level within each service). Each level splits results further, so the response contains one result per unique combination of group values instead of one aggregated total. Defaults to an empty array (one ungrouped result) when omitted."});var bMe=d({tags:["aggregation"],url:`${r2}/multi-query`,method:"POST",body:t.Object({timeRange:kn,queries:Ra,groupBy:t.Optional(Jr),returnType:h2,dataSource:Wt,formula:Ao,executionOptions:Wd,triggeredBy:t.Optional(t.Literal("refresh")),shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1})),clusterIds:t.Optional(Oa),viewAs:t.Optional(t.Object({owner:p({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:Pn}))}),response:Ui});var Xd=2,Jd=2;var FR=[{key:"amex15_digits",name:"American Express card (1x15 digits)",category:"financial-data",example:"378282246310005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex4443_digits",name:"American Express card (4+4+4+3 digits)",category:"financial-data",example:"3782 8224 6310 005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex465_digits",name:"American Express card (4+6+5 digits)",category:"financial-data",example:"3782 822463 10005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"amex87_digits",name:"American Express card (8+7 digits)",category:"financial-data",example:"37828224 6310005",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card14_digits",name:"Diners card (1x14 digits)",category:"financial-data",example:"30569309025904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card4442_digits",name:"Diners card (4+4+4+2 digits)",category:"financial-data",example:"3056 9309 0259 04",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card464_digits",name:"Diners card (4+6+4 digits)",category:"financial-data",example:"3056 930902 5904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"diners_card86_digits",name:"Diners card (8+6 digits)",category:"financial-data",example:"30569309 025904",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card16_digits",name:"Discover card (1x16 digits)",category:"financial-data",example:"6011111111111117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card88_digits",name:"Discover card (2x8 digits)",category:"financial-data",example:"60111111 11111117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"discover_card4444_digits",name:"Discover card (4x4 digits)",category:"financial-data",example:"6011 1111 1111 1117",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card16_digits",name:"JCB card (1x16 digits)",category:"financial-data",example:"3530111333300000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card88_digits",name:"JCB card (2x8 digits)",category:"financial-data",example:"35301113 33300000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"jcb_card4444_digits",name:"JCB card (4x4 digits)",category:"financial-data",example:"3530 1113 3330 0000",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card16_digits",name:"Maestro card (1x16 digits)",category:"financial-data",example:"6759649826438453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card88_digits",name:"Maestro card (2x8 digits)",category:"financial-data",example:"67596498 26438453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"maestro_card4444_digits",name:"Maestro card (4x4 digits)",category:"financial-data",example:"6759 6498 2643 8453",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard16_digits",name:"Mastercard (1x16 digits)",category:"financial-data",example:"5555555555554444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard88_digits",name:"MasterCard (2x8 digits)",category:"financial-data",example:"55555555 55554444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"mastercard4444_digits",name:"MasterCard (4x4 digits)",category:"financial-data",example:"5555 5555 5555 4444",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa16_digits",name:"Visa (1x16 digits)",category:"financial-data",example:"4111111111111111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa19_digits",name:"Visa (1x19 digits)",category:"financial-data",example:"4111111111111111151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa88_digits",name:"Visa (2x8 digits)",category:"financial-data",example:"41111111 11111111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa883_digits",name:"Visa (8+8+3 digits)",category:"financial-data",example:"41111111 11111111 151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa4444_digits",name:"Visa (4x4 digits)",category:"financial-data",example:"4111 1111 1111 1111",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"visa44443_digits",name:"Visa (4+4+4+4+3 digits)",category:"financial-data",example:"4111 1111 1111 1111 151",isUsingLuhnAlgorithm:!0,regexp:"(?-u:\\\\b)[02-9]([-\\\\s_]*\\d){12,18}(?-u:\\\\b)"},{key:"dropbox_long_lived_api_token",name:"Dropbox long lived API token",category:"credential",example:"767cb868836AAAAAAAAAAszri2cnmzu5tr0yf-nvclmwfyiswl67qyqw-uzn-scg",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:[a-z0-9]{11}(AAAAAAAAAA)[a-z0-9\\-_=]{43})"},{key:"dropbox_short_lived_api_token",name:"Dropbox short lived API token",category:"credential",example:"sl.nu0yvsrposcjeyjcpmbfrmqygllrxpahrgbt8flml9xroifbic",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:sl\\.[a-z0-9\\-=_]{50})"},{key:"french_nirpp",name:"French social security number (NIRPP)",category:"personal-information",example:"188073512757119",isUsingLuhnAlgorithm:!1,regexp:"([12])\\s*[0-9]{2}\\s*(0[1-9]|1[0-2])\\s*(2[AB]|[0-9]{2})\\s*([0-9]{3})\\s*([0-9]{3})(\\s*[0-9]{2})?"},{key:"ip_address",name:"IP address",category:"device-identifier",example:"81.55.13.53",isUsingLuhnAlgorithm:!1,regexp:""},{key:"social_security_number",name:"Social security number (XXX-XX-XXXX)",category:"personal-information",example:"437-02-2223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])-(?:0[1-9]|[1-9]0|[1-9][1-9])-(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"social_security_number_space",name:"Social security number (XXX XX XXXX)",category:"personal-information",example:"437 02 2223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])\\s+(?:0[1-9]|[1-9]0|[1-9][1-9])\\s+(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"social_security_number_digits",name:"Social security number (9 digits)",category:"personal-information",example:"437022223",isUsingLuhnAlgorithm:!1,regexp:"(?x)(?-u:\\b)(?:00[1-9]|0[1-9][0-9]|[1-578][0-9]{2}|6[0-57-9][0-9]|66[0-57-9])(?:0[1-9]|[1-9]0|[1-9][1-9])(?:000[1-9]|00[1-9]0|0[1-9]00|[1-9]000|[1-9]{4})(?-u:\\b)"},{key:"email",name:"Email",category:"credential",example:"admin@tsuga.com",isUsingLuhnAlgorithm:!1,regexp:"[a-zA-Z0-9-_.]*[a-zA-Z0-9_](@[a-zA-Z0-9_]+)(\\.[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)?[a-zA-Z])(?-u:\\b)"},{key:"one_password_secret_key",name:"1Password secret key",category:"credential",example:"A3-O28NKC-F58GULWCN72-4NIKS-KGY7V-U7FAT",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)A3-[A-Z0-9]{6}-(?:(?:[A-Z0-9]{11})|(?:[A-Z0-9]{6}-[A-Z0-9]{5}))-[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}(?-u:\\b)"},{key:"one_password_service_account_token",name:"1Password service account token",category:"credential",example:"ops_eyJdAZ/FoIyz0jAXpEQOrRdIE8ydVaYfAXeZXGFqHWfBOjnE/Vgf5kHIbwrNAp2WeFNPeFiVJPlLv1hmaTVums0ldq1Kv8JEglMqP3f0ATBuX/WRbKqXYS3Z1wSzxg6S0krW4df7ZplvK04+JhJimejyTEH5dYaxqsYDBSLxjeEq7JWsmHEuXj6WP5qQi7FB+5s+CwhWPWY/jDhUMB3fdowXbfv5VnWri3iYrfBh+bFeRe9KURhXGHRDE9hgs",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ops_eyJ[a-zA-Z0-9+/]{50}"},{key:"adafruit_api_key",name:"Adafruit API key",category:"credential",example:"jb9pb4unb2bhe7xqepmgwtl2jg7ti101",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{32})"},{key:"adobe_client_id",name:"Adobe client ID",category:"credential",example:"c4166853dfd2897ebe706d49ef13fe63",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"adobe_client_secret",name:"Adobe client secret",category:"credential",example:"p8e-bb6e1614324ae48e507d33af176db3b7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:p8e-[a-z0-9]{32})"},{key:"age_secret_key",name:"Age secret key",category:"credential",example:"AGE-SECRET-KEY-1QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AGE-SECRET-KEY-1[QPZRY9X8GF2TVDW0S3JN54KHCE6MUA7L]{58}"},{key:"airtable_api_key",name:"Airtable API key",category:"credential",example:"19b73hbi0tc5cdy4w",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{17})"},{key:"algolia_api_key",name:"Algolia API key",category:"credential",example:"346155deb68d31c4018d73de73452947",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"alibaba_access_key_id",name:"Alibaba Cloud AccessKey ID",category:"credential",example:"LTAI7cc6804e4c2155cd52bd",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:LTAI[a-z0-9]{20})"},{key:"alibaba_secret_key",name:"Alibaba Cloud secret key",category:"credential",example:"suwixirhh10xhnko9bv0vfg2971u9p",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"anthropic_admin_api_key",name:"Anthropic admin API key",category:"credential",example:"sk-ant-admin01-abc12fake-456def789ghij-klmnopqrstuvwx-3456yza789bcde-12fakehijklmnopby56aaaogaopaaaabc123xyzAA",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-ant-admin01-[a-zA-Z0-9_-]{93}AA)"},{key:"anthropic_api_key",name:"Anthropic API key",category:"credential",example:"sk-ant-api03-abc123xyz-456def789ghij-klmnopqrstuvwx-3456yza789bcde-1234fghijklmnopby56aaaogaopaaaabc123xyzAA",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-ant-api03-[a-zA-Z0-9_-]{93}AA)"},{key:"artifactory_api_key",name:"Artifactory API key",category:"credential",example:"AKCpt771klpkqllt647fdf36fq43radbz2w2nyetvx4l90qyeef8kbgkmke63ul5vf6mqsy82",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AKCp[A-Za-z0-9]{69}(?-u:\\b)"},{key:"artifactory_reference_token",name:"Artifactory reference token",category:"credential",example:"cmVmdc6i6888t9viuobfd88e46pdonjjsvmme6np82qti7wzbj7l9m1ygtyl9wik",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)cmVmd[A-Za-z0-9]{59}(?-u:\\b)"},{key:"asana_client_id",name:"Asana client ID",category:"credential",example:"9760134337886314",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{16})"},{key:"asana_client_secret",name:"Asana client secret",category:"credential",example:"tcnc8mjrf5bad359nnz3j1z90gow67ji",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"atlassian_api_token",name:"Atlassian API token",category:"credential",example:"fdo4scsa4kh53jnenkfp5fbe",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:[a-z0-9]{20}[a-f0-9]{4})|(?-u:\\b)(?:ATATT3[A-Za-z0-9_-=]{50})"},{key:"authress_service_client_access_key",name:"Authress service client access key",category:"credential",example:"sc_scmz00n9xj.0ykp.acc_2k5vtnrec4.55vc9459s-gc5qlia7a67jvzm0bobn3g0ezimd3b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:sc|ext|scauth|authress)_[a-z0-9]{5,30}\\.[a-z0-9]{4,6}\\.(?-i:acc)[_-][a-z0-9-]{10,32}\\.[a-z0-9+/_=-]{30})"},{key:"aws_access_token",name:"AWS access token",category:"credential",example:"AKIALALEMEL33243OLIB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z2-7]{16})(?-u:\\b)"},{key:"azure_ad_client_secret",name:"Azure AD client secret",category:"credential",example:"bP88Q~rcBcYjzzOhg1Hnn76Wm3jGgakZiZ.8vMgR",isUsingLuhnAlgorithm:!1,regexp:"(?:^|[\\\\'\"` \\r\\n\\t\\f\\v>=:(?:,)])(?:[a-zA-Z0-9_~.]{3}[0-9]Q~[a-zA-Z0-9_~.-]{31,34})(?:$|[\\\\'\"` \\r\\n\\t\\f\\v<),])"},{key:"bitbucket_client_id",name:"Bitbucket client ID",category:"credential",example:"yyxmjnl3kahirvct7sat2082pzqdyf09",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"bitbucket_client_secret",name:"Bitbucket client secret",category:"credential",example:"fylw1pominwz91e5guqjiugw6srutpl64vzch5rnt8xnt31ka7so9va73fscz836",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{64})"},{key:"beamer_api_token",name:"Beamer API token",category:"credential",example:"b_zhy-phuoqk13asco6az4u_0yhtklgswm4umkv95nv4gu",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:b_[a-z0-9=_\\-]{44})"},{key:"codecov_access_token",name:"Codecov access token",category:"credential",example:"r93iopllonuphk41qglet20y8cb83thm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"clickhouse_cloud_api_secret_key",name:"ClickHouse Cloud API secret key",category:"credential",example:"4b1dbRdW3rOcB7xLthrM4BTBGK1qPLkHigpN1bXD6z",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:4b1d[A-Za-z0-9]{38})(?-u:\\b)"},{key:"clojars_api_token",name:"Clojars API token",category:"credential",example:"CLOJARS_d1vd7t0blxaarzx25dxoda4hm5ox86st6o5ww7tnzsfz07wvu223bf0fmgim",isUsingLuhnAlgorithm:!1,regexp:"CLOJARS_[a-z0-9]{60}"},{key:"cloudflare_api_key",name:"Cloudflare API key",category:"credential",example:"ckg0h_dzkxnl627gy3nskpq9wzm4d5hc_vxk272h",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{40})"},{key:"cloudflare_global_api_key",name:"Cloudflare global API key",category:"credential",example:"1d003bb65ec73ad2691fb76631b6496e3c9d9",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{37})"},{key:"cloudflare_origin_ca_key",name:"Cloudflare Origin CA key",category:"credential",example:"v1.0-aaa334dc886f30631ba0a610-0d98ef66290d7e50aac7c27b5986c99e6f3f1084c881d8ac0eae5de1d1aa0644076ff57022069b3237d19afe60ad045f207ef2b16387ee37b749441b2ae2e9ebe5b4606e846475d4a5",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:v1\\.0-[a-f0-9]{24}-[a-f0-9]{50})"},{key:"cohere_api_token",name:"Cohere API token",category:"credential",example:"lpn59BQ4FNUabVJh1vCpIqZpQbaViELQrTa14p9D",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[a-zA-Z0-9]{40})"},{key:"confluent_access_token",name:"Confluent access token",category:"credential",example:"kkat92sclkukwvr2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{16})"},{key:"confluent_secret_key",name:"Confluent secret key",category:"credential",example:"64d4ppp37l9fjhadm8vv0awie6wjo4d6ourfcqvi2bcs2tm95x4f0e8gyb8z8usj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"contentful_delivery_api_token",name:"Contentful delivery API token",category:"credential",example:"eumospigka64wiwpavfmmblrq7x1hm6gz84wiiw2ff3",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{43})"},{key:"curl_auth_header",name:"Curl authorization header",category:"credential",example:"curl --header 'Authorization: 5eb4223e-5008-46e5-be67-c7b8f2732305'",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)curl(?-u:\\b)(?:.*?|.*?(?:[\\r\\n]{1,2}.*?){1,5})[ \\t\\n\\r](?:-H|--header)(?:=|[ \\t]{0,5})(?:"(?:Authorization:[ \\t]{0,5}(?:Basic[ \\t](?:[a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \\t](?:[a-zA-Z0-9_=~@.+/-]{8,})|(?:[a-zA-Z0-9_=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \\t]{0,5}(?:[a-zA-Z0-9_=~@.+/-]{8,}))"|'(?:Authorization:[ \\t]{0,5}(?:Basic[ \\t](?:[a-z0-9+/]{8,}={0,3})|(?:Bearer|(?:Api-)?Token)[ \\t](?:[a-zA-Z0-9_=~@.+/-]{8,})|(?:[a-zA-Z0-9_=~@.+/-]{8,}))|(?:(?:X-(?:[a-z]+-)?)?(?:Api-?)?(?:Key|Token)):[ \\t]{0,5}(?:[a-zA-Z0-9_=~@.+/-]{8,}))')(?:(?-u:\\B)|[ \\r\\n\\t\\f\\v]|\\z)`},{key:"curl_auth_user",name:"Curl basic authentication",category:"credential",example:"curl -u elastic:P@ssw0rd$1",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)curl(?-u:\\b)(?:.*|.*(?:[\\r\\n]{1,2}.*){1,5})[ \\t\\n\\r](?:-u|--user)(?:=|[ \\t]{0,5})(?:"(:[^"]{3,}|[^:"]{3,}:|[^:"]{3,}:[^"]{3,})"|'(?:[^:']{3,}:[^']{3,})'|(?:(?:"[^"]{3,}"|'[^']{3,}'|[a-zA-Z0-9_$@.-]+):(?:"[^"]{3,}"|'[^']{3,}'|[a-zA-Z0-9_\${}@.-]+)))(?:[ \\r\\n\\t\\f\\v]|\\z)`},{key:"databricks_api_token",name:"Databricks API token",category:"credential",example:"dapia2553f815d29a193fd09c2bb55201895",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dapi[a-f0-9]{32}(?:-[0-9])?)"},{key:"datadog_access_token",name:"Datadog access token",category:"credential",example:"ljgbhjnca2hy5yc2nv7cag1ag7ehx2hc6geparov",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{40})"},{key:"defined_networking_api_token",name:"Defined Networking API token",category:"credential",example:"dnkey-nowf_nwyqhvqt1gi66xnuuf2rb-bfxnr9_qydyxnxn1y8uijvhhp9owllbg-2czoe-7qs5_w5650xei",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:-[a-z0-9=_\\-]{26}-[a-z0-9=_\\-]{52})"},{key:"digitalocean_pat",name:"DigitalOcean personal access token",category:"credential",example:"dop_v1_ec8f4a856c1459bd442a275461e2f709506347de30b180851cde71f696e9fcc8",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dop_v1_[a-f0-9]{64})"},{key:"digitalocean_access_token",name:"DigitalOcean OAuth access token",category:"credential",example:"doo_v1_42b8ea6c4b0c373f88aff9d3fa87e123ab23b0d3c22ac6d4361a4e9c1e89eaa6",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:doo_v1_[a-f0-9]{64})"},{key:"digitalocean_refresh_token",name:"DigitalOcean OAuth refresh token",category:"credential",example:"dor_v1_4d9b3e6fbe65ab472e464dfa6377d702e80164442acdfbeb3ef032d917cb9984",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:dor_v1_[a-f0-9]{64})"},{key:"discord_api_token",name:"Discord API token",category:"credential",example:"7eb855d9a40747182d0b0ea74df27aee31d05756a9933a815a3ccb5a46b2d61d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{64})"},{key:"discord_client_id",name:"Discord client ID",category:"credential",example:"763721114261247538",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{18})"},{key:"discord_client_secret",name:"Discord client secret",category:"credential",example:"13641266018325206246161633988007",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"doppler_api_token",name:"Doppler API token",category:"credential",example:"dp.pt.vgin8wwjy7sx66fyq99tavkm3y5g2jdxmsufh257dhj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)dp\\.pt\\.[a-z0-9]{43}"},{key:"dropbox_api_token",name:"Dropbox API token",category:"credential",example:"rdlztoij88rzrsk",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{15})"},{key:"droneci_access_token",name:"DroneCI access token",category:"credential",example:"v26gffr903rbti5v7m392ba0u7oarz36",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"duffel_api_token",name:"Duffel API token",category:"credential",example:"duffel_test_-yd6b3pc4jy593pt5kr2l3ynzkb5b_f619dshefiz=v",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)duffel_(?:test|live)_[a-z0-9_\\-=]{43}"},{key:"dynatrace_api_token",name:"Dynatrace API token",category:"credential",example:"dt0c01.ben820rdpb1so4kasfx3yn4a.zkje7lawif35udsin5t1mi1m1sne7wdzphlzrmdnu3j69gr4kgf5dwg4x5lb30zg",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)dt0c01\\.[a-z0-9]{24}\\.[a-z0-9]{64}"},{key:"easypost_api_token",name:"EasyPost API token",category:"credential",example:"EZAKBVScDZwZFv0nJXHBcxPGil7eztnPJOSmDFf2NGKQk6Dn7VqULciSRm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)EZAK[a-z0-9]{54}(?-u:\\b)"},{key:"easypost_test_api_token",name:"EasyPost test API token",category:"credential",example:"EZTKuxUXVU5HBS1K2iyh165t3VtivpdxMgIf5Y2P1oJxeFeaJGcwzVexds",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)EZTK[a-z0-9]{54}(?-u:\\b)"},{key:"etsy_access_token",name:"Etsy access token",category:"credential",example:"8ssp35lhprxpb3sjyergcz5z",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{24})"},{key:"facebook_secret",name:"Facebook secret",category:"credential",example:"c41c21ba4fb5ee05398db86ca83f06db",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"facebook_access_token",name:"Facebook access token",category:"credential",example:"911602140448729|AY-lRJZq9BoDLobvAiP25L7RcMg",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:[0-9]{15,16}(\\||%)[0-9a-z\\-_]{27,40})"},{key:"facebook_page_access_token",name:"Facebook page access token",category:"credential",example:"EAAM9GOnCB9kBO2frzOAWGN2zMnZClQshlWydZCrBNdodesbwimx1mfVJgqZBP5RSpMfUzWhtjTTXHG5I1UlvlwRZCgjm3ZBVGeTYiqAAoxyED6HaUdhpGVNoPUwAuAWWFsi9OvyYBQt22DGLqMIgD7VktuCTTZCWKasz81Q822FPhMTB9VFFyClNzQ0NLZClt9zxpsMMrUZCo1VU1rL3CKavir5QTfBjfCEzHNlWAUDUV2YZD",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:EAA[MC][a-z0-9]{50})"},{key:"fastly_api_token",name:"Fastly API token",category:"credential",example:"im7_ux24tyyxz_4y4mvzj22akpid830c",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"finicity_client_secret",name:"Finicity client secret",category:"credential",example:"roepymyr0ce7wxhjvgb2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{20})"},{key:"finicity_api_token",name:"Finicity API token",category:"credential",example:'= "cce089057c8b7fe7f2a8474b9a050816',isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"flickr_access_token",name:"Flickr access token",category:"credential",example:"damvt93tudulk6wrfp36sawndc9pa7bb",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"finnhub_access_token",name:"Finnhub access token",category:"credential",example:"x01lnfp13spcbsa0at32",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{20})"},{key:"flutterwave_public_key",name:"Flutterwave public key",category:"credential",example:"FLWPUBK_TEST-99484d505b4ee5c1181a2884f5fe3852-X",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWPUBK_TEST-[a-h0-9]{32}-X"},{key:"flutterwave_secret_key",name:"Flutterwave secret key",category:"credential",example:"FLWSECK_TEST-66187ac83488c2245f0d7e95fa37e833-X",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWSECK_TEST-[a-h0-9]{32}-X"},{key:"flutterwave_encryption_key",name:"Flutterwave encryption key",category:"credential",example:"FLWSECK_TEST-6262214a02e7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)FLWSECK_TEST-[a-h0-9]{12}"},{key:"flyio_access_token",name:"Fly.io access token",category:"credential",example:"fo1_m-HT0NHLBSPwMJ2hIer4v3lxtWEC7grXNidQxJMrVVE",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:fo1_[a-zA-Z0-9_-]{43}|fm1[ar]_[a-zA-Z0-9+\\/]{50}))"},{key:"frameio_api_token",name:"Frame.io API token",category:"credential",example:"fio-u-4ov9vjtr2wwj8j1gob-8xrx2-1=z818psmitskgoq4=p-_k77d54034z55xk-lqh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)fio-u-[a-z0-9\\-_=]{64}"},{key:"freshbooks_access_token",name:"FreshBooks access token",category:"credential",example:"gqw118uwne1nddlt4yruvvs4jr9s0vrj5mxaswgb2amacod8lgnmrknsvbovsx1g",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"gocardless_api_token",name:"GoCardless API token",category:"credential",example:"live_-z4lwtrrk6p6=-v1ig_y_4ceplziwek0lw=oz-eu",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:live_[a-z0-9\\-_=]{40})"},{key:"gcp_api_key",name:"GCP API key",category:"credential",example:"AIzaYpvGqEzpgB7R353HD9CxN8LuhZ6d6UfuXLL",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:AIza[a-zA-Z0-9_-]{35})"},{key:"github_pat",name:"GitHub personal access token",category:"credential",example:"ghp_t7i9llxuukeb7apn4zlnyeyz5b0007rsfs54",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ghp_[0-9a-zA-Z]{36}"},{key:"github_fine_grained_pat",name:"GitHub fine-grained personal access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)github_pat_[a-zA-Z0-9_]{82}"},{key:"github_oauth",name:"GitHub OAuth token",category:"credential",example:"gho_anlrm6zqscqityoqozv503by66dobnem4yxh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gho_[0-9a-zA-Z]{36}"},{key:"github_app_token",name:"GitHub app token",category:"credential",example:"ghs_0zleityj4n1ulz178o9in1w97q1ifw8u3y8h",isUsingLuhnAlgorithm:!1,regexp:"(?:ghu|ghs)_[0-9a-zA-Z]{36}"},{key:"github_refresh_token",name:"GitHub refresh token",category:"credential",example:"ghr_inu1aa7qbgi46cf8nprbgh4kn03d0zk35raj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ghr_[0-9a-zA-Z]{36}"},{key:"gitlab_cicd_job_token",name:"GitLab CI/CD job token",category:"credential",example:"glcbt-7h2nr_6jmho0uoqkb1ww431kfl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glcbt-[0-9a-zA-Z]{1,5}_[0-9a-zA-Z_-]{20}"},{key:"gitlab_deploy_token",name:"GitLab deploy token",category:"credential",example:"gldt-7a3o70gqa8zkal0zdp4x",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gldt-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_feature_flag_client_token",name:"GitLab feature flag client token",category:"credential",example:"glffct-dsct62ndnvcj7alw5nas",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glffct-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_feed_token",name:"GitLab feed token",category:"credential",example:"glft-13956nvy00289v6xu0di",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glft-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_incoming_mail_token",name:"GitLab incoming mail token",category:"credential",example:"glimt-fcdt1a5jvj01si61jgkse2r20",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glimt-[0-9a-zA-Z_\\-]{25}"},{key:"gitlab_kubernetes_agent_token",name:"GitLab Kubernetes agent token",category:"credential",example:"glagent-8wxkulkbbuk7u6r3nvrefswdfw5o0v7vy81y4oky8rnfogm826",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glagent-[0-9a-zA-Z_\\-]{50}"},{key:"gitlab_oauth_app_secret",name:"GitLab OAuth app secret",category:"credential",example:"gloas-vawws2nw5kf6rizn49g41jc3jiy4xqioaihrwm1msltbdt4cbmo4x52tygcic7af",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)gloas-[0-9a-zA-Z_\\-]{64}"},{key:"gitlab_pat",name:"GitLab personal access token",category:"credential",example:"glpat-2gl3ku1497ms4gzyv16i",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glpat-[a-zA-Z0-9_-]{20}"},{key:"gitlab_pat_routable",name:"GitLab personal access token (routable)",category:"credential",example:"glpat-2hf7vebpux9j56tdcqqsvap7vxc.chvjof35u",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glpat-[0-9a-zA-Z_-]{27}\\.[0-9a-z]{2}[0-9a-z]{7}(?-u:\\b)"},{key:"gitlab_ptt",name:"GitLab personal access token (temporary)",category:"credential",example:"glptt-b54e8b7b90cf006b79af110baa9b8d9183fd7048",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glptt-[0-9a-f]{40}"},{key:"gitlab_rrt",name:"GitLab registration token",category:"credential",example:"GR1348941vnauzmn2hj0zncvt0nfe",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)GR1348941[a-zA-Z0-9_-]{20}"},{key:"gitlab_runner_authentication_token",name:"GitLab runner authentication token",category:"credential",example:"glrt-xbd1w7c9clbxm52zdxkm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glrt-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_runner_authentication_token_routable",name:"GitLab runner authentication token (routable)",category:"credential",example:"glrt-t5_8d8ugbkfzddae0dw06tvm0x7qxc.mwcd1a7cn",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glrt-t[0-9]_[0-9a-zA-Z_\\-]{27}\\.[0-9a-z]{2}[0-9a-z]{7}(?-u:\\b)"},{key:"gitlab_scim_token",name:"GitLab SCIM token",category:"credential",example:"glsoat-9jb5zk1nvy800c1uqhh0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)glsoat-[0-9a-zA-Z_\\-]{20}"},{key:"gitlab_session_cookie",name:"GitLab session cookie",category:"credential",example:"_gitlab_session=yjhub6vtrp60djn6rszuemeacsoqox97",isUsingLuhnAlgorithm:!1,regexp:"_gitlab_session=[0-9a-z]{32}"},{key:"gitter_access_token",name:"Gitter access token",category:"credential",example:"uazubes6trcd_1gym09opuf_8gj1rmvj6jwber4a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{40})"},{key:"grafana_api_key",name:"Grafana API key",category:"credential",example:"eyJrIjoiyl5shjvqja0xkfbu38m24vn5httsipr1h9fgjhodxzlkpravuiy8h7hom5kt8gtwuguh2v",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:eyJrIjoi[A-Za-z0-9]{70}={0,3})"},{key:"grafana_cloud_api_token",name:"Grafana cloud API token",category:"credential",example:"glc_cb7p4j2g1qu0sy84me72ufmn1z8mqk8y",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:glc_[A-Za-z0-9+/]{32}={0,3})"},{key:"grafana_service_account_token",name:"Grafana service account token",category:"credential",example:"glsa_rm3sadbwl8o2c13v4ipgkz04h66kiy6t_edaea401",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:glsa_[A-Za-z0-9]{32}_[A-Fa-f0-9]{8})"},{key:"harness_api_key",name:"Harness API key",category:"credential",example:"pat.vzcxr183pymw194fdq1q0v.qjqjarqkd9ydxqagjmq3f5iq.8nn5nyaow3h5mmgjh053",isUsingLuhnAlgorithm:!1,regexp:"(?:pat|sat)\\.[a-zA-Z0-9_-]{22}\\.[a-zA-Z0-9]{24}\\.[a-zA-Z0-9]{20}"},{key:"hashicorp_tf_api_token",name:"HashiCorp Terraform API token",category:"credential",example:"984d8033429986.atlasv1.799k5cihj_807yc1e8afvla8ackd1khsb50nfeswbxbr1re54y0wpzs2tjy=",isUsingLuhnAlgorithm:!1,regexp:"[a-z0-9]{14}\\.(?-i:atlasv1)\\.[a-z0-9\\-_=]{60,70}"},{key:"heroku_api_key",name:"Heroku API key",category:"credential",example:"9127f65b-8b3f-c0b7-a336-a4347e71bc51",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"heroku_api_key_v2",name:"Heroku API key v2",category:"credential",example:"HRKU-AAxPYvV6l2R3DvF0w9VJ4m8cz9oaygOHxpQvcw--iD51MszQZeakD9DZsclX",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(HRKU-AA[0-9a-zA-Z_-]{58}))"},{key:"hubspot_api_key",name:"HubSpot API key",category:"credential",example:"86cb6664-b191-db72-95a7-49adebe84b74",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})"},{key:"huggingface_access_token",name:"HuggingFace access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:hf_(?i:[a-z]{34}))"},{key:"huggingface_organization_api_token",name:"HuggingFace organization API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:api_org_(?i:[a-z]{34}))"},{key:"intercom_api_key",name:"Intercom API key",category:"credential",example:"zuc5c=ykf5gcwesqvmh2pji6k3extx0rbalsznte3sdo7iu7f-lumol2npfk",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{60})"},{key:"intra42_client_secret",name:"Intra42 client secret",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:s-s4t2(?:ud|af)-[abcdef0123456789]{64})"},{key:"jfrog_api_key",name:"JFrog API key",category:"credential",example:"lj7nrgoo0kr04kw312zvly7l0olsn37vhto5wdn3yqi5srxnc2axstp7a1kewkxi717w295kh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{73})"},{key:"jfrog_identity_token",name:"JFrog identity token",category:"credential",example:"xh0x2upbtkkg1pseg7ezmcyw2c3kt0bt05l5v8ynvkro6wagolhch0f7kppplt8b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"jwt",name:"JSON web token",category:"credential",example:"ey7gzQUpN8Kz7XY6Yin.ey1o36_XrBphAG8WMHQ.",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ey[a-zA-Z0-9]{17,}\\.ey[a-zA-Z0-9\\/\\\\_-]{17,}\\.(?:[a-zA-Z0-9\\/\\\\_-]{10,}={0,2})?)"},{key:"jwt_base64",name:"JSON web token base64",category:"credential",example:"ZXlKNE5YUWpVekkxTmlJNklsUjFUM0pDZVRKT1kxUnNSbE5YZFZvNFMyZzRWemhCYWxGaFoySTBabTVtVURGVGJFdE5Uemd0VTI4aWZRLmV5SnBjM01pT2lKcWIyVWlMQTBLSUNKbGVIQWlPakV6TURBNE1Ua3pPREFzRFFvZ0ltaDBkSEE2THk5bGVHRnRjR3hsTG1OdmJTOXBjMTl5YjI5MElqcDBjblZsZlEuZEJqZnRKZVo0Q1ZQLW1COTJLMjd1aGJVSlUxcDFyX3dXMWdGV0ZPRWpYaw==",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)ZXlK(?:(?P<alg>aGJHY2lPaU)|(?P<apu>aGNIVWlPaU)|(?P<apv>aGNIWWlPaU)|(?P<aud>aGRXUWlPaU)|(?P<b64>aU5qUWlP)|(?P<crit>amNtbDBJanBi)|(?P<cty>amRIa2lPaU)|(?P<epk>bGNHc2lPbn)|(?P<enc>bGJtTWlPaU)|(?P<jku>cWEzVWlPaU)|(?P<jwk>cWQyc2lPb)|(?P<iss>cGMzTWlPaU)|(?P<iv>cGRpSTZJ)|(?P<kid>cmFXUWlP)|(?P<key_ops>clpYbGZiM0J6SWpwY)|(?P<kty>cmRIa2lPaUp)|(?P<nonce>dWIyNWpaU0k2)|(?P<p2c>d01tTWlP)|(?P<p2s>d01uTWlPaU)|(?P<ppt>d2NIUWlPaU)|(?P<sub>emRXSWlPaU)|(?P<svt>emRuUWlP)|(?P<tag>MFlXY2lPaU)|(?P<typ>MGVYQWlPaUp)|(?P<url>MWNtd2l)|(?P<use>MWMyVWlPaUp)|(?P<ver>MlpYSWlPaU)|(?P<version>MlpYSnphVzl1SWpv)|(?P<x>NElqb2)|(?P<x5c>NE5XTWlP)|(?P<x5t>NE5YUWlPaU)|(?P<x5ts256>NE5YUWpVekkxTmlJNkl)|(?P<x5u>NE5YVWlPaU)|(?P<zip>NmFYQWlPaU))[a-zA-Z0-9\\/\\\\_+\\-\\r\\n]{40,}={0,2}"},{key:"launchdarkly_access_token",name:"LaunchDarkly access token",category:"credential",example:"ezmej9s6yv4qwk2=yeb4kfi162p33b_2hzm7tr-0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{40})"},{key:"linear_api_key",name:"Linear API key",category:"credential",example:"lin_api_0n5n0k26vb4ka9je9dqdcwl1dae5mbpfhb48xio6",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)lin_api_[a-z0-9]{40}"},{key:"linear_client_secret",name:"Linear client secret",category:"credential",example:"7b956760f09b81684ed833c524f081de",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32})"},{key:"linkedin_client_id",name:"LinkedIn client ID",category:"credential",example:"18u930hak0em0r",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{14})"},{key:"linkedin_client_secret",name:"LinkedIn client secret",category:"credential",example:"uvkxd9rw41ylk1zj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{16})"},{key:"lob_api_key",name:"Lob API key",category:"credential",example:"test_02efbb923a38370aac769e3bedc4d3398be",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:(live|test)_[a-f0-9]{35})"},{key:"lob_pub_api_key",name:"Lob publishable API key",category:"credential",example:"test_pub_df170d9f5be9244959713dfee686c42",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:(test|live)_pub_[a-f0-9]{31})"},{key:"mailchimp_api_key",name:"MailChimp API key",category:"credential",example:"81277fbbe2dd9c5e18d5f28cebcc558c-us20",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{32}-us[0-9][0-9])"},{key:"mailgun_pub_key",name:"Mailgun public validation key",category:"credential",example:"pubkey-5011bae1a4b57dfa83762c24b0e1299d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:pubkey-[a-f0-9]{32})"},{key:"mailgun_private_api_token",name:"Mailgun private API token",category:"credential",example:"key-176f7ef066471ac351adab734d2c9fb2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:key-[a-f0-9]{32})"},{key:"mailgun_signing_key",name:"Mailgun webhook signing key",category:"credential",example:"24564bd3d54a469601d5ac5daecb9ad2-00001111-22223333",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-h0-9]{32}-[a-h0-9]{8}-[a-h0-9]{8})"},{key:"mapbox_api_token",name:"MapBox API token",category:"credential",example:"pk.5ko18udoy3cilkpgyedje9limykwj8n7wmhug4967o9wze284mmpuuhjzgig.edjzuv7jwhc6lnv5b3p9nc",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:pk\\.[a-z0-9]{60}\\.[a-z0-9]{22})"},{key:"mattermost_access_token",name:"Mattermost access token",category:"credential",example:"rtw2hncbfhpbyyri90d3q2mo1m",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{26})"},{key:"maxmind_license_key",name:"MaxMind license key",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:[A-Za-z0-9]{6}_[A-Za-z0-9]{29}_mmk)"},{key:"cisco_meraki_api_key",name:"Cisco Meraki API key",category:"credential",example:"acea14a1470f7cf443a031dde64065ce81c77b2b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[0-9a-f]{40})"},{key:"messagebird_api_token",name:"MessageBird API token",category:"credential",example:"448q6im7yxutswabdko1n69ry",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{25})"},{key:"messagebird_client_id",name:"MessageBird client ID",category:"credential",example:"12345678-ABCD-ABCD-ABCD-1234567890AB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"netlify_access_token",name:"Netlify access token",category:"credential",example:"3j1sa0o20v0k-cjbjn3vh_4uqnkvb3w_px5no2in",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{40,46})"},{key:"new_relic_user_api_key",name:"New Relic user API key",category:"credential",example:"NRAK-zozcnrh45ornsbl1duyfhell59u",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRAK-[a-z0-9]{27})"},{key:"new_relic_user_api_id",name:"New Relic user API ID",category:"credential",example:"k0jze7delork84k8ke1z1dm275yw2aqf5uu2cy7x1uiloll3xab5203hiz9tx9xx",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"new_relic_browser_api_token",name:"New Relic browser API token",category:"credential",example:"NRJS-c7fa1261a97506e4a45",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRJS-[a-f0-9]{19})"},{key:"new_relic_insert_key",name:"New Relic insight insert key",category:"credential",example:"NRII-4168ab7eb2e051f37144ad884d32ab34",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:NRII-[a-z0-9-]{32})"},{key:"notion_api_token",name:"Notion API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ntn_[0-9]{11}[A-Za-z0-9]{32}[A-Za-z0-9]{3})"},{key:"npm_access_token",name:"npm access token",category:"credential",example:"npm_vz9e7fvsn7o2n2tddg6b01gs7g9wldlys4vm",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:npm_[a-z0-9]{36})"},{key:"nytimes_access_token",name:"NYTimes access token",category:"credential",example:"ako7xzi0mx7w15ogdkew7ilq7h13x8rl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9=_\\-]{32})"},{key:"octopus_deploy_api_key",name:"Octopus Deploy API key",category:"credential",example:"API-NFWN6F7X32BYDBU94IGY3V5ZQY",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:API-[A-Z0-9]{26})"},{key:"okta_access_token",name:"Okta access token",category:"credential",example:"003cKkRNNMy4ul7V8UDHEjEBGbnsQ6tejSHzfeBtcp",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:00[a-zA-Z0-9_=\\-]{40})"},{key:"openai_api_key",name:"OpenAI API key",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})(?-u:\\b)|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20})"},{key:"openshift_user_token",name:"OpenShift user token",category:"credential",example:"sha256~OFL-TnR3jyLteu_rAuff3PUYNELVvByMRFYCcAkaJSR",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sha256~[a-zA-Z0-9_-]{43})(?:[^a-zA-Z0-9_-]|\\z)"},{key:"perplexity_api_key",name:"Perplexity API key",category:"credential",example:"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'",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pplx-[a-zA-Z0-9]{48})(?:[`'\" \\r\\n\\t\\f\\v;]|\\\\[nr]|$|(?-u:\\b))"},{key:"pgpassword_shell_assignment",name:"PGPASSWORD shell assignment",category:"credential",example:"PGPASSWORD='supersecret'",isUsingLuhnAlgorithm:!1,regexp:`(?-u:\\b)PGPASSWORD=(?:"[^"\\r\\n]+"|'[^'\\r\\n]+'|[^\\s'"]+)`},{key:"plaid_api_token",name:"Plaid API token",category:"credential",example:"access-development-4b0f8c31-83fe-e4c5-3d02-91e487b69d2d",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:access-(?:sandbox|development|production)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"plaid_client_id",name:"Plaid client ID",category:"credential",example:"TTPjxpFNiwOct5XLdxjXD0Ta",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{24})"},{key:"plaid_secret_key",name:"Plaid secret key",category:"credential",example:"ikhqm7a9k76l8f544dl0v8kxvm2w55",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"planetscale_password",name:"PlanetScale password",category:"credential",example:"pscale_pw_9gvu8z79m4b814z0vv8266w70h3i7jlq",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_pw_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"planetscale_api_token",name:"PlanetScale API token",category:"credential",example:"pscale_tkn_nwy9jkjgnry96ftecsx_=jrxc6pkmmew",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_tkn_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"planetscale_oauth_token",name:"PlanetScale OAuth token",category:"credential",example:"pscale_oauth_zx8v3gzfnfxbymj__l629i68jnz5gnff",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pscale_oauth_[a-zA-Z0-9_=\\.-]{32,64})"},{key:"postman_api_token",name:"Postman API token",category:"credential",example:"PMAK-525b84aa46e2c588620d8123-06f9ca36c4aad4305baafbe00716b7bc8f",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:PMAK-[a-f0-9]{24}\\-[a-f0-9]{34})"},{key:"prefect_api_token",name:"Prefect API token",category:"credential",example:"pnu_kttbffyfgffu2sfbxzxw8mbpgvvtxjljwe1p",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pnu_[a-zA-Z0-9]{36})"},{key:"privateai_api_token",name:"PrivateAI API token",category:"credential",example:"iwuxqzqilzbfnccncvjz6px23dnej11h",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:[a-z0-9]{32})"},{key:"private_key",name:"Private key",category:"credential",example:`-----BEGIN PRIVATE KEY-----
54
54
  MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAC4AWkdwKYSd8
55
55
  Ks14IReLcYgADhoXk56ZzXI=
56
- -----END PRIVATE KEY-----`,isUsingLuhnAlgorithm:!1,regexp:"-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[ \\r\\n\\t\\f\\v\\S-]{64,}?KEY(?: BLOCK)?-----"},{key:"pulumi_api_token",name:"Pulumi API token",category:"credential",example:"pul-b77e6bff9fddebbc2bb8eca94e3f29a41f6da70a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pul-[a-f0-9]{40})"},{key:"pypi_upload_token",name:"PyPI upload token",category:"credential",example:"pypi-AgEIcHlwaS5vcmc128fd9e0b47dde39cfecad3a997273458e6392f6aac649ae38864bdd7ff12836",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)pypi-AgEIcHlwaS5vcmc[a-zA-Z0-9_-]{50}"},{key:"rapidapi_access_token",name:"RapidAPI access token",category:"credential",example:"g4x40h94pi_-zlklfz3-qvhiiu5zankyrqqwmsl60decihbqvl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{50})"},{key:"readme_api_token",name:"ReadMe API token",category:"credential",example:"rdme_k38kau741xa5lw03mdkvcd4vn6s6hdhvhg1wxa4ls7dp8h58r0yxq65nsqwndn056pxsc4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:rdme_[a-z0-9]{70})"},{key:"rubygems_api_token",name:"RubyGems API token",category:"credential",example:"rubygems_7790aaa8102395704a64594a11f6de4941a27f86bc3fc9d4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:rubygems_[a-f0-9]{48})"},{key:"scalingo_api_token",name:"Scalingo API token",category:"credential",example:"tk-us-4fhmqrg-rl4416b3oij_qx3q284wbhbqpk7r3te4r14lafou",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:tk-us-[a-zA-Z0-9_-]{48})"},{key:"sendbird_access_id",name:"SendBird access ID",category:"credential",example:"7e7801fd-c25d-50ab-a723-01b94c8d6c5f",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sendbird_access_token",name:"SendBird access token",category:"credential",example:"305f75f04e3afa65360c25d9944fdae91138328d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{40})"},{key:"sendgrid_api_token",name:"SendGrid API token",category:"credential",example:"SG.--ed-fvdeffijnle7575jp1sh24wq_9y9hcjua5w3dnqh5-wyegkpzenziy1_qr=hf",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:SG\\.[a-z0-9=_\\-\\.]{66})"},{key:"sendinblue_api_token",name:"Sendinblue API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:xkeysib-[a-f0-9]{64}\\-[a-z0-9]{16})"},{key:"sentry_access_token",name:"Sentry access token",category:"credential",example:"1ad463398f40a52bb94a3795762f4003d51b03b8a788cba55e3a81de81c72940",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{64})"},{key:"sentry_org_token",name:"Sentry org token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)sntrys_eyJpYXQiO[a-zA-Z0-9+/]{10}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10}={0,2}_[a-zA-Z0-9+/]{43}(?:[^a-zA-Z0-9+/]|\\z)"},{key:"sentry_user_token",name:"Sentry user token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sntryu_[a-f0-9]{64})"},{key:"settlemint_application_access_token",name:"Settlemint application access token",category:"credential",example:"sm_aat_gshgzsv353m5yb9s",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_aat_[a-zA-Z0-9]{16})"},{key:"settlemint_personal_access_token",name:"Settlemint personal access token",category:"credential",example:"sm_pat_1yhza49gsle0trg8",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_pat_[a-zA-Z0-9]{16})"},{key:"settlemint_service_access_token",name:"Settlemint service access token",category:"credential",example:"sm_sat_cha543e6lb19llli",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_sat_[a-zA-Z0-9]{16})"},{key:"shippo_api_token",name:"Shippo API token",category:"credential",example:"shippo_live_1d0f80d04e7788c1edb8fc2b8076bbf8f59b84b7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:shippo_(?:live|test)_[a-fA-F0-9]{40})"},{key:"shopify_access_token",name:"Shopify access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpat_[a-fA-F0-9]{32}"},{key:"shopify_custom_access_token",name:"Shopify custom access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpca_[a-fA-F0-9]{32}"},{key:"shopify_private_app_access_token",name:"Shopify private app access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shppa_[a-fA-F0-9]{32}"},{key:"shopify_shared_secret",name:"Shopify shared secret",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpss_[a-fA-F0-9]{32}"},{key:"sidekiq_secret",name:"Sidekiq secret",category:"credential",example:"aa8d3915:64fb5cb5",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{8}:[a-f0-9]{8})"},{key:"sidekiq_sensitive_url",name:"Sidekiq sensitive URL",category:"credential",example:"https://cafebabe:deadbeef@gems.contribsys.com/",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)https?://(?:[a-f0-9]{8}:[a-f0-9]{8})@(?:gems.contribsys.com|enterprise.contribsys.com)(?:[\\/|\\#|\\?|:]|$)"},{key:"slack_bot_token",name:"Slack bot token",category:"credential",example:"xoxb-781236542736-2364535789652-GkwFDQoHqzXDVsC6GzqYUypD",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*"},{key:"slack_user_token",name:"Slack user token",category:"credential",example:"xoxp-41684372915-1320496754-45609968301-e708ba56e1517a99f6b5fb07349476ef",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}"},{key:"slack_app_token",name:"Slack app token",category:"credential",example:"xapp-1-A052FGTS2DL-5171572773297-610b6a11f4b7eb819e87b767d80e6575a3634791acb9a9ead051da879eb5b55e",isUsingLuhnAlgorithm:!1,regexp:"xapp-[0-9]-[A-Z0-9]+-[0-9]+-[a-z0-9]+"},{key:"slack_config_access_token",name:"Slack config access token",category:"credential",example:"xoxe.xoxp-1-Mi0yLTM0MTQwNDE0MDE3Ni0zNjU5NDY0Njg4MTctNTE4MjA3NTQ5NjA4MC01NDEyOTYyODY5NzUxLThhMTBjZmI1ZWIzMGIwNTg0ZDdmMDI5Y2UxNzVlZWVhYzU2ZWQyZTZiODNjNDZiMGUxMzRlNmNjNDEwYmQxMjQ",isUsingLuhnAlgorithm:!1,regexp:"xoxe.xox[bp]-[0-9]-[A-Z0-9]{50}"},{key:"slack_config_refresh_token",name:"Slack config refresh token",category:"credential",example:"xoxe-1-My0xLTMxNzcwMjQ0MTcxMy01MTU4MTUyNjkxNzE0LTUxODE4NDI0MDY3MzYtMjA5MGFkOTFlZThkZWE2OGFlZDYwYWJjODNhYzAxYjA5ZjVmODBhYjgzN2QyNDdjOTNlOGY5NTg2YWM1OGM4Mg",isUsingLuhnAlgorithm:!1,regexp:"xoxe-[0-9]-[A-Z0-9]{50}"},{key:"slack_legacy_bot_token",name:"Slack legacy bot token",category:"credential",example:"xoxb-263594206564-FGqddMF8t08v8N7Oq4i57vs1",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26}"},{key:"slack_legacy_workspace_token",name:"Slack legacy workspace token",category:"credential",example:"xoxa-2-511111111-31111111111-3111111111111-e039d02840a0b9379c",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[ar]-(?:[0-9]-)?[0-9a-zA-Z]{8,48}"},{key:"slack_legacy_token",name:"Slack legacy token",category:"credential",example:"xoxs-416843729158-132049654-5609968301-e708ba56e1",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[os]-[0-9]+-[0-9]+-[0-9]+-[a-fA-F0-9]+"},{key:"slack_webhook_url",name:"Slack webhook URL",category:"credential",example:"hooks.slack.com/services/z6cvbfngk3h7i0vts4akmbxidtb8o3b4pq2sbbd6o86g",isUsingLuhnAlgorithm:!1,regexp:"(?:https?://)?hooks.slack.com/(?:services|workflows|triggers)/[A-Za-z0-9+/]{43,56}"},{key:"snyk_api_token",name:"Snyk API token",category:"credential",example:"12345678-ABCD-ABCD-ABCD-1234567890AB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sonar_api_token",name:"Sonar API token",category:"credential",example:"12345678ABCDEFH1234567890ABCDEFH12345678",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:(?:squ_|sqp_|sqa_)?[a-z0-9=_-]{40})"},{key:"stripe_access_token",name:"Stripe access token",category:"credential",example:"sk_test_cyge9m4s1kxiqdkszz0a57nyx6wk73",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})"},{key:"square_access_token",name:"Square access token",category:"credential",example:"sq0atp-OQUxovdrj3tfFpSd66r3sY",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:EAAA|sq0atp-)[a-zA-Z0-9_-]{22,60})"},{key:"squarespace_access_token",name:"Squarespace access token",category:"credential",example:"86447eab-140f-2563-3572-bb016dafd692",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sumologic_access_id",name:"SumoLogic access ID",category:"credential",example:"suJS4ZsaD5bQTt",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:su[a-zA-Z0-9]{12})"},{key:"sumologic_access_token",name:"SumoLogic access token",category:"credential",example:"1xohkwr8lpvm4osygkpe5zbd16c3376ver2qed1bssuko4uy4tij1bnf4dnwy7o4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"microsoft_teams_webhook",name:"Microsoft Teams webhook URL",category:"credential",example:"https://mycompany.webhook.office.com/webhookb2/767lrnj6-okh8-dnh8-jey2-y2iteohrwz75@6igi6oz6-ud9w-wior-2zva-5vx0wp6wuiqk/IncomingWebhook/o1zox92ssprrppjtnvcjqq0q09k2wnc3/qwox5p9d-x4zr-3yis-t1on-s67zj50tmyht",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)https://[a-z0-9]+\\.webhook\\.office\\.com/webhookb2/[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}/IncomingWebhook/[a-z0-9]{32}/[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}"},{key:"telegram_bot_api_token",name:"Telegram bot API token",category:"credential",example:"59015865:A12o5wu6f78zofs0udypf9ti23u82g-qkfz",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{5,16}:(?-i:A)[a-z0-9_\\-]{34})"},{key:"travisci_access_token",name:"Travis CI access token",category:"credential",example:"zjgfo5fhshd5c60hpz22wh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{22})"},{key:"twilio_api_key",name:"Twilio API key",category:"credential",example:"SKa585fd034fcd16cdd741f7df9b57fb3b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)SK[0-9a-fA-F]{32}"},{key:"twitch_api_token",name:"Twitch API token",category:"credential",example:"1hm9gcychlkpf93jdjnwdu0uaamu6d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"twitter_api_key",name:"Twitter API key",category:"credential",example:"m8zqu4etx07bjt7tyeacc6pox",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{25})"},{key:"twitter_api_secret",name:"Twitter API secret",category:"credential",example:"7f4gxkubw9qs346ik99zk3z8b6kk3d7g8toi7zujgvgbt8q0yv",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{50})"},{key:"twitter_access_token",name:"Twitter access token",category:"credential",example:"465616696186918-96B1NCD5CH0uyi7zUHiS",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{15,25}-[a-zA-Z0-9]{20,40})"},{key:"twitter_access_secret",name:"Twitter access secret",category:"credential",example:"vyuo5peybdzznr7z0ua5wamhogusans4m29uzi25w4jgj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{45})"},{key:"twitter_bearer_token",name:"Twitter bearer token",category:"credential",example:"AAAAAAAAAAAAAAAAAAAAAAWRGWFGlfwyqNrrIa3pewqNNLX0jQMj2sR6M2cZUfBdqXDtkt7Nsb56F4tCz7Pt8ujbosrLxnRqYgwI0b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:A{22}[a-zA-Z0-9%]{80})"},{key:"typeform_api_token",name:"Typeform API token",category:"credential",example:"tfp_o-nsn=6eg2ios=4g652xhf933qor4jj7ort2qh_uw_5jdsuffp31ln=e-2a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:tfp_[a-z0-9\\-_\\.=]{59})"},{key:"vault_batch_token",name:"Vault batch token",category:"credential",example:"hvb.x84j4cl53mzvhvb1nfc3mfi721gh5i-92f96lt0gns5lpksfu5f0199j-gw4ycxg6au4ser86mczcr_nx6ur2elbpazfrybo80fxjv3bghxshml3g261l6qi03yrz03qup84jk-fc2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:hvb\\.[a-zA-Z0-9_-]{50})"},{key:"vault_service_token",name:"Vault service token",category:"credential",example:"s.8QH9knZV94f0IjBZismfOPD0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:hvs\\.[a-zA-Z0-9_-]{90}|s\\.(?i:[a-z0-9]{24})))"},{key:"yandex_api_key",name:"Yandex API key",category:"credential",example:"AQVN9wiAh8pyz3lmB5WTo_KUuPDXlxtzkA5-YFG",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:AQVN[A-Za-z0-9_\\-]{35,38})"},{key:"yandex_aws_access_token",name:"Yandex AWS access token",category:"credential",example:"YCZ6DHVrZONPNtgwWLZPrIGyviSrudRVSr8w0b1S",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:YC[a-zA-Z0-9_\\-]{38})"},{key:"yandex_access_token",name:"Yandex access token",category:"credential",example:"t1.L=.WJ9CYVI5eeLkTOrMM_dgaPgdmpen48R8RYsL4VJqelVKDmrqYsSHkH6QyVVhJkuHSQFTd0NOhClEDyCz7eEbh5=",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:t1\\.[A-Z0-9a-z_-]+[=]{0,2}\\.[A-Z0-9a-z_-]{86}[=]{0,2})"},{key:"zendesk_secret_key",name:"Zendesk secret key",category:"credential",example:"iydgm2jofftb2xu7niv55qnfxdwbwmqt2s561bgc",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{40})"},{key:"infracost_api_token",name:"Infracost API token",category:"credential",example:"ico-fNZw8jjy6TugMUHKWX4l9iSP3i95SPNH",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ico-[a-zA-Z0-9]{32})"},{key:"iban",name:"Iban",category:"financial-data",example:"FR7630006000011234567890189",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{11,30}(?-u:\\b)"},{key:"aikido_token",name:"Aikido token",category:"credential",example:"AIK_SECRET_XU28CmBY7Kxk3RPrqfHk9n6p5QX4p1tXzvJ7J1B3RPrqfHk9n6p5QX4p1tXzvJ7J",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AIK_SECRET_[A-Za-z0-9]{64}"},{key:"aikido_ci_token",name:"Aikido CI secret",category:"credential",example:"AIK_CI_US_XU28CmBY7Kxk3RPrqfHk9n6p5QX4p1tXzvJ7J1B3RPrqfHk9n6p5QX4p1tXzvJ7J",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AIK_CI_(US_|ME_)?[A-Za-z0-9]{64}"},{key:"tsuga_ingestion_key",name:"Tsuga ingestion key",category:"credential",example:"tsuga_in:v1:OUvrwavCG//ixL08HEds9OAT",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)tsuga_in:v1:[A-Za-z0-9+/]{24}"},{key:"tsuga_operation_key",name:"Tsuga operation key",category:"credential",example:"tsuga_op:v1:zz3-LWv-sLy:0k7Skt255M0yXe/ZLBoiSamb",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)tsuga_op:v1:[A-Za-z0-9_-]+:[A-Za-z0-9+/]{24}"}],h2=DR.map(e=>e.key);var _Me=new Set(h2),IMe=DR.map(e=>e.key);var LMe={[wu]:Lu,[wu.replace(`${L}.`,"")]:Lu,[vu]:Nu,[vu.replace(`${L}.`,"")]:Nu,[Ln]:xi,[Ln.replace(`${L}.`,"")]:xi},kMe={[Lu]:wu,[Nu]:vu,[xi]:Ln};function GR(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var $R=["alert_cluster","alert_conditions","alert_data_url","alert_id","alert_owner","alert_previous_status","alert_priority","alert_start_time","alert_status","alert_tags","alert_timeframe","alert_title","alert_transition","alert_triggered_by","dashboard_url","monitor_url"],FR=["alert_queries","alert_thresholds","alert_values"],y2=[...$R,...FR],jR=["alert_event_name","alert_message"],s0e=[...y2,...jR],c0e=new Set([...$R,...jR]),p0e=new Set(FR);var ef={aws:"aws",gcp:"gcp",azure:"azure"},Dn=[ef.aws,ef.gcp,ef.azure];var qR=t.Object({id:t.String({description:"Unique Tsuga cluster ID. Tsuga assigns it when the cluster record is created. Use this value as `clusterId` with public API requests that accept `clusterId`."}),name:t.String({description:"Cluster name stored in Tsuga. Usable as a display label when `friendlyName` is not set."}),friendlyName:t.Optional(t.String({description:"Human-readable display name for the cluster. Present when a friendly name is configured."})),clusterType:t.Enum(Dn,{description:"Cloud provider selected for the Tsuga cluster."}),clusterRegion:t.String({description:"Cloud region selected for the cluster using the provider region identifier."})},{$id:"Cluster",description:"Tsuga cluster available to the organization. Use its `id` to scope public API requests that accept `clusterId`."}),T2={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(qR,{examples:[T2]});var BR=d({description:"Lists Tsuga clusters available to the organization. Use cluster IDs with public API requests that accept `clusterId`, such as telemetry, service, Kubernetes Explorer, and quality-report requests.",operationId:"listClusters",tags:["clusters"],url:`/${"v1"}/clusters`,method:"GET",response:t.Array(qR)});function HR(e,r){e.command("clusters").description("Manage Tsuga cluster selection").command("list").description("List all Tsuga clusters available to the operation API key").action(async()=>{let o=await r()(BR);W(o)})}function zR(e,r,n,o){let i=e.commands.map(c=>c.name()).filter(c=>!c.startsWith("__")),a=e.options.map(c=>c.long).filter(c=>!!c);for(let c of e.options)(c.required||c.optional)&&(c.long&&o.add(c.long),c.short&&o.add(c.short));n.set(r.join(" "),{cmds:i,flags:[...a,"--help"]});for(let c of e.commands)c.name().startsWith("__")||zR(c,[...r,c.name()],n,o)}function E2(e){let r=new Map,n=new Set;return zR(e,[],r,n),{rows:[...r].map(([i,{cmds:a,flags:c}])=>({key:i,cmds:[...new Set(a)].join(" "),flags:[...new Set(c)].join(" ")})),valueFlags:[...n].join(" ")}}function KR(e){return e.map(({key:r,cmds:n,flags:o})=>` ${JSON.stringify(r)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
57
- `)}function _2(e,r){return`_tsuga_complete() {
56
+ -----END PRIVATE KEY-----`,isUsingLuhnAlgorithm:!1,regexp:"-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[ \\r\\n\\t\\f\\v\\S-]{64,}?KEY(?: BLOCK)?-----"},{key:"pulumi_api_token",name:"Pulumi API token",category:"credential",example:"pul-b77e6bff9fddebbc2bb8eca94e3f29a41f6da70a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:pul-[a-f0-9]{40})"},{key:"pypi_upload_token",name:"PyPI upload token",category:"credential",example:"pypi-AgEIcHlwaS5vcmc128fd9e0b47dde39cfecad3a997273458e6392f6aac649ae38864bdd7ff12836",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)pypi-AgEIcHlwaS5vcmc[a-zA-Z0-9_-]{50}"},{key:"rapidapi_access_token",name:"RapidAPI access token",category:"credential",example:"g4x40h94pi_-zlklfz3-qvhiiu5zankyrqqwmsl60decihbqvl",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9_-]{50})"},{key:"readme_api_token",name:"ReadMe API token",category:"credential",example:"rdme_k38kau741xa5lw03mdkvcd4vn6s6hdhvhg1wxa4ls7dp8h58r0yxq65nsqwndn056pxsc4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:rdme_[a-z0-9]{70})"},{key:"rubygems_api_token",name:"RubyGems API token",category:"credential",example:"rubygems_7790aaa8102395704a64594a11f6de4941a27f86bc3fc9d4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:rubygems_[a-f0-9]{48})"},{key:"scalingo_api_token",name:"Scalingo API token",category:"credential",example:"tk-us-4fhmqrg-rl4416b3oij_qx3q284wbhbqpk7r3te4r14lafou",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:tk-us-[a-zA-Z0-9_-]{48})"},{key:"sendbird_access_id",name:"SendBird access ID",category:"credential",example:"7e7801fd-c25d-50ab-a723-01b94c8d6c5f",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sendbird_access_token",name:"SendBird access token",category:"credential",example:"305f75f04e3afa65360c25d9944fdae91138328d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{40})"},{key:"sendgrid_api_token",name:"SendGrid API token",category:"credential",example:"SG.--ed-fvdeffijnle7575jp1sh24wq_9y9hcjua5w3dnqh5-wyegkpzenziy1_qr=hf",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:SG\\.[a-z0-9=_\\-\\.]{66})"},{key:"sendinblue_api_token",name:"Sendinblue API token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:xkeysib-[a-f0-9]{64}\\-[a-z0-9]{16})"},{key:"sentry_access_token",name:"Sentry access token",category:"credential",example:"1ad463398f40a52bb94a3795762f4003d51b03b8a788cba55e3a81de81c72940",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{64})"},{key:"sentry_org_token",name:"Sentry org token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)sntrys_eyJpYXQiO[a-zA-Z0-9+/]{10}(?:LCJyZWdpb25fdXJs|InJlZ2lvbl91cmwi|cmVnaW9uX3VybCI6)[a-zA-Z0-9+/]{10}={0,2}_[a-zA-Z0-9+/]{43}(?:[^a-zA-Z0-9+/]|\\z)"},{key:"sentry_user_token",name:"Sentry user token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sntryu_[a-f0-9]{64})"},{key:"settlemint_application_access_token",name:"Settlemint application access token",category:"credential",example:"sm_aat_gshgzsv353m5yb9s",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_aat_[a-zA-Z0-9]{16})"},{key:"settlemint_personal_access_token",name:"Settlemint personal access token",category:"credential",example:"sm_pat_1yhza49gsle0trg8",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_pat_[a-zA-Z0-9]{16})"},{key:"settlemint_service_access_token",name:"Settlemint service access token",category:"credential",example:"sm_sat_cha543e6lb19llli",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:sm_sat_[a-zA-Z0-9]{16})"},{key:"shippo_api_token",name:"Shippo API token",category:"credential",example:"shippo_live_1d0f80d04e7788c1edb8fc2b8076bbf8f59b84b7",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:shippo_(?:live|test)_[a-fA-F0-9]{40})"},{key:"shopify_access_token",name:"Shopify access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpat_[a-fA-F0-9]{32}"},{key:"shopify_custom_access_token",name:"Shopify custom access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpca_[a-fA-F0-9]{32}"},{key:"shopify_private_app_access_token",name:"Shopify private app access token",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shppa_[a-fA-F0-9]{32}"},{key:"shopify_shared_secret",name:"Shopify shared secret",category:"credential",example:"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",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)shpss_[a-fA-F0-9]{32}"},{key:"sidekiq_secret",name:"Sidekiq secret",category:"credential",example:"aa8d3915:64fb5cb5",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-f0-9]{8}:[a-f0-9]{8})"},{key:"sidekiq_sensitive_url",name:"Sidekiq sensitive URL",category:"credential",example:"https://cafebabe:deadbeef@gems.contribsys.com/",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)https?://(?:[a-f0-9]{8}:[a-f0-9]{8})@(?:gems.contribsys.com|enterprise.contribsys.com)(?:[\\/|\\#|\\?|:]|$)"},{key:"slack_bot_token",name:"Slack bot token",category:"credential",example:"xoxb-781236542736-2364535789652-GkwFDQoHqzXDVsC6GzqYUypD",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xoxb-[0-9]{10,13}-[0-9]{10,13}[a-zA-Z0-9-]*"},{key:"slack_user_token",name:"Slack user token",category:"credential",example:"xoxp-41684372915-1320496754-45609968301-e708ba56e1517a99f6b5fb07349476ef",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[pe](?:-[0-9]{10,13}){3}-[a-zA-Z0-9-]{28,34}"},{key:"slack_app_token",name:"Slack app token",category:"credential",example:"xapp-1-A052FGTS2DL-5171572773297-610b6a11f4b7eb819e87b767d80e6575a3634791acb9a9ead051da879eb5b55e",isUsingLuhnAlgorithm:!1,regexp:"xapp-[0-9]-[A-Z0-9]+-[0-9]+-[a-z0-9]+"},{key:"slack_config_access_token",name:"Slack config access token",category:"credential",example:"xoxe.xoxp-1-Mi0yLTM0MTQwNDE0MDE3Ni0zNjU5NDY0Njg4MTctNTE4MjA3NTQ5NjA4MC01NDEyOTYyODY5NzUxLThhMTBjZmI1ZWIzMGIwNTg0ZDdmMDI5Y2UxNzVlZWVhYzU2ZWQyZTZiODNjNDZiMGUxMzRlNmNjNDEwYmQxMjQ",isUsingLuhnAlgorithm:!1,regexp:"xoxe.xox[bp]-[0-9]-[A-Z0-9]{50}"},{key:"slack_config_refresh_token",name:"Slack config refresh token",category:"credential",example:"xoxe-1-My0xLTMxNzcwMjQ0MTcxMy01MTU4MTUyNjkxNzE0LTUxODE4NDI0MDY3MzYtMjA5MGFkOTFlZThkZWE2OGFlZDYwYWJjODNhYzAxYjA5ZjVmODBhYjgzN2QyNDdjOTNlOGY5NTg2YWM1OGM4Mg",isUsingLuhnAlgorithm:!1,regexp:"xoxe-[0-9]-[A-Z0-9]{50}"},{key:"slack_legacy_bot_token",name:"Slack legacy bot token",category:"credential",example:"xoxb-263594206564-FGqddMF8t08v8N7Oq4i57vs1",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xoxb-[0-9]{8,14}-[a-zA-Z0-9]{18,26}"},{key:"slack_legacy_workspace_token",name:"Slack legacy workspace token",category:"credential",example:"xoxa-2-511111111-31111111111-3111111111111-e039d02840a0b9379c",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[ar]-(?:[0-9]-)?[0-9a-zA-Z]{8,48}"},{key:"slack_legacy_token",name:"Slack legacy token",category:"credential",example:"xoxs-416843729158-132049654-5609968301-e708ba56e1",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)xox[os]-[0-9]+-[0-9]+-[0-9]+-[a-fA-F0-9]+"},{key:"slack_webhook_url",name:"Slack webhook URL",category:"credential",example:"hooks.slack.com/services/z6cvbfngk3h7i0vts4akmbxidtb8o3b4pq2sbbd6o86g",isUsingLuhnAlgorithm:!1,regexp:"(?:https?://)?hooks.slack.com/(?:services|workflows|triggers)/[A-Za-z0-9+/]{43,56}"},{key:"snyk_api_token",name:"Snyk API token",category:"credential",example:"12345678-ABCD-ABCD-ABCD-1234567890AB",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sonar_api_token",name:"Sonar API token",category:"credential",example:"12345678ABCDEFH1234567890ABCDEFH12345678",isUsingLuhnAlgorithm:!1,regexp:"(?i)(?-u:\\b).*(?:(?:squ_|sqp_|sqa_)?[a-z0-9=_-]{40})"},{key:"stripe_access_token",name:"Stripe access token",category:"credential",example:"sk_test_cyge9m4s1kxiqdkszz0a57nyx6wk73",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:sk|rk)_(?:test|live|prod)_[a-zA-Z0-9]{10,99})"},{key:"square_access_token",name:"Square access token",category:"credential",example:"sq0atp-OQUxovdrj3tfFpSd66r3sY",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:EAAA|sq0atp-)[a-zA-Z0-9_-]{22,60})"},{key:"squarespace_access_token",name:"Squarespace access token",category:"credential",example:"86447eab-140f-2563-3572-bb016dafd692",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"},{key:"sumologic_access_id",name:"SumoLogic access ID",category:"credential",example:"suJS4ZsaD5bQTt",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?-u:\\b).*(?:su[a-zA-Z0-9]{12})"},{key:"sumologic_access_token",name:"SumoLogic access token",category:"credential",example:"1xohkwr8lpvm4osygkpe5zbd16c3376ver2qed1bssuko4uy4tij1bnf4dnwy7o4",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{64})"},{key:"microsoft_teams_webhook",name:"Microsoft Teams webhook URL",category:"credential",example:"https://mycompany.webhook.office.com/webhookb2/767lrnj6-okh8-dnh8-jey2-y2iteohrwz75@6igi6oz6-ud9w-wior-2zva-5vx0wp6wuiqk/IncomingWebhook/o1zox92ssprrppjtnvcjqq0q09k2wnc3/qwox5p9d-x4zr-3yis-t1on-s67zj50tmyht",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)https://[a-z0-9]+\\.webhook\\.office\\.com/webhookb2/[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}@[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}/IncomingWebhook/[a-z0-9]{32}/[a-z0-9]{8}-(?:[a-z0-9]{4}-){3}[a-z0-9]{12}"},{key:"telegram_bot_api_token",name:"Telegram bot API token",category:"credential",example:"59015865:A12o5wu6f78zofs0udypf9ti23u82g-qkfz",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{5,16}:(?-i:A)[a-z0-9_\\-]{34})"},{key:"travisci_access_token",name:"Travis CI access token",category:"credential",example:"zjgfo5fhshd5c60hpz22wh",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{22})"},{key:"twilio_api_key",name:"Twilio API key",category:"credential",example:"SKa585fd034fcd16cdd741f7df9b57fb3b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)SK[0-9a-fA-F]{32}"},{key:"twitch_api_token",name:"Twitch API token",category:"credential",example:"1hm9gcychlkpf93jdjnwdu0uaamu6d",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{30})"},{key:"twitter_api_key",name:"Twitter API key",category:"credential",example:"m8zqu4etx07bjt7tyeacc6pox",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{25})"},{key:"twitter_api_secret",name:"Twitter API secret",category:"credential",example:"7f4gxkubw9qs346ik99zk3z8b6kk3d7g8toi7zujgvgbt8q0yv",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{50})"},{key:"twitter_access_token",name:"Twitter access token",category:"credential",example:"465616696186918-96B1NCD5CH0uyi7zUHiS",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[0-9]{15,25}-[a-zA-Z0-9]{20,40})"},{key:"twitter_access_secret",name:"Twitter access secret",category:"credential",example:"vyuo5peybdzznr7z0ua5wamhogusans4m29uzi25w4jgj",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{45})"},{key:"twitter_bearer_token",name:"Twitter bearer token",category:"credential",example:"AAAAAAAAAAAAAAAAAAAAAAWRGWFGlfwyqNrrIa3pewqNNLX0jQMj2sR6M2cZUfBdqXDtkt7Nsb56F4tCz7Pt8ujbosrLxnRqYgwI0b",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:A{22}[a-zA-Z0-9%]{80})"},{key:"typeform_api_token",name:"Typeform API token",category:"credential",example:"tfp_o-nsn=6eg2ios=4g652xhf933qor4jj7ort2qh_uw_5jdsuffp31ln=e-2a",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:tfp_[a-z0-9\\-_\\.=]{59})"},{key:"vault_batch_token",name:"Vault batch token",category:"credential",example:"hvb.x84j4cl53mzvhvb1nfc3mfi721gh5i-92f96lt0gns5lpksfu5f0199j-gw4ycxg6au4ser86mczcr_nx6ur2elbpazfrybo80fxjv3bghxshml3g261l6qi03yrz03qup84jk-fc2",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:hvb\\.[a-zA-Z0-9_-]{50})"},{key:"vault_service_token",name:"Vault service token",category:"credential",example:"s.8QH9knZV94f0IjBZismfOPD0",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:(?:hvs\\.[a-zA-Z0-9_-]{90}|s\\.(?i:[a-z0-9]{24})))"},{key:"yandex_api_key",name:"Yandex API key",category:"credential",example:"AQVN9wiAh8pyz3lmB5WTo_KUuPDXlxtzkA5-YFG",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:AQVN[A-Za-z0-9_\\-]{35,38})"},{key:"yandex_aws_access_token",name:"Yandex AWS access token",category:"credential",example:"YCZ6DHVrZONPNtgwWLZPrIGyviSrudRVSr8w0b1S",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:YC[a-zA-Z0-9_\\-]{38})"},{key:"yandex_access_token",name:"Yandex access token",category:"credential",example:"t1.L=.WJ9CYVI5eeLkTOrMM_dgaPgdmpen48R8RYsL4VJqelVKDmrqYsSHkH6QyVVhJkuHSQFTd0NOhClEDyCz7eEbh5=",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:t1\\.[A-Z0-9a-z_-]+[=]{0,2}\\.[A-Z0-9a-z_-]{86}[=]{0,2})"},{key:"zendesk_secret_key",name:"Zendesk secret key",category:"credential",example:"iydgm2jofftb2xu7niv55qnfxdwbwmqt2s561bgc",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b).*(?:[a-z0-9]{40})"},{key:"infracost_api_token",name:"Infracost API token",category:"credential",example:"ico-fNZw8jjy6TugMUHKWX4l9iSP3i95SPNH",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)(?:ico-[a-zA-Z0-9]{32})"},{key:"iban",name:"Iban",category:"financial-data",example:"FR7630006000011234567890189",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)[a-zA-Z]{2}[0-9]{2}[a-zA-Z0-9]{11,30}(?-u:\\b)"},{key:"aikido_token",name:"Aikido token",category:"credential",example:"AIK_SECRET_XU28CmBY7Kxk3RPrqfHk9n6p5QX4p1tXzvJ7J1B3RPrqfHk9n6p5QX4p1tXzvJ7J",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AIK_SECRET_[A-Za-z0-9]{64}"},{key:"aikido_ci_token",name:"Aikido CI secret",category:"credential",example:"AIK_CI_US_XU28CmBY7Kxk3RPrqfHk9n6p5QX4p1tXzvJ7J1B3RPrqfHk9n6p5QX4p1tXzvJ7J",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)AIK_CI_(US_|ME_)?[A-Za-z0-9]{64}"},{key:"tsuga_ingestion_key",name:"Tsuga ingestion key",category:"credential",example:"tsuga_in:v1:OUvrwavCG//ixL08HEds9OAT",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)tsuga_in:v1:[A-Za-z0-9+/]{24}"},{key:"tsuga_operation_key",name:"Tsuga operation key",category:"credential",example:"tsuga_op:v1:zz3-LWv-sLy:0k7Skt255M0yXe/ZLBoiSamb",isUsingLuhnAlgorithm:!1,regexp:"(?-u:\\b)tsuga_op:v1:[A-Za-z0-9_-]+:[A-Za-z0-9+/]{24}"}],b2=FR.map(e=>e.key);var MMe=new Set(b2),DMe=FR.map(e=>e.key);var WMe={[wu]:ku,[wu.replace(`${L}.`,"")]:ku,[vu]:Lu,[vu.replace(`${L}.`,"")]:Lu,[Ln]:Ci,[Ln.replace(`${L}.`,"")]:Ci},ZMe={[ku]:wu,[Lu]:vu,[Ci]:Ln};function jR(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var qR=["alert_cluster","alert_conditions","alert_data_url","alert_id","alert_owner","alert_previous_status","alert_priority","alert_start_time","alert_status","alert_tags","alert_timeframe","alert_title","alert_transition","alert_triggered_by","dashboard_url","monitor_url"],BR=["alert_queries","alert_thresholds","alert_values"],O2=[...qR,...BR],HR=["alert_event_name","alert_message"],b0e=[...O2,...HR],O0e=new Set([...qR,...HR]),A0e=new Set(BR);var ef={aws:"aws",gcp:"gcp",azure:"azure"},Dn=[ef.aws,ef.gcp,ef.azure];var KR=t.Object({id:t.String({description:"Unique Tsuga cluster ID. Tsuga assigns it when the cluster record is created. Use this value as `clusterId` with public API requests that accept `clusterId`."}),name:t.String({description:"Cluster name stored in Tsuga. Usable as a display label when `friendlyName` is not set."}),friendlyName:t.Optional(t.String({description:"Human-readable display name for the cluster. Present when a friendly name is configured."})),clusterType:t.Enum(Dn,{description:"Cloud provider selected for the Tsuga cluster."}),clusterRegion:t.String({description:"Cloud region selected for the cluster using the provider region identifier."})},{$id:"Cluster",description:"Tsuga cluster available to the organization. Use its `id` to scope public API requests that accept `clusterId`."}),zR="clusterId must be provided when the organization has multiple clusters",A2={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(KR,{examples:[A2]});var tf=d({description:"Lists Tsuga clusters available to the organization. Use cluster IDs with public API requests that accept `clusterId`, such as telemetry, service, Kubernetes Explorer, and quality-report requests.",operationId:"listClusters",tags:["clusters"],url:`/${"v1"}/clusters`,method:"GET",response:t.Array(KR)});var qt=class e extends Error{constructor(n,o,i,s,c){super(n);this.statusCode=o;this.code=i;this.requestId=s;this.details=c;this.name="CliError"}static fromErrorResponse(n,o){return new e(n.message,n.statusCode,n.code,o,n.details)}};function YR(e){if(e instanceof qt){let r=[`Error: ${e.message}`];return e.statusCode&&r.push(`Status: ${e.statusCode}`),e.requestId&&r.push(`Request ID: ${e.requestId}`),e.details&&r.push(`Details: ${JSON.stringify(e.details,null,2)}`),r.join(`
57
+ `)}return e instanceof Error?`Error: ${e.message}`:String(e)}function VR(e,r){e.command("clusters").description("Manage Tsuga cluster selection").command("list").description("List all Tsuga clusters available to the operation API key").action(async()=>{let o=await r()(tf);W(o)})}function QR(e){return e instanceof qt&&e.message.includes(zR)}async function WR(e){let n=(await e(tf).catch(()=>[])).map(o=>` ${o.id} ${o.friendlyName??o.name}`);return[...n.length>0?["","Available clusters:",...n]:[],"","Pick one with --cluster <CLUSTER_ID>, TSUGA_CLUSTER_ID, or `tsuga config set default cluster <CLUSTER_ID>`."].join(`
58
+ `)}function XR(e,r,n,o){let i=e.commands.map(c=>c.name()).filter(c=>!c.startsWith("__")),s=e.options.map(c=>c.long).filter(c=>!!c);for(let c of e.options)(c.required||c.optional)&&(c.long&&o.add(c.long),c.short&&o.add(c.short));n.set(r.join(" "),{cmds:i,flags:[...s,"--help"]});for(let c of e.commands)c.name().startsWith("__")||XR(c,[...r,c.name()],n,o)}function x2(e){let r=new Map,n=new Set;return XR(e,[],r,n),{rows:[...r].map(([i,{cmds:s,flags:c}])=>({key:i,cmds:[...new Set(s)].join(" "),flags:[...new Set(c)].join(" ")})),valueFlags:[...n].join(" ")}}function ZR(e){return e.map(({key:r,cmds:n,flags:o})=>` ${JSON.stringify(r)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
59
+ `)}function R2(e,r){return`_tsuga_complete() {
58
60
  local cur key cmds flags words i word prev
59
61
  local valueflags="${r}"
60
62
  local -a path
@@ -75,7 +77,7 @@ ${e}
75
77
  COMPREPLY=( $(compgen -W "$words" -- "$cur") )
76
78
  }
77
79
  complete -F _tsuga_complete tsuga
78
- `}function I2(e,r){return`#compdef tsuga
80
+ `}function C2(e,r){return`#compdef tsuga
79
81
  _tsuga_complete() {
80
82
  local cur key cmds flags out i word prev
81
83
  local valueflags="${r}"
@@ -97,10 +99,10 @@ ${e}
97
99
  compadd -- \${=out}
98
100
  }
99
101
  compdef _tsuga_complete tsuga
100
- `}function tf(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function S2(e){return e.map(({key:r,cmds:n,flags:o})=>` case ${tf(r)}
101
- set cmds ${tf(n)}
102
- set flags ${tf(o)}`).join(`
103
- `)}function b2(e,r){return`# Update with: tsuga completion fish > ~/.config/fish/completions/tsuga.fish
102
+ `}function rf(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function P2(e){return e.map(({key:r,cmds:n,flags:o})=>` case ${rf(r)}
103
+ set cmds ${rf(n)}
104
+ set flags ${rf(o)}`).join(`
105
+ `)}function U2(e,r){return`# Update with: tsuga completion fish > ~/.config/fish/completions/tsuga.fish
104
106
  function __tsuga_complete
105
107
  set -l valueflags -- ${r}
106
108
  set -l tokens (commandline -xpc)
@@ -135,47 +137,46 @@ ${e}
135
137
  end
136
138
  end
137
139
  complete -c tsuga -f -a '(__tsuga_complete)'
138
- `}function YR(e){e.command("completion <SHELL>").description("Print a shell completion script (bash, zsh, or fish)").addHelpText("after",`
140
+ `}function JR(e){e.command("completion <SHELL>").description("Print a shell completion script (bash, zsh, or fish)").addHelpText("after",`
139
141
  Usage:
140
142
  bash: eval "$(tsuga completion bash)" # add to ~/.bashrc
141
143
  zsh: eval "$(tsuga completion zsh)" # add to ~/.zshrc
142
- fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(r=>{let{rows:n,valueFlags:o}=E2(e);if(r==="bash")z(_2(KR(n),o));else if(r==="zsh")z(I2(KR(n),o));else if(r==="fish")z(b2(S2(n),o));else throw new Error(`Unsupported shell "${r}". Supported: bash, zsh, fish.`)})}function VR(e){let r=e.command("config").description("Show or manage configuration");r.action(()=>{let n=e.opts(),o=Ai({clusterId:n.cluster});z(nR(o,Ru()).trimEnd())}),r.command("set").description("Set a configuration value").command("default <FLAG_NAME> <VALUE>").description("Set a custom default value for a command flag").allowUnknownOption(!0).action((n,o)=>{tR(n,o),z(`Default set: ${n} = ${o}`)}),r.command("reset").description("Reset configuration values").command("defaults").description("Clear all custom defaults").action(()=>{rR(),z("Custom defaults cleared")})}var QR=`/${"v1"}/docs`,WR=t.Object({path:t.String({description:"Path identifying the page. Documentation pages use a slug path (e.g. `getting-started/send-your-first-logs`). API-reference pages use `api/<operationId>` (e.g. `api/aggregateScalar`)."}),title:t.String({description:'Title of the page (e.g. "Send your first logs" or "POST /v1/aggregation/multi-query/scalar")'}),content:t.String({description:"Raw markdown content of the page"})},{$id:"DocPage",description:"A documentation or API-reference page with its raw markdown content"}),O2={path:"getting-started/send-your-first-logs",title:"Send your first logs",content:`# Send your first logs
143
- ...`};Object.assign(WR,{examples:[O2]});var ZR=t.Object({kind:t.Enum(["doc","api"],{description:"`doc` for documentation pages (guides, references, release notes); `api` for API-reference endpoints indexed from the OpenAPI spec. Use this to decide how to present or follow up on the result."}),path:t.String({description:"Path identifying the result. Documentation pages use a slug path (e.g. `data-collection/guides/how-to-add-resource-attributes`). API-reference results use `api/<operationId>` (e.g. `api/aggregateScalar`)."}),title:t.String({description:'Title of the result (e.g. "How to Add Resource Attributes" or "POST /v1/aggregation/multi-query/scalar")'}),subsection:t.Optional(t.String({description:'For documentation pages: the heading path inside the page that matched (e.g. "Language setup"). For API results: the matched field or parameter breadcrumb (e.g. "Body \u203A queries"). Absent when the match is the page or endpoint intro.'})),tab:t.Optional(t.String({description:'Tab label inside the page that the result matched. Set when the matching content is inside a <Tabs><Tab label="\u2026"> block. Always absent for API results.'})),anchor:t.Optional(t.String({description:"For documentation pages: the slugified heading ID used as the URL fragment (e.g. `language-setup`). For API results: the Scalar deep-link fragment (`tag/<tag>/<METHOD><path>`). The `link` field already has this baked in."})),score:t.Number({description:"Relevance score between 0 and 1 (higher is more relevant)"}),excerpt:t.String({description:"Short snippet of matching content"}),link:t.String({description:"URL to the result in the Tsuga app. Documentation pages include the section anchor and tab query parameter when applicable. API results deep-link into the API reference at `/documentation/api#tag/\u2026`."})},{$id:"DocSearchResult",description:"A documentation page or API-reference endpoint search result"}),A2={kind:"doc",path:"data-collection/guides/how-to-add-resource-attributes",title:"How to Add Resource Attributes",subsection:"Set resource attributes by language",tab:"Python",anchor:"set-resource-attributes-by-language",score:.9,excerpt:"...Python SDK setup should use the default resource detectors...",link:"https://www.app.tsuga.com/documentation/data-collection/guides/how-to-add-resource-attributes?tab=Python#set-resource-attributes-by-language"};Object.assign(ZR,{examples:[A2]});var XR=d({description:"Retrieve the raw markdown content of a documentation or API-reference page by its path. Documentation pages use slug paths (e.g. `getting-started/send-your-first-logs`); API-reference pages use `api/<operationId>` (e.g. `api/aggregateScalar`).",operationId:"getDocPage",tags:["public","docs"],url:QR,method:"GET",query:t.Object({path:p({allowEmpty:!1,description:"Documentation path to fetch. Use page slug paths for docs or `api/<operationId>` for API-reference pages."})},{description:"Documentation page lookup query."}),response:WR}),JR=d({description:"Searches public documentation pages and API-reference endpoints. Use this to build help search or route users to Tsuga docs and API reference results. Results are ranked by relevance; an empty array means no page or endpoint matched the query.",operationId:"searchDocs",tags:["public","docs"],url:`${QR}/search`,method:"GET",query:t.Object({query:p({allowEmpty:!1,description:"Search text to match against documentation and API-reference content."})},{description:"Documentation search query."}),response:t.Array(ZR)});function eC(e,r){let n=e.command("docs").description("Search and fetch Tsuga documentation and API-reference pages");n.command("get <DOC_PATH>").description("Get a documentation or API-reference page by path (e.g. 'getting-started/send-your-first-logs' or 'api/aggregateScalar')").action(async o=>{let i=await r()(XR,{query:{path:o}});W(i)}),n.command("search <SEARCH_TEXT>").description("Search Tsuga documentation and the full API reference, ranked by relevance").action(async o=>{let i=await r()(JR,{query:{query:o}});W(i)})}var Iw=require("node:fs");var x2="/v0/profiles",R2=["cpu","samples","wall","off_cpu","space","inuse_space","objects","inuse_objects","alloc_space","alloc_objects","goroutine"],C2=20,Rs={service:p({allowEmpty:!1,description:"Service the profiles belong to, as it appears in `profile.{type}.{service}`."}),type:t.Enum(R2,{description:"pprof sample type."}),filter:t.Optional(p({type:"tsuga-query",description:"TQL over the profile labels. Only label equality, negation and wildcards are accepted."})),groupBy:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Labels to split the flamegraph by. The stack itself cannot be a group-by."})),limit:t.Optional(t.Integer({minimum:1,default:C2,description:"Maximum number of groups, ranked by total value."})),minFraction:t.Optional(t.Number({minimum:0,maximum:1,description:"Nodes below this share of the root total fold into their parent."}))},ADe=d({tags:["profiles"],url:`${x2}/query`,method:"POST",body:t.Object({...Rs,timeRange:kn,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),response:Ci});var tC=`/${"v1"}/aggregation`,rC=t.Object({id:t.String({description:"Result identifier. Query results use `q1`, `q2`, and so on; formula results use `formula`."}),group:t.Record(t.String(),t.Union([t.String(),t.Number()]),{description:"Group-by field values for this result. Empty when no group-by is requested."})}),nC=t.Object({results:t.Array(t.Object({...rC.properties,value:t.Number({description:"Aggregated value for this query or formula and group, over the full time range."})},{title:"ScalarResult"}),{description:"One aggregated value per query or formula and group."})},{$id:"ScalarAggregationResponse",title:"ScalarAggregationResponse",description:"Scalar aggregation response with one value per query or formula and group."}),P2={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(nC,{examples:[P2]});var $u=t.Object({series:t.Array(t.Object({...rC.properties,points:t.Array(t.Object({timestamp:t.Integer({description:"Unix timestamp in milliseconds for this point, spaced by `aggregationWindow`."}),value:t.Number({description:"Aggregated value at this timestamp."})}),{description:"Ordered data points for this query or formula and group."})},{title:"Series"}),{description:"One time series per query or formula and group."})},{$id:"TimeseriesAggregationResponse",title:"TimeseriesAggregationResponse",description:"Timeseries aggregation response with timestamped points over time."}),U2={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign($u,{examples:[U2]});var w2=t.Omit(xs.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),v2=t.Optional(Xr),oC={timeRange:Tt,queries:t.Array(w2,{maxItems:As,description:`Aggregations that may be combined together in the same query. Each item is referenced from \`formula\` as q1, q2, and so on, in submission order. Limited to ${As} items. For dataSource "metrics", each aggregate's \`field\` is the metric name, not an attribute; to count distinct values of an attribute use unique-count with field "<metricName>.context.<attribute>" (e.g. "system.cpu.utilization.context.host.name").`}),groupBy:v2,dataSource:Vt,formula:t.Optional(Oo)},Cs=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),iC=t.Object(oC,{description:"Scalar aggregation request. Provide a time range, one or more queries, a telemetry data source, and optional grouping or formula. Omit `groupBy` for ungrouped results. Send `clusterId` as a query parameter, not in the JSON body."}),N2={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(iC,{examples:[N2]});var aC=d({description:"Runs one or more aggregation queries over logs, metrics, traces, or RUM events and returns scalar values. Use optional group-by and formula fields to compute grouped or derived results. See [Analytics queries](/documentation/visualize/analytics/queries).",operationId:"aggregateScalar",tags:["public","aggregation"],url:`${tC}/multi-query/scalar`,method:"POST",body:iC,query:Cs,response:nC}),sC=t.Object({...oC,aggregationWindow:p({description:"Time bucket size for timeseries aggregation, such as `10s`, `1m`, or `1h`."})},{description:"Timeseries aggregation request. Provide a time range, bucket size, one or more queries, a telemetry data source, and optional grouping or formula. Omit `groupBy` for ungrouped series. Send `clusterId` as a query parameter, not in the JSON body."}),L2={timeRange:{from:1782201500,to:1782203400},aggregationWindow:"1m",dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(sC,{examples:[L2]});var cC=d({description:"Runs one or more aggregation queries over logs, metrics, traces, or RUM events and returns timestamped series. Use `aggregationWindow` to choose the time bucket size. See [Analytics queries](/documentation/visualize/analytics/queries).",operationId:"aggregateTimeseries",tags:["public","aggregation"],url:`${tC}/multi-query/timeseries`,method:"POST",body:sC,query:Cs,response:$u});var pC=`/${"v1"}/profiles`,uC=t.Object({...Rs,timeRange:Tt},{description:"Profile query request. Send clusterId as a query parameter, not in this JSON body.",examples:[{service:"api",type:"cpu",timeRange:{from:1782201500,to:1782203400},filter:"context.env:prod"}]}),k2=t.Object({stacks:t.Array(t.Object({stack:t.String({description:"Frames from the root to the leaf, joined with `;` (folded stack format)."}),group:t.Record(t.String(),t.String(),{description:"Group-by label values for this stack. Empty when no group-by is requested."}),value:t.Number({description:"Total sample value of this stack, in the unit of the profile type."})}),{description:"One entry per distinct leaf stack, after folding nodes below minFraction."})},{examples:[{stacks:[{stack:"main;handleRequest;encodeJson",group:{},value:125e7},{stack:"main;handleRequest;queryDb",group:{},value:8e8}]}]}),rf=d({description:"Aggregates continuous profiling samples for a service into folded stacks, optionally split by profile labels.",tags:["private"],url:`${pC}/query`,method:"POST",body:uC,query:Cs,response:k2}),M2=t.Object({pprof:t.String({description:"Merged pprof profile, base64-encoded (standard alphabet, padded)."})}),lC=d({description:"Merges continuous profiling samples for a service into a single pprof profile.",tags:["private"],url:`${pC}/pprof`,method:"POST",body:uC,query:Cs,response:M2});var or=class e extends Error{constructor(n,o,i,a,c){super(n);this.statusCode=o;this.code=i;this.requestId=a;this.details=c;this.name="CliError"}static fromErrorResponse(n,o){return new e(n.message,n.statusCode,n.code,o,n.details)}};function mC(e){if(e instanceof or){let r=[`Error: ${e.message}`];return e.statusCode&&r.push(`Status: ${e.statusCode}`),e.requestId&&r.push(`Request ID: ${e.requestId}`),e.details&&r.push(`Details: ${JSON.stringify(e.details,null,2)}`),r.join(`
144
- `)}return e instanceof Error?`Error: ${e.message}`:String(e)}var dC=dn(require("node:fs"));function Ui(e){if(e.file){let r=dC.default.readFileSync(e.file==="-"?0:e.file,"utf-8");return JSON.parse(r)}if(e.data)return JSON.parse(e.data);throw new Error("Provide a request body with -f <FILE_PATH> or -d <JSON>. Use --generate-skeleton to get a template.")}function nf(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,r=>s.IsObject(r)&&s.HasPropertyKey(r,"check")&&s.HasPropertyKey(r,"error")&&s.IsFunction(r.check)&&s.IsFunction(r.error))}function hr(e){return s.IsObject(e)&&!s.IsArray(e)}function Fu(e){return s.IsBoolean(e)}function j(e){return hr(e)||Fu(e)}function of(e){return s.HasPropertyKey(e,"additionalItems")&&j(e.additionalItems)}function Jr(e){return s.HasPropertyKey(e,"additionalProperties")&&j(e.additionalProperties)}function af(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(r=>j(r))}function Ps(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function sf(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(r=>j(r))}function cf(e){return s.HasPropertyKey(e,"const")}function Ao(e){return s.HasPropertyKey(e,"contains")&&j(e.contains)}function Qt(e){return s.HasPropertyKey(e,"default")}function pf(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(r=>j(r)||s.IsArray(r)&&r.every(n=>s.IsString(n)))}function uf(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(r=>s.IsArray(r)&&r.every(n=>s.IsString(n)))}function lf(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(r=>j(r))}function Gn(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function mf(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function df(e){return s.HasPropertyKey(e,"else")&&j(e.else)}function ff(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function gf(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function en(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Us(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function tn(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function hf(e){return s.HasPropertyKey(e,"if")&&j(e.if)}function wi(e){return s.HasPropertyKey(e,"items")&&(j(e.items)||s.IsArray(e.items)&&e.items.every(r=>j(r)))}function yf(e){return wi(e)&&s.IsArray(e.items)}function Tf(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function Ef(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function ju(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function _f(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function If(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function rn(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function xo(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function vi(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function ws(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function vs(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function Sf(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function bf(e){return s.HasPropertyKey(e,"not")&&j(e.not)}function Of(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(r=>j(r))}function Ns(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function Ls(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(r=>j(r))}function Ni(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(r=>j(r))}function ks(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(r=>j(r))}function Af(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||j(e.propertyNames))}function D2(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function qu(e){return D2(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function xf(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function Rf(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function Ro(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(r=>s.IsString(r))}function Cf(e){return s.HasPropertyKey(e,"then")&&j(e.then)}function Pf(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(r=>s.IsString(r)))}function Li(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Bu(e){return s.HasPropertyKey(e,"unevaluatedItems")&&j(e.unevaluatedItems)}function Hu(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&j(e.unevaluatedProperties)}var Rt=class{constructor(){let r=new Set,n=new Set;this.stack=[{indices:r,keys:n}]}Push(){let r=new Set,n=new Set;return this.stack.push({indices:r,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(r){return this.GetIndices().add(r),!0}AddKey(r){return this.GetKeys().add(r),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(r){for(let n of r)n.GetIndices().forEach(o=>this.GetIndices().add(o)),n.GetKeys().forEach(o=>this.GetKeys().add(o));return!0}},Ms=class extends Rt{constructor(r){super(),this.callback=r}AddError(r){return this.callback(r),!1}},ut=class extends Ms{constructor(){super(r=>this.errors.push(r)),this.errors=[]}AddError(r){return this.errors.push(r),!1}GetErrors(){return this.errors}};function fC(e,r,n,o){return s.Every(n["~refine"],0,(i,a)=>i.check(o))}function gC(e,r,n,o,i,a){return s.EveryAll(i["~refine"],0,(c,l)=>c.check(a)||r.AddError({keyword:"~refine",schemaPath:n,instancePath:o,params:{index:l,message:c.error(a)}}))}function hC(e){return wi(e)&&s.IsArray(e.items)}function yC(e,r,n,o){return hC(n)?s.Every(o,0,(a,c)=>s.IsLessThan(c,n.items.length)||Wt(e,r,n.additionalItems,a)&&r.AddIndex(c)):!0}function TC(e,r,n,o,i,a){return hC(i)?s.Every(a,0,(l,m)=>{let f=`${n}/additionalItems`,h=`${o}/${m}`;return s.IsLessThan(m,i.items.length)||Zt(e,r,f,h,i.additionalItems,l)&&r.AddIndex(m)}):!0}function G2(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function EC(e){let r=[];return Ls(e)&&r.push(...s.Keys(e.patternProperties)),ks(e)&&r.push(...s.Keys(e.properties).map(G2)),s.IsEqual(r.length,0)?"(?!)":`(${r.join("|")})`}function _C(e,r,n,o){let i=new RegExp(EC(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||Wt(e,r,n.additionalProperties,o[c])&&r.AddKey(c))}function IC(e,r,n,o,i,a){let c=new RegExp(EC(i)),l=[];return s.EveryAll(s.Keys(a),0,(f,h)=>{let E=`${n}/additionalProperties`,I=`${o}/${f}`,g=new ut,T=c.test(f)||Zt(e,g,E,I,i.additionalProperties,a[f])&&r.AddKey(f);return T||l.push(f),T})||r.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:o,params:{additionalProperties:l}})}function SC(e,r,n,o){let i=n.allOf.reduce((a,c)=>{let l=new Rt;return oe(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,n.allOf.length)&&r.Merge(i)}function bC(e,r,n,o,i,a){let c=[],l=i.allOf.reduce((f,h,E)=>{let I=`${n}/allOf/${E}`,g=new ut,T=be(e,g,I,o,h,a);return T||c.push(g),T?[...f,g]:f},[]),m=s.IsEqual(l.length,i.allOf.length)&&r.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>r.AddError(h))),m}function OC(e,r,n,o){let i=n.anyOf.reduce((a,c)=>{let l=new Rt;return oe(e,l,c,o)?[...a,l]:a},[]);return s.IsGreaterThan(i.length,0)&&r.Merge(i)}function AC(e,r,n,o,i,a){let c=[],l=i.anyOf.reduce((f,h,E)=>{let I=new ut,g=`${n}/anyOf/${E}`,T=be(e,I,g,o,h,a);return T||c.push(I),T?[...f,I]:f},[]),m=s.IsGreaterThan(l.length,0)&&r.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>r.AddError(h))),m||r.AddError({keyword:"anyOf",schemaPath:n,instancePath:o,params:{}})}function wf(e,r,n,o){return n}function xC(e,r,n,o,i,a){return wf(e,r,i,a)||r.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function vf(e,r,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function RC(e,r,n,o,i,a){return vf(e,r,i,a)||r.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function $2(e){return!(xo(e)&&s.IsEqual(e.minContains,0))}function Nf(e,r,n,o){return $2(n)?!s.IsEqual(o.length,0)&&s.SomeAll(o,(i,a)=>oe(e,r,n.contains,i)&&r.AddIndex(a)):!0}function CC(e,r,n,o,i,a){return Nf(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function PC(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependencies),0,([c,l])=>!s.HasPropertyKey(o,c)||(s.IsArray(l)?l.every(m=>s.HasPropertyKey(o,m)):oe(e,r,l,o)));return i||a}function UC(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependencies),0,([m,f])=>{let h=`${n}/dependencies/${m}`;return!s.HasPropertyKey(a,m)||(s.IsArray(f)?f.every(E=>s.HasPropertyKey(a,E)||r.AddError({keyword:"dependencies",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})):be(e,r,h,o,f,a))});return c||l}function wC(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependentRequired),0,([c,l])=>!s.HasPropertyKey(o,c)||l.every(m=>s.HasPropertyKey(o,m)));return i||a}function vC(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentRequired),0,([m,f])=>!s.HasPropertyKey(a,m)||s.EveryAll(f,0,h=>s.HasPropertyKey(a,h)||r.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})));return c||l}function NC(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependentSchemas),0,([c,l])=>!s.HasPropertyKey(o,c)||oe(e,r,l,o));return i||a}function LC(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentSchemas),0,([m,f])=>{let h=`${n}/dependentSchemas/${m}`;return!s.HasPropertyKey(a,m)||be(e,r,h,o,f,a)});return c||l}function kC(e,r,n,o){let i=e.DynamicRef(n)??!1;return j(i)&&oe(e,r,i,o)}function MC(e,r,n,o,i,a){let c=e.DynamicRef(i)??!1;return j(c)&&be(e,r,"#",o,c,a)}function Mf(e,r,n,o){return s.Some(n.enum,i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function DC(e,r,n,o,i,a){return Mf(e,r,i,a)||r.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function Df(e,r,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function GC(e,r,n,o,i,a){return Df(e,r,i,a)||r.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function Gf(e,r,n,o){return s.IsGreaterThan(o,n.exclusiveMinimum)}function $C(e,r,n,o,i,a){return Gf(e,r,i,a)||r.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var Gi={};Xt(Gi,{Clear:()=>WC,Entries:()=>OK,Get:()=>RK,Has:()=>xK,IsDate:()=>Mi,IsDateTime:()=>Ku,IsDuration:()=>zu,IsEmail:()=>Yu,IsHostname:()=>Qu,IsIPv4:()=>Xu,IsIPv6:()=>Ju,IsIdnEmail:()=>Wu,IsIdnHostname:()=>Zu,IsIri:()=>tl,IsIriReference:()=>el,IsJsonPointer:()=>nl,IsJsonPointerUriFragment:()=>rl,IsRegex:()=>ol,IsRelativeJsonPointer:()=>il,IsTime:()=>Di,IsUri:()=>pl,IsUriReference:()=>al,IsUriTemplate:()=>sl,IsUrl:()=>ul,IsUuid:()=>ll,Reset:()=>ZC,Set:()=>AK,Test:()=>CK});var F2=[0,31,28,31,30,31,30,31,31,30,31,30,31],j2=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function q2(e){return e%4===0&&(e%100!==0||e%400===0)}function Mi(e){let r=j2.exec(e);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3];return o>=1&&o<=12&&i>=1&&i<=(o===2&&q2(n)?29:F2[o])}var B2=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Di(e,r=!0){let n=B2.exec(e);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],c=n[4]==="-"?-1:1,l=+(n[5]||0),m=+(n[6]||0);if(l>23||m>59||r&&!n[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(o<=23&&i<=59&&a<60)return!0;let f=i-m*c,h=o-l*c-(f<0?1:0);return(h===23||h===-1)&&(f===59||f===-1)&&a<61}function Ku(e,r=!0){let n=e.split(/T/i);return n.length===2&&Mi(n[0])&&Di(n[1],r)}var H2=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function zu(e){return H2.test(e)}var K2=/^(?!.*\.\.)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i;function Yu(e){return K2.test(e)}var Co=36,Vu=1,$f=26,z2=38,Y2=700,V2=72,Q2=128;function W2(e,r,n){e=n?Math.floor(e/Y2):e>>1,e+=Math.floor(e/r);let o=0;for(;e>(Co-Vu)*$f>>1;)e=Math.floor(e/(Co-Vu)),o+=Co;return o+Math.floor((Co-Vu+1)*e/(e+z2))}function FC(e){let r=[],n=Q2,o=0,i=V2,a=e.lastIndexOf("-");if(a>0)for(let l=0;l<a;l++){let m=e.charCodeAt(l);if(m>=128)throw new Error("Invalid punycode: non-basic before delimiter");r.push(m)}let c=a<0?0:a+1;for(;c<e.length;){let l=o,m=1,f=Co;for(;;){if(c>=e.length)throw new Error("Invalid punycode: unexpected end of input");let E=e.charCodeAt(c++),I;if(E>=97&&E<=122)I=E-97;else if(E>=48&&E<=57)I=E-48+26;else if(E>=65&&E<=90)ye();else throw new Error("Invalid punycode: bad digit character");o+=I*m;let g=f<=i?Vu:f>=i+$f?$f:f-i;if(I<g)break;m*=Co-g,f+=Co}let h=r.length+1;i=W2(o-l,h,l===0),n+=Math.floor(o/h),o%=h,r.splice(o,0,n),o++}return globalThis.String.fromCodePoint(...r)}function X2(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function J2(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function eK(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function tK(e){return X2(e)||J2(e)||eK(e)}var rK=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),nK=new Set([2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,6980,7082,7083,43456,69702,69759,69817,69939,69940,70080,70197,70477,70722,70850,71103,71231,71350,72767,73028,73029]);function oK(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function iK(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function aK(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function sK(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function cK(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function pK(e){return e>=1632&&e<=1641}function uK(e){return e>=1776&&e<=1785}function jC(e){return nK.has(e)}function qC(e){if(e.length===0)return ye();let r=[...e].map(c=>c.codePointAt(0)),n=r.length;if(r[0]===45||r[n-1]===45||n>=4&&r[2]===45&&r[3]===45||tK(r[0]))return!1;let o=!1,i=!1,a=!1;for(let c=0;c<n;c++){let l=r[c];if(rK.has(l))return!1;(aK(l)||sK(l)||cK(l))&&(o=!0),pK(l)&&(i=!0),uK(l)&&(a=!0);let m=r[c-1],f=r[c+1];switch(l){case 183:if(m!==108||f!==108)return!1;break;case 885:if(f===void 0||!oK(f))return!1;break;case 1523:case 1524:if(m===void 0||!iK(m))return!1;break;case 8204:if(m===void 0||m<128&&!jC(m))return!1;break;case 8205:if(m===void 0||!jC(m))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o||i&&a)}function lK(e){if(e.charCodeAt(0)===45||e.charCodeAt(e.length-1)===45||e.length>=4&&e.charCodeAt(2)===45&&e.charCodeAt(3)===45)return!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45))return!1}return!0}function BC(e){return e.toLowerCase().startsWith("xn--")}function HC(e){try{let r=e.slice(4).toLowerCase();if(r.lastIndexOf("-")===0)return!1;let o=FC(r);return o?qC(o):!1}catch{return!1}}function KC(e){return e.length===0||e.length>63?!1:BC(e)?HC(e):qC(e)}function zC(e){return e.length===0||e.length>63?!1:BC(e)?HC(e):lK(e)}function Qu(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(let r of e.split("."))if(!zC(r))return!1;return!0}var dK=/^(?!.*\.\.)[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+(?:\.[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+)*@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?)*$/iu;function Wu(e){return dK.test(e)}function Zu(e){if(e.length===0||e.includes(" "))return!1;let r=e.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".");if(r.length>253)return!1;for(let n of r.split("."))if(!KC(n))return!1;return!0}function Ff(e,r,n){let o=0,i=0,a=0,c=0;for(let l=r;l<n;l++){let m=e.charCodeAt(l);if(m===46){if(a===0||i>255||c===48&&a>1)return!1;o++,i=0,a=0,c=0}else if(m>=48&&m<=57)a===0&&(c=m),i=i*10+(m-48),a++;else return!1}return o===3&&a>0&&i<=255&&!(c===48&&a>1)}function Xu(e){return Ff(e,0,e.length)}function fK(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Ju(e){let r=e.length;if(r===0)return!1;let n=0,o=!1,i=0;if(e.charCodeAt(0)===58&&e.charCodeAt(1)===58){if(r===2)return!0;o=!0,i=2}for(;i<r;){let a=0,c=i;for(;i<r&&fK(e.charCodeAt(i));)i++,a++;if(a===0)return!1;let l=e.charCodeAt(i);if(l===46){if(!Ff(e,c,r))return!1;n+=2,i=r;break}if(a>4)return!1;if(n++,i===r)break;if(l!==58)return!1;if(i++,e.charCodeAt(i)===58){if(o||e.charCodeAt(i+1)===58)return!1;if(o=!0,i++,i===r)break}}return o?n<=7:n===8}function YC(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function el(e){if(e.includes(" ")||e.includes("\\")||/[\x00-\x1F\x7F]/.test(e)||/%(?![0-9a-fA-F]{2})/.test(e))return!1;if(e==="")return!0;let r=e.indexOf(":");return r>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,r))?YC(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&r===-1?!1:YC(e)}function tl(e){try{return new URL(e),!0}catch{return!1}}var gK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function rl(e){return gK.test(e)}var hK=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function nl(e){return hK.test(e)}function ol(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var yK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function il(e){return yK.test(e)}var TK=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function al(e){return TK.test(e)}var EK=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;function sl(e){return EK.test(e)}function VC(e){return e>=97&&e<=122||e>=65&&e<=90}function QC(e){return VC(e)||e>=48&&e<=57}function cl(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function _K(e){return QC(e)||e===43||e===45||e===46}function jf(e){return QC(e)||e===45||e===46||e===95||e===126}function qf(e){return e===33||e===36||e===38||e===39||e===40||e===41||e===42||e===43||e===44||e===59||e===61}function IK(e){return jf(e)||qf(e)||e===58||e===64}function pl(e){let r=e.length;if(r===0||!VC(e.charCodeAt(0)))return!1;let n=1;for(;n<r;){let o=e.charCodeAt(n);if(o===58)break;if(!_K(o))return!1;n++}if(e.charCodeAt(n)!==58)return!1;if(n++,e.charCodeAt(n)===47&&e.charCodeAt(n+1)===47){n+=2;let o=n,i=-1;for(let a=n;a<r;a++){let c=e.charCodeAt(a);if(c===64){i=a;break}if(c===47||c===63||c===35)break}if(i!==-1){for(let a=o;a<i;a++){let c=e.charCodeAt(a);if(c===91||c===93)return!1;if(c===37){if(a+2>=i||!cl(e.charCodeAt(a+1))||!cl(e.charCodeAt(a+2)))return!1;a+=2}else if(!jf(c)&&!qf(c)&&c!==58)return!1}n=i+1}if(e.charCodeAt(n)===91){for(n++;n<r&&e.charCodeAt(n)!==93;)n++;if(e.charCodeAt(n)!==93)return!1;n++}else for(;n<r;){let a=e.charCodeAt(n);if(a===47||a===63||a===35||a===58)break;if(a<128&&!jf(a)&&!qf(a))return!1;n++}if(e.charCodeAt(n)===58)for(n++;n<r;){let a=e.charCodeAt(n);if(a===47||a===63||a===35)break;if(a<48||a>57)return!1;n++}}for(;n<r;){let o=e.charCodeAt(n);if(o===37){if(n+2>=r||!cl(e.charCodeAt(n+1))||!cl(e.charCodeAt(n+2)))return!1;n+=2}else{if(o>127)return!1;if(!(IK(o)||o===47||o===63||o===35))return!1}n++}return!0}var SK=/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;function ul(e){return SK.test(e)}var bK=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function ll(e){return bK.test(e)}var Ce=new Map;function WC(){Ce.clear()}function OK(){return[...Ce.entries()]}function AK(e,r){Ce.set(e,r)}function xK(e){return Ce.has(e)}function RK(e){return Ce.get(e)}function CK(e,r){return Ce.get(e)?.(r)??!0}function ZC(){WC(),Ce.set("date-time",Ku),Ce.set("date",Mi),Ce.set("duration",zu),Ce.set("email",Yu),Ce.set("hostname",Qu),Ce.set("idn-email",Wu),Ce.set("idn-hostname",Zu),Ce.set("ipv4",Xu),Ce.set("ipv6",Ju),Ce.set("iri-reference",el),Ce.set("iri",tl),Ce.set("json-pointer-uri-fragment",rl),Ce.set("json-pointer",nl),Ce.set("regex",ol),Ce.set("relative-json-pointer",il),Ce.set("time",Di),Ce.set("uri-reference",al),Ce.set("uri-template",sl),Ce.set("uri",pl),Ce.set("url",ul),Ce.set("uuid",ll)}ZC();function Bf(e,r,n,o){return Gi.Test(n.format,o)}function XC(e,r,n,o,i,a){return Bf(e,r,i,a)||r.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function JC(e,r,n,o){let i=Cf(n)?n.then:!0,a=df(n)?n.else:!0;return oe(e,r,n.if,o)?oe(e,r,i,o):oe(e,r,a,o)}function eP(e,r,n,o,i,a){let c=Cf(i)?i.then:!0,l=df(i)?i.else:!0,m=new ut,f=be(e,m,`${n}/if`,o,i.if,a)?be(e,m,`${n}/then`,o,c,a)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"then"}}):be(e,r,`${n}/else`,o,l,a)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"else"}});return f&&r.Merge([m]),f}function PK(e,r,n,o){return s.Every(n.items,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Wt(e,r,i,o[a])&&r.AddIndex(a))}function UK(e,r,n,o,i,a){return s.EveryAll(i.items,0,(c,l)=>{let m=`${n}/items/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||Zt(e,r,m,f,c,a[l])&&r.AddIndex(l)})}function wK(e,r,n,o){let i=Ni(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>Wt(e,r,n.items,a)&&r.AddIndex(c))}function vK(e,r,n,o,i,a){let c=Ni(i)?i.prefixItems.length:0;return s.EveryAll(a,c,(l,m)=>{let f=`${n}/items`,h=`${o}/${m}`;return Zt(e,r,f,h,i.items,l)&&r.AddIndex(m)})}function tP(e,r,n,o){return yf(n)?PK(e,r,n,o):wK(e,r,n,o)}function rP(e,r,n,o,i,a){return yf(i)?UK(e,r,n,o,i,a):vK(e,r,n,o,i,a)}function NK(e){return Ao(e)}function Hf(e,r,n,o){if(!NK(n))return!0;let i=s.Counted(o,a=>oe(e,r,n.contains,a));return s.IsLessEqualThan(i,n.maxContains)}function nP(e,r,n,o,i,a){let c=xo(i)?i.minContains:1;return Hf(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function Kf(e,r,n,o){return s.IsLessEqualThan(o,n.maximum)}function oP(e,r,n,o,i,a){return Kf(e,r,i,a)||r.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function zf(e,r,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function iP(e,r,n,o,i,a){return zf(e,r,i,a)||r.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function Yf(e,r,n,o){return s.IsMaxLength(o,n.maxLength)}function aP(e,r,n,o,i,a){return Yf(e,r,i,a)||r.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function Vf(e,r,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function sP(e,r,n,o,i,a){return Vf(e,r,i,a)||r.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function LK(e){return Ao(e)}function Qf(e,r,n,o){if(!LK(n))return!0;let i=s.Counted(o,(a,c)=>oe(e,r,n.contains,a)&&r.AddIndex(c));return s.IsGreaterEqualThan(i,n.minContains)}function cP(e,r,n,o,i,a){return Qf(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function Wf(e,r,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function pP(e,r,n,o,i,a){return Wf(e,r,i,a)||r.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function Zf(e,r,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function uP(e,r,n,o,i,a){return Zf(e,r,i,a)||r.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function Xf(e,r,n,o){return s.IsMinLength(o,n.minLength)}function lP(e,r,n,o,i,a){return Xf(e,r,i,a)||r.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function Jf(e,r,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function mP(e,r,n,o,i,a){return Jf(e,r,i,a)||r.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function eg(e,r,n,o){return s.IsMultipleOf(o,n.multipleOf)}function dP(e,r,n,o,i,a){return eg(e,r,i,a)||r.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function tg(e,r,n,o){let i=new Rt;return!oe(e,i,n.not,o)&&r.Merge([i])}function fP(e,r,n,o,i,a){return tg(e,r,i,a)||r.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function gP(e,r,n,o){let i=n.oneOf.reduce((a,c)=>{let l=new Rt;return oe(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,1)&&r.Merge(i)}function hP(e,r,n,o,i,a){let c=[],l=[],m=i.oneOf.reduce((h,E,I)=>{let g=new ut,T=`${n}/oneOf/${I}`,O=be(e,g,T,o,E,a);return O&&l.push(I),O||c.push(g),O?[...h,g]:h},[]),f=s.IsEqual(m.length,1)&&r.Merge(m);return!f&&s.IsEqual(l.length,0)&&c.forEach(h=>h.GetErrors().forEach(E=>r.AddError(E))),f||r.AddError({keyword:"oneOf",schemaPath:n,instancePath:o,params:{passingSchemas:l}})}function rg(e,r,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(o)}function yP(e,r,n,o,i,a){return rg(e,r,i,a)||r.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function TP(e,r,n,o){return s.Every(s.Entries(n.patternProperties),0,([i,a])=>{let c=new RegExp(i,"u");return s.Every(s.Entries(o),0,([l,m])=>!c.test(l)||Wt(e,r,a,m)&&r.AddKey(l))})}function EP(e,r,n,o,i,a){return s.EveryAll(s.Entries(i.patternProperties),0,([c,l])=>{let m=`${n}/patternProperties/${c}`,f=new RegExp(c,"u");return s.EveryAll(s.Entries(a),0,([h,E])=>{let I=`${o}/${h}`;return!f.test(h)||Zt(e,r,m,I,l,E)&&r.AddKey(h)})})}function _P(e,r,n,o){return s.IsEqual(o.length,0)||s.Every(n.prefixItems,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Wt(e,r,i,o[a])&&r.AddIndex(a))}function IP(e,r,n,o,i,a){return s.IsEqual(a.length,0)||s.EveryAll(i.prefixItems,0,(c,l)=>{let m=`${n}/prefixItems/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||Zt(e,r,m,f,c,a[l])&&r.AddIndex(l)})}function ng(e,r){return e.includes(r)||at.Get().exactOptionalPropertyTypes}function og(e,r){return s.IsUndefined(e[r])}function SP(e,r,n,o){let i=Ro(n)?n.required:[];return s.Every(s.Entries(n.properties),0,([c,l])=>{let m=!s.HasPropertyKey(o,c)||Wt(e,r,l,o[c])&&r.AddKey(c);return ng(i,c)?m:og(o,c)||m})}function bP(e,r,n,o,i,a){let c=Ro(i)?i.required:[];return s.EveryAll(s.Entries(i.properties),0,([m,f])=>{let h=`${n}/properties/${m}`,E=`${o}/${m}`,I=()=>!s.HasPropertyKey(a,m)||Zt(e,r,h,E,f,a[m])&&r.AddKey(m);return ng(c,m)?I():og(a,m)||I()})}function OP(e,r,n,o){return s.Every(s.Keys(o),0,(i,a)=>oe(e,r,n.propertyNames,i))}function AP(e,r,n,o,i,a){let c=[];return s.EveryAll(s.Keys(a),0,(m,f)=>{let h=`${o}/${m}`,E=`${n}/propertyNames`,I=new ut,g=be(e,I,E,h,i.propertyNames,m);return g||c.push(m),g})||r.AddError({keyword:"propertyNames",schemaPath:n,instancePath:o,params:{propertyNames:c}})}function xP(e,r,n,o){let i=e.RecursiveRef(n)??!1;return j(i)&&oe(e,r,i,o)}function RP(e,r,n,o,i,a){let c=e.RecursiveRef(i)??!1;return j(c)&&be(e,r,"#",o,c,a)}function CP(e,r,n,o){let i=e.Ref(n)??!1,a=new Rt,c=j(i)&&oe(e,a,i,o);return c&&r.Merge([a]),c}function PP(e,r,n,o,i,a){let c=e.Ref(i)??!1,l=new ut,m=j(c)&&be(e,l,"#",o,c,a);return m&&r.Merge([l]),m||l.GetErrors().forEach(f=>r.AddError(f)),m}function UP(e,r,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function wP(e,r,n,o,i,a){let c=[];return s.EveryAll(i.required,0,m=>{let f=s.HasPropertyKey(a,m);return f||c.push(m),f})||r.AddError({keyword:"required",schemaPath:n,instancePath:o,params:{requiredProperties:c}})}function ig(e,r,n,o,i){return s.IsEqual(n,"object")?s.IsObjectNotArray(i):s.IsEqual(n,"array")?s.IsArray(i):s.IsEqual(n,"boolean")?s.IsBoolean(i):s.IsEqual(n,"integer")?s.IsInteger(i):s.IsEqual(n,"number")?s.IsNumber(i):s.IsEqual(n,"null")?s.IsNull(i):s.IsEqual(n,"string")?s.IsString(i):s.IsEqual(n,"bigint")?s.IsBigInt(i):s.IsEqual(n,"constructor")?s.IsConstructor(i):s.IsEqual(n,"function")?s.IsFunction(i):s.IsEqual(n,"symbol")?s.IsSymbol(i):s.IsEqual(n,"undefined")?s.IsUndefined(i):s.IsEqual(n,"void")?s.IsUndefined(i):!0}function vP(e,r,n,o,i){return s.Some(n,a=>ig(e,r,a,o,i))}function NP(e,r,n,o){return s.IsArray(n.type)?vP(e,r,n.type,n,o):ig(e,r,n.type,n,o)}function LP(e,r,n,o,i,a){return(s.IsArray(i.type)?vP(e,r,i.type,i,a):ig(e,r,i.type,i,a))||r.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function kP(e,r,n,o){let i=r.GetIndices();return s.Every(o,0,(a,c)=>(i.has(c)||oe(e,r,n.unevaluatedItems,a))&&r.AddIndex(c))}function MP(e,r,n,o,i,a){let c=r.GetIndices(),l=[];return s.EveryAll(a,0,(f,h)=>{let E=new ut,I=(c.has(h)||be(e,E,n,o,i.unevaluatedItems,f))&&r.AddIndex(h);return I||l.push(h),I})||r.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:o,params:{unevaluatedItems:l}})}function DP(e,r,n,o){let i=r.GetKeys();return s.Every(s.Entries(o),0,([a,c])=>i.has(a)||oe(e,r,n.unevaluatedProperties,c)&&r.AddKey(a))}function GP(e,r,n,o,i,a){let c=r.GetKeys(),l=[];return s.EveryAll(s.Entries(a),0,([f,h])=>{let E=new ut,I=c.has(f)||be(e,E,n,o,i.unevaluatedProperties,h)&&r.AddKey(f);return I||l.push(f),I})||r.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function $P(e){return!s.IsEqual(e.uniqueItems,!1)}function FP(e,r,n,o){if(!$P(n))return!0;let i=new Set(o.map(ro.Hash)).size,a=o.length;return s.IsEqual(i,a)}function jP(e,r,n,o,i,a){if(!$P(i))return!0;let c=new Set,l=a.reduce((f,h,E)=>{let I=ro.Hash(h);return c.has(I)?[...f,E]:(c.add(I),f)},[]);return s.IsEqual(l.length,0)||r.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:o,params:{duplicateItems:l}})}function Wt(e,r,n,o){return r.Push()&&oe(e,r,n,o)&&r.Pop()}function oe(e,r,n,o){e.Push(n);let i=Fu(n)?wf(e,r,n,o):(!Pf(n)||NP(e,r,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!Ro(n)||UP(e,r,n,o))&&(!Jr(n)||_C(e,r,n,o))&&(!pf(n)||PC(e,r,n,o))&&(!uf(n)||wC(e,r,n,o))&&(!lf(n)||NC(e,r,n,o))&&(!Ls(n)||TP(e,r,n,o))&&(!ks(n)||SP(e,r,n,o))&&(!Af(n)||OP(e,r,n,o))&&(!vs(n)||Jf(e,r,n,o))&&(!If(n)||Vf(e,r,n,o)))&&(!s.IsArray(o)||(!of(n)||yC(e,r,n,o))&&(!Ao(n)||Nf(e,r,n,o))&&(!wi(n)||tP(e,r,n,o))&&(!Ef(n)||Hf(e,r,n,o))&&(!ju(n)||zf(e,r,n,o))&&(!xo(n)||Qf(e,r,n,o))&&(!vi(n)||Zf(e,r,n,o))&&(!Ni(n)||_P(e,r,n,o))&&(!Li(n)||FP(e,r,n,o)))&&(!s.IsString(o)||(!_f(n)||Yf(e,r,n,o))&&(!ws(n)||Xf(e,r,n,o))&&(!Us(n)||Bf(e,r,n,o))&&(!Ns(n)||rg(e,r,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!gf(n)||Df(e,r,n,o))&&(!en(n)||Gf(e,r,n,o))&&(!Tf(n)||Kf(e,r,n,o))&&(!rn(n)||Wf(e,r,n,o))&&(!Sf(n)||eg(e,r,n,o)))&&(!Rf(n)||CP(e,r,n,o))&&(!xf(n)||xP(e,r,n,o))&&(!mf(n)||kC(e,r,n,o))&&(!cf(n)||vf(e,r,n,o))&&(!ff(n)||Mf(e,r,n,o))&&(!hf(n)||JC(e,r,n,o))&&(!bf(n)||tg(e,r,n,o))&&(!af(n)||SC(e,r,n,o))&&(!sf(n)||OC(e,r,n,o))&&(!Of(n)||gP(e,r,n,o))&&(!Bu(n)||!s.IsArray(o)||kP(e,r,n,o))&&(!Hu(n)||!s.IsObject(o)||DP(e,r,n,o))&&(!nf(n)||fC(e,r,n,o));return e.Pop(n),i}function Zt(e,r,n,o,i,a){return r.Push()&&be(e,r,n,o,i,a)&&r.Pop()}function be(e,r,n,o,i,a){e.Push(i);let c=Fu(i)?xC(e,r,n,o,i,a):!!(+(!Pf(i)||LP(e,r,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!Ro(i)||wP(e,r,n,o,i,a))&+(!Jr(i)||IC(e,r,n,o,i,a))&+(!pf(i)||UC(e,r,n,o,i,a))&+(!uf(i)||vC(e,r,n,o,i,a))&+(!lf(i)||LC(e,r,n,o,i,a))&+(!Ls(i)||EP(e,r,n,o,i,a))&+(!ks(i)||bP(e,r,n,o,i,a))&+(!Af(i)||AP(e,r,n,o,i,a))&+(!vs(i)||mP(e,r,n,o,i,a))&+(!If(i)||sP(e,r,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!of(i)||TC(e,r,n,o,i,a))&+(!Ao(i)||CC(e,r,n,o,i,a))&+(!wi(i)||rP(e,r,n,o,i,a))&+(!Ef(i)||nP(e,r,n,o,i,a))&+(!ju(i)||iP(e,r,n,o,i,a))&+(!xo(i)||cP(e,r,n,o,i,a))&+(!vi(i)||uP(e,r,n,o,i,a))&+(!Ni(i)||IP(e,r,n,o,i,a))&+(!Li(i)||jP(e,r,n,o,i,a))))&+(!s.IsString(a)||!!(+(!_f(i)||aP(e,r,n,o,i,a))&+(!ws(i)||lP(e,r,n,o,i,a))&+(!Us(i)||XC(e,r,n,o,i,a))&+(!Ns(i)||yP(e,r,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!gf(i)||GC(e,r,n,o,i,a))&+(!en(i)||$C(e,r,n,o,i,a))&+(!Tf(i)||oP(e,r,n,o,i,a))&+(!rn(i)||pP(e,r,n,o,i,a))&+(!Sf(i)||dP(e,r,n,o,i,a))))&+(!Rf(i)||PP(e,r,n,o,i,a))&+(!xf(i)||RP(e,r,n,o,i,a))&+(!mf(i)||MC(e,r,n,o,i,a))&+(!cf(i)||RC(e,r,n,o,i,a))&+(!ff(i)||DC(e,r,n,o,i,a))&+(!hf(i)||eP(e,r,n,o,i,a))&+(!bf(i)||fP(e,r,n,o,i,a))&+(!af(i)||bC(e,r,n,o,i,a))&+(!sf(i)||AC(e,r,n,o,i,a))&+(!Of(i)||hP(e,r,n,o,i,a))&+(!Bu(i)||!s.IsArray(a)||MP(e,r,n,o,i,a))&+(!Hu(i)||!s.IsObject(a)||GP(e,r,n,o,i,a)))&&(!nf(i)||gC(e,r,n,o,i,a));return e.Pop(i),c}var $n={};Xt($n,{DynamicRef:()=>QK,Ref:()=>sg});var $i={};Xt($i,{Delete:()=>qK,Get:()=>FK,Has:()=>$K,Indices:()=>$s,Set:()=>jK});function qP(e){if(e.length===0)throw Error("Cannot set root")}function BP(e){if(!s.IsObject(e))throw Error("Cannot set value")}function kK(e){if(s.IsUnsafePropertyKey(e))throw Error("Pointer contains unsafe property key")}function HP(e){for(let r of e)kK(r)}function MK(e){return/^(0|[1-9]\d*)$/.test(e)}function KP(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function DK(e,r){return s.IsObject(r)&&s.HasPropertyKey(r,e)}function GK(e,r){return s.IsObject(r)&&!s.IsUnsafePropertyKey(e)?r[e]:void 0}function ag(e,r){return e.reduce((n,o)=>GK(o,n),r)}function $s(e){if(s.IsEqual(e.length,0))return[];let r=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return r.length>0&&r[0]===""?r.slice(1):r}function $K(e,r){let n=e;return $s(r).every(o=>DK(o,n)?(n=n[o],!0):!1)}function FK(e,r){let n=$s(r);return ag(n,e)}function jK(e,r,n){let o=$s(r);qP(o),HP(o);let[i,a]=KP(o),c=ag(i,e);return BP(c),c[a]=n,e}function qK(e,r){let n=$s(r);qP(n),HP(n);let[o,i]=KP(n),a=ag(o,e);return BP(a),s.IsArray(a)&&MK(i)?a.splice(+i,1):delete a[i],e}function BK(e,r,n){if(e.$id===n.hash)return e;let o=new URL(e.$id,r.href),i=new URL(n.href,r.href);if(s.IsEqual(o.pathname,i.pathname))return n.hash.startsWith("#")?zP(e,r,n):e}function HK(e,r,n){let o=new URL(`#${e.$anchor}`,r.href),i=new URL(n.href,r.href);return s.IsEqual(o.href,i.href)?e:void 0}function KK(e,r,n){let o=new URL(`#${e.$dynamicAnchor}`,r.href),i=new URL(n.href,r.href);return s.IsEqual(o.href,i.href)?e:void 0}function zP(e,r,n){if(n.href.endsWith("#"))return e;if(!n.hash.startsWith("#"))return;let o=decodeURIComponent(n.hash.slice(1));if(o.startsWith("/"))return $i.Get(e,o)}function zK(e,r,n){if(tn(e)){let o=BK(e,r,n);if(!s.IsUndefined(o))return o}if(Ps(e)){let o=HK(e,r,n);if(!s.IsUndefined(o))return o}if(Gn(e)){let o=KK(e,r,n);if(!s.IsUndefined(o))return o}return zP(e,r,n)}function YK(e,r,n){return e.reduce((o,i)=>{let a=cg(i,r,n);return s.IsUndefined(a)?o:a},void 0)}function VK(e,r,n){return s.Keys(e).reduce((o,i)=>{let a=cg(e[i],r,n);return s.IsUndefined(a)?o:a},void 0)}function cg(e,r,n){let o=hr(e)&&tn(e)?new URL(e.$id,r.href):r;if(hr(e)){let i=zK(e,o,n);if(!s.IsUndefined(i))return i}if(s.IsArray(e))return YK(e,o,n);if(s.IsObject(e))return VK(e,o,n)}function sg(e,r){let n=new URL("http://unknown/"),o=tn(e)?new URL(e.$id,n.href):n,i=new URL(r,o.href);return cg(e,o,i)}function QK(e,r,n,o){let i=n.$dynamicRef.startsWith("#")?sg(r,n.$dynamicRef):sg(e,n.$dynamicRef);return s.IsUndefined(i)?void 0:!hr(i)||!Gn(i)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?i:o.find(l=>l.$dynamicAnchor===i.$dynamicAnchor)??i}var Fi=function(e,r,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?e!==r||!o:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(e):o?o.value:r.get(e)},Fn,YP,VP,QP,WP,Po=class{constructor(r,n){Fn.add(this),this.context=r,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((r,n)=>new URL(n.$id,r),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(r){hr(r)&&(tn(r)&&(this.ids.push(r),Fi(this,Fn,"m",YP).call(this,r)),Ps(r)&&this.anchors.push(r),qu(r)&&this.recursiveAnchors.push(r),Gn(r)&&this.dynamicAnchors.push(r))}Pop(r){hr(r)&&(tn(r)&&(this.ids.pop(),Fi(this,Fn,"m",VP).call(this,r)),Ps(r)&&this.anchors.pop(),qu(r)&&this.recursiveAnchors.pop(),Gn(r)&&this.dynamicAnchors.pop())}Ref(r){return Fi(this,Fn,"m",QP).call(this,r)??Fi(this,Fn,"m",WP).call(this,r)}RecursiveRef(r){return qu(this.Base())?$n.Ref(this.recursiveAnchors[0],r.$recursiveRef):$n.Ref(this.Base(),r.$recursiveRef)}DynamicRef(r){let n=this.schema;return $n.DynamicRef(n,this.Base(),r,this.dynamicAnchors)}};Fn=new WeakSet,YP=function e(r,n=!0){if(!hr(r))return;let o=r;if(!(!n&&tn(o))){!n&&Gn(o)&&this.dynamicAnchors.push(o);for(let i of s.Keys(o))Fi(this,Fn,"m",e).call(this,o[i],!1)}},VP=function e(r,n=!0){if(!hr(r))return;let o=r;if(!(!n&&tn(o))){!n&&Gn(o)&&this.dynamicAnchors.pop();for(let i of s.Keys(o))Fi(this,Fn,"m",e).call(this,o[i],!1)}},QP=function(r){return s.HasPropertyKey(this.context,r.$ref)?this.context[r.$ref]:void 0},WP=function(r){let n=this.schema;return r.$ref.startsWith("#")?$n.Ref(this.Base(),r.$ref):$n.Ref(n,r.$ref)};function ml(...e){let[r,n,o]=ie.Match(e,{3:(h,E,I)=>[h,E,I],2:(h,E)=>[{},h,E]}),i=at.Get(),a=vT(),c=[],l=new Po(r,n),m=new Ms(h=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...h,message:a(h)})});return[be(l,m,"#","",n,o),c]}function ug(...e){let[r,n,o]=ie.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),i=new Po(r,n),a=new Rt;return oe(i,a,n,o)}function Te(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return ug(r,n,o)}function jn(...e){let[r,n,o]=ie.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),[i,a]=ml(r,n,o);return a}var qn=class extends Error{constructor(r,n,o){super(r),Object.defineProperty(this,"cause",{value:{source:r,errors:o,value:n},writable:!1,configurable:!1,enumerable:!1})}};function ZP(e,r,n){return s.IsArray(n)?n.map(o=>lt(e,r.items,o)):n}function XP(e,r,n){return lt({...e,...r.$defs},st(r.$ref),n)}function XK(e,r){let n=s.HasPropertyKey(r,"unevaluatedProperties")?{additionalProperties:r.unevaluatedProperties}:{},o=er(e,r),i=yt(o);return $(i)?nu(i,n):i}function JP(e,r,n){let o=XK(e,r);return lt(e,o,n)}function dl(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function eU(e,r,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=dl(r);for(let i of s.Keys(n)){if(s.HasPropertyKey(r.properties,i)){n[i]=lt(e,r.properties[i],n[i]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Le(o)&&Te(e,o,n[i])){n[i]=lt(e,o,n[i]);continue}delete n[i]}return n}function tU(e,r,n){if(!s.IsObject(n))return n;let o=dl(r),[i,a]=[new RegExp(pt(r)),xe(r)];for(let c of s.Keys(n)){if(i.test(c)){n[c]=lt(e,a,n[c]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Le(o)&&Te(e,o,n[c])){n[c]=lt(e,o,n[c]);continue}delete n[c]}return n}function rU(e,r,n){return s.HasPropertyKey(e,r.$ref)?lt(e,e[r.$ref],n):n}function nU(e,r,n){if(!s.IsArray(n))return n;let o=Math.min(n.length,r.items.length);for(let i=0;i<o;i++)n[i]=lt(e,r.items[i],n[i]);return s.IsGreaterThan(n.length,o)?n.slice(0,o):n}function Be(e){return Jn(e)}function oU(e,r,n){for(let o of r.anyOf){let i=lt(e,o,Be(n));if(Te(e,o,i))return i}return n}function lt(e,r,n){return J(r)?ZP(e,r,n):_e(r)?XP(e,r,n):G(r)?JP(e,r,n):$(r)?eU(e,r,n):he(r)?tU(e,r,n):me(r)?rU(e,r,n):V(r)?nU(e,r,n):C(r)?oU(e,r,n):n}function JK(e,r){for(let n of Xc.Keys(e))Xc.HasPropertyKey(r,n)||(r[n]=e[n]);return r}function ez(e){let r={};for(let n of Xc.Keys(e))r[n]=Fs(e[n]);return r}function tz(e){return lg(SA(e))}function lg(e){return e.map(r=>Fs(r))}function Fs(e){let r=J(e)?vt(Fs(e.items),Wo(e)):G(e)?dt(lg(e.allOf)):C(e)?q(tz(e.anyOf)):$(e)?D(ez(e.properties)):he(e)?ii(_n(e),Fs(xe(e))):V(e)?Fe(lg(e.items)):e;return JK(e,r)}function ji(e){return Fs(e)}function Nr(...e){let[r,n,o]=ie.Match(e,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]}),i=at.Get().unionPrioritySort?ji(n):n;return lt(r,i,o)}var se={};Xt(se,{Fail:()=>wo,IsOk:()=>mg,Ok:()=>k,TryArray:()=>rz,TryBigInt:()=>dg,TryBoolean:()=>fz,TryNull:()=>Ez,TryNumber:()=>bz,TryString:()=>Oz,TryUndefined:()=>Pz});function mg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function k(e){return{value:e}}function wo(){}function rz(e){return s.IsArray(e)?k(e):k([e])}function nz(e){return s.IsEqual(e,!0)?k(BigInt(1)):k(BigInt(0))}var oz=/^-?(0|[1-9]\d*)n$/,iz=/^-?(0|[1-9]\d*)\.\d+$/,az=/^-?(0|[1-9]\d*)$/;function sz(e){return oz.test(e)}function cz(e){return iz.test(e)}function pz(e){return az.test(e)}function uz(e){let r=e.toLowerCase();return sz(e)?k(BigInt(e.slice(0,e.length-1))):cz(e)?k(BigInt(e.split(".")[0])):pz(e)?k(BigInt(e)):s.IsEqual(r,"false")?k(BigInt(0)):s.IsEqual(r,"true")?k(BigInt(1)):void 0}function dg(e){return s.IsBigInt(e)?k(e):s.IsBoolean(e)?nz(e):s.IsNumber(e)?k(BigInt(Math.trunc(e))):s.IsNull(e)?k(BigInt(0)):s.IsString(e)?uz(e):s.IsUndefined(e)?k(BigInt(0)):void 0}function lz(e){return s.IsEqual(e,BigInt(0))?k(!1):s.IsEqual(e,BigInt(1))?k(!0):void 0}function mz(e){return s.IsEqual(e,0)?k(!1):s.IsEqual(e,1)?k(!0):void 0}function dz(e){return s.IsEqual(e.toLowerCase(),"false")?k(!1):s.IsEqual(e.toLowerCase(),"true")?k(!0):s.IsEqual(e,"0")?k(!1):s.IsEqual(e,"1")?k(!0):void 0}function fz(e){return s.IsBigInt(e)?lz(e):s.IsBoolean(e)?k(e):s.IsNumber(e)?mz(e):s.IsNull(e)?k(!1):s.IsString(e)?dz(e):s.IsUndefined(e)?k(!1):void 0}function gz(e){return s.IsEqual(e,BigInt(0))?k(null):void 0}function hz(e){return s.IsEqual(e,!1)?k(null):void 0}function yz(e){return s.IsEqual(e,0)?k(null):void 0}function Tz(e){let r=e.toLowerCase();return s.IsEqual(r,"undefined")||s.IsEqual(r,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?k(null):void 0}function Ez(e){return s.IsBigInt(e)?gz(e):s.IsBoolean(e)?hz(e):s.IsNumber(e)?yz(e):s.IsNull(e)?k(null):s.IsString(e)?Tz(e):s.IsUndefined(e)?k(null):void 0}var iU=BigInt(Number.MAX_SAFE_INTEGER),aU=BigInt(Number.MIN_SAFE_INTEGER);function _z(e){return e<=iU&&e>=aU?k(Number(e)):void 0}function Iz(e){return k(e?1:0)}function Sz(e){let r=+e;if(s.IsNumber(r))return k(r);let n=e.toLowerCase();if(s.IsEqual(n,"false"))return k(0);if(s.IsEqual(n,"true"))return k(1);let o=dg(e);return mg(o)?o.value<=iU&&o.value>=aU?k(Number(o.value)):void 0:void 0}function bz(e){return s.IsBigInt(e)?_z(e):s.IsBoolean(e)?Iz(e):s.IsNumber(e)?k(e):s.IsNull(e)?k(0):s.IsString(e)?Sz(e):s.IsUndefined(e)?k(0):void 0}function Oz(e){return s.IsBigInt(e)?k(e.toString()):s.IsBoolean(e)?k(e.toString()):s.IsNumber(e)?k(e.toString()):s.IsNull(e)?k("null"):s.IsString(e)?k(e):s.IsUndefined(e)?k(""):void 0}function Az(e){return s.IsEqual(e,BigInt(0))?k(void 0):void 0}function xz(e){return s.IsEqual(e,!1)?k(void 0):void 0}function Rz(e){return s.IsEqual(e,0)?k(void 0):void 0}function Cz(e){let r=e.toLowerCase();return s.IsEqual(r,"undefined")||s.IsEqual(r,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?k(void 0):void 0}function Pz(e){return s.IsBigInt(e)?Az(e):s.IsBoolean(e)?xz(e):s.IsNumber(e)?Rz(e):s.IsNull(e)?k(void 0):s.IsString(e)?Cz(e):s.IsUndefined(e)?k(e):void 0}function sU(e,r,n){return se.TryArray(n).value.map(i=>He(e,r.items,i))}function cU(e,r,n){let o=se.TryBigInt(n);return se.IsOk(o)?o.value:n}function pU(e,r,n){let o=se.TryBoolean(n);return se.IsOk(o)?o.value:n}function uU(e,r,n){return He({...e,...r.$defs},st(r.$ref),n)}function lU(e,r,n){return He(e,yt(r),n)}function mU(e,r,n){let o=se.TryNumber(n);return se.IsOk(o)?Math.trunc(o.value):n}function dU(e,r,n){let o=er(e,r),i=yt(o);return He(e,i,n)}function Uz(e,r,n){let o=se.TryBigInt(n);return se.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function wz(e,r,n){let o=se.TryBoolean(n);return se.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function vz(e,r,n){let o=se.TryNumber(n);return se.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function Nz(e,r,n){let o=se.TryString(n);return se.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function fU(e,r,n){return s.IsEqual(r.const,n)?n:jT(r)?Uz(e,r,n):qT(r)?wz(e,r,n):sp(r)?vz(e,r,n):cp(r)?Nz(e,r,n):ye()}function gU(e,r,n){let o=se.TryNull(n);return se.IsOk(o)?o.value:n}function hU(e,r,n){let o=se.TryNumber(n);return se.IsOk(o)?o.value:n}function fl(e,r,n,o){let i=s.Keys(o);for(let[a,c]of r)for(let l of i)a.test(l)||(o[l]=He(e,n,o[l]));return o}function js(e,r,n){return nt(e)&&s.IsUndefined(n[r])}function Lz(e,r,n){let o=s.EntriesRegExp(r.properties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)!a.test(l)||js(c,l,n)||(n[l]=He(e,c,n[l]));return s.HasPropertyKey(r,"additionalProperties")&&s.IsObject(r.additionalProperties)?fl(e,o,r.additionalProperties,n):n}function yU(e,r,n){return s.IsObjectNotArray(n)?Lz(e,r,n):n}function kz(e,r,n){let o=s.EntriesRegExp(r.patternProperties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)a.test(l)&&(n[l]=He(e,c,n[l]));return s.HasPropertyKey(r,"additionalProperties")&&s.IsObject(r.additionalProperties)?fl(e,o,r.additionalProperties,n):n}function TU(e,r,n){return s.IsObjectNotArray(n)?kz(e,r,n):n}function EU(e,r,n){return s.HasPropertyKey(e,r.$ref)?He(e,e[r.$ref],n):n}function _U(e,r,n){let o=se.TryString(n);return se.IsOk(o)?o.value:n}function IU(e,r,n){return He(e,yt(r),n)}function SU(e,r,n){if(!s.IsArray(n))return n;for(let o=0;o<Math.min(r.items.length,n.length);o++)n[o]=He(e,r.items[o],n[o]);return n}function bU(e,r,n){let o=se.TryUndefined(n);return se.IsOk(o)?o.value:n}function OU(e,r,n){if(r.anyOf.some(c=>Te(e,c,n)))return n;let a=r.anyOf.map(c=>He(e,c,Be(n))).find(c=>Te(e,r,c));return s.IsUndefined(a)?n:a}function AU(e,r,n){let o=se.TryUndefined(n);return se.IsOk(o)?void 0:n}function He(e,r,n){return J(r)?sU(e,r,n):Dt(r)?cU(e,r,n):Ot(r)?pU(e,r,n):_e(r)?uU(e,r,n):We(r)?lU(e,r,n):ct(r)?mU(e,r,n):G(r)?dU(e,r,n):Z(r)?fU(e,r,n):xr(r)?gU(e,r,n):we(r)?hU(e,r,n):$(r)?yU(e,r,n):he(r)?TU(e,r,n):me(r)?EU(e,r,n):tt(r)?_U(e,r,n):Ie(r)?IU(e,r,n):V(r)?SU(e,r,n):gr(r)?bU(e,r,n):C(r)?OU(e,r,n):Ft(r)?AU(e,r,n):n}function Bn(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return He(r,n,o)}function xU(e,r,n){if(!s.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=mt(e,r.items,n[o]);return n}function RU(e,r,n){return mt({...e,...r.$defs},st(r.$ref),n)}function CU(e,r){return s.IsUndefined(r)?s.IsFunction(e.default)?e.default():Be(e.default):r}function PU(e,r,n){let o=er(e,r),i=yt(o);return mt(e,i,n)}function UU(e,r,n){if(!s.IsObject(n))return n;let o=s.Keys(r.properties);for(let i of o){let a=mt(e,r.properties[i],n[i]);s.IsUndefined(a)&&(nt(r.properties[i])||!s.HasPropertyKey(r.properties[i],"default"))||(n[i]=a)}if(!Jr(r)||s.IsBoolean(r.additionalProperties))return n;for(let i of s.Keys(n))o.includes(i)||(n[i]=mt(e,r.additionalProperties,n[i]));return n}function wU(e,r,n){if(!s.IsObject(n))return n;let[o,i]=[new RegExp(pt(r)),xe(r)];for(let a of s.Keys(n))o.test(a)&&Qt(i)&&(n[a]=mt(e,i,n[a]));if(!Jr(r))return n;for(let a of s.Keys(n))o.test(a)||(n[a]=mt(e,r.additionalProperties,n[a]));return n}function vU(e,r,n){return s.HasPropertyKey(e,r.$ref)?mt(e,e[r.$ref],n):n}function NU(e,r,n){if(!s.IsArray(n))return n;let[o,i]=[r.items,Math.max(r.items.length,n.length)];for(let a=0;a<i;a++)a<o.length&&(n[a]=mt(e,o[a],n[a]));return n}function LU(e,r,n){for(let o of r.anyOf){let i=mt(e,o,Be(n));if(Te(e,o,i))return i}return n}function mt(e,r,n){let o=Qt(r)?CU(r,n):n;return J(r)?xU(e,r,o):_e(r)?RU(e,r,o):G(r)?PU(e,r,o):$(r)?UU(e,r,o):he(r)?wU(e,r,o):me(r)?vU(e,r,o):V(r)?NU(e,r,o):C(r)?LU(e,r,o):o}function vo(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return mt(r,n,o)}function qi(e){return(...r)=>{let[n,o,i]=ie.Match(r,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]});return e.reduce((a,c)=>c(n,o,a),i)}}function Mz(e,r,n){return r["~codec"].decode(n)}function Dz(e,r,n){return r["~codec"].encode(n)}function Pe(e,r,n,o){return no(n)?s.IsEqual(e,"Decode")?Mz(r,n,o):Dz(r,n,o):o}function Gz(e,r,n,o){if(!s.IsArray(o))return o;for(let i=0;i<o.length;i++)o[i]=Ne(e,r,n.items,o[i]);return Pe(e,r,n,o)}function $z(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsArray(i))return i;for(let a=0;a<i.length;a++)i[a]=Ne(e,r,n.items,i[a]);return i}function kU(e,r,n,o){return s.IsEqual(e,"Decode")?Gz(e,r,n,o):$z(e,r,n,o)}function MU(e,r,n,o){return o=Ne(e,{...r,...n.$defs},st(n.$ref),o),Pe(e,r,n,o)}function DU(e){return e.reduce((r,n)=>({...r,...n}),{})}function GU(e,r){for(let n of r)if(!s.IsDeepEqual(e,n))return n;return e}function Fz(e,r,n,o){if(s.IsEqual(n.allOf.length,0))return Pe(e,r,n,o);let i=n.allOf.map(l=>Ne(e,r,l,Nr(l,Be(o)))),c=i.every(l=>s.IsObject(l))?DU(i):GU(o,i);return Pe(e,r,n,c)}function jz(e,r,n,o){if(s.IsEqual(n.allOf.length,0))return Pe(e,r,n,o);let i=Pe(e,r,n,o),a=n.allOf.map(l=>Ne(e,r,l,Nr(l,Be(i))));return a.every(l=>s.IsObject(l))?DU(a):GU(i,a)}function $U(e,r,n,o){return s.IsEqual(e,"Decode")?Fz(e,r,n,o):jz(e,r,n,o)}function qz(e,r,n,o){if(!s.IsObjectNotArray(o))return o;for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||js(n.properties[i],i,o)||(o[i]=Ne(e,r,n.properties[i],o[i]));return Pe(e,r,n,o)}function Bz(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsObjectNotArray(i))return i;for(let a of s.Keys(n.properties))!s.HasPropertyKey(i,a)||js(n.properties[a],a,i)||(i[a]=Ne(e,r,n.properties[a],i[a]));return i}function FU(e,r,n,o){return s.IsEqual(e,"Decode")?qz(e,r,n,o):Bz(e,r,n,o)}function Hz(e,r,n,o){if(!s.IsObjectNotArray(o))return o;let i=new RegExp(pt(n));for(let a of s.Keys(o))i.test(a)&&(o[a]=Ne(e,r,xe(n),o[a]));return Pe(e,r,n,o)}function Kz(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsObjectNotArray(i))return i;let a=new RegExp(pt(n));for(let c of s.Keys(i))a.test(c)&&(i[c]=Ne(e,r,xe(n),i[c]));return i}function jU(e,r,n,o){return s.IsEqual(e,"Decode")?Hz(e,r,n,o):Kz(e,r,n,o)}function qU(e,r,n,o){return s.HasPropertyKey(r,n.$ref)?Ne(e,r,r[n.$ref],o):o}function BU(e,r,n,o){return s.IsEqual(e,"Decode")?Pe(e,r,n,qU(e,r,n,o)):qU(e,r,n,Pe(e,r,n,o))}function zz(e,r,n,o){if(!s.IsArray(o))return o;for(let i=0;i<Math.min(n.items.length,o.length);i++)o[i]=Ne(e,r,n.items[i],o[i]);return Pe(e,r,n,o)}function Yz(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsArray(i))return o;for(let a=0;a<Math.min(n.items.length,i.length);a++)i[a]=Ne(e,r,n.items[a],i[a]);return i}function HU(e,r,n,o){return s.IsEqual(e,"Decode")?zz(e,r,n,o):Yz(e,r,n,o)}function Vz(e,r,n,o){for(let i of n.anyOf){if(!Te(r,i,o))continue;let a=Ne(e,r,i,o);return Pe(e,r,n,a)}return o}function Qz(e,r,n,o){let i=Pe(e,r,n,o);for(let a of n.anyOf){let c=Ne(e,r,a,Be(i));if(Te(r,a,c))return c}return i}function KU(e,r,n,o){return s.IsEqual(e,"Decode")?Vz(e,r,n,o):Qz(e,r,n,o)}function Ne(e,r,n,o){return J(n)?kU(e,r,n,o):_e(n)?MU(e,r,n,o):G(n)?$U(e,r,n,o):$(n)?FU(e,r,n,o):he(n)?jU(e,r,n,o):me(n)?BU(e,r,n,o):V(n)?HU(e,r,n,o):C(n)?KU(e,r,n,o):Pe(e,r,n,o)}var fg=class extends qn{constructor(r,n){super("Decode",r,n)}};function Wz(e,r,n){if(!Te(e,r,n))throw new fg(n,jn(e,r,n));return n}function Zz(e,r,n){let o=at.Get().unionPrioritySort?ji(r):r;return Ne("Decode",e,o,n)}var x6e=qi([(e,r,n)=>Be(n),(e,r,n)=>vo(e,r,n),(e,r,n)=>Bn(e,r,n),(e,r,n)=>Nr(e,r,n),(e,r,n)=>Wz(e,r,n),(e,r,n)=>Zz(e,r,n)]);var gg=class extends qn{constructor(r,n){super("Encode",r,n)}};function Xz(e,r,n){if(!Te(e,r,n))throw new gg(n,jn(e,r,n));return n}function Jz(e,r,n){let o=at.Get().unionPrioritySort?ji(r):r;return Ne("Encode",e,o,n)}var $6e=qi([(e,r,n)=>Be(n),(e,r,n)=>Jz(e,r,n),(e,r,n)=>vo(e,r,n),(e,r,n)=>Bn(e,r,n),(e,r,n)=>Nr(e,r,n),(e,r,n)=>Xz(e,r,n)]);var ir=class extends Error{constructor(r,n){super(n),this.type=r}};function zU(e,r){return s.IsFunction(r.default)?r.default(r):s.IsObject(r.default)?Be(r.default):r.default}function YU(e,r){if(Li(r)&&!Qt(r))throw new ir(r,"Arrays with uniqueItems constraints must specify a default annotation");let n=vi(r)?r.minItems:0;return Array.from({length:n},()=>Ke(e,r.items))}function VU(e,r){return en(r)?BigInt(r.exclusiveMinimum)+BigInt(1):rn(r)?BigInt(r.minimum):BigInt(0)}function QU(e,r){return!1}function WU(e,r){let n=Ke(e,r.instanceType);return class{constructor(){Object.assign(this,n)}}}function ZU(e,r){return Ke({...e,...r.$defs},st(r.$ref))}function XU(e,r){return Ke(e,yt(r))}function JU(e,r){let n=Ke(e,r.returnType);return()=>n}function ew(e,r){return en(r)&&s.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:rn(r)?r.minimum:0}function tw(e,r){let n=er(e,r),o=yt(n);return Ke(e,o)}function rw(e,r){return r.const}function nw(e,r){throw new ir(r,"Cannot create TNever types")}function ow(e,r){return null}function iw(e,r){return en(r)&&s.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:rn(r)?r.minimum:0}function aw(e,r){return(s.IsUndefined(r.required)?[]:r.required).reduce((o,i)=>({...o,[i]:Ke(e,r.properties[i])}),{})}function sw(e,r){if(vs(r)&&!Qt(r))throw new ir(r,"Record with the minProperties constraint must have a default annotation");return{}}function cw(e,r){return s.HasPropertyKey(e,r.$ref)?Ke(e,e[r.$ref]):(()=>{throw new ir(r,"Unable to deref Ref")})()}function pw(e,r){if((Ns(r)||Us(r))&&!Qt(r))throw Error("Strings with format or pattern constraints must specify default");let o=ws(r)?r.minLength:0;return"".padEnd(o)}function uw(e,r){return Symbol()}function lw(e,r){let n=Da(r.pattern);if(tt(n))throw new ir(r,"Unable to create TemplateLiteral due to infinite type expansion");return Ke(e,n)}function mw(e,r){return Array.from({length:r.minItems},(n,o)=>Ke(e,r.items[o]))}function dw(e,r){if(s.IsEqual(r.anyOf.length,0))throw Error("Unable to create Union with no variants");return Ke(e,r.anyOf[0])}function Ke(e,r){return Qt(r)?zU(e,r):J(r)?YU(e,r):Dt(r)?VU(e,r):Ot(r)?QU(e,r):Ye(r)?WU(e,r):_e(r)?ZU(e,r):We(r)?XU(e,r):Ve(r)?JU(e,r):ct(r)?ew(e,r):G(r)?tw(e,r):Z(r)?rw(e,r):dr(r)?nw(e,r):xr(r)?ow(e,r):we(r)?iw(e,r):$(r)?aw(e,r):he(r)?sw(e,r):me(r)?cw(e,r):tt(r)?pw(e,r):Rr(r)?uw(e,r):Ie(r)?lw(e,r):V(r)?mw(e,r):gr(r)?void 0:C(r)?dw(e,r):Ft(r)?void 0:void 0}function Lr(...e){let[r,n]=ie.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return Ke(r,n)}var hg=class extends qn{constructor(r,n){super("Parse",r,n)}};function eY(e,r,n){if(!Te(e,r,n))throw new hg(n,jn(e,r,n));return n}var a8e=qi([(e,r,n)=>Be(n),(e,r,n)=>vo(e,r,n),(e,r,n)=>Bn(e,r,n),(e,r,n)=>Nr(e,r,n),(e,r,n)=>eY(e,r,n)]);var rY=D({type:Y("insert"),path:At(),value:et()}),nY=Object({type:Y("update"),path:At(),value:et()}),oY=D({type:Y("delete"),path:At()}),d8e=q([rY,nY,oY]);function Bi(e){if(!e.body)throw new Error("This command does not accept a request body");let r=e.body;return r.examples?.length?r.examples[0]:Lr(r)}function yr(e,r,n,o,i){e.command(r).description(n).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async a=>{if(a.generateSkeleton){W(Bi(o));return}let c=Ui(a),l=await i()(o,{body:c});W(l)})}var Ue=" (unix seconds, ISO 8601, or relative like -1h/-30m/now)";var sY=30,hw=["flat","flatPercent","cum","cumPercent","function"];function Sw(e,r){let n=e.command("profiles").description("Query continuous profiling data");yw(n.command("top").description("Rank functions by self (flat) and inclusive (cum) sample value, like pprof -top")).option("--limit <COUNT>","Maximum number of functions to print",String(sY)).option("--fields <FIELDS>",`Comma-separated fields to project from each function (default for --output=tsv|csv: ${hw.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async o=>{let i=ds(o.output),a=o.fields===void 0?void 0:fs(o.fields),c=Number(o.limit);if(!Number.isInteger(c)||c<1)throw new or(`--limit must be a positive integer (got: ${o.limit})`);let l=await r()(rf,{body:Tw(o)}),{total:m,functions:f}=cY(l.stacks),h=f.slice(0,c);if(i==="json"){W({total:m,functions:a?h.map(I=>gs(I,a)):h});return}let E=hs(i,h,a??hw);E.length>0&&z(E)}),yw(n.command("pprof").description("Download a merged pprof profile (raw protobuf, not gzipped)")).option("-O, --output-file <FILE_PATH>","Write the profile to this file instead of stdout").action(async o=>{if(o.outputFile===void 0&&process.stdout.isTTY)throw new or("Refusing to write a binary profile to the terminal. Use --output-file <FILE_PATH> or pipe stdout.");let i=await r()(lC,{body:Tw(o)}),a=Buffer.from(i.pprof,"base64");if(o.outputFile===void 0){process.stdout.write(a);return}(0,Iw.writeFileSync)(o.outputFile,a)}),yr(n,"query","Run a raw profile query and print the folded stacks",rf,r)}function yw(e){return e.requiredOption("--service <SERVICE_NAME>","Service the profiles belong to").addOption(new ur("--type <PROFILE_TYPE>","Profile type").choices(Rs.type.enum).makeOptionMandatory()).option("--from <TIMESTAMP>",`Start of time range${Ue}${_w("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${_w("to")}`).option("--filter <TSUGA_QUERY>","Tsuga query over profile labels (equality, negation, wildcards)")}function Tw(e){return{service:e.service,type:e.type,timeRange:{from:Ew("from",e.from),to:Ew("to",e.to)},...e.filter===void 0?{}:{filter:e.filter}}}function cY(e){let r=new Map,n=new Map,o=0;for(let{stack:c,value:l}of e){let m=c.split(";"),f=m[m.length-1];if(f!==void 0){o+=l,r.set(f,(r.get(f)??0)+l);for(let h of new Set(m))n.set(h,(n.get(h)??0)+l)}}let i=c=>o===0?0:Math.round(c/o*1e4)/100,a=[...n.entries()].map(([c,l])=>{let m=r.get(c)??0;return{function:c,flat:m,flatPercent:i(m),cum:l,cumPercent:i(l)}}).sort((c,l)=>l.flat-c.flat||l.cum-c.cum||c.function.localeCompare(l.function));return{total:o,functions:a}}function Ew(e,r){let n=r??nr(e);if(!n)throw new or(`--${e} is required`);return Qo(n)}function _w(e){let r=nr(e);return r===void 0?"":` (default: ${r})`}function bw(e,r){let n=e.command("experimental").description("Experimental commands that may change or be removed without notice");Sw(n,r)}var pY=`/${"v1"}/feedback`,Ow=t.Object({id:t.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),uY={id:"request-123-abc"};Object.assign(Ow,{examples:[uY]});var Aw=t.Object({content:p({allowEmpty:!1,type:"long",description:"Free-text feedback content, e.g. what went wrong, what was confusing, or a suggestion. Required and must be non-empty."})}),lY={content:"The traces command times out for large services."};Object.assign(Aw,{examples:[lY]});var xw=d({description:"Submit free-text feedback about Tsuga tools or APIs, e.g. a tool that failed, returned unusable output, or was confusing to use. Feedback is recorded for the Tsuga team to review and improve tooling.",operationId:"createFeedback",tags:["public","feedback"],url:pY,method:"POST",body:Aw,response:Ow});function Rw(e,r){e.command("feedback <MESSAGE...>").description("Send feedback about Tsuga tools or APIs (e.g. a tool that failed or was confusing)").action(async n=>{let o=await r()(xw,{body:{content:n.join(" ")}});W(o)})}var Pt="/v0/monitors",Hi=["alert","resolve","keep_last_status","consider_zero"],Ki=["alert","resolve","keep_last_status"];var Pw=["no_aggregation","all","any","each","proportion"],Uw=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var mY=t.Object({formula:t.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(Uw,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),dY=t.Object({formula:p({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(Uw,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),fY=5,yg=t.Array(mY,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Tg=t.Array(dY,{minItems:1,maxItems:fY,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Eg=t.Object({formula:t.String({description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:t.Enum(["rate","error","cpu","general","to_be_set"],{description:"Anomaly model type Tsuga uses to classify expected behavior: `rate` flags downward anomalies (e.g. count rates), `error` and `cpu` flag upward anomalies (e.g. error counts/rates, CPU usage), `general` flags both directions, and `to_be_set` is a placeholder Tsuga replaces by inferring the model type from the monitor query when the monitor is created or updated."})},{description:"Anomaly detection condition evaluated by this monitor. The `formula` result is compared against behavior learned from historical query results, and the monitor alerts on deviations in the direction implied by `conditionType`."}),_g=t.Object({formula:p({type:"tsuga-formula",description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:t.Enum(["rate","error","cpu","general","to_be_set"],{description:"Anomaly model type used to classify expected behavior: `rate` flags downward anomalies (e.g. count rates), `error` and `cpu` flag upward anomalies (e.g. error counts/rates, CPU usage), and `general` flags both directions. Use `to_be_set` to let Tsuga infer the model type from the monitor query during create or update."})},{description:"Anomaly detection condition evaluated by this monitor. The `formula` result is compared against behavior learned from historical query results, and the monitor alerts on deviations in the direction implied by `conditionType`."}),Ct=[1,2,3,4,5];var gl={timeframe:t.Number({description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over. Always a whole number, at least 1."}),groupByFields:t.Array(t.Object({fields:t.Array(t.String(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty means the monitor evaluates a single ungrouped series."}),limit:t.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:t.Optional(Q),replaceNullWith:t.Optional(t.String({description:"Value used to group documents that have no value for a grouped field."}))}),{description:"Monitor group by configuration. The `limit` setting is currently ignored; evaluation applies a fixed limit of 100 groups per field."}),aggregationAlertLogic:t.Optional(t.Enum(Pw,{description:"How grouped results are combined into alert state. Use `no_aggregation` only when `groupByFields` is empty; use `all`, `any`, `each`, or `proportion` with non-empty `groupByFields`. `proportion` also requires `proportionAlertThreshold`."})),proportionAlertThreshold:t.Optional(t.Integer({description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},hl={timeframe:t.Integer({minimum:1,description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over."}),groupByFields:t.Array(t.Object({fields:t.Array(p(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty or omitted means the monitor evaluates a single ungrouped series."}),limit:t.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:t.Optional(Q),replaceNullWith:t.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))}),{maxItems:1,description:"Monitor group by configuration. The `limit` setting is currently ignored; evaluation applies a fixed limit of 100 groups per field."}),aggregationAlertLogic:t.Optional(t.Enum(Pw,{description:"How grouped results are combined into alert state. Use `no_aggregation` only when `groupByFields` is empty; use `all`, `any`, `each`, or `proportion` with non-empty `groupByFields`. `proportion` also requires `proportionAlertThreshold`. On create, omitted query-monitor values default to `no_aggregation`; on update, omitted values keep the existing aggregation logic."})),proportionAlertThreshold:t.Optional(t.Integer({minimum:1,maximum:99,description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},Ig={...gl,timeframe:t.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},Sg={...hl,timeframe:t.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},ww=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:yg,noDataBehavior:t.Enum(Hi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...gl,queries:Zr},{$id:"MonitorConfigurationMetric"}),vw=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Tg,noDataBehavior:t.Enum(Hi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...hl,queries:Mn},{$id:"InputMonitorConfigurationMetric"}),Nw=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:yg,noDataBehavior:t.Enum(Hi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...gl,queries:Zr},{$id:"MonitorConfigurationLog"}),Lw=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Tg,noDataBehavior:t.Enum(Hi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...hl,queries:Mn},{$id:"InputMonitorConfigurationLog"}),kw=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:yg,noDataBehavior:t.Enum(Hi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...gl,queries:Zr},{$id:"MonitorConfigurationTrace"}),gY=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Tg,noDataBehavior:t.Enum(Hi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...hl,queries:Mn},{$id:"InputMonitorConfigurationTrace"}),Mw=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Eg,noDataBehavior:t.Enum(Ki,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Ig,queries:Zr},{$id:"MonitorConfigurationAnomalyLog"}),Dw=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:_g,noDataBehavior:t.Enum(Ki,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Sg,queries:Mn},{$id:"InputMonitorConfigurationAnomalyLog"}),Gw=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Eg,noDataBehavior:t.Enum(Ki,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Ig,queries:Zr},{$id:"MonitorConfigurationAnomalyMetric"}),$w=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:_g,noDataBehavior:t.Enum(Ki,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Sg,queries:Mn},{$id:"InputMonitorConfigurationAnomalyMetric"}),Fw=t.Object({type:t.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Use this configuration when Tsuga should learn historical trace query behavior and alert on unusual movement in trace-derived values."}),condition:Eg,noDataBehavior:t.Enum(Ki,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Ig,queries:Zr},{$id:"MonitorConfigurationAnomalyTrace"}),hY=t.Object({type:t.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Set this value to create or update an anomaly monitor that learns historical trace query behavior and alerts on unusual movement in trace-derived values."}),condition:_g,noDataBehavior:t.Enum(Ki,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Sg,queries:Mn},{$id:"InputMonitorConfigurationAnomalyTrace"}),jw=t.Object({type:t.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:t.Integer({description:"Number of days before certificate expiry when the monitor should warn."}),cloudAccounts:t.Optional(t.Array(t.String(),{description:"Cloud account IDs whose certificates are checked. Omitted means certificates from all cloud accounts are checked."})),aggregationAlertLogic:t.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:t.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"MonitorConfigurationCertificateExpiry"}),yY=t.Object({type:t.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:t.Integer({minimum:1,maximum:365,description:"Number of days before certificate expiry when the monitor should warn. Valid values are 1 through 365."}),cloudAccounts:t.Optional(t.Array(t.String(),{minItems:1,description:"Cloud account IDs whose certificates are checked. Omit to check certificates from all cloud accounts."})),aggregationAlertLogic:t.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:t.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"InputMonitorConfigurationCertificateExpiry"}),TY=t.Object({type:t.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured environment, scoped by teams, services, or both. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:t.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:t.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:t.Object({teamIds:t.Optional(t.Array(t.String(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets."})),env:t.String({description:"Environment whose logs are searched for new error patterns."}),services:t.Optional(t.Array(t.String(),{description:"Service names whose logs are searched for new error patterns."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included, so sending both teams and services searches only the listed services owned by the listed teams. Send a non-empty `teamIds`, a non-empty `services`, or both."})},{$id:"MonitorConfigurationLogErrorPattern"}),EY=t.Object({type:t.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured environment, scoped by teams, services, or both. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:t.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:t.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:t.Object({teamIds:t.Optional(t.Array(p(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets.",minItems:1})),env:p({description:"Environment whose logs are searched for new error patterns."}),services:t.Optional(t.Array(p(),{description:"Service names whose logs are searched for new error patterns.",minItems:1}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included, so sending both teams and services searches only the listed services owned by the listed teams. Send a non-empty `teamIds`, a non-empty `services`, or both."})},{$id:"InputMonitorConfigurationLogErrorPattern"}),_Y=x("type",[ww,Nw,kw,Mw,Gw,TY,Fw,jw],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),IY=x("type",[vw,Lw,gY,Dw,$w,hY,EY,yY],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var an=t.Object({id:t.String({description:"Tsuga-generated monitor ID assigned when the monitor is created."}),name:t.String({description:"Display name of the monitor and alert source."}),owner:t.String({description:"Team ID that owns and manages the monitor."}),message:t.Optional(t.String({description:"Caller-supplied message included in notifications triggered by this monitor. Omitted when the monitor was created or last updated without one."})),tags:ve,configuration:_Y,priority:t.Enum(Ct,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:Cn,dashboardId:t.Optional(t.String({description:"ID of the dashboard linked to this monitor for context when investigating alerts. Caller-supplied. Omitted when no dashboard is linked."})),pauseUntil:t.Optional(S({description:"Timestamp until which the monitor is snoozed."})),creator:t.Optional(pe),updater:t.Optional(pe),createdAt:S({description:"Timestamp when Tsuga created the monitor."}),updatedAt:S({description:"Timestamp when Tsuga last updated the monitor."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."}),clusterIds:t.Array(t.String(),{description:"Cluster IDs where the monitor is deployed. Empty means all eligible clusters."})},{title:"Monitor"}),SY=x("type",[ww,Nw,kw,Mw,Gw,Fw,jw]),NZe=t.Object({...an.properties,configuration:SY},{title:"Monitor"}),LZe=t.Object({...an.properties,configuration:x("type",[vw,Lw,Dw,$w])},{title:"Monitor"}),qs=t.Object({name:p({description:"Display name of the monitor and alert source."}),message:Se(p({type:"long"}),{description:"Message included in notifications triggered by this monitor. Optional on create."}),tags:De,configuration:IY,priority:t.Enum(Ct,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the monitor."}),dashboardId:Se(p({allowEmpty:!1}),{description:"ID of the dashboard to link to this monitor for context when investigating alerts. On create: omit or send `null` to leave the monitor unlinked. On update: omit to skip updating this field, send `null` to clear an existing link."}),pauseUntil:Se(p({allowEmpty:!1,type:"date-time"}),{description:"ISO timestamp until which the monitor should be snoozed."}),permissions:Cn,clusterIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Cluster IDs where the monitor should be deployed. Empty or omitted means all eligible clusters for cluster-deployed monitor types."}))}),Cw=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],Hn={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var bg=t.Object({owners:ce(p({allowEmpty:!1}),{description:"Restrict results to monitors owned by any of these team IDs",maxItems:50}),searchQuery:Wr({description:"Search query filter for monitors.",valueDescription:"Case-insensitive substring matched against monitor ID, monitor name, query filters, and aggregate fields. Wildcard characters are treated literally."}),tags:ce(Mt.items,{description:"Restrict results to monitors that have at least one of the listed key/value tags",maxItems:50}),priorities:ce(t.Enum(Ct),{description:"Restrict results to monitors with one of these priorities",maxItems:Ct.length}),types:ce(t.Enum(Cw),{description:"Restrict results to monitors with these types",maxItems:Cw.length}),activity:t.Enum(["active","snoozed"],{description:"Restrict results by activity status: active monitors or currently snoozed monitors"}),clusterIds:ce(p({allowEmpty:!1}),{description:"Restrict results to monitors deployed to any of these cluster IDs (monitors with no cluster restriction are always included)",maxItems:50})},{description:"Optional filters applied to narrow the returned monitors"}),yl=t.Partial(bg),Og=t.Partial(t.Object({...ae,filters:yl,sort:t.Object({by:t.Enum([Hn.PRIORITY,Hn.TYPE,Hn.NAME,Hn.OWNER,Hn.TAGS,Hn.CLUSTER_IDS,Hn.PAUSE_UNTIL,Hn.ASSET_UPDATED_AT],{description:"Field to sort the returned monitors by. For `priority`, `desc` returns highest-priority monitors first because priority 1 is highest."}),direction:Q},{description:"Optional sorting applied to the returned monitors. Ties are broken by creation time and monitor ID for stable pagination."})})),kZe=d({tags:["monitors"],url:`${Pt}/query`,method:"POST",paginated:!0,response:t.Array(an),body:Og}),MZe=d({tags:["monitors"],url:`${Pt}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(bg,["tags"])))}),response:kt}),DZe=d({tags:["monitors"],url:`${Pt}/counts/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(bg,["activity"])))}),response:t.Object({all:t.Integer({description:"Total number of monitors matching the filters that the user can read."}),active:t.Integer({description:"Number of matching readable monitors that are not currently snoozed."}),snoozed:t.Integer({description:"Number of matching readable monitors that are currently snoozed."})})}),GZe=d({tags:["monitors"],url:`${Pt}/:id`,method:"GET",params:t.Object({id:p()}),response:an}),$Ze=d({tags:["monitors"],url:Pt,method:"POST",body:qs,response:an}),FZe=d({tags:["monitors"],url:`${Pt}/:id`,method:"PUT",params:t.Object({id:p()}),body:qs,response:an}),bY=Yt(yl,{maxIds:100}),jZe=d({tags:["monitors"],url:`${Pt}/bulk-update`,method:"PUT",body:t.Object({selection:bY,owner:p({allowEmpty:!1})}),response:t.Object({})}),qZe=d({tags:["monitors"],url:`${Pt}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),OY=Yt(yl),BZe=d({tags:["monitors"],url:`${Pt}/bulk-delete`,method:"DELETE",body:t.Object({selection:OY}),response:t.Object({})}),HZe=d({tags:["monitors"],url:`${Pt}/:id/snooze`,method:"POST",params:t.Object({id:p()}),body:t.Object({pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:an}),AY=Yt(yl,{maxIds:100}),KZe=d({tags:["monitors"],url:`${Pt}/bulk-snooze`,method:"POST",body:t.Object({selection:AY,pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:t.Object({})}),xY=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],RY=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],CY=[...xY,...RY],No=t.Enum(CY),PY=x("type",[t.Object({type:t.Literal("each"),subStates:t.Record(t.String(),t.Object({stateValue:t.Union([No,t.Null()]),lastChangedAt:S()}))}),t.Object({type:t.Literal("no_aggregation"),stateValue:t.Optional(No)}),t.Object({type:t.Literal("any"),stateValue:t.Optional(No)}),t.Object({type:t.Literal("all"),stateValue:t.Optional(No)}),t.Object({type:t.Literal("proportion"),stateValue:t.Optional(No)})]),UY=t.Object({monitorId:t.String(),currentState:PY,lastChangedAt:t.Optional(S())}),zZe=d({tags:["monitors"],url:`${Pt}/states/:id`,method:"GET",params:t.Object({id:p()}),response:UY}),YZe=d({tags:["monitors"],url:`${Pt}/:id/transitions`,method:"GET",params:t.Object({id:p()}),query:t.Object({from:t.Number(),to:t.Number()}),response:t.Array(t.Object({id:t.String(),createdAt:S(),fromState:t.Optional(No),toState:t.Optional(No),dimension:t.Optional(t.String())}))}),wY=["unprocessed","processed","failed-to-process"],VZe=d({tags:["monitors"],url:`${Pt}/:id/results`,method:"GET",params:t.Object({id:p()}),query:t.Object({from:t.Number(),to:t.Number()}),response:t.Object({isTruncated:t.Boolean(),results:t.Array(t.Object({id:t.String(),evaluationAt:S(),formulaResult:t.Object({groups:t.Array(t.Object({groupKey:t.Record(t.String(),Os),results:t.Array(t.Union([t.Number(),t.Null()])),conditionMet:t.Enum(["true","false","nan-no-data"])}))}),createdAt:S(),status:t.Enum(wY)}))})});var zi="/v0/notifications",Dr=`${zi}/rules`,qw=`${zi}/slack/setup`,Yi=`${zi}/integrations`,Lo=["triggered","resolved","no-data"],vY=["sent","stale","pending","rate-limited","failed","silenced"],NY=t.Optional(t.Object({maxMessages:t.Integer({description:"Maximum number of notifications this target can send during the rate-limiting window."}),minutes:t.Integer({description:"Length of the rate-limiting window, in minutes."})},{description:"Per-target rate limit used when sending notifications. If omitted, Tsuga allows up to 1000 notifications every 10 minutes for this target."})),Ag=t.Object({maxMessages:t.Integer({minimum:1,description:"Maximum number of notifications this target can send during the rate-limiting window. The ratio of `maxMessages` to `minutes` cannot exceed 100 notifications per minute."}),minutes:t.Integer({minimum:1,description:"Length of the rate-limiting window, in minutes. The ratio of `maxMessages` to `minutes` cannot exceed 100 notifications per minute."})},{description:"Per-target rate limit used when sending notifications. If omitted, Tsuga allows up to 1000 notifications every 10 minutes for this target."}),LY=t.Optional(Ag),kr=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),Mr=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({minimum:1,description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),Bs=t.Object({id:t.String({description:"Identifier of the notification target within this rule, used with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:NY,config:x("type",[t.Object({type:t.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:t.String({description:"Slack channel ID that receives the notification"}),integrationId:t.String({description:"Slack workspace ID that receives the notification"}),integrationName:t.String({description:"Human readable name of the Slack integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigSlack"}),t.Object({type:t.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:t.String({description:"Identifier of the incident.io integration to use"}),integrationName:t.String({description:"Human readable name of the incident.io integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigIncidentIo"}),t.Object({type:t.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:t.Array(t.String(),{description:"Email addresses that will receive the alert"}),renotifyConfig:kr},{$id:"RuleTargetConfigEmail"}),t.Object({type:t.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:t.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:t.String({description:"Human readable name of the Grafana IRM integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigGrafanaIrm"}),t.Object({type:t.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:t.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:t.String({description:"Human readable name of the PagerDuty integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigPagerDuty"}),t.Object({type:t.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:t.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:t.String({description:"Human readable name of the Microsoft Teams integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigMicrosoftTeams"}),t.Object({type:t.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:t.String({description:"Identifier of the webhook integration to use"}),integrationName:t.String({description:"Human readable name of the webhook integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigWebhook"}),t.Object({type:t.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:t.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:t.String({description:"Human readable name of the ServiceNow integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigServiceNow"}),t.Object({type:t.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:t.String({description:"Identifier of the Google Chat integration to use"}),integrationName:t.String({description:"Human readable name of the Google Chat integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigGoogleChat"}),t.Object({type:t.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:t.String({description:"Identifier of the Squadcast integration to use"}),integrationName:t.String({description:"Human readable name of the Squadcast integration"}),renotifyConfig:kr},{$id:"RuleTargetConfigSquadcast"}),t.Object({type:t.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:t.String({description:"Identifier of the Jira integration to use"}),integrationName:t.String({description:"Human readable name of the Jira integration"}),projectKey:t.String({description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:t.String({description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:t.Optional(t.String({description:"Jira status the alert ticket is moved to right after it is filed for a firing alert. A later transition between two firing states leaves the ticket status alone."})),closedStatus:t.Optional(t.String({description:"Jira status the alert ticket is moved to when the alert resolves. Only takes effect when the rule delivers recovery transitions."}))},{$id:"RuleTargetConfigJira"})],{description:"Destination that received the notification. The `type` field discriminates the variant: `email` sends directly to the listed addresses, and every other type routes through the named integration referenced by `integrationId`."})}),Vi=t.Object({id:p({description:"Identifier of the notification target within this rule. Choose a stable ID that is unique among this rule's targets; Tsuga uses it with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:LY,config:x("type",[t.Object({type:t.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:p({allowEmpty:!1,description:"Slack channel ID that receives the notification"}),integrationId:p({allowEmpty:!1,description:"Slack workspace ID that receives the notification"}),renotifyConfig:Mr},{$id:"RuleTargetInputSlack"}),t.Object({type:t.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the incident.io integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputIncidentIo"}),t.Object({type:t.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the PagerDuty integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputPagerDuty"}),t.Object({type:t.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:t.Array(p({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"}),renotifyConfig:Mr},{$id:"RuleTargetInputEmail"}),t.Object({type:t.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Grafana IRM integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputGrafanaIrm"}),t.Object({type:t.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Microsoft Teams integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputMicrosoftTeams"}),t.Object({type:t.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the webhook integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputWebhook"}),t.Object({type:t.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the ServiceNow integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputServiceNow"}),t.Object({type:t.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Google Chat integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputGoogleChat"}),t.Object({type:t.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Squadcast integration to use"}),renotifyConfig:Mr},{$id:"RuleTargetInputSquadcast"}),t.Object({type:t.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Jira integration to use"}),projectKey:p({allowEmpty:!1,description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:p({allowEmpty:!1,description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:t.Optional(p({allowEmpty:!1,description:"Jira status the alert ticket is moved to right after it is filed for a firing alert. A later transition between two firing states leaves the ticket status alone."})),closedStatus:t.Optional(p({allowEmpty:!1,description:"Jira status the alert ticket is moved to when the alert resolves. Only takes effect when the rule delivers recovery transitions."}))},{$id:"RuleTargetInputJira"})],{description:"Destination that should receive the notification. The `type` field discriminates the variant: `email` sends directly to the listed addresses and needs no integration; every other type routes through the integration identified by `integrationId`, which must already exist (create it first with the notification integration endpoints)."})}),xg=x("type",[t.Object({type:t.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:t.Array(t.String(),{description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),t.Object({type:t.Literal("all-teams",{description:"Match alert transitions for every team in the organization. Public API callers need an API key with `all` scope to create or update this filter."})},{title:"AllTeams"}),t.Object({type:t.Literal("all-public-teams",{description:"Match alert transitions for all public teams. Public API callers need an API key with `all` or `owning-team-and-public` scope to create or update this filter."})},{title:"AllPublicTeams"})],{description:"Team visibility filter used when matching alert transitions. Tsuga validates create and update requests against the caller permissions."}),Rg=x("type",[t.Object({type:t.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:t.Array(p(),{minItems:1,maxItems:100,description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),t.Object({type:t.Literal("all-teams",{description:"Match alert transitions for every team in the organization. Public API callers need an API key with `all` scope to create or update this filter."})},{title:"AllTeams"}),t.Object({type:t.Literal("all-public-teams",{description:"Match alert transitions for all public teams. Public API callers need an API key with `all` or `owning-team-and-public` scope to create or update this filter."})},{title:"AllPublicTeams"})],{description:"Team visibility filter used when matching alert transitions. Tsuga validates create and update requests against the caller permissions."}),ko=t.Object({id:t.String({description:"Tsuga-generated notification rule ID assigned when the rule is created."}),name:t.String({description:"Display name of the notification rule."}),queryString:t.Optional(t.String({description:"Optional query that narrows which alert transitions trigger the rule. Matches on the monitor transition group key and the monitor tags, e.g. `env:prod service:api`. Omit or leave empty to match regardless of tags."})),teamsFilter:xg,prioritiesFilter:t.Array(t.Enum(Ct),{description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(Lo),{description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:t.Array(t.String(),{description:"Cluster IDs that must match for this rule to fire. An empty array matches every cluster, as does a transition that has no cluster ID."}),owner:t.String({description:"Team ID that owns and manages the rule."}),createdAt:S({description:"Timestamp when Tsuga created the rule."}),updatedAt:S({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when its filters match."}),tags:ve,targets:t.Array(Bs,{description:"Destinations that receive a notification whenever this rule matches an alert transition. Every target in the list is notified independently, subject to its own rate limit and renotification settings."}),creator:t.Optional(pe),updater:t.Optional(pe)}),Hs=t.Object({name:p({description:"Display name of the notification rule."}),queryString:Se(p({type:"tags-query"}),{description:"Optional query that narrows which alert transitions trigger the rule. Matches on the monitor transition group key and the monitor tags, e.g. `env:prod service:api`. Omit or leave empty to match regardless of tags."}),teamsFilter:Rg,prioritiesFilter:t.Array(t.Enum(Ct),{maxItems:Ct.length,description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(Lo),{maxItems:Lo.length,description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Cluster IDs that must match for this rule to fire. Omit it, or leave it empty, to match every cluster."})),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:De,isActive:t.Boolean({description:"Set to true for the rule to send notifications when its filters match."}),targets:t.Array(Vi,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),Ks=t.Object({id:t.String({description:"Unique identifier of the adaptive notification rule. Generated by Tsuga."}),name:t.String({description:"Display name of the adaptive notification rule."}),owner:t.String({description:"Team ID that owns and manages the rule."}),createdAt:S({description:"Timestamp when Tsuga created the rule."}),updatedAt:S({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when one of its monitors fires."}),shouldCreateInvestigation:t.Boolean({description:"Whether each page records an investigation holding the sampled traces and the call graph the destination was resolved from, linked from the notification body."}),tags:ve,monitorIds:t.Array(t.String(),{description:"Monitors this rule reacts to."}),sloIds:t.Array(t.String(),{description:"SLOs this rule reacts to."}),fallbackTarget:Bs,creator:t.Optional(pe),updater:t.Optional(pe)}),Bw=t.Object({name:p({description:"Display name of the adaptive notification rule."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:De,isActive:t.Boolean({description:"Set to true for the rule to send notifications when one of its monitors fires."}),shouldCreateInvestigation:t.Optional(t.Boolean({description:"Set to true to record an investigation for each page, holding the sampled traces and the call graph the destination was resolved from, and to link it from the notification body. Defaults to false."})),monitorIds:t.Optional(t.Array(p({allowEmpty:!1}),{maxItems:100,description:"Monitors this rule reacts to. Only trace monitors and metric monitors over OTel span metrics are eligible. Send at least one monitor or SLO."})),sloIds:t.Optional(t.Array(p({allowEmpty:!1}),{maxItems:100,description:"SLOs this rule reacts to. Only SLOs over traces or OTel span metrics are eligible. Omit for a rule that reacts to monitors only; send at least one monitor or SLO."})),fallbackTarget:Vi}),kY=["active","inactive"],MY=["name","isActive","owner","tags","clusterIdsFilter","targets","type","updatedAt"],Hw=t.Object({owners:ce(p({allowEmpty:!1}),{description:"Restrict results to rules owned by any of these team IDs.",maxItems:50}),searchQuery:Wr({description:"Search query filter for notification rules.",valueDescription:"Case-insensitive substring matched against rule name and ID."}),tags:ce(Mt.items,{description:"Restrict results to rules that have at least one of the listed key/value tags.",maxItems:50}),destinations:ce(p({allowEmpty:!1}),{description:"Restrict results to rules that route to any of these email addresses or integration IDs.",maxItems:50}),clusterIds:ce(p({allowEmpty:!1}),{description:"Restrict results to rules that run on any of these cluster IDs. Rules with no cluster restriction are treated as running on every cluster, including the requested ones.",maxItems:50}),status:t.Enum(kY,{description:"Restrict results to active or inactive rules."})}),DY=t.Partial(t.Object({...ae,filters:t.Partial(Hw),sort:t.Object({by:t.Enum(MY,{description:"Field to sort the returned notification rules by."}),direction:Q})})),GY=t.Object({type:t.Literal("standard",{description:"Standard notification rule matched by query, tags, and destinations."}),...ko.properties}),$Y=t.Object({type:t.Literal("adaptive",{description:"Adaptive notification rule matched by selected monitors or SLOs."}),...Ks.properties}),FY=x("type",[GY,$Y]),jY=t.Object({value:t.String({description:"Email address or integration ID used when filtering destinations."}),label:t.String({description:"Display name of the destination."}),type:t.String({description:"Destination type, such as email or slack."})}),qY=t.Object({tags:kt,destinations:t.Array(jY,{description:"Destination filter options from the matching rules."}),activeCounts:t.Object({totalCount:t.Integer({description:"Total number of matching rules regardless of whether they are active."}),active:t.Integer({description:"Number of matching rules that are active."}),inactive:t.Integer({description:"Number of matching rules that are inactive."})})}),BY=t.Object({filters:t.Optional(t.Partial(Hw,{description:"Filters applied before collecting tag, destination, and active-count options."}))}),nXe=d({tags:["notification-rules"],url:`${Dr}/query`,method:"POST",paginated:!0,body:DY,response:t.Array(FY,{description:"Matching standard and adaptive notification rules after they are merged, sorted, and paginated."})}),oXe=d({tags:["notification-rules"],url:`${Dr}/options/query`,method:"POST",body:BY,response:qY}),iXe=d({tags:["notification-rules"],url:Dr,method:"GET",paginated:!0,query:t.Object(ae),response:t.Array(ko)}),aXe=d({tags:["notification-rules"],url:`${Dr}/:id`,params:t.Object({id:p()}),method:"GET",response:ko}),sXe=d({tags:["notification-rules"],url:Dr,method:"POST",body:Hs,response:ko}),cXe=d({tags:["notification-rules"],url:`${Dr}/:id`,method:"PUT",params:t.Object({id:p()}),body:Hs,response:ko}),pXe=d({tags:["notification-rules"],url:`${Dr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),uXe=d({tags:["notification-rules"],url:`${Dr}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p(),{uniqueItems:!0})}),response:t.Object({})}),Qi=`${zi}/adaptive-rules`,lXe=d({tags:["notification-rules"],url:Qi,method:"GET",paginated:!0,query:t.Object(ae),response:t.Array(Ks)}),mXe=d({tags:["notification-rules"],url:`${Qi}/:id`,params:t.Object({id:p()}),method:"GET",response:Ks}),dXe=d({tags:["notification-rules"],url:Qi,method:"POST",body:Bw,response:Ks}),fXe=d({tags:["notification-rules"],url:`${Qi}/:id`,method:"PUT",params:t.Object({id:p()}),body:Bw,response:Ks}),gXe=d({tags:["notification-rules"],url:`${Qi}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),hXe=d({tags:["notification-rules"],url:`${Qi}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p(),{uniqueItems:!0})}),response:t.Object({})}),yXe=d({tags:["notification-integrations"],url:`${qw}/start`,method:"POST",response:t.Object({redirectUrl:t.String()})}),HY=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],Kw=t.Object({id:t.String(),name:t.String(),type:t.Enum(HY),createdAt:S(),ruleCount:t.Number(),creator:t.Optional(pe)}),KY=["name","type","ruleCount","createdAt"],zY=t.Object({searchQuery:Wr({description:"Search query filter for notification integrations.",valueDescription:"Case-insensitive substring matched against integration name and ID."})}),YY=t.Partial(t.Object({...ae,filters:t.Partial(zY),sort:t.Object({by:t.Enum(KY,{description:"Field to sort the returned notification integrations by."}),direction:Q})})),TXe=d({tags:["notification-integrations"],url:`${Yi}/query`,method:"POST",paginated:!0,body:YY,response:t.Array(Kw,{description:"Matching notification integrations after they are filtered, sorted, and paginated."})}),EXe=d({tags:["notification-integrations"],url:`${Dr}/integrations`,method:"GET",paginated:!0,query:t.Object(ae),response:t.Array(Kw)}),_Xe=d({tags:["notification-integrations"],url:`${qw}/callback`,method:"GET",query:t.Object({code:p()}),response:t.Object({success:t.Boolean()})}),Cg=["POST","PUT"],VY=t.Record(t.String(),t.String()),QY=t.Record(t.String(),t.Unknown()),WY=t.Record(t.String(),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))])),ZY=x("type",[t.Object({type:t.Literal("json"),value:QY}),t.Object({type:t.Literal("form"),value:WY})]),XY=t.Object({ok:t.String(),alert:t.String()}),zs=t.Object({id:t.String(),name:t.String(),setting:x("type",[t.Object({type:t.Literal("incident-io"),alertSourceConfigId:t.String(),tokenLastChars:t.String()}),t.Object({type:t.Literal("grafana-irm"),urlLastChars:t.String()}),t.Object({type:t.Literal("pagerduty"),integrationKeyLastChars:t.String()}),t.Object({type:t.Literal("microsoft-teams"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("webhook"),urlLastChars:t.String(),method:t.Enum(Cg),authentication:x("type",[t.Object({type:t.Literal("bearer"),tokenLastChars:t.String()}),t.Object({type:t.Literal("basic"),username:t.String(),passwordLastChars:t.String()}),t.Object({type:t.Literal("custom-header"),key:t.String(),valueLastChars:t.String()}),t.Object({type:t.Literal("none")})]),customHeaders:t.Optional(VY),payloadTemplate:ZY,eventNameMapping:t.Optional(XY)}),t.Object({type:t.Literal("servicenow"),instanceName:t.String(),username:t.String(),passwordLastChars:t.String()}),t.Object({type:t.Literal("google-chat"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("squadcast"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("jira"),siteUrl:t.String(),email:t.String(),apiTokenLastChars:t.String()})]),tags:ve}),JY=t.Object({type:t.Literal("webhook"),url:p({type:"uri"}),method:t.Enum(Cg),authentication:x("type",[t.Object({type:t.Literal("bearer"),token:p({allowEmpty:!1})}),t.Object({type:t.Literal("basic"),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),t.Object({type:t.Literal("custom-header"),key:p({allowEmpty:!1}),value:p({allowEmpty:!1})}),t.Object({type:t.Literal("none")})]),customHeaders:t.Record(p({allowEmpty:!1}),p()),payloadTemplate:x("type",[t.Object({type:t.Literal("json"),value:t.Record(p({allowEmpty:!1}),t.Unknown())}),t.Object({type:t.Literal("form"),value:t.Record(p({allowEmpty:!1}),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))]))})]),eventNameMapping:t.Optional(t.Object({ok:p({allowEmpty:!1}),alert:p({allowEmpty:!1})}))}),zw=t.Object({type:t.Literal("incident-io"),alertSourceConfigId:p(),token:p()}),Yw=t.Object({type:t.Literal("grafana-irm"),url:p({type:"uri"})}),Vw=t.Object({type:t.Literal("pagerduty"),integrationKey:p()}),Qw=t.Object({type:t.Literal("microsoft-teams"),webhookUrl:p({type:"uri"})}),e4=t.Object({type:t.Literal("servicenow"),instanceName:p({allowEmpty:!1,description:'Instance name of the ServiceNow instance. This corresponds to the subdomain part of the instance URL, like "my-instance" in "my-instance.service-now.com"'}),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),t4=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),r4=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),n4=t.Object({type:t.Literal("jira"),siteUrl:p({type:"uri",allowEmpty:!1,description:'Base URL of the Jira Cloud site, like "https://your-company.atlassian.net". Tsuga files issues against this site.'}),email:p({type:"email",allowEmpty:!1,description:"Atlassian account email used together with the API token for Basic authentication."}),apiToken:p({allowEmpty:!1,description:"Atlassian API token minted for the account, used as the Basic auth password."})}),Pg=t.Object({name:p(),setting:x("type",[zw,Yw,Vw,Qw,JY,e4,t4,r4,n4]),tags:De}),o4=t.Object({type:t.Literal("webhook"),url:t.Optional(p({type:"uri"})),method:t.Optional(t.Enum(Cg)),authentication:t.Optional(x("type",[t.Object({type:t.Literal("bearer"),token:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("basic"),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("custom-header"),key:t.Optional(p({allowEmpty:!1})),value:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("none")})])),customHeaders:t.Optional(t.Record(p({allowEmpty:!1}),p())),payloadTemplate:t.Optional(x("type",[t.Object({type:t.Literal("json"),value:t.Record(p({allowEmpty:!1}),t.Unknown())}),t.Object({type:t.Literal("form"),value:t.Record(p({allowEmpty:!1}),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))]))})])),eventNameMapping:Se(t.Object({ok:t.Optional(p({allowEmpty:!1})),alert:t.Optional(p({allowEmpty:!1}))}))}),i4=t.Object({type:t.Literal("servicenow"),instanceName:t.Optional(p({allowEmpty:!1})),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),a4=t.Object({type:t.Literal("jira"),siteUrl:t.Optional(p({type:"uri",allowEmpty:!1})),email:t.Optional(p({allowEmpty:!1})),apiToken:t.Optional(p({allowEmpty:!1}))}),s4=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),c4=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),Ug=t.Object({name:t.Optional(p()),tags:De,setting:t.Optional(x("type",[zw,Yw,Vw,Qw,o4,i4,s4,c4,a4]))}),IXe=d({tags:["notification-integrations"],url:Yi,method:"POST",body:Pg,response:zs}),SXe=d({tags:["notification-integrations"],url:`${Yi}/:id`,method:"GET",params:t.Object({id:p()}),response:zs}),bXe=d({tags:["notification-integrations"],url:`${Yi}/:id`,method:"PATCH",params:t.Object({id:p()}),body:Ug,response:zs}),OXe=d({tags:["notification-integrations"],url:`${Yi}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),p4=x("status",[t.Object({status:t.Literal("ok",{description:"Tsuga reached Jira and listed the projects the credentials can file into."}),projects:t.Array(t.Object({key:t.String({description:'Jira project key, like "OPS".'}),name:t.String({description:"Human readable Jira project name."}),issueTypes:t.Array(t.String(),{description:"Issue type names available when creating an issue in this project."}),statuses:t.Optional(t.Array(t.String(),{description:"Status names an issue in this project can be transitioned to. Omitted when Jira refused the status lookup for this project."}))}),{description:"Projects the connected Jira account can file issues into."})},{title:"JiraMetadataOk"}),t.Object({status:t.Literal("error",{description:"Tsuga could not load Jira metadata with the stored credentials."}),message:t.String({description:"Human readable reason the Jira metadata could not be loaded."})},{title:"JiraMetadataError"})],{description:"Result of probing Jira for the projects, issue types and statuses reachable with a stored integration. Returns a typed error instead of failing so the rule editor can fall back to free-text entry."}),AXe=d({tags:["notification-integrations"],url:`${Yi}/:id/jira-metadata`,method:"GET",params:t.Object({id:p()}),response:p4}),xXe=d({tags:["notification-rules"],url:`${Pt}/:id/notifications`,method:"GET",params:t.Object({id:p()}),query:t.Optional(t.Object({from:t.Optional(t.Number()),to:t.Optional(t.Number())})),response:t.Object({notifications:t.Array(t.Object({id:t.String(),monitorId:t.String(),monitorResultId:t.String(),ruleId:t.Optional(t.String()),targetId:t.Optional(t.String()),status:t.Enum(vY),tryCount:t.Number(),nextTryAt:S(),createdAt:S(),updatedAt:S(),sentAt:t.Optional(S())})),isTruncated:t.Boolean()})}),u4=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],RXe=d({tags:["notification-rules"],url:`${Dr}/test`,method:"POST",body:t.Object({notificationRule:Hs,targetIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:t.Union([t.Object({success:t.Literal(!1),overallMessage:t.String({description:"Message when there is an overall error"})}),t.Object({success:t.Boolean(),results:t.Array(t.Object({targetId:t.String({description:"The ID of the target that was tested"}),targetType:t.Enum(u4,{description:"The type of the target (e.g., slack, webhook)"}),status:t.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:t.Optional(t.String({description:"Message if the notification failed for this specific target"}))}))})])});var sn="/v0/slos",l4=[7,30,90],m4=["good","bad"],Jw=t.Enum(m4,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),d4=["good","bad","ignore"],ev=t.Enum(d4,{description:"How to treat time buckets with no data: good (count as meeting the SLO), bad (count as breaching it), or ignore (exclude from the error budget)"}),Ww=30,Zw=1440,tv=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],f4=["healthy","breached","no_data"],Tl=t.Enum(f4,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),Xw={sli:t.Optional(t.Number({description:"Service level indicator for the latest evaluation; absent when there is no data"})),errorBudget:t.Optional(t.Number({description:"Remaining error budget at the latest evaluation; negative when exhausted, absent when there is no data"})),status:Tl},g4=t.Object({overall:t.Object(Xw,{description:"Latest overall evaluation for the cluster"}),perGroup:t.Array(t.Object({groupKey:t.Record(t.String(),Os,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...Xw}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),rv=t.Record(t.String(),g4,{description:"Latest evaluation results keyed by cluster ID."}),wg=t.Object({queries:Zr,formula:Gu},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Tsuga evaluates this query formula during SLO evaluation and returns it as part of the saved SLO configuration. Returned queries include Tsuga-derived missing-point fill: event SLO queries use zero fill, and time SLO queries keep missing points null."}),vg=t.Object({queries:kR,formula:Oo},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Formulas reference queries as q1, q2, and so on. Do not send per-query fill; Tsuga derives the fill behavior from the SLO type."}),h4=t.Object({type:t.Literal("burn-rate",{description:"Alert configuration kind. Set to `burn-rate` for alerts that fire when the SLO consumes error budget faster than the configured multiplier."}),burnRate:t.Number({description:"Burn-rate multiplier that triggers this alert. The short and long evaluation windows are derived from the predefined template with the closest burn rate."})},{title:"BurnRateAlert"}),y4=t.Object({type:t.Literal("burn-rate",{description:"Alert configuration kind. Set to `burn-rate` for alerts that fire when the SLO consumes error budget faster than the configured multiplier."}),burnRate:t.Number({minimum:1,maximum:100,description:"Burn-rate multiplier that triggers this alert. Required for burn-rate alerts; valid input is 1 through 100. Non-template values are accepted; short and long evaluation windows are derived from the predefined template with the closest burn rate."})},{title:"BurnRateAlert"});var T4=t.Object({type:t.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:t.Number({description:"SLI percentage threshold for this alert. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),E4=t.Object({type:t.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"SLI percentage threshold for this alert. Required for threshold alerts; valid input is greater than 0 and less than 100. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),_4=x("type",[h4,T4],{description:"Alert trigger configuration: burn-rate or threshold"}),nv=x("type",[y4,E4],{description:"Alert trigger configuration: burn-rate or threshold"}),Ng=t.Enum(Ct,{description:"Alert priority (1 is highest, 5 is lowest)"}),Lg=t.Object({id:t.String({description:"Tsuga-generated SLO alert ID assigned when the alert is created."}),sloId:t.String({description:"Parent SLO ID for this alert."}),priority:Ng,configuration:_4,createdAt:S({description:"Timestamp when Tsuga created the alert."}),updatedAt:S({description:"Timestamp when Tsuga last updated the alert."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"SloAlert"}),I4=t.Object({priority:Ng,configuration:nv}),S4=t.Object({id:t.Optional(p({allowEmpty:!1,description:"Identifier of an existing alert to update. Omit to create a new alert on this SLO."})),priority:Ng,configuration:nv}),b4=x("type",[t.Object({type:t.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:Vt,goodQuery:wg,totalQuery:wg,groupByFields:t.Optional(Pi),noDataBehavior:Jw},{title:"EventSloConfiguration"}),t.Object({type:t.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:Vt,query:wg,sliceSizeMinutes:t.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:t.Object({operator:t.Enum(tv,{description:"Comparison operator between the query value and the threshold"}),value:t.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:t.Optional(Pi),noDataBehavior:ev},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),O4=x("type",[t.Object({type:t.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:Vt,goodQuery:vg,totalQuery:vg,groupByFields:t.Optional(Xr),noDataBehavior:Jw},{title:"EventSloConfiguration"}),t.Object({type:t.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:Vt,query:vg,sliceSizeMinutes:t.Integer({minimum:Ww,maximum:Zw,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${Ww} through ${Zw}.`}),threshold:t.Object({operator:t.Enum(tv,{description:"Comparison operator between the query value and the threshold"}),value:t.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:t.Optional(Xr),noDataBehavior:ev},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),A4=t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),ov=t.Enum(l4,{type:"integer",description:"Rolling SLO evaluation window in days. Set by the caller on create or update and returned on read and list responses. Allowed values are 7, 30, and 90."}),x4=t.Array(t.String(),{description:"Cluster IDs this SLO is evaluated on. Omit or send an empty array on input to run on all clusters; responses use an empty array to mean all clusters. Non-empty input values must reference existing clusters."}),R4=t.Array(p({allowEmpty:!1}),{description:"Cluster IDs this SLO is evaluated on. Omit or send an empty array on input to run on all clusters; responses use an empty array to mean all clusters. Non-empty input values must reference existing clusters."}),Wi=t.Object({id:t.String({description:"Tsuga-generated SLO ID assigned when the SLO is created."}),name:t.String({description:"Display name of the SLO, set by the caller."}),description:t.Optional(t.String({description:"Free-form, caller-provided description of what the SLO measures. Absent when not set."})),tags:ve,configuration:b4,target:t.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:ov,owner:t.String({description:"Team ID that owns the SLO"}),permissions:Cn,clusterIds:x4,creator:t.Optional(pe),updater:t.Optional(pe),alerts:t.Array(Lg,{description:"Alerts attached to this SLO"}),createdAt:S({description:"Timestamp when Tsuga created the SLO."}),updatedAt:S({description:"Timestamp when Tsuga last updated the SLO."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"Slo"}),C4=t.Object({...Wi.properties,results:rv},{title:"SloWithResults"}),El=t.Object({name:p({allowEmpty:!1,description:"Display name of the SLO."}),description:Se(p({type:"long"}),{description:"Free-form, caller-provided description of what the SLO measures. Optional."}),tags:De,configuration:O4,target:A4,timeframeDays:ov,owner:p({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:Cn,clusterIds:t.Optional(R4),alerts:t.Array(I4,{description:"Alerts to create on this SLO. Send an empty array for none."})}),kg=t.Object({...t.Omit(El,["alerts"]).properties,alerts:t.Array(S4,{description:"Alerts attached to this SLO. The SLO owns its alerts: the set is reconciled to exactly this list \u2014 existing alerts are matched by id, alerts without an id are created, and existing alerts absent from the list are deleted. Send an empty array to clear all alerts."})}),iv=t.Object({owners:ce(p({allowEmpty:!1}),{description:"Restrict results to SLOs owned by any of these team IDs",maxItems:50}),searchQuery:Wr({description:"Text filter for SLO names or IDs. Optional; `exclude: true` removes matching SLOs.",valueDescription:"Substring matched case-insensitively against the SLO name or SLO ID."}),tags:ce(Mt.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:ce(p({allowEmpty:!1}),{description:"Restrict results to SLOs that run against any of these cluster IDs (SLOs with no cluster restriction are always included)",maxItems:50}),statuses:ce(Tl,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),Mg=t.Partial(iv),P4=["name","owner","tags","updatedAt","sli","errorBudget","status"],Dg=t.Partial(t.Object({...ae,filters:Mg,sort:t.Object({by:t.Enum(P4,{description:"Field to sort by"}),direction:Q},{description:"Optional sorting applied to the returned SLOs"})})),$Xe=d({tags:["slos"],url:`${sn}/query`,method:"POST",paginated:!0,response:t.Array(C4),body:Dg}),FXe=d({tags:["slos"],url:`${sn}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(iv,["tags","statuses"])))}),response:kt}),jXe=d({tags:["slos"],url:`${sn}/:id`,method:"GET",params:t.Object({id:p()}),response:Wi}),qXe=d({tags:["slos"],url:`${sn}/:id/results`,method:"GET",params:t.Object({id:p()}),response:rv}),BXe=d({tags:["slos"],url:sn,method:"POST",body:El,response:Wi}),HXe=d({tags:["slos"],url:`${sn}/:id`,method:"PUT",params:t.Object({id:p()}),body:kg,response:Wi}),KXe=d({tags:["slos"],url:`${sn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),U4=Yt(Mg),zXe=d({tags:["slos"],url:`${sn}/bulk-delete`,method:"DELETE",body:t.Object({selection:U4}),response:t.Object({})}),w4=Yt(Mg,{maxIds:100}),YXe=d({tags:["slos"],url:`${sn}/bulk-update`,method:"PUT",body:t.Object({selection:w4,owner:p({allowEmpty:!1})}),response:t.Object({})});var Bt="/v0/service-catalog",v4=t.Object({team:t.String({description:"Team name observed on telemetry for this service. The emitting service sets it through telemetry attributes. Returned when Tsuga has observed a team value for the service; metadata refreshes weekly or when a new service version appears."}),lastSeenAt:S({description:"Most recent time this team was observed for the service. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A team name observed on telemetry for this service, with the last time it was seen."}),N4=t.Object({ingestionApiKey:t.String({description:"Ingestion API key name or identifier observed on telemetry for this service. Tsuga sets it from the key used to ingest matching telemetry. Returned when key metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this ingestion key was observed for the service. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An ingestion API key observed on telemetry for this service, with the last time it was seen."}),L4=t.Object({version:t.String({description:"Service version value observed in telemetry. The emitting service sets it through `context.service.version`. Returned when Tsuga has observed a version for the service."}),firstSeenAt:S({description:"First time this version was observed for the service. Tsuga sets it from telemetry timestamps and refreshes observed versions on each service catalog pass."}),lastSeenAt:S({description:"Most recent time this version was observed for the service. Tsuga sets it from telemetry timestamps and refreshes observed versions on each service catalog pass."}),faulty:t.Optional(t.Boolean({description:"Whether Tsuga detected this version as associated with faulty behavior."})),faultyLatency:t.Optional(t.Boolean({description:"Whether the faulty behavior Tsuga detected for this version is a latency degradation. Only set by faulty deployment detection when it reports on latency; absent when the detection did not evaluate latency."})),detectionTriggered:t.Optional(t.Boolean({description:"Whether faulty deployment detection has already been triggered for this version. Set when the detection job is launched to avoid re-triggering it. Absent on versions predating this field."}))},{description:"A service version observed in telemetry, with first and last seen timestamps and faulty deployment detection results."}),k4=t.Object({language:t.String({description:"Programming language observed for this service. The OpenTelemetry SDK sets it through telemetry metadata. Returned when language metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this language was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A programming language observed for this service, with the last time it was seen."}),M4=t.Object({runtime:t.String({description:"Runtime observed for this service. The emitting service or OpenTelemetry instrumentation sets it through telemetry metadata. Returned when runtime metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this runtime was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A runtime observed for this service, with the last time it was seen."}),av=t.Object({protocol:t.String({description:"Observed API protocol, such as `http`, `grpc`, or `graphql`. Tsuga infers it from span metadata. Returned when protocol metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this protocol was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An API protocol observed for this service, with the last time it was seen."}),D4=t.Object({framework:t.String({description:"Observed application framework, such as `express`, `fastify`, `django`, or `rails`. Tsuga detects it from OpenTelemetry instrumentation scope. Returned when framework metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this framework was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An application framework detected from OpenTelemetry instrumentation scope, with the last time it was seen."}),G4=t.Object({platform:t.String({description:"Observed cloud or orchestration platform, such as `aws_eks` or `kubernetes`. The emitting service or collector sets it through telemetry resource attributes. Returned when platform metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this platform was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A cloud or orchestration platform this service runs on, with the last time it was seen."}),$4=t.Object({provider:t.String({description:"Observed cloud provider, such as `aws`, `gcp`, or `azure`. The emitting service or collector sets it through telemetry resource attributes. Returned when provider metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this provider was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A cloud provider this service runs on, with the last time it was seen."}),Zi=t.Object({id:t.String({description:"Tsuga-generated identifier of this service notification target. Tsuga returns it when the target is created or listed, and clients use it to update or delete the target. It is unique across service targets."}),serviceId:t.String({description:"Identifier of the service catalog entry this target is attached to. Tsuga sets it from the service path parameter and returns it on read and write responses."}),config:Bs.properties.config,rateLimit:Bs.properties.rateLimit,createdAt:S({description:"Timestamp when the service notification target was created. Tsuga sets this value and returns it on private service-catalog responses."}),updatedAt:S({description:"Timestamp when the service notification target was last updated. Tsuga sets this value and returns it on private service-catalog responses."})}),Gg=t.Object({config:Vi.properties.config,rateLimit:Vi.properties.rateLimit},{description:"Service notification target create request. The caller provides the destination configuration and optional rate limit; Tsuga attaches the target to the service in the path."}),$g=t.Object({config:Vi.properties.config,rateLimit:t.Union([Ag,t.Null()],{description:"Per-target rate limit to apply when sending notifications. Set it to `null` to drop the current limit and fall back to the default of 1000 notifications every 10 minutes."})},{description:"Service notification target update request. The caller provides the replacement destination configuration and rate limit; omitted fields are not supported by this schema."}),_l=t.Object({id:t.String({description:"Unique identifier of this service. Use it with service detail and graph endpoints."}),serviceName:t.String({description:"OpenTelemetry service name observed in telemetry."}),serviceNamespace:t.Optional(t.String({description:"OpenTelemetry service namespace observed in telemetry."})),env:t.String({description:"Environment value observed for this service."}),teams:t.Array(v4,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:t.Array(N4,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:t.Array(L4,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:t.Array(k4,{description:"Programming languages observed for this service."}),runtimes:t.Array(M4,{description:"Runtime values observed for this service."}),serverProtocols:t.Array(av,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:t.Array(av,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:t.Array(D4,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:t.Array(G4,{description:"Cloud platforms this service is running on"}),cloudProviders:t.Array($4,{description:"Cloud providers this service is running on"}),lastSeenAt:S({description:"Most recent time Tsuga observed telemetry for this service."}),firstSeenAt:S({description:"First time Tsuga observed telemetry for this service."}),additionalUserFields:t.Optional(t.Unsafe({type:"object",additionalProperties:!0,description:"Additional user-defined service metadata, when configured."})),traceRequestRate:t.Optional(t.Number({description:"Requests per second observed for this service over the queried window, counting calls of its primary span kind. Omitted when the trace query failed, which is distinct from `0` (the service is quiet)."})),traceErrorRate:t.Optional(t.Number({description:"Percentage of this service\u2019s primary-span-kind calls over the queried window that ended with error status. Omitted when the trace query failed."})),notificationTargets:t.Array(Zi,{description:"Notification targets attached to this service, used by adaptive notification rules to page its owners."}),createdAt:S({description:"Timestamp when Tsuga created this service catalog entry."}),updatedAt:S({description:"Timestamp when Tsuga last updated this service catalog entry."})}),F4=t.Object({spanKind:t.Enum(lR),count:t.Number()}),Fg=t.Object({..._l.properties,spanKindCounts:t.Array(F4)}),oJe=d({tags:["service-catalog"],query:t.Object({...ae,clusterId:t.Optional(p()),env:t.Optional(p())}),method:"GET",paginated:!0,url:`${Bt}/services`,response:t.Array(Fg)}),j4=["serviceName","env","lastDeploy","traceErrorRate","traceRequestRate","teams","api","frameworks","languages","pagingDestination"],q4=t.Object({searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against service names."})},{description:"Text filter for service names."}),teams:ce(p({allowEmpty:!1}),{description:"Restrict results to services observed under any of these team names",maxItems:50}),envs:ce(p({allowEmpty:!1}),{description:"Restrict results to services observed in any of these environments",maxItems:50}),versions:ce(p({allowEmpty:!1}),{description:"Restrict results to services whose latest observed version is one of these",maxItems:50}),languages:ce(p({allowEmpty:!1}),{description:"Restrict results to services written in any of these languages",maxItems:50}),hasRecentData:t.Boolean({description:"When true, only return services whose request rate over the queried window is non-zero"})}),B4=["1h","4h","24h"];var H4=t.Partial(t.Object({...ae,clusterId:p(),filters:t.Partial(q4,{description:"Optional filters applied to narrow the returned services"}),sort:t.Object({by:t.Enum(j4,{description:"Field to sort the returned services by"}),direction:Q},{description:"Optional sorting applied to the returned services"}),statsWindow:t.Enum(B4,{description:"Lookback used to compute the trace request rate and trace error rate fields, and the span-call totals that pick each service's primary environment. Defaults to `1h`."})})),iJe=d({tags:["service-catalog"],url:`${Bt}/v2/services/query`,method:"POST",paginated:!0,body:H4,response:t.Array(Fg)}),aJe=d({tags:["service-catalog"],query:t.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:t.Optional(p({allowEmpty:!1})),env:p({allowEmpty:!1}),clusterId:t.Optional(p())}),method:"GET",url:`${Bt}/v2/service`,response:Fg}),sJe=d({tags:["service-catalog"],query:t.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:t.Optional(p({allowEmpty:!1})),clusterId:t.Optional(p())}),method:"GET",url:`${Bt}/v2/service/envs`,response:t.Array(t.Object({env:t.String({description:"Environment the service was observed in."}),ingestedBytes:t.Number({description:"Trace bytes ingested for the service in this environment over the lookback."})}),{description:"Environments the service was observed in, busiest first."})}),cJe=d({tags:["service-catalog"],method:"GET",url:`${Bt}/services/:serviceId`,params:t.Object({serviceId:p()}),response:_l}),pJe=d({tags:["service-catalog"],method:"GET",url:`${Bt}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),response:t.Array(Zi)}),uJe=d({tags:["service-catalog"],method:"POST",url:`${Bt}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),body:Gg,response:Zi}),lJe=d({tags:["service-catalog"],method:"PUT",url:`${Bt}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),body:$g,response:Zi}),mJe=d({tags:["service-catalog"],method:"DELETE",url:`${Bt}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),response:v}),K4=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var sv=t.Object({id:t.String(),hostName:t.String(),env:t.Optional(t.String()),cpuUtilizationAverage:t.Number(),hostType:t.Enum(K4),teams:t.Array(t.String()),tags:t.Array(t.String()),firstSeenAt:S(),lastSeenAt:S(),clusterId:t.String()}),dJe=d({tags:["service-catalog"],method:"GET",url:`${Bt}/hosts`,response:t.Array(sv)}),fJe=d({tags:["service-catalog"],method:"GET",url:`${Bt}/hosts/:hostId`,params:t.Object({hostId:p()}),response:sv}),z4=["http","rpc","messaging","genai","object_store"],cv={name:t.String({description:"Service or inferred dependency name shown in the graph."}),env:t.Optional(t.String({description:"Environment observed from spans."}))},jg=t.Object({...cv,nodeType:t.Literal("observed",{description:"Discriminator for this node variant. Always `observed` for a graph node matched to a service catalog entry by name and env."}),id:t.Union([t.String(),t.Null()],{description:"Service ID, or null when multiple namespaces match the observed service name."}),namespace:t.Union([t.String(),t.Null()],{description:"Service namespace, or null when multiple namespaces match the observed service name."}),errorRate:t.Optional(t.Number({description:"Ratio of entry requests with at least one error to total entry requests observed on this service. Omitted when no entry requests were observed. Computed from the raw sampled counts, so trace sampling does not affect it."})),entryErrorRequestCount:t.Number({description:"Estimated number of entry requests on this service where at least one entry span had error status, projected from the sampled traces onto the full population."}),entryRequestCount:t.Number({description:"Estimated number of entry requests on this service, projected from the sampled traces onto the full population. Observed as unique trace IDs that have at least one entry span on this service. An entry span is a consumer-kind span, a root span (no parent), or any span whose parent belongs to a different service."})}),pv={...cv,endpoint:t.Optional(t.String({description:"Inferred service endpoint address"})),resourceName:t.Optional(t.String({description:"Inferred resource name, e.g. table or queue name"}))},qg=t.Object({...pv,nodeType:t.Literal("inferred_db",{description:"Discriminator for this node variant. Always `inferred_db` for a database dependency detected from client-span attributes that could not be matched to a service catalog entry."}),serviceType:t.Literal("db",{description:"Inferred dependency type. Always `db` for this node variant."}),databaseName:t.Optional(t.String({description:"Database name from span_attributes db.namespace. Matches the database catalog `name`."})),databaseSystem:t.String({description:"Database system from span_attributes db.system.name (falling back to legacy db.system). Matches the database catalog `databaseSystem`."})}),Bg=t.Object({...pv,nodeType:t.Literal("inferred",{description:"Discriminator for this node variant. Always `inferred` for a non-database dependency detected from client-span attributes (e.g. a queue or external HTTP call) that could not be matched to a service catalog entry. Database dependencies use the `inferred_db` variant."}),serviceType:t.Enum(z4,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),Y4=x("nodeType",[jg,qg,Bg]),Hg=t.Object({from:t.Object({env:t.Optional(t.String({description:"Environment of the source node"})),name:t.String({description:"Name of the source node"})},{description:"Reference to the caller node, i.e. the service or dependency that issued the request."}),to:t.Object({env:t.Optional(t.String({description:"Environment of the target node"})),name:t.String({description:"Name of the target node"}),databaseSystem:t.Optional(t.String({description:"Database system of the target when it is an inferred database node (`inferred_db`). Together with `name` and `env` it identifies the target node, distinguishing a database from a same-named service or a same-named database on another system."}))},{description:"Reference to the callee node, i.e. the service or dependency that received the request."}),count:t.Number({description:"Estimated number of cross-service transitions on this directed edge in the graph query window. The graph is built from a uniform sample of traces, so this is projected onto the full population rather than counted directly."}),errorRate:t.Optional(t.Number({description:"Ratio of errored client spans to total client spans observed on this edge. Omitted when no client spans were observed. For edges to inferred services, the originating span is treated as the client span regardless of its kind. Computed from the raw sampled counts, so trace sampling does not affect it."})),errorCount:t.Number({description:"Estimated number of client spans with error status on this edge, projected from the sampled traces onto the full population."}),clientSpanCount:t.Number({description:"Estimated number of client spans on this edge, projected from the sampled traces onto the full population."})},{description:"Directed dependency edge from a caller node (`from`) to a callee node (`to`) in the service graph, with call-volume and error counts observed over the query window."}),gJe=d({tags:["service-catalog"],url:`${Bt}/services/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p()}),query:t.Object({...it.properties,query:t.Optional(p({type:"tsuga-query"}))}),response:t.Object({clusterId:t.String(),nodes:t.Array(Y4),edges:t.Array(Hg)})}),V4=t.Object({monitors:t.Array(t.Object({id:t.String({description:"Identifier of the monitor"}),name:t.String({description:"Display name of the monitor"}),owner:t.String({description:"Team ID that owns the monitor"}),priority:t.Enum(Ct,{description:"Priority of the monitor"})})),slos:t.Array(t.Object({id:t.String({description:"Identifier of the SLO"}),name:t.String({description:"Display name of the SLO"}),owner:t.String({description:"Team ID that owns the SLO"}),statusCount:t.Partial(t.Record(Tl,t.Number()),{description:"Count of SLO statuses for this service: one entry per group matching the service when the SLO groups by service.name, otherwise the overall status"})}))}),hJe=d({tags:["service-catalog"],method:"GET",url:`${Bt}/services/:serviceId/related-resources`,params:t.Object({serviceId:p()}),response:V4}),yJe=d({tags:["service-catalog"],method:"GET",url:`${Bt}/services/by-api-keys`,response:t.Record(t.String(),t.Array(t.Object({serviceName:t.String(),serviceNamespace:t.Optional(t.String())})))});var Il=`/${"v1"}/services`,Kg=t.Pick(_l,["id","serviceName","serviceNamespace","env","teams","versions","languages","runtimes","serverProtocols","clientProtocols","frameworks","cloudPlatforms","cloudProviders","lastSeenAt","firstSeenAt","traceRequestRate","traceErrorRate"],{$id:"Service",description:"Service inferred from telemetry, with observed metadata, activity counts, and version signals. See [Services](/documentation/categorize/services/index)."}),Q4={id:"123-456-abc",serviceName:"api-gateway",serviceNamespace:"platform",env:"production",teams:[{team:"platform",lastSeenAt:"2024-01-15T12:34:56.000Z"}],versions:[{version:"1.2.3",firstSeenAt:"2024-01-01T08:00:00.000Z",lastSeenAt:"2024-01-15T12:34:56.000Z",faulty:!0,faultyLatency:!0}],languages:[{language:"go",lastSeenAt:"2024-01-15T12:34:56.000Z"}],runtimes:[{runtime:"go",lastSeenAt:"2024-01-15T12:34:56.000Z"}],serverProtocols:[{protocol:"http",lastSeenAt:"2024-01-15T12:34:56.000Z"}],clientProtocols:[{protocol:"grpc",lastSeenAt:"2024-01-15T12:34:56.000Z"}],frameworks:[{framework:"gin",lastSeenAt:"2024-01-15T12:34:56.000Z"}],cloudPlatforms:[{platform:"aws_eks",lastSeenAt:"2024-01-15T12:34:56.000Z"},{platform:"kubernetes",lastSeenAt:"2024-01-15T12:34:56.000Z"}],cloudProviders:[{provider:"aws",lastSeenAt:"2024-01-15T12:34:56.000Z"}],lastSeenAt:"2024-01-15T12:34:56.000Z",firstSeenAt:"2024-01-01T08:00:00.000Z",traceRequestRate:2.36,traceErrorRate:8.2};Object.assign(Kg,{examples:[Q4]});var uv=d({description:"Lists services inferred from telemetry. Use this endpoint to inventory service ownership, environments, versions, runtimes, and recent activity. Pagination fields limit the returned page.",operationId:"listServices",tags:["services"],url:Il,method:"GET",paginated:!0,query:t.Object({...qe,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Omit to use the first cluster in the organization; this does not query all clusters."})),env:t.Optional(p({allowEmpty:!1,description:"Environment whose activity and metadata each returned service is described by. Services not observed in it are omitted. Omit to describe each service by its busiest environment."}))},{description:"Service list query. Use pagination and optional cluster and environment scope."}),response:t.Array(Kg)}),lv=d({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${Il}/:serviceId`,method:"GET",params:t.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to retrieve. Use the `id` returned by service list responses."})}),response:Kg}),W4=t.Pick(jg,["name","env","nodeType","id","namespace","errorRate","entryErrorRequestCount","entryRequestCount"],{$id:"ObservedServiceGraphNode",description:"Service graph node matched to a service catalog entry by name and env. `id`/`namespace` are null when multiple namespaces share the observed service name."}),Z4=t.Pick(Bg,["name","env","nodeType","serviceType","endpoint","resourceName"],{$id:"InferredServiceGraphNode",description:"Dependency node detected from client-span attributes (e.g. a queue or external HTTP call) that could not be matched to a service catalog entry. Database dependencies use the `inferred_db` variant."}),X4=t.Pick(qg,["name","env","nodeType","serviceType","endpoint","resourceName"],{$id:"InferredDbServiceGraphNode",description:"Database dependency node detected from client-span attributes that could not be matched to a service catalog entry."}),J4=x("nodeType",[W4,X4,Z4]),e3=t.Pick(Hg,["from","to","count","errorRate","errorCount","clientSpanCount"],{$id:"ServiceGraphEdge",description:"Directed dependency edge from a caller node (`from`) to a callee node (`to`), with call-volume and error counts observed over the query window."}),t3=t.Optional(t.Integer({...it.properties.from,description:"Start of the service graph query window as a Unix timestamp in seconds. Provide both `from` and `to` for a deterministic graph window; otherwise Tsuga uses backend graph defaults."})),r3=t.Optional(t.Integer({...it.properties.to,description:"End of the service graph query window as a Unix timestamp in seconds. Provide both `from` and `to` for a deterministic graph window; otherwise Tsuga uses backend graph defaults."})),n3=p({type:"tsuga-query",default:"*",description:"Tsuga query used to filter spans considered for the graph. Defaults to `*`, which applies no additional filter beyond the service identity."}),mv=d({description:"Retrieves a dependency graph for one service over an optional time range and query filter. Provide an explicit time range for deterministic results. Use this to inspect observed downstream and upstream service relationships. See [Service page](/documentation/categorize/services/service-page).",operationId:"getServiceGraph",tags:["services"],url:`${Il}/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to use as the graph root. Use the `id` returned by service list or get responses."})}),query:t.Object({from:t3,to:r3,query:t.Optional(n3)},{description:"Service graph query. Use time range and optional span query filters."}),response:t.Object({clusterId:t.String({description:"Cluster ID the graph was built from"}),nodes:t.Array(J4,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:t.Array(e3,{description:"Directed dependency edges between graph nodes."})})}),Sl=`${Il}/:serviceId/notification-targets`,bl=t.Pick(Zi,["id","serviceId","config","rateLimit"],{$id:"ServiceNotificationTarget",description:"Notification target attached to a service, used by adaptive notification rules to page the service owners. See [Rules](/documentation/alert/notifications/rules)."}),zg={rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}},o3={id:"789-abc-def",serviceId:"123-456-abc",...zg};Object.assign(bl,{examples:[o3]});var Ol=p({allowEmpty:!1,description:"Identifier of the service the notification target belongs to. Use the `id` returned by service list or get responses."}),xJe=d({description:"Lists the notification targets attached to one service. Use this to discover target IDs before updating or deleting a target.",operationId:"listServiceNotificationTargets",tags:["services"],url:Sl,method:"GET",params:t.Object({serviceId:Ol}),response:t.Array(bl)}),i3=t.Pick(Gg,["config","rateLimit"],{description:"Service notification target create request. Provide the delivery destination and an optional per-target rate limit.",examples:[zg]}),a3=t.Pick($g,["config","rateLimit"],{description:"Service notification target update request. The submitted destination and rate limit overwrite the stored ones.",examples:[zg]}),RJe=d({description:"Attaches a notification target to a service. Adaptive notification rules matching the service page this target on alert transitions.",operationId:"createServiceNotificationTarget",tags:["services"],url:Sl,method:"POST",params:t.Object({serviceId:Ol}),body:i3,response:bl}),CJe=d({description:"Updates one notification target attached to a service.",operationId:"updateServiceNotificationTarget",tags:["services"],url:`${Sl}/:targetId`,method:"PUT",params:t.Object({serviceId:Ol,targetId:p({allowEmpty:!1,description:"Identifier of the notification target to update. Use the `id` returned by service notification target list or create responses."})}),body:a3,response:bl}),PJe=d({description:"Detaches a notification target from a service. Notification rules stop paging this destination for the service.",operationId:"deleteServiceNotificationTarget",tags:["services"],url:`${Sl}/:targetId`,method:"DELETE",params:t.Object({serviceId:Ol,targetId:p({allowEmpty:!1,description:"Identifier of the notification target to delete. Use the `id` returned by service notification target list or create responses."})}),response:v});function dv(e,r){let n=r??nr(e);return n===void 0?void 0:Qo(n)}function Yg(e){let r=nr(e);return r===void 0?"":` (default: ${r})`}function fv(e,r){e.command("service-graph").description("Inspect service dependency graphs").command("get <SERVICE_ID>").description("Retrieve the dependency graph for a service").option("--from <TIMESTAMP>",`Start of time range${Ue}${Yg("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Yg("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${Yg("query")}`).action(async(o,i)=>{let a={},c=dv("from",i.from),l=dv("to",i.to);c!==void 0&&(a.from=c),l!==void 0&&(a.to=l),i.query!==void 0&&(a.query=i.query);let m=await r()(mv,{params:{serviceId:o},query:a});W(m)})}var s3=`/${"v1"}/grok`,c3=25,p3=100,gv=t.Object({rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok parsing rule to preview against each sample. The rule uses the same Grok syntax as the log route **Grok parser** processor, for example `pod:%{DATA:namespace}/%{DATA:name}`."}),{minItems:1,maxItems:c3,description:"Ordered Grok parsing rules to preview. For each sample, Tsuga tries the rules in order and returns the first successful match, matching route Grok processor semantics."}),samples:t.Array(p({allowEmpty:!1,type:"long",description:"Raw log line to parse with the provided Grok rules. The value is parsed as preview input only; this endpoint does not ingest or store the sample."}),{minItems:1,maxItems:p3,description:"Sample log lines to run against the rules. Results are returned in the same order as this array."})},{description:"Grok rules and sample log lines to preview extraction before saving a route processor. The endpoint uses the same parser as the route builder preview and does not create or update routes."}),u3={rules:['pod:%{DATA:pod_namespace}/%{DATA:pod_name}\\] "%{DATA:request}" HTTP/%{POSINT:status}'],samples:['[conn-id:abc pod:tsuga-events/tsuga-events-searcher-0] "/token" HTTP/200']};Object.assign(gv,{examples:[u3]});var hv=t.Object({results:t.Array(t.Object({sample:t.String({description:"Echo of the submitted log line, so results can be matched to the samples in the request."}),matched:t.Boolean({description:"Whether any submitted rule matched this sample. `true` means `extracted` contains the captured fields; `false` means no rule matched."}),extracted:t.Union([t.Record(t.String(),t.Unknown()),t.Null()],{description:"Fields extracted from the first matching Grok rule when `matched` is `true`; dotted capture names are expanded into nested objects. `null` when no rule matched."})}),{description:"Preview result for each submitted sample, in the same order as the request `samples` array."})},{description:"Grok extraction preview results from applying the ordered rules to each submitted sample."}),l3={results:[{sample:'[conn-id:abc pod:tsuga-events/tsuga-events-searcher-0] "/token" HTTP/200',matched:!0,extracted:{pod_namespace:"tsuga-events",pod_name:"tsuga-events-searcher-0",request:"/token",status:"200"}}]};Object.assign(hv,{examples:[l3]});var yv=d({url:`${s3}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:gv,response:hv,description:"Parses sample log lines with Grok rules and returns extracted fields, using the same Grok engine as the log route processor. Use this endpoint to author and test route Grok rules before saving them. The operation requires public API read access to log routes. A rule that fails to compile returns a 400 response with error code `GROK_RULE_VALIDATION_ERROR` and structured details in `error.details.ruleErrors`."});function Tv(e,r){let n=e.command("grok").description("Test and preview grok parsing rules");yr(n,"parse","Parse sample log lines with grok rules and return the extracted fields",yv,r)}var Ev=require("node:child_process"),_v=require("node:fs"),Iv=require("node:os"),Rl=require("node:path");var Mo=require("node:fs");function Ys(e,r){let n=`${e}.tmp.${process.pid}`;(0,Mo.writeFileSync)(n,r),(0,Mo.renameSync)(n,e)}function Vs(e){try{return(0,Mo.readFileSync)(e,"utf8")}catch(r){if(r.code==="ENOENT")return;throw r}}function Qs(e,r){if(r===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,Mo.writeFileSync)(n,r),n}function Do(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Vg="tsuga-dev/agent-plugins",Al="tsuga";function xl(e,r){z(` $ ${e} ${r.join(" ")}`);try{(0,Ev.execFileSync)(e,r,{stdio:["ignore","inherit","inherit"]})}catch(n){let o=n.status??1;throw new Error(`${e} ${r.join(" ")} exited ${o}`,{cause:n})}}function m3(e,r){z("Claude Code \u2192 installing Tsuga plugin"),xl("claude",["plugin","marketplace","add",Vg]),xl("claude",["plugin","install",`tsuga@${Al}`]),r.autoUpdate&&d3(e)}function d3(e){let r=(0,Rl.join)(e,".claude","settings.json");z(`Claude Code \u2192 ${r} (autoUpdate)`),(0,_v.mkdirSync)((0,Rl.dirname)(r),{recursive:!0});let n=Vs(r),o=JSON.parse(n??"{}");if(!Do(o))throw new Error(`${r} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!Do(i))throw new Error(`${r} "extraKnownMarketplaces" must be a JSON object`);let a=i[Al],c=Do(a)?a:{};o.extraKnownMarketplaces={...i,[Al]:{source:{source:"github",repo:Vg},...c,autoUpdate:!0}};let l=Qs(r,n);Ys(r,`${JSON.stringify(o,null,2)}
145
- `),z(l===void 0?" created":` patched (backup: ${l})`)}function f3(){z("Codex \u2192 installing Tsuga plugin"),xl("codex",["plugin","marketplace","add",Vg]),xl("codex",["plugin","add",`tsuga@${Al}`])}function Sv(e){let r=e.command("install").description("Install Tsuga plugins into local LLM CLIs").command("plugin").description("Install the Tsuga plugin into a specific LLM CLI");r.command("claude-code").description("Install the Tsuga plugin into Claude Code (requires the claude CLI in PATH)").option("--no-auto-update","Skip patching ~/.claude/settings.json with autoUpdate=true").action(n=>{m3((0,Iv.homedir)(),n),z("Restart your claude session to load the new plugins.")}),r.command("codex").description("Install the Tsuga plugin into Codex (requires the codex CLI in PATH)").action(()=>{f3(),z("Restart your codex session to load the new plugins.")})}var g3=10,h3=t.Object({key:p({allowEmpty:!1,description:"Telemetry attribute key to scope the ranking by: a service, environment, team, route, or other positive equality term in the population you want fields for. Use dot-path keys such as `context.service.name`."}),value:t.Optional(p({allowEmpty:!1,description:"Attribute value the scoped telemetry should match, when the scope is a specific service, environment, team, route, or other known value. When omitted, artifacts that reference the key match this entry at full weight regardless of value."})),valueMustMatch:t.Optional(t.Boolean({description:"When true, this entry is a hard filter rather than a weight: any widget or monitor that does not match it exactly (key = value) contributes no fields at all, instead of contributing at a reduced weight. Other widgets of the same dashboard still contribute if they match. Requires `value`."}))}),Qg=t.Object({field:t.String({description:"Field name to use in queries. For `kind: attribute`, this is an attribute dot path. For `kind: metric`, this is either a metric name or a `metricName.context.attribute` path when the metric query used a metric attribute."}),kind:t.Enum(["attribute","metric"],{description:"Whether the field is a telemetry attribute or a metric name. `metric` appears only in the metrics bucket, for fields referenced as the aggregated field of a metrics-source query."}),inferredType:t.Enum(["numeric","categorical","unknown"],{description:"Value type inferred from how the field is used: `numeric` when aggregated with sum/average/percentile, referenced by numeric or range filters, or a metric name; `categorical` when only grouped by or matched with equality/text filters; `unknown` otherwise. Evidence-based \u2014 a numeric field used only in equality filters reads as categorical."}),score:t.Number({description:"Relative relevance score computed by Tsuga from how strongly readable dashboards and monitors use this field for the requested scope, discounted when the field is common across the whole organization. Higher values mean stronger evidence that the field is useful for this scope. Scores are intended for ranking, not for comparison across unrelated scopes."}),artifacts:t.Number({description:"Number of distinct readable dashboards and monitors that reference this field and match the requested scope. Tsuga counts an artifact once per field even if it uses the field in multiple widgets or queries."}),globalArtifacts:t.Number({description:"Number of organization-wide dashboards and monitors that reference this field, regardless of the requested scope or caller permissions. Tsuga uses this anonymous baseline to down-rank fields that are common everywhere."}),usage:t.Object({groupBy:t.Number({description:"Number of distinct readable matching artifacts that use this field as a group-by or split dimension."}),filter:t.Number({description:"Number of distinct readable matching artifacts that filter on this field in widget queries, monitor queries, or dashboard-wide filters."}),measure:t.Number({description:"Number of distinct readable matching artifacts that aggregate this field as `aggregate.field`."}),column:t.Number({description:"Number of distinct readable matching artifacts that pin this field as a list-widget column."})},{description:"Distinct-artifact counts by usage kind, explaining why the field ranked where it did; a dashboard referencing the field the same way in many widgets counts once for that usage kind."})}),Wg=t.Object({logs:t.Array(Qg,{description:"Top log fields for the requested scope, ranked by score and mined from readable logs-sourced dashboards and monitors."}),traces:t.Array(Qg,{description:"Top trace fields for the requested scope, ranked by score and mined from readable traces-sourced dashboards and monitors."}),metrics:t.Array(Qg,{description:"Top metric names and metric-attribute fields for the requested scope, ranked by score and mined from readable metrics-sourced dashboards and monitors."}),dashboardsMatched:t.Number({description:"Number of dashboards that matched the requested scope and that the caller can read. Dashboards the caller cannot read are removed before field rankings are returned."}),monitorsMatched:t.Number({description:"Number of monitors that matched the requested scope and that the caller can read. Monitors the caller cannot read are removed before field rankings are returned."})}),Zg=t.Object({scope:t.Array(h3,{minItems:1,maxItems:g3,description:"Scope entries that define the population to rank fields for, drawn from positive equality pairs in a TQL query, such as service and environment. Tsuga matches entries softly by default: an artifact's contribution is weighted by the fraction of entries it matches."})}),XJe=d({tags:["interesting-fields"],url:"/v0/interesting-fields",method:"POST",body:Zg,response:Wg});var y3=`/${"v1"}/interesting-fields`,T3={scope:[{key:"context.service.name",value:"payments"},{key:"context.env",value:"prod",valueMustMatch:!0}]},E3=t.Object(Zg.properties,{description:"The scope to rank fields for, as attribute key/value pairs such as a service name and an environment. Entries are matched softly by default: a widget contributes in proportion to how many entries it matches, so a broader scope returns a broader ranking. Set `valueMustMatch` on an entry to make it a hard filter instead: a widget that does not match it exactly contributes nothing, even when other entries match.",examples:[T3]}),bv=d({url:y3,method:"POST",operationId:"getInterestingFields",tags:["public","interesting-fields"],body:E3,response:Wg,description:"Ranks the telemetry fields most relevant to a scope, mined from how the org already uses them in dashboards and monitors, bucketed by logs, traces, and metrics. Use this before guessing a field or metric name: a field that many scope-matching dashboards group or filter on is the one an operator would reach for. Ranking is TF-IDF style, so a field used everywhere in the org scores below one that is distinctive to the scope. Dashboards and monitors the caller cannot read never contribute field names, only the anonymous frequency baseline. The operation requires public API read access to dashboards and monitors."});function Ov(e,r){let n=e.command("interesting-fields").description("Discover the telemetry fields an org already uses for a scope");yr(n,"list","Rank the log, trace and metric fields most relevant to a scope, mined from dashboards and monitors",bv,r)}var sr="/v0/kubernetes-explorer",_3="^[a-z0-9.-]+$",I3="^[A-Za-z0-9._-]+$",Av=256,xv=t.Optional(p({allowEmpty:!1,description:"Tsuga cluster ID to target. Tsuga assigns it when a cluster is connected to the organization. Optional for single-cluster organizations and required for organizations with multiple clusters to scope the request to one cluster."}));var ar=e=>t.Optional(t.Array(p({allowEmpty:!1}),{description:e})),Rv=["clusters","namespaces","teams","envs"],Cl="Names of other filter fields in this query whose values exclude rather than include. Set this to a field name to keep only the resources matching none of that field's values; fields left out keep the resources matching any of their values.",Xg={clusterId:xv,search:t.Optional(t.String({pattern:_3,minLength:1,maxLength:Av,description:"Substring matched against the resource name. Kubernetes names are lowercase RFC 1123, so only lowercase letters, digits, `.` and `-` are accepted; uppercase and other characters are rejected. Wildcard and other query-syntax characters are treated literally."}))},Cv={clusterId:xv,search:t.Optional(t.String({pattern:I3,minLength:1,maxLength:Av,description:"Substring matched against the Kubernetes cluster name. Unlike Kubernetes resource names this is a collector-assigned identifier, so uppercase letters, digits, `.`, `-` and `_` are accepted. Wildcard and other query-syntax characters are treated literally."}))},Pv=t.Object(Xg),Uv=t.Object(Cv),Ws={...Xg,includeInternalNamespaces:t.Optional(t.Boolean({description:"When false or omitted, resources in internal namespaces (kube-system, kube-public, kube-node-lease, local-path-storage, gke-managed-*) are excluded."})),clusters:ar("Restrict results to these Kubernetes cluster names."),namespaces:ar("Restrict results to these namespaces."),teams:ar("Restrict results to these team names."),envs:ar("Restrict results to these environments."),exclusiveFilters:t.Optional(t.Array(t.Enum(Rv),{description:Cl})),...ae},S3=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],b3=[...Rv,"nodes","deployments","statefulsets","daemonsets","podStatus"],O3={...Ws,nodes:ar("Restrict results to pods scheduled on these nodes."),deployments:ar("Restrict results to pods owned by these Deployments."),statefulsets:ar("Restrict results to pods owned by these StatefulSets."),daemonsets:ar("Restrict results to pods owned by these DaemonSets."),podStatus:ar("Restrict results to pods whose resolved status matches any of these values. Typical values are the five Kubernetes phases plus Tsuga-derived CrashLoopBackOff and Error. Applied after stitching pod phase and container status reason telemetry, because phase is not a filterable metric attribute. When exclusiveFilters includes podStatus, keep pods whose status matches none of these values instead."),exclusiveFilters:t.Optional(t.Array(t.Enum(b3),{description:`${Cl} Excluding podStatus is applied after stitching pod phase and container status reason telemetry, because phase is not a filterable metric attribute.`}))},A3=["deployment","statefulset","daemonset"],wv=t.Object({kind:t.Enum(A3,{description:"Kind of Kubernetes workload associated with the pod. Derived from workload attributes in pod telemetry."}),name:t.String({description:"Name of the workload associated with the pod. Derived from workload attributes in pod telemetry."})},{description:"Kubernetes workload controller that owns the pod. Present when workload attributes are observed in pod telemetry."}),vv=t.Object({podName:t.String({description:"Name of the Kubernetes pod. Set when the pod is created."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the pod. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that reported the pod. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the pod. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the pod, such as production or staging. Present when an environment label or mapping is observed."})),node:t.Optional(t.String({description:"Kubernetes node currently or most recently running the pod. Present when node telemetry is observed."})),phase:t.Enum(S3,{description:"Current or most recently observed pod status. From pod status and container state telemetry. Values include the Kubernetes phases Pending, Running, Succeeded, Failed, and Unknown, plus Tsuga-derived CrashLoopBackOff and Error values."}),readyContainers:t.Integer({description:"Number of containers in the pod that are currently ready. From container readiness telemetry. Zero or greater."}),totalContainers:t.Integer({description:"Number of observed containers for the pod based on container readiness telemetry. Zero or greater."}),restarts:t.Integer({description:"Total restart count across containers in the pod. From container restart telemetry. Zero or greater."}),createdAt:t.Optional(S({description:"Timestamp from pod start time telemetry for the selected pod instance. Present when pod start time telemetry is observed."}))}),Jg=t.Object({...vv.properties,workload:t.Optional(wv),cpuUsageMilli:t.Optional(t.Number({description:"Recent pod CPU usage in millicores. Present when CPU usage telemetry is observed."})),cpuLimitMilli:t.Optional(t.Number({description:"Configured pod CPU limit in millicores, summed across observed containers. Present when a CPU limit is configured and observed."})),cpuRequestMilli:t.Optional(t.Number({description:"Configured pod CPU request in millicores, summed across observed containers. Present when a CPU request is configured and observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent pod memory usage in bytes. Present when memory usage telemetry is observed."})),memoryLimitBytes:t.Optional(t.Number({description:"Configured pod memory limit in bytes, summed across observed containers. Present when a memory limit is configured and observed."})),memoryRequestBytes:t.Optional(t.Number({description:"Configured pod memory request in bytes, summed across observed containers. Present when a memory request is configured and observed."})),cpuUtilization:t.Optional(t.Number({description:"Recent CPU usage divided by the configured CPU limit. Present when both usage and limit are observed."})),memoryUtilization:t.Optional(t.Number({description:"Recent memory usage divided by the configured memory limit. Present when both usage and limit are observed."})),cpuRequestUtilization:t.Optional(t.Number({description:"Recent CPU usage divided by the configured CPU request. Present when both usage and request are observed."})),memoryRequestUtilization:t.Optional(t.Number({description:"Recent memory usage divided by the configured memory request. Present when both usage and request are observed."}))}),x3=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],met=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/pods`,query:t.Object({...O3,sortBy:t.Optional(t.Enum(x3,{description:"Field to sort pods by."})),sortDirection:t.Optional(Q)}),paginated:!0,response:t.Array(Jg)}),R3=["teams","envs"],eh=t.Object({cluster:t.String({description:"Kubernetes cluster name from cluster telemetry."}),teams:t.Optional(t.Array(t.String(),{description:"Team metadata values observed on pods in non-default Kubernetes namespaces on the cluster. Present when team labels or mappings are observed."})),envs:t.Optional(t.Array(t.String(),{description:"Environment metadata values observed on pods in non-default Kubernetes namespaces on the cluster. Present when environment labels or mappings are observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Aggregate recent CPU usage for observed pods in the cluster, excluding default Kubernetes namespaces, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Aggregate recent memory usage for observed pods in the cluster, excluding default Kubernetes namespaces, in bytes. Present when memory usage telemetry is observed."})),readyNodes:t.Optional(t.Integer({description:"Number of Kubernetes nodes in the cluster that are ready. Present when node readiness telemetry is observed."})),podPhaseCounts:t.Optional(t.Object({Pending:t.Integer({description:"Number of observed pods currently in the Pending phase."}),Running:t.Integer({description:"Number of observed pods currently in the Running phase."}),Succeeded:t.Integer({description:"Number of observed pods currently in the Succeeded phase."}),Failed:t.Integer({description:"Number of observed pods currently in the Failed phase."}),Unknown:t.Integer({description:"Number of observed pods currently in the Unknown phase."})},{description:"Counts of observed pods by Kubernetes phase, excluding default Kubernetes namespaces. Present when pod phase telemetry is observed."}))}),C3=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],det=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/clusters`,query:t.Object({...Cv,teams:ar("Restrict to clusters that host workloads from these team names."),envs:ar("Restrict to clusters that host workloads in these environments."),exclusiveFilters:t.Optional(t.Array(t.Enum(R3),{description:Cl})),sortBy:t.Optional(t.Enum(C3,{description:"Field to sort clusters by."})),sortDirection:t.Optional(Q),...ae}),paginated:!0,response:t.Array(eh)}),P3=["clusters"],U3=["Ready","NotReady","Unknown"],th=t.Object({node:t.String({description:"Kubernetes node name from node telemetry."}),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the node. Present when cluster telemetry is observed."})),status:t.Optional(t.Enum(U3,{description:"Readiness of the node, derived from its Ready condition. Present when node condition telemetry is observed."})),instanceType:t.Optional(t.String({description:"Cloud instance type backing the node (for example `r7g.2xlarge`). Present when host telemetry is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods scheduled on the node, including pods in internal namespaces since they occupy node capacity. Present when pod telemetry is observed."})),allocatablePods:t.Optional(t.Integer({description:"Maximum number of pods the node can run. Present when node allocatable telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent CPU usage for the node, in millicores. Reported by the kubelet, so it is absent on nodes that only report cluster-level telemetry."})),cpuAllocatableMilli:t.Optional(t.Number({description:"CPU available to pods on the node, in millicores. Present when node allocatable telemetry is observed."})),cpuUtilization:t.Optional(t.Number({description:"Node CPU usage divided by allocatable CPU. Present when both usage and allocatable telemetry are observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent memory usage for the node, in bytes. Reported by the kubelet, so it is absent on nodes that only report cluster-level telemetry."})),memoryAllocatableBytes:t.Optional(t.Number({description:"Memory available to pods on the node, in bytes. Present when node allocatable telemetry is observed."})),memoryUtilization:t.Optional(t.Number({description:"Node memory usage divided by allocatable memory. Present when both usage and allocatable telemetry are observed."}))}),w3=["node","cluster","status","instanceType","pods","allocatablePods","cpuUsageMilli","cpuAllocatableMilli","cpuUtilization","memoryUsageBytes","memoryAllocatableBytes","memoryUtilization"],fet=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/nodes`,query:t.Object({...Xg,clusters:ar("Restrict results to these Kubernetes cluster names."),exclusiveFilters:t.Optional(t.Array(t.Enum(P3),{description:Cl})),sortBy:t.Optional(t.Enum(w3,{description:"Field to sort nodes by."})),sortDirection:t.Optional(Q),...ae}),paginated:!0,response:t.Array(th)}),rh=t.Object({namespace:t.String({description:"Kubernetes namespace name from namespace telemetry. Includes namespaces with no observed pods when namespace telemetry is observed."}),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the namespace. Present when cluster telemetry is observed."})),teams:t.Optional(t.Array(t.String(),{description:"Team metadata values observed in workloads in the namespace. Present when team labels or mappings are observed."})),envs:t.Optional(t.Array(t.String(),{description:"Environment metadata values observed in workloads in the namespace. Present when environment labels or mappings are observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods in the namespace. Present when pod telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Aggregate recent CPU usage for observed pods in the namespace, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Aggregate recent memory usage for observed pods in the namespace, in bytes. Present when memory usage telemetry is observed."}))}),v3=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],get=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/namespaces`,query:t.Object({...Ws,sortBy:t.Optional(t.Enum(v3,{description:"Field to sort namespaces by."})),sortDirection:t.Optional(Q)}),paginated:!0,response:t.Array(rh)}),nh=t.Object({deployment:t.String({description:"Kubernetes Deployment name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the Deployment. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the Deployment. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the Deployment. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the Deployment. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the Deployment. Present when pod telemetry and workload attributes are observed."})),availableReplicas:t.Optional(t.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed Deployment pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed Deployment pods, in bytes. Present when memory usage telemetry is observed."}))}),N3=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],het=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/deployments`,query:t.Object({...Ws,sortBy:t.Optional(t.Enum(N3,{description:"Field to sort deployments by."})),sortDirection:t.Optional(Q)}),paginated:!0,response:t.Array(nh)}),oh=t.Object({statefulSet:t.String({description:"Kubernetes StatefulSet name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the StatefulSet. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the StatefulSet. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the StatefulSet. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the StatefulSet. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the StatefulSet. Present when pod telemetry and workload attributes are observed."})),readyReplicas:t.Optional(t.Integer({description:"Number of ready StatefulSet replicas from StatefulSet status telemetry. Present when StatefulSet status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the StatefulSet. Present when StatefulSet spec telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed StatefulSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed StatefulSet pods, in bytes. Present when memory usage telemetry is observed."}))}),L3=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],yet=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/statefulsets`,query:t.Object({...Ws,sortBy:t.Optional(t.Enum(L3,{description:"Field to sort StatefulSets by."})),sortDirection:t.Optional(Q)}),paginated:!0,response:t.Array(oh)}),ih=t.Object({daemonSet:t.String({description:"Kubernetes DaemonSet name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the DaemonSet. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the DaemonSet. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the DaemonSet. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the DaemonSet. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the DaemonSet. Present when pod telemetry and workload attributes are observed."})),readyNodes:t.Optional(t.Integer({description:"Number of eligible nodes with a ready DaemonSet pod. Present when DaemonSet status telemetry is observed."})),desiredNodes:t.Optional(t.Integer({description:"Number of eligible nodes where the DaemonSet should run a pod. Present when DaemonSet status telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed DaemonSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed DaemonSet pods, in bytes. Present when memory usage telemetry is observed."}))}),k3=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],Tet=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/daemonsets`,query:t.Object({...Ws,sortBy:t.Optional(t.Enum(k3,{description:"Field to sort DaemonSets by."})),sortDirection:t.Optional(Q)}),paginated:!0,response:t.Array(ih)}),ah=t.Object({overview:t.Object({...vv.properties,workload:t.Optional(wv)},{description:"Pod identity, status, and owning workload, derived from recent pod metrics."}),healthMetrics:t.Object({cpu:t.Object({usage:t.String({description:"Metric name callers can use to query pod CPU usage. This is not the current CPU value."}),limit:t.String({description:"Metric name callers can use to query configured container CPU limits for the pod. This is not the current CPU limit value."}),request:t.String({description:"Metric name callers can use to query configured container CPU requests for the pod. This is not the current CPU request value."})},{description:"Metric names for pod CPU usage and for configured container CPU limits and requests."}),memory:t.Object({usage:t.String({description:"Metric name callers can use to query pod memory usage. This is not the current memory value."}),limit:t.String({description:"Metric name callers can use to query configured container memory limits for the pod. This is not the current memory limit value."}),request:t.String({description:"Metric name callers can use to query configured container memory requests for the pod. This is not the current memory request value."})},{description:"Metric names for pod memory usage and for configured container memory limits and requests."})},{description:"Metric names callers can use to query pod CPU and memory telemetry. These are fixed metric identifiers, not current values."}),searchFilters:t.Object({logs:t.String({description:"TQL log search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."}),traces:t.String({description:"TQL trace search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."})},{description:"TQL filters scoped to this pod, ready to use as the query for log and trace search."})}),Nv=t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),podName:p({allowEmpty:!1})}),Eet=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/pod-details`,query:Nv,response:ah}),sh=t.Object({configuration:t.Optional(t.Object({spec:t.Record(t.String(),t.Unknown(),{description:"Kubernetes PodSpec from the latest observed pod manifest. Fields outside `object.spec` are stripped."}),lastObservedAt:S({description:"Timestamp when Tsuga last observed the pod manifest used for configuration."})},{description:"Pod configuration from the latest observed pod manifest. Present when a pod manifest log is found for the pod."})),labels:t.Record(t.String(),t.String(),{description:"Kubernetes labels on the pod from the latest observed pod manifest. Key-value strings."}),annotations:t.Record(t.String(),t.String(),{description:"Kubernetes annotations on the pod from the latest observed pod manifest. Key-value strings."}),deletedAt:t.Optional(S({description:"Timestamp when Tsuga last observed the pod deletion event. Present when the latest observed pod event is deleted."}))}),_et=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/pod-manifest`,query:Nv,response:sh}),ch=t.Object({podName:t.String({description:"Name of a pod instance associated with the workload. Resolved from recent pod usage telemetry and workload attributes."}),podUid:t.Optional(t.String({description:"Kubernetes UID for the pod replica. Present when UID telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent CPU usage for the pod replica, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent memory usage for the pod replica, in bytes. Present when memory usage telemetry is observed."}))},{description:"A single pod instance with recent CPU or memory telemetry for the workload, resolved from pod usage telemetry and workload attributes."}),ph=t.Object({overview:t.Object({deploymentName:t.String({description:"Kubernetes Deployment name for this detail response."}),namespace:t.Optional(t.String({description:"Kubernetes namespace for this detail response. Present when any deployment signal is found."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name for this detail response. Present when any deployment signal is found."})),team:t.Optional(t.String({description:"Team metadata from the Deployment available-replica metric. Present when the metric includes team metadata."})),env:t.Optional(t.String({description:"Environment metadata from the Deployment available-replica metric. Present when the metric includes environment metadata."})),availableReplicas:t.Optional(t.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),latestRevisionAt:t.Optional(S({description:"Latest ReplicaSet metadata.creationTimestamp observed for the Deployment. Present when ReplicaSet object telemetry is observed."}))}),podReplicas:t.Array(ch,{description:"Pod instances with recent CPU or memory telemetry for the Deployment. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({replicaSetName:t.String({description:"ReplicaSet name for a Deployment revision from workload telemetry."}),revision:t.Integer({description:"Deployment revision number from ReplicaSet annotations. Integer greater than or equal to zero."}),firstSeen:t.Optional(S({description:"ReplicaSet metadata.creationTimestamp from the latest observed ReplicaSet object. Present when creation time is observed."})),observedGeneration:t.Optional(t.Integer({description:"Latest generation observed for the ReplicaSet revision. Present when generation telemetry is observed."})),readyReplicas:t.Optional(t.Integer({description:"Number of ready replicas for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),replicas:t.Optional(t.Integer({description:"Total replica count for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),logsSearchFilter:t.String({description:"TQL log search filter scoped to this ReplicaSet revision. Built from cluster, namespace, and ReplicaSet identifiers."})}),{description:"Deployment rollout revisions from recent ReplicaSet object telemetry. Includes the latest observed event per ReplicaSet, excludes ReplicaSets whose latest observed spec.replicas is 0, and returns up to 8 revisions sorted by revision number descending."})}),Iet=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/deployment-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),deploymentName:p({allowEmpty:!1})}),response:ph}),M3=t.Object({overview:t.Object({statefulSetName:t.String(),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),team:t.Optional(t.String()),env:t.Optional(t.String()),readyReplicas:t.Optional(t.Integer()),desiredReplicas:t.Optional(t.Integer()),latestRevisionAt:t.Optional(S())}),podReplicas:t.Array(ch,{description:"Pod instances with recent CPU or memory telemetry for the StatefulSet. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({revisionName:t.String(),firstSeen:t.Optional(S())}))}),bet=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/statefulset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),statefulSetName:p({allowEmpty:!1})}),response:M3}),D3=t.Object({overview:t.Object({daemonSetName:t.String(),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),team:t.Optional(t.String()),env:t.Optional(t.String()),readyNodes:t.Optional(t.Integer()),desiredNodes:t.Optional(t.Integer()),latestRevisionAt:t.Optional(S())}),podReplicas:t.Array(ch,{description:"Pod instances with recent CPU or memory telemetry for the DaemonSet. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({observedGeneration:t.Integer(),firstSeen:t.Optional(S())}))}),Oet=d({tags:["kubernetes-explorer"],method:"GET",url:`${sr}/daemonset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),daemonSetName:p({allowEmpty:!1})}),response:D3});var Gr=`/${"v1"}/kubernetes-explorer`,Lv=t.Pick(Jg,["podName","namespace","cluster","team","env","node","phase","readyContainers","totalContainers","restarts","createdAt","workload","cpuUsageMilli","cpuLimitMilli","memoryUsageBytes","memoryLimitBytes","cpuUtilization","memoryUtilization"],{description:"A Kubernetes pod with its current phase, owning workload, and resource usage."}),G3={podName:"api-gateway-7d9f8c6b5-2xk4p",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",node:"ip-10-0-1-23.ec2.internal",phase:"Running",readyContainers:1,totalContainers:1,restarts:0,createdAt:"2024-01-15T12:34:56.000Z",workload:{kind:"deployment",name:"api-gateway"},cpuUsageMilli:125,cpuLimitMilli:500,memoryUsageBytes:134217728,memoryLimitBytes:536870912,cpuUtilization:.25,memoryUtilization:.25};Object.assign(Lv,{examples:[G3]});var kv=t.Pick(eh,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),$3={cluster:"prod-us-east",teams:["platform","payments"],envs:["production"],cpuUsageMilli:4200,memoryUsageBytes:8589934592,readyNodes:6,podPhaseCounts:{Pending:1,Running:42,Succeeded:3,Failed:0,Unknown:0}};Object.assign(kv,{examples:[$3]});var Mv=t.Pick(rh,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),F3={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(Mv,{examples:[F3]});var Dv=t.Pick(th,["node","cluster","status","instanceType","pods","allocatablePods","cpuUsageMilli","cpuAllocatableMilli","cpuUtilization","memoryUsageBytes","memoryAllocatableBytes","memoryUtilization"],{description:"A Kubernetes node with its readiness, instance type, and usage against what it can allocate to pods."}),j3={node:"ip-10-0-1-23.ec2.internal",cluster:"prod-us-east",status:"Ready",instanceType:"r7g.2xlarge",pods:25,allocatablePods:234,cpuUsageMilli:4e3,cpuAllocatableMilli:8e3,cpuUtilization:.5,memoryUsageBytes:4e9,memoryAllocatableBytes:16e9,memoryUtilization:.25};Object.assign(Dv,{examples:[j3]});var Gv=t.Pick(nh,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),q3={deployment:"api-gateway",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,availableReplicas:3,desiredReplicas:3,cpuUsageMilli:375,memoryUsageBytes:402653184};Object.assign(Gv,{examples:[q3]});var $v=t.Pick(oh,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),B3={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign($v,{examples:[B3]});var Fv=t.Pick(ih,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),H3={daemonSet:"otel-collector",namespace:"observability",cluster:"prod-us-east",team:"platform",env:"production",pods:6,readyNodes:6,desiredNodes:6,cpuUsageMilli:300,memoryUsageBytes:805306368};Object.assign(Fv,{examples:[H3]});var jv=t.Pick(ah,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),K3={overview:{podName:"api-gateway-7d9f8c6b5-2xk4p",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",node:"ip-10-0-1-23.ec2.internal",phase:"Running",readyContainers:1,totalContainers:1,restarts:0,createdAt:"2024-01-15T12:34:56.000Z",workload:{kind:"deployment",name:"api-gateway"}},healthMetrics:{cpu:{usage:"k8s.pod.cpu.usage",limit:"k8s.container.cpu_limit",request:"k8s.container.cpu_request"},memory:{usage:"k8s.pod.memory.usage",limit:"k8s.container.memory_limit",request:"k8s.container.memory_request"}},searchFilters:{logs:'context.k8s.cluster.name:"prod-us-east" AND context.k8s.namespace.name:"production" AND context.k8s.pod.name:"api-gateway-7d9f8c6b5-2xk4p"',traces:'context.k8s.cluster.name:"prod-us-east" AND context.k8s.namespace.name:"production" AND context.k8s.pod.name:"api-gateway-7d9f8c6b5-2xk4p"'}};Object.assign(jv,{examples:[K3]});var qv=t.Pick(sh,["configuration","labels","annotations","deletedAt"],{description:"Manifest-derived details for a single Kubernetes pod: the pod manifest spec, labels, and annotations from the pod's most recently observed manifest."}),z3={configuration:{spec:{restartPolicy:"Always",serviceAccountName:"api-gateway"},lastObservedAt:"2024-01-15T12:30:00.000Z"},labels:{app:"api-gateway","pod-template-hash":"7d9f8c6b5"},annotations:{"prometheus.io/scrape":"true"}};Object.assign(qv,{examples:[z3]});var Bv=t.Pick(ph,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),Y3={overview:{deploymentName:"api-gateway",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",availableReplicas:3,desiredReplicas:3,latestRevisionAt:"2024-01-15T12:00:00.000Z"},podReplicas:[{podName:"api-gateway-7d9f8c6b5-2xk4p",podUid:"a1b2c3d4-e5f6-7890-abcd-ef1234567890",cpuUsageMilli:125,memoryUsageBytes:134217728}],revisions:[{replicaSetName:"api-gateway-7d9f8c6b5",revision:7,firstSeen:"2024-01-15T12:00:00.000Z",observedGeneration:7,readyReplicas:3,replicas:3,logsSearchFilter:'context.k8s.cluster.name:"prod-us-east" context.k8s.namespace.name:"production" context.k8s.replicaset.name:"api-gateway-7d9f8c6b5"'}]};Object.assign(Bv,{examples:[Y3]});var Hv=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Tsuga cluster ID to target. Tsuga assigns it when a cluster is connected to the organization. Optional for single-cluster organizations and required for organizations with multiple clusters to scope the request to one cluster."}))}),Xi=t.Pick(Pv,["clusterId","search"]),V3=t.Pick(Uv,["clusterId","search"]),Kv=d({description:"Lists Kubernetes pods observed across the organization with their current phase, owning workload, and resource usage.",operationId:"listKubernetesPods",tags:["public","kubernetes-explorer"],method:"GET",url:`${Gr}/pods`,query:Xi,response:t.Array(Lv)}),zv=d({description:"Lists Kubernetes clusters observed across the organization with aggregate resource usage, node readiness, and pod phase counts.",operationId:"listKubernetesClusters",tags:["public","kubernetes-explorer"],method:"GET",url:`${Gr}/clusters`,query:V3,response:t.Array(kv)}),Yv=d({description:"Lists Kubernetes namespaces observed across the organization with pod counts and aggregate resource usage.",operationId:"listKubernetesNamespaces",tags:["public","kubernetes-explorer"],method:"GET",url:`${Gr}/namespaces`,query:Xi,response:t.Array(Mv)}),Vv=d({description:"Lists Kubernetes nodes observed across the organization with their readiness, instance type, and resource usage against allocatable capacity.",operationId:"listKubernetesNodes",tags:["public","kubernetes-explorer"],method:"GET",url:`${Gr}/nodes`,query:Xi,response:t.Array(Dv)}),Qv=d({description:"Lists Kubernetes deployments observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesDeployments",tags:["public","kubernetes-explorer"],method:"GET",url:`${Gr}/deployments`,query:Xi,response:t.Array(Gv)}),Wv=d({description:"Lists Kubernetes StatefulSets observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesStatefulSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${Gr}/statefulsets`,query:Xi,response:t.Array($v)}),Zv=d({description:"Lists Kubernetes DaemonSets observed across the organization with eligible-node readiness and aggregate resource usage.",operationId:"listKubernetesDaemonSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${Gr}/daemonsets`,query:Xi,response:t.Array(Fv)}),Xv=t.Object({...Hv.properties,k8sCluster:p({allowEmpty:!1,description:"Kubernetes cluster name that contains the pod. From cluster telemetry. Required to identify the pod because pod names are only unique within a namespace and cluster."}),k8sNamespace:p({allowEmpty:!1,description:"Kubernetes namespace that contains the pod. From pod metadata. Required to identify the pod because pod names are only unique within a namespace and cluster."}),podName:p({allowEmpty:!1,description:"Kubernetes pod name to retrieve. Set when the pod is created. Required to fetch pod details for the selected cluster and namespace."})}),Jv=d({description:"Retrieves metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and ready-to-use log and trace filters. Manifest configuration, labels, and annotations are served by the pod-manifest endpoint.",operationId:"getKubernetesPodDetails",tags:["public","kubernetes-explorer"],method:"GET",url:`${Gr}/pod-details`,query:Xv,response:jv}),eN=d({description:"Retrieves the manifest-derived details for a single Kubernetes pod: the pod manifest spec, labels, and annotations from the pod's most recently observed manifest.",operationId:"getKubernetesPodManifest",tags:["public","kubernetes-explorer"],method:"GET",url:`${Gr}/pod-manifest`,query:Xv,response:qv}),tN=d({description:"Retrieves detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions with ready-to-use log filters.",operationId:"getKubernetesDeploymentDetails",tags:["public","kubernetes-explorer"],method:"GET",url:`${Gr}/deployment-details`,query:t.Object({...Hv.properties,k8sCluster:p({allowEmpty:!1,description:"Kubernetes cluster name that contains the Deployment. From cluster telemetry. Required to identify the Deployment because names are only unique within a namespace and cluster."}),k8sNamespace:p({allowEmpty:!1,description:"Kubernetes namespace that contains the Deployment. From workload metadata. Required to identify the Deployment because names are only unique within a namespace and cluster."}),deploymentName:p({allowEmpty:!1,description:"Kubernetes Deployment name to retrieve. From workload telemetry. Required to fetch deployment details for the selected cluster and namespace."})}),response:Bv});var Q3="clusterId";function rN(e,r,n){let o=r.query.properties??{},i=Object.keys(o).filter(a=>a!==Q3);for(let a of i){let c=a.replace(/([A-Z])/g,"-$1").toLowerCase(),l=c.replace(/-/g,"_").toUpperCase(),m=o[a]?.description??"";n?e.requiredOption(`--${c} <${l}>`,m):e.option(`--${c} <${l}>`,m)}return i}function Go(e,r,n,o){let i=e.command(r).description(n.description??`List Kubernetes ${r}`),a=rN(i,n,!1);i.action(async c=>{let l={};for(let m of a)c[m]!==void 0&&(l[m]=c[m]);W(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function uh(e,r,n,o){let i=e.command(r).description(n.description??`Get Kubernetes ${r}`),a=rN(i,n,!0);i.action(async c=>{let l={};for(let m of a)l[m]=c[m];W(await o()(n,{query:l}))})}function nN(e,r){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");Go(n,"pods",Kv,r),Go(n,"clusters",zv,r),Go(n,"namespaces",Yv,r),Go(n,"nodes",Vv,r),Go(n,"deployments",Qv,r),Go(n,"statefulsets",Wv,r),Go(n,"daemonsets",Zv,r),uh(n,"pod-details",Jv,r),uh(n,"pod-manifest",eN,r),uh(n,"deployment-details",tN,r)}var W3=t.Union([t.Literal("scalar"),t.Literal("timeseries")]),Z3="/v0/promql",Pl=t.Object({query:p({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:kn,step:p({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:t.Optional(W3),executionOptions:Wd,shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),X3={query:'rate({"otel.trace.span_processor.spans"}[5m])',timeRange:{from:17822015e5,to:17822034e5},step:"1m",executionOptions:{parallelism:1,engine:"q"},clusterId:"cluster-abc"};Object.assign(Pl,{examples:[X3]});var jet=d({tags:["promql"],url:Z3,method:"POST",body:Pl,response:Ci});var J3=`/${"v1"}/promql`,eV=t.Object({...t.Pick(Pl,["query","step"]).properties,timeRange:Tt},{description:"PromQL range-query request. Send clusterId as a query parameter, not in this JSON body.",examples:[{query:'sum by ("context.service.name") (sum_over_time({"traces.span.metrics.calls", "span.kind"="SPAN_KIND_SERVER"}[5m]))',timeRange:{from:1782201500,to:1782203400},step:"1m"}]}),tV=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to query. Set by the client as the clusterId query parameter, not in the JSON body. Required when the organization has multiple clusters; omit only for single-cluster organizations. Unknown cluster IDs return 404."}))}),oN=d({description:"Runs a PromQL range query over Tsuga metric data and returns timeseries results. Authenticate with a bearer operation API key or OAuth access token that can read metrics. Send clusterId as a query parameter; multi-cluster organizations must provide it. See [How to write PromQL queries](/documentation/visualize/guides/how-to-write-promql-queries) for query syntax and examples.",operationId:"queryPromql",tags:["public","promql"],url:J3,method:"POST",body:eV,query:tV,response:$u});function iN(e,r){let n=e.command("promql").description("Run PromQL queries over metric data");yr(n,"query","Run a PromQL range query over metric data",oN,r)}var ea="/v0/dashboard-folders",ta=t.Object({id:t.String({description:"Tsuga-generated dashboard folder ID assigned when the folder is created. Use it as dashboard `folderId` or child-folder `parentFolderId`."}),name:t.String({description:"Display name of the dashboard folder. Set by the caller on create or update."}),owner:t.String({description:"ID of the team that owns the dashboard folder. Set by the caller on create or update and used for folder access control."}),parentFolderId:t.Optional(t.String({description:"ID of the top-level parent folder when this folder is nested. Set by the caller on create or update. Returned only for child folders; omitted for top-level folders."})),tags:ve,creator:t.Optional(pe),updater:t.Optional(pe),createdAt:S(),updatedAt:S()},{title:"DashboardFolder"}),lh=t.Object({...ta.properties,dashboardCount:t.Number({description:"Number of dashboards directly assigned to this folder that the caller can read. Returned only by folder list responses; callers without dashboard read access see 0."})}),Ul=t.Object({name:p({allowEmpty:!1,description:"Display name of the dashboard folder. Required and non-empty."}),owner:p({allowEmpty:!1,description:"ID of the team that owns the dashboard folder. Required and used for folder access control."}),parentFolderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"ID of the top-level folder to nest this folder under. Omit on create or pass null to create a top-level folder; omit on update to keep the current parent; pass null on update to move the folder to top level. Non-null values must name a readable top-level folder. Folders can be nested at most two levels deep."})),tags:De}),wl=t.Partial(t.Object({owners:ce(p({allowEmpty:!1}),{description:"Restrict results to dashboard folders owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard folder names or folder IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:t.Optional(t.Boolean({description:"If true, exclude dashboard folders matching this value instead of including them"}))},{description:"Text filter for dashboard folder names or IDs. Optional; `exclude: true` returns folders whose name and ID do not match the substring."}),tags:ce(Mt.items,{description:"Restrict results to dashboard folders that have at least one of the listed key/value tags",maxItems:50}),parentFolderId:t.Union([t.Null(),p({allowEmpty:!1})],{description:"Parent folder filter for dashboard folder query results. Optional; pass a folder ID to return the child folders nested directly under it, or null to return only top-level folders. Omit to return all folders."})},{description:"Optional filters applied to narrow the returned dashboard folders"})),Ji={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},mh=[Ji.OWNER,Ji.TAGS,Ji.DASHBOARD_COUNT,Ji.UPDATED_AT,Ji.NAME],rV=t.Partial(t.Object({...ae,filters:wl,sort:t.Object({by:t.Enum([...mh,Ji.IS_FAVORITE],{description:"Field to sort the returned dashboard folders by"}),direction:Q},{description:"Optional sorting applied to the returned dashboard folders"})})),att=d({tags:["dashboard-folders"],url:`${ea}/query`,method:"POST",paginated:!0,body:rV,response:t.Array(lh)}),stt=d({tags:["dashboard-folders"],url:`${ea}/:id`,method:"GET",params:t.Object({id:p()}),response:ta}),ctt=d({tags:["dashboard-folders"],url:ea,method:"POST",body:Ul,response:ta}),ptt=d({tags:["dashboard-folders"],url:`${ea}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ul,response:ta}),utt=d({tags:["dashboard-folders"],url:`${ea}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),ltt=d({tags:["dashboard-folders"],url:`${ea}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit(wl,["tags"]))}),response:kt});var Zs=`/${"v1"}/dashboard-folders`,vl=t.Pick(ta,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),aN={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(vl,{examples:[aN]});var sN=t.Pick(lh,["id","name","owner","parentFolderId","tags","dashboardCount"],{$id:"DashboardFolderWithDashboardCount",description:"Folder used to organize dashboards into a two-level hierarchy, including the number of readable dashboards it directly contains."}),nV={...aN,dashboardCount:10};Object.assign(sN,{examples:[nV]});var dh=t.Pick(Ul,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),oV={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(dh,{examples:[oV]});var iV=t.Object({by:t.Enum(mh,{description:"Field to sort the returned dashboard folders by: `owner` sorts by owning team name, `tags` sorts by tag key/value pairs, `dashboardCount` sorts by the number of readable dashboards directly in the folder, `updatedAt` sorts by last-updated timestamp, and `name` sorts alphabetically by folder name."}),direction:Q},{description:"Optional sorting applied to the returned dashboard folders"}),cN=t.Object({...qe,filters:t.Optional(t.Pick(wl,["owners","searchQuery","tags","parentFolderId"])),sort:t.Optional(iV)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),aV={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"Platform"},tags:{values:[{key:"team",value:"platform"}]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(cN,{examples:[aV]});var pN=d({description:"Queries dashboard folders visible to the authenticated operation key. Returns all folders unless the `parentFolderId` filter is set: pass a folder ID to select the children of that folder, or null to return only top-level folders. Results are ordered by most recently updated folder first unless `sort` is set, and include the number of readable dashboards directly assigned to each folder. Use filters to narrow by owning team, name or ID substring, or tags.",operationId:"queryDashboardFolders",tags:["dashboard-folders"],url:`${Zs}/query`,method:"POST",paginated:!0,body:cN,response:t.Array(sN)}),uN=d({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${Zs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to retrieve. Use the `id` returned by folder list, get, create, or update responses."})}),response:vl}),lN=d({description:"Creates a dashboard folder owned by the specified team. To create a child folder, set `parentFolderId` to a readable top-level folder.",operationId:"createDashboardFolder",tags:["dashboard-folders"],url:Zs,method:"POST",body:dh,response:vl}),mN=d({description:"Updates an existing dashboard folder by ID. Send the folder name, owner, tags, and parent relationship; omit `parentFolderId` to keep the current parent or send null to move the folder to top level.",operationId:"updateDashboardFolder",tags:["dashboard-folders"],url:`${Zs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to update. Use the `id` returned by folder list, get, create, or update responses."})}),body:dh,response:vl}),dN=d({description:"Deletes an empty dashboard folder by ID. The request fails if the folder still contains dashboards or child folders; dashboards and child folders are not moved or deleted automatically.",operationId:"deleteDashboardFolder",tags:["dashboard-folders"],url:`${Zs}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to delete. Use the `id` returned by folder list, get, create, or update responses."})}),response:v});var $r="/v0/dashboards",gN=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],sV=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],wtt=[...sV,"note","slo"];var cV=["ns","us","ms","s","m","h","days"];var pV=["B","KB","MB","GB","TB","PB"];var uV=20;var hN=t.Object({type:t.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),yN=t.Object({type:t.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:t.Enum(cV,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),TN=t.Object({type:t.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:t.Enum(pV,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),EN=t.Object({type:t.Literal("percent",{description:"Formats numeric values as percentages. Use it when the raw value is already on a 0-100 scale, for example `25` to display `25%`."})},{$id:"DataNormalizerPercent",title:"Percent"}),_N=t.Object({type:t.Literal("percent-fraction",{description:"Formats numeric values as percentages. Use it when the raw value is a 0-1 fraction; Tsuga multiplies the value by 100 for display, for example `0.2` to display `20%`."})},{$id:"DataNormalizerPercentFraction",title:"Percent Fraction"}),IN=t.Object({type:t.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),SN=t.Object({type:t.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),bN=t.Object({type:t.Literal("none",{description:"Displays raw values without a unit. Records an explicit removal of the unit, so it is not re-derived from metric metadata"})},{$id:"DataNormalizerNone",title:"None"}),lV=t.Object({type:t.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:t.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"}),mV=t.Object({type:t.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:t.String({description:"Text label describing the custom unit. Must not be empty.",minLength:1,maxLength:uV})},{$id:"InputDataNormalizerCustom",title:"Custom"}),Ut=x("type",[yN,TN,EN,_N,IN,SN,hN,bN,lV],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),wt=x("type",[yN,TN,EN,_N,IN,SN,hN,bN,mV],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),fh=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(Ut)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),gh=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(wt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),ra=["background","no-background"],dV=["table","legend-only","no-legend"];var fV=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],ON=["alert","warning","success"],Fr=t.Object({operator:t.Enum(fV,{description:"Comparator used to evaluate the metric value"}),value:t.Number({description:"Threshold value used when evaluating the operator"}),color:t.Enum(ON,{description:"Color applied when the condition is met"})},{title:"ConditionalFormatting",description:"Color rule evaluated against the displayed value. The first matching rule in the array is applied."}),gV=t.Object({value:t.Number({description:"Y-axis value where the threshold marker is placed"}),level:t.Enum(ON,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),hV=["sec","min","hour","day"],zn=t.Object({time:t.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:t.Enum(hV,{description:"Unit used to measure the bucket width"})},{description:"Time bucket width for time-based chart widgets. Optional; when present, `time` and `metric` together define the bucket width."});var Kn=t.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),na=t.Object({formula:t.Optional(t.String({description:"Optional alias for formula (only used for display in the UI)"})),queries:t.Optional(t.Record(t.String(),t.String({description:'Display name for this query series in the legend, keyed by the zero-based query index as a string ("0" = first query, "1" = second, and so on). This differs from `formula`, which references queries as "q1", "q2". Omit to fall back to an auto-generated label like "Count on <filter>".'}),{description:"Display names for individual query series, keyed by the zero-based query index as a string."}))},{description:"Display names used for the formula series and the individual query series instead of auto-generated labels."}),oa=t.Object({formula:t.Optional(p({type:"short",description:"Optional alias for formula (only used for display in the UI)"})),queries:t.Optional(t.Record(t.String(),p({type:"short",description:'Display name for this query series in the legend, keyed by the zero-based query index as a string ("0" = first query, "1" = second, and so on). This differs from `formula`, which references queries as "q1", "q2". Omit to fall back to an auto-generated label like "Count on <filter>".'}),{description:"Display names for individual query series, keyed by the zero-based query index as a string."}))},{description:"Display names used for the formula series and the individual query series instead of auto-generated labels."}),Ll={source:Vt,queries:LR,formula:t.Optional(Gu),aliases:t.Optional(na),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},kl={source:Vt,queries:xs,formula:t.Optional(Oo),aliases:t.Optional(oa),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},jr=t.Optional(t.Enum(["relative","absolute"],{description:"`absolute` keeps each group at its own value; `relative` shows it as a percentage of the ungrouped total (defaults to absolute)"})),ia={...Ll,groupBy:t.Optional(Pi)},aa={...kl,groupBy:t.Optional(Xr)},ze=t.Enum(dV,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),Ee=t.Optional(t.Union([t.Number(),t.Literal("max")],{description:"Display precision for numeric labels, tooltips, tables, and scalar values. Use a number of decimal places to round displayed values, or `max` to display the full submitted precision."})),cr=t.Optional(t.Array(gV,{description:"Threshold markers displayed on the chart"})),yV=t.Object({name:t.String({description:"Display name of the table column"}),...Ll,source:Vt,normalizer:t.Optional(Ut),precision:Ee},{title:"TableColumn",description:"Table column backed by its own aggregation. `defaultSorting` and `columnSizes` reference it as `col-<index>`, using its zero-based position in `columns`."}),TV=t.Object({name:p({description:"Display name of the table column"}),...kl,source:Vt,normalizer:t.Optional(wt),precision:Ee},{title:"TableColumn",description:"Table column backed by its own aggregation. `defaultSorting` and `columnSizes` reference it as `col-<index>`, using its zero-based position in `columns`."}),EV=t.Array(t.Object({id:t.String({description:"ID of the column to sort by"}),desc:t.Boolean({description:"Whether the sort is descending"})},{title:"TableDefaultSorting"}),{description:"Default sorting applied to a table widget. Column IDs are `label` for the grouping column and `col-<index>` for each entry in `columns`. Users can still change sorting by selecting columns in the rendered table."}),_V=t.Array(t.Object({id:p({description:"ID of the column to sort by"}),desc:t.Boolean({description:"Whether the sort is descending"})},{title:"TableDefaultSorting"}),{description:"Default sorting applied to a table widget. Column IDs are `label` for the grouping column and `col-<index>` for each entry in `columns`. Users can still change sorting by selecting columns in the rendered table."}),hh=t.Array(t.Object({id:t.String({description:"Column attribute used for the default list sort. It matches an attribute in `listColumns` or a built-in list column for the selected list source."}),desc:t.Boolean({description:"Sort direction for the default list sort. `true` sorts descending; `false` sorts ascending."})},{title:"ListDefaultSorting"}),{description:"Default sorting applied to a list widget. Applies to log, span, or connection list widgets. Users can still change sorting by selecting columns in the rendered list."}),yh=t.Array(t.Object({id:p({description:"Column attribute used for the default list sort. Set this to an attribute in `listColumns` or a built-in list column for the selected list source."}),desc:t.Boolean({description:"Sort direction for the default list sort. Set `true` for descending order or `false` for ascending order."})},{title:"ListDefaultSorting"}),{description:"Default sorting applied to a list widget. Optional on create or update for log, span, or connection list widgets. Users can still change sorting by selecting columns in the rendered list."}),AN=["horizontal","vertical"],IV=t.Object({type:t.Literal("list",{description:"Displays matching logs in a tabular list"}),query:t.String({description:"Query that selects logs for the list"}),listColumns:t.Optional(t.Array(fh,{description:"Custom columns to display for each log"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets."})),defaultSorting:t.Optional(hh)},{$id:"GraphVisualizationList",title:"List"}),SV=t.Object({type:t.Literal("list",{description:"Displays matching logs in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects logs for the list"}),listColumns:t.Optional(t.Array(gh,{description:"Custom columns to display for each log"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(yh)},{$id:"InputGraphVisualizationList",title:"List"}),Nl=x("type",[t.Object({type:t.Literal("auto",{description:"Automatically choose this axis bound"})}),t.Object({type:t.Literal("number",{description:"Use a fixed numeric axis bound"}),value:t.Number({description:"Fixed numeric axis bound value"})})],{description:"Axis bound mode: automatic or fixed numeric value"}),sa=t.Object({min:Nl,max:Nl,scale:x("type",[t.Object({type:t.Literal("pow",{description:"Power scale"}),exponent:t.Number({description:"Exponent used by the power scale"})}),t.Object({type:t.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:t.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets."}),ca=t.Object({min:Nl,max:Nl,scale:x("type",[t.Object({type:t.Literal("pow",{description:"Power scale"}),exponent:t.Number({minimum:0,description:"Exponent used by the power scale"})}),t.Object({type:t.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:t.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets. Optional on create or update."}),bV=t.Array(t.Integer({description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"}),OV=t.Array(t.Integer({minimum:0,maximum:100,description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"});var AV=["regular","dashed"],pa=t.Record(t.String(),t.Object({groupId:t.String(),lineStyle:t.Enum(AV)}),{description:"Line style of each series, keyed by 1-based query index. The last index is the formula when there is one. For widgets with a single query, only the `1` entry is read and it applies to every series. Defaults to regular."}),xV=t.Object({type:t.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(ze),thresholds:cr,yAxisSettings:t.Optional(sa),lineStyleOptions:t.Optional(pa)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),RV=t.Object({type:t.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(ze),thresholds:cr,yAxisSettings:t.Optional(ca),lineStyleOptions:t.Optional(pa)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),CV=t.Object({type:t.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),query:t.String({description:"The read-only SQL query to execute against the connection."}),listColumns:t.Optional(t.Array(fh,{description:"Custom columns to display for each database row"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets."})),defaultSorting:t.Optional(hh)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),PV=t.Object({type:t.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),query:p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),listColumns:t.Optional(t.Array(gh,{description:"Custom columns to display for each database row"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(yh)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),UV=t.Object({type:t.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."}))},{$id:"GraphVisualizationTopListConnection",title:"TopListConnection"}),wV=t.Object({type:t.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1})},{$id:"InputGraphVisualizationTopListConnection",title:"TopListConnection"}),vV=t.Object({type:t.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(ze)},{$id:"GraphVisualizationPieConnection",title:"PieConnection"}),NV=t.Object({type:t.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),LV=t.Object({type:t.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(ze),thresholds:cr,yAxisSettings:t.Optional(sa)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),kV=t.Object({type:t.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(ze),thresholds:cr,yAxisSettings:t.Optional(ca)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),MV=t.Object({type:t.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),backgroundMode:t.Optional(t.Enum(ra,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(Ut),legendMode:t.Optional(ze)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),DV=t.Object({type:t.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),backgroundMode:t.Optional(t.Enum(ra,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(wt),legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),GV=t.Object({type:t.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:t.String({description:"Tsuga query that selects logs to cluster into patterns"}),layout:t.Optional(t.Enum(AN,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),$V=t.Object({type:t.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:p({type:"tsuga-query",description:"Tsuga query that selects logs to cluster into patterns"}),layout:t.Optional(t.Enum(AN,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),FV=t.Object({type:t.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:t.String({description:"Query that selects trace spans for the list"}),listColumns:t.Optional(t.Array(fh,{description:"Custom columns to display for each span"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets."})),defaultSorting:t.Optional(hh)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),jV=t.Object({type:t.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects trace spans for the list"}),listColumns:t.Optional(t.Array(gh,{description:"Custom columns to display for each span"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(yh)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),Xs=t.Array(t.String({description:"Raw PromQL expression for this widget, returned exactly as stored."}),{description:"PromQL expressions configured for this widget. PromQL-backed widgets require at least one query."}),Js=t.Array(p({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),qV=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Xs,aliases:t.Optional(na),timeBucket:t.Optional(zn),normalizer:t.Optional(Ut),precision:Ee,legendMode:t.Optional(ze),thresholds:cr,yAxisSettings:t.Optional(sa),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:t.Optional(pa)},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),BV=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Js,aliases:t.Optional(oa),timeBucket:t.Optional(zn),normalizer:t.Optional(wt),precision:Ee,legendMode:t.Optional(ze),thresholds:cr,yAxisSettings:t.Optional(ca),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:t.Optional(pa)},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),HV=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Xs,aliases:t.Optional(na),backgroundMode:t.Optional(t.Enum(ra,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(Ut),legendMode:t.Optional(ze)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),KV=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Js,aliases:t.Optional(oa),backgroundMode:t.Optional(t.Enum(ra,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(wt),legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),zV=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Xs,aliases:t.Optional(na),normalizer:t.Optional(Ut),precision:Ee,conditions:t.Optional(t.Array(Fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),YV=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Js,aliases:t.Optional(oa),normalizer:t.Optional(wt),precision:Ee,conditions:t.Optional(t.Array(Fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),VV=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Xs,aliases:t.Optional(na),normalizer:t.Optional(Ut),precision:Ee,legendMode:t.Optional(ze)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),QV=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Js,aliases:t.Optional(oa),normalizer:t.Optional(wt),precision:Ee,legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),WV=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Xs,aliases:t.Optional(na),timeBucket:t.Optional(zn),precision:Ee,normalizer:t.Optional(Ut),thresholds:cr,legendMode:t.Optional(ze),yAxisSettings:t.Optional(sa)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),ZV=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Js,aliases:t.Optional(oa),timeBucket:t.Optional(zn),precision:Ee,normalizer:t.Optional(wt),thresholds:cr,legendMode:t.Optional(ze),yAxisSettings:t.Optional(ca)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),XV=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...ia,groupByMode:jr,timeBucket:t.Optional(zn),normalizer:t.Optional(Ut),precision:Ee,legendMode:t.Optional(ze),thresholds:cr,yAxisSettings:t.Optional(sa),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:t.Optional(pa)},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),JV=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...aa,groupByMode:jr,timeBucket:t.Optional(zn),normalizer:t.Optional(wt),precision:Ee,legendMode:t.Optional(ze),thresholds:cr,yAxisSettings:t.Optional(ca),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:t.Optional(pa)},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),xN="Requests stacked rendering for a top-list widget. Tsuga renders stacked rows only for one count or sum query with exactly two grouped fields, no formula, non-negative values, and a single-cluster context; otherwise the widget renders as a normal top list.",e9=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...ia,groupByMode:jr,normalizer:t.Optional(Ut),precision:Ee,conditions:t.Optional(t.Array(Fr,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:t.Optional(t.Boolean({description:xN}))},{$id:"GraphVisualizationTopList",title:"TopList"}),t9=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...aa,groupByMode:jr,normalizer:t.Optional(wt),precision:Ee,conditions:t.Optional(t.Array(Fr,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:t.Optional(t.Boolean({description:xN}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),r9=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...ia,groupByMode:jr,normalizer:t.Optional(Ut),precision:Ee,legendMode:t.Optional(ze)},{$id:"GraphVisualizationPie",title:"Pie"}),n9=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...aa,groupByMode:jr,normalizer:t.Optional(wt),precision:Ee,legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationPie",title:"Pie"}),o9=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Ll,backgroundMode:t.Optional(t.Enum(ra,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(Ut),legendMode:t.Optional(ze)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),i9=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...kl,backgroundMode:t.Optional(t.Enum(ra,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(wt),legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),a9=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...ia,groupByMode:jr,timeBucket:t.Optional(zn),precision:Ee,normalizer:t.Optional(Ut),thresholds:cr,legendMode:t.Optional(ze),yAxisSettings:t.Optional(sa)},{$id:"GraphVisualizationBar",title:"Bar"}),s9=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...aa,groupByMode:jr,timeBucket:t.Optional(zn),precision:Ee,normalizer:t.Optional(wt),thresholds:cr,legendMode:t.Optional(ze),yAxisSettings:t.Optional(ca)},{$id:"InputGraphVisualizationBar",title:"Bar"}),RN='Attribute that switches the count to "Groups" mode: records are grouped by this attribute, the aggregation produces one value per group, and the chart buckets those per-group values. When omitted, individual records are bucketed.',CN=t.String({description:RN}),PN=p({description:RN}),c9=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...ia,group:t.Optional(CN),precision:Ee,normalizer:t.Optional(Ut),percentileMarkers:t.Optional(bV),boundsScale:t.Optional(Du)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),p9=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...aa,group:t.Optional(PN),precision:Ee,normalizer:t.Optional(wt),percentileMarkers:t.Optional(OV),boundsScale:t.Optional(Du)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),UN=["red","pink","violet","blue","cyan","green","yellow","orange"],wN=t.Enum(UN,{description:"Color palette used to render the heatmap intensity gradient"}),u9=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...ia,group:t.Optional(CN),precision:Ee,normalizer:t.Optional(Ut),palette:t.Optional(wN)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),l9=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...aa,group:t.Optional(PN),precision:Ee,normalizer:t.Optional(wt),palette:t.Optional(wN)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),vN=t.Object({from:t.Number({description:"Lower bound of the Gauge color threshold; runs up to the next threshold or the max"}),color:t.Enum(UN,{description:"Color applied to the band starting at this value"})},{title:"GaugeColorThreshold",description:"Color band of the gauge range. Bands are ordered by `from`, so entries may be listed in any order."}),m9=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Ll,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(vN,{description:"Color thresholds inside the gauge range"})),precision:Ee,normalizer:t.Optional(Ut)},{$id:"GraphVisualizationGauge",title:"Gauge"}),d9=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...kl,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(vN,{description:"Color thresholds inside the gauge range"})),precision:Ee,normalizer:t.Optional(wt)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),f9=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(yV,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Pi),groupByMode:jr,defaultSorting:t.Optional(EV),columnSizes:t.Optional(t.Record(t.String(),t.Number({description:"Column width by column id"}),{description:"Table column widths in pixels, keyed by column id: `label` for the grouping column and `col-<index>` for each entry in `columns`. Columns without an entry keep their default width."}))},{$id:"GraphVisualizationTable",title:"Table"}),g9=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(TV,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Xr),groupByMode:jr,defaultSorting:t.Optional(_V),columnSizes:t.Optional(t.Record(t.String(),t.Number({description:"Column width by column id"}),{description:"Table column widths in pixels, keyed by column id: `label` for the grouping column and `col-<index>` for each entry in `columns`. Columns without an entry keep their default width."}))},{$id:"InputGraphVisualizationTable",title:"Table"}),h9=t.Object({type:t.Literal("note",{description:"Displays static text on the dashboard"}),note:t.Optional(t.String({description:"Markdown-compatible text shown in the note"})),noteColor:t.Optional(t.Enum(gN,{description:"Background color used to render the note"})),noteAlign:t.Optional(Kn),noteJustifyContent:t.Optional(Kn)},{$id:"GraphVisualizationNote",title:"Note"}),y9=t.Object({type:t.Literal("note",{description:"Displays static text on the dashboard"}),note:t.Optional(p({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:t.Optional(t.Enum(gN,{description:"Background color used to render the note"})),noteAlign:t.Optional(Kn),noteJustifyContent:t.Optional(Kn)},{$id:"InputGraphVisualizationNote",title:"Note"}),T9=t.Object({type:t.Literal("slo-uptime",{description:"Displays the SLI percentage of an SLO computed over the dashboard time range, colored against the SLO target. Experimental."}),sloId:t.String({description:"Id of the SLO to display"})},{$id:"GraphVisualizationSloUptime",title:"SloUptime"}),E9=t.Object({type:t.Literal("slo-uptime",{description:"Displays the SLI percentage of an SLO computed over the dashboard time range, colored against the SLO target. Experimental."}),sloId:p({allowEmpty:!1,description:"Id of the SLO to display"})},{$id:"InputGraphVisualizationSloUptime",title:"SloUptime"}),_9=t.Object({type:t.Literal("slo-over-time",{description:"Displays the good and bad events, or the per-slice status, of an SLO over the dashboard time range. Experimental."}),sloId:t.String({description:"Id of the SLO to display"})},{$id:"GraphVisualizationSloOverTime",title:"SloOverTime"}),I9=t.Object({type:t.Literal("slo-over-time",{description:"Displays the good and bad events, or the per-slice status, of an SLO over the dashboard time range. Experimental."}),sloId:p({allowEmpty:!1,description:"Id of the SLO to display"})},{$id:"InputGraphVisualizationSloOverTime",title:"SloOverTime"}),S9=x("type",[xV,CV,UV,vV,LV,MV,qV,HV,zV,VV,WV,XV,e9,r9,o9,m9,a9,c9,u9,f9,IV,h9,GV,FV,T9,_9],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),b9=x("type",[RV,PV,wV,NV,kV,DV,BV,KV,YV,QV,ZV,JV,t9,n9,i9,d9,s9,p9,l9,g9,SV,y9,$V,jV,E9,I9],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),Ml=t.Object({id:t.String({description:"Unique identifier of the graph widget inside the dashboard. Set by the caller when the graph is created; use it to target the graph in later update requests."}),name:t.Optional(t.String({description:"Display name of the graph widget."})),description:t.Optional(t.String({description:"Optional text shown with the graph widget."})),descriptionAlign:t.Optional(Kn),descriptionJustifyContent:t.Optional(Kn),visualization:S9,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid. Dashboard validation uses this with `h` and the widget type to reject layouts below the widget minimum."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall. Dashboard validation uses this with `w` and the widget type to reject layouts below the widget minimum."})},{description:`Grid position and size of the widget. Optional; when provided, the size must be at least ${Xd}\xD7${Jd} (width\xD7height) grid units, except note widgets which can go down to 1\xD71.`}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),Dl=t.Object({id:p({description:"Unique identifier of the graph widget inside the dashboard. Assign it when the graph is created; use it to target the graph in later update requests."}),name:t.Optional(p({description:"Display name of the graph widget."})),description:t.Optional(t.String({minLength:1,maxLength:800,description:"Text shown with the graph widget."})),descriptionAlign:t.Optional(Kn),descriptionJustifyContent:t.Optional(Kn),visualization:b9,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid. Dashboard validation uses this with `h` and the widget type to reject layouts below the widget minimum."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall. Dashboard validation uses this with `w` and the widget type to reject layouts below the widget minimum."})},{description:`Grid position and size of the widget. Optional; when provided, the size must be at least ${Xd}\xD7${Jd} (width\xD7height) grid units, except note widgets which can go down to 1\xD71.`}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),fN=10,O9=t.Array(t.Object({key:t.String({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:t.Array(t.String({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:t.Optional(t.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{description:"Dashboard-wide filters applied to every widget on the dashboard."}),A9=t.Array(t.Object({key:p({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:t.Array(p({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:t.Optional(t.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{maxItems:fN,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${fN} filters are allowed.`}),ua=t.Object({id:t.String({description:"Tsuga-generated dashboard ID assigned when the dashboard is created."}),name:t.String({description:"Display name of the dashboard. Set by the caller on create or update."}),owner:t.String({description:"ID of the team that owns the dashboard. Set by the caller on create or update and used for dashboard access control."}),graphs:t.Array(Ml,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(O9),createdAt:S({description:"Timestamp when Tsuga created the dashboard."}),updatedAt:S({description:"Timestamp when Tsuga last updated the dashboard."}),creator:t.Optional(pe),updater:t.Optional(pe),tags:ve,timePreset:t.Optional(t.Enum(pm,{description:"Relative time preset used when opening the dashboard."})),folderId:t.Optional(t.String({description:"Folder that contains the dashboard. Set from the dashboard's saved folder relationship. Returned when the dashboard is in a folder; omitted when it is not."}))}),Gl=t.Object({name:p({description:"Display name of the dashboard."}),owner:p({allowEmpty:!1,description:"ID of the team that owns the dashboard. Required and used for dashboard access control."}),graphs:t.Array(Dl,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(A9),tags:De,timePreset:t.Optional(t.Enum(pm,{description:"Relative time preset used when opening the dashboard. Optional; create defaults to `past-30-minutes` when omitted, and update omission preserves the current value."})),folderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder that should contain the dashboard. Optional; omit on update to keep the current folder, pass null to clear the folder, or pass a readable dashboard-folder ID to move it."}))}),Tr={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},NN=[Tr.OWNER,Tr.TAGS,Tr.WIDGET_COUNT,Tr.UPDATED_AT,Tr.NAME],$o=t.Partial(t.Object({owners:ce(p({allowEmpty:!1}),{description:"Restrict results to dashboards owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard names or dashboard IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:t.Optional(t.Boolean({description:"If true, exclude dashboards matching this value instead of including them"}))},{description:"Text filter for dashboard names or IDs. Optional; `exclude: true` returns dashboards whose name and ID do not match the substring."}),tags:ce(Mt.items,{description:"Restrict results to dashboards that have at least one of the listed key/value tags",maxItems:50}),folderId:t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder filter for dashboard query results. Optional; pass a folder ID to return dashboards in that folder, or null to return only dashboards that are not in any folder."})},{description:"Optional filters applied to narrow the returned dashboards"})),x9=t.Partial(t.Object({...ae,filters:$o,sort:t.Object({by:t.Enum([Tr.IS_FAVORITE,Tr.OWNER,Tr.TAGS,Tr.WIDGET_COUNT,Tr.UPDATED_AT,Tr.NAME],{description:"Field to sort the returned dashboards by"}),direction:Q},{description:"Optional sorting applied to the returned dashboards"})})),vtt=d({tags:["dashboards"],url:`${$r}/query`,method:"POST",paginated:!0,response:t.Array(ua),body:x9}),Ntt=d({tags:["dashboards"],url:`${$r}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit($o,["tags"]))}),response:kt}),Ltt=d({tags:["dashboards"],url:`${$r}/counts/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial($o))}),response:t.Object({all:t.Integer({description:"Total number of dashboards matching the filters that the user can read."})})}),ktt=d({tags:["dashboards"],url:`${$r}/:id`,method:"GET",params:t.Object({id:p()}),response:ua}),Mtt=d({tags:["dashboards"],url:$r,method:"POST",body:Gl,response:ua}),Dtt=d({tags:["dashboards"],url:`${$r}/:id`,method:"PATCH",params:t.Object({id:p()}),body:t.Partial(Gl),response:ua}),R9=Yt($o,{maxIds:100}),Gtt=d({tags:["dashboards"],url:`${$r}/bulk-update`,method:"PUT",body:t.Object({selection:R9,owner:t.Optional(p({allowEmpty:!1,description:"Owning team ID to apply to every dashboard. Optional when folderId is provided; omit to keep the current owner."})),folderId:Se(p({allowEmpty:!1}),{description:"Folder that should contain every dashboard. Optional when owner is provided; omit to keep the current folder, pass null to clear the folder, or pass a dashboard-folder ID to move dashboards."})}),response:t.Object({})}),$tt=d({tags:["dashboards"],url:`${$r}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),Ftt=d({tags:["dashboards"],url:`${$r}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1}),graphId:p({allowEmpty:!1})}),body:t.Omit(Dl,["id"]),response:Ml}),C9=Yt($o),jtt=d({tags:["dashboards"],url:`${$r}/bulk-delete`,method:"DELETE",body:t.Object({selection:C9}),response:t.Object({})});var la=`/${"v1"}/dashboards`,ec=t.Pick(ua,["id","name","owner","graphs","filters","tags","timePreset","folderId"],{$id:"Dashboard",description:"Saved visualization made of dashboard-wide filters and ordered graphs. Use dashboards to preserve reusable views for a team or workflow. See [Dashboards](/documentation/visualize/dashboards/index)."}),P9={id:"123-456-abc",name:"API Performance Overview",owner:"team-123-abc",graphs:[{id:"789-abc-def",name:"Request Latency P99",visualization:{type:"timeseries",source:"metrics",queries:[{aggregate:{type:"percentile",field:"duration",percentile:99},filter:"service:api-gateway"}]},layout:{x:0,y:0,w:6,h:4}}],filters:[{key:"env",values:["production"]}],tags:[{key:"team",value:"platform"}],timePreset:"past-1-hour"};Object.assign(ec,{examples:[P9]});var U9=t.Object({by:t.Enum([...NN],{description:"Field to sort the returned dashboards by: `owner` sorts by owning team ID, `tags` sorts by tag key/value pairs, `widgetCount` sorts by the number of graphs on the dashboard, `updatedAt` sorts by last-updated timestamp, and `name` sorts alphabetically by dashboard name."}),direction:Q},{description:"Optional sorting applied to the returned dashboards"}),LN=t.Object({...qe,filters:t.Optional(t.Pick($o,["owners","searchQuery","tags","folderId"])),sort:t.Optional(U9)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),w9={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"API"},tags:{values:[{key:"service",value:"api-gateway"}]},folderId:"folder-123-abc"},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(LN,{examples:[w9]});var kN=d({description:"Queries dashboards visible to the authenticated operation key. Use this endpoint to build dashboard inventories or synchronize dashboard metadata. Pagination fields limit the returned page; use the response metadata to request additional pages. See [Dashboards](/documentation/visualize/dashboards/index).",operationId:"queryDashboards",tags:["dashboards"],url:`${la}/query`,method:"POST",paginated:!0,body:LN,response:t.Array(ec)}),MN=d({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${la}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to retrieve. Use the `id` returned by dashboard query, create, or update responses."})}),response:ec}),Th=t.Pick(Gl,["name","owner","graphs","filters","tags","timePreset","folderId"],{description:"Dashboard create or update request. Provide the dashboard identity, owner team, widgets, filters, tags, and optional time preset."}),v9={name:"API Performance Overview",owner:"team-123-abc",graphs:[{id:"789-abc-def",name:"Request Latency P99",visualization:{type:"timeseries",source:"metrics",queries:[{aggregate:{type:"percentile",field:"duration",percentile:99},filter:"service:api-gateway"}]},layout:{x:0,y:0,w:6,h:4}}],filters:[{key:"env",values:["production"]}],tags:[{key:"team",value:"platform"}],timePreset:"past-1-hour",folderId:null};Object.assign(Th,{examples:[v9]});var N9=t.Omit(Dl,["id"],{description:"Dashboard graph update request. The graph identifier is supplied in the `graphId` path parameter; provide the replacement graph definition without an `id` field."}),DN=d({description:"Creates a dashboard owned by the specified team. Use this to provision dashboards from automation or templates. The response returns the saved dashboard definition.",operationId:"createDashboard",tags:["dashboards"],url:la,method:"POST",body:Th,response:ec}),GN=d({description:"Updates an existing dashboard by ID. Fields are patched from the request body; omitted fields keep their current values.",operationId:"updateDashboard",tags:["dashboards"],url:`${la}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to update. Use the `id` returned by dashboard query, get, or create responses."})}),body:t.Partial(Th),response:ec}),L9=t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to delete. Use the `id` returned by dashboard query, get, create, or update responses."})}),$N=d({description:"Deletes a dashboard by ID. Use only after confirming no users or automation still rely on the dashboard.",operationId:"deleteDashboard",tags:["dashboards"],url:`${la}/:id`,method:"DELETE",params:L9,response:v}),Qtt=d({description:"Updates one graph inside a dashboard without replacing the full dashboard. Use this for targeted widget edits when you already know the dashboard ID and graph ID.",operationId:"updateDashboardGraph",tags:["dashboards"],url:`${la}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard that contains the graph to update. Use the `id` returned by dashboard responses."}),graphId:p({allowEmpty:!1,description:"Identifier of the graph to update within the dashboard. Use graph IDs from the dashboard response."})}),body:N9,response:Ml});var FN=100,jN=3,ma=t.Object({id:t.String({description:"Tsuga-generated ingestion API key ID assigned when the key is created."}),name:t.String({description:"Human-readable key name. Names must be kebab-case when creating or updating keys."}),keyLastCharacters:t.String({description:"Last visible characters of the secret key. Use this to identify a key without exposing the full secret."}),owner:t.String({description:"Team ID that owns and manages the ingestion API key."}),tags:kt,teamOverrideFields:t.Optional(t.Array(t.String(),{description:"Telemetry attribute names used to override ownership for data sent with this key."})),updatedAt:S({description:"Timestamp when Tsuga last updated the key metadata."}),createdAt:S({description:"Timestamp when Tsuga created the key."}),creator:t.Optional(pe),updater:t.Optional(pe),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})}),tc=t.Object({name:t.String({format:Ti,minLength:1,maxLength:FN,description:`Kebab-case name for the ingestion API key. Maximum length is ${FN} characters.`}),owner:p({allowEmpty:!1,description:"Team ID that will own and manage the ingestion API key."}),tags:Mt,teamOverrideFields:t.Union([t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:jN,description:`Array form. Up to ${jN} fields are allowed.`}),t.Null({description:"Clear any existing team override fields."})],{description:"Telemetry attribute names used to override ownership for data sent with this key. Send null to clear existing override fields."})}),da="/v0/ingestion-api-keys",ort=d({tags:["ingestion-api-keys"],url:da,method:"POST",body:tc,response:t.Intersect([ma,t.Object({key:t.String({description:"Full secret value of the ingestion API key. Generated by Tsuga and returned only in this create response; subsequent get and list responses expose only `keyLastCharacters`. Store it immediately, since it cannot be retrieved again after this response."})})])}),irt=d({tags:["ingestion-api-keys"],url:da,method:"GET",paginated:!0,query:t.Object(ae),response:t.Array(ma)}),art=d({tags:["ingestion-api-keys"],url:`${da}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:ma}),srt=d({tags:["ingestion-api-keys"],url:`${da}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1})}),body:tc,response:ma}),crt=d({tags:["ingestion-api-keys"],url:`${da}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:v}),prt=d({tags:["ingestion-api-keys"],url:`${da}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p({allowEmpty:!1}),{uniqueItems:!0})}),response:t.Object({})});var rc=`/${"v1"}/ingestion-api-keys`,nc=t.Pick(ma,["id","name","owner","tags","teamOverrideFields","keyLastCharacters"],{$id:"IngestionApiKey",description:"API key used to send telemetry data to Tsuga. The full key secret is returned only when the key is created. See [API keys](/documentation/account-and-settings/api-keys)."}),qN={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(nc,{examples:[qN]});var BN=t.Pick(tc,["name","owner","tags","teamOverrideFields"],{$id:"CreateIngestionApiKeyRequest",description:"Ingestion API key creation request. Provide a kebab-case name, owner team, required tags, and required team override fields as an array of fields or null."}),HN=t.Pick(tc,["name","owner","tags","teamOverrideFields"],{$id:"UpdateIngestionApiKeyRequest",description:"Ingestion API key update request. Provide the full metadata definition, including name, owner team, tags, and team override fields."}),KN={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(BN,{examples:[KN]});Object.assign(HN,{examples:[KN]});var k9={...qN,key:"tsuga_in:v1:abc123xyx7Qm"},zN=d({description:"Lists ingestion API keys visible to the authenticated operation key. Use this to inventory telemetry intake keys, owners, tags, and team override fields. Pagination fields limit the returned page.",operationId:"listIngestionApiKeys",tags:["ingestion-api-keys"],url:rc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(nc)}),yrt=d({description:"Retrieves one ingestion API key by ID. The response never includes the full secret key value; only the last visible characters are returned.",operationId:"getIngestionApiKey",tags:["ingestion-api-keys"],url:`${rc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to retrieve. Use the `id` returned by ingestion API key list or create responses."})}),response:nc}),M9=t.Intersect([t.Pick(nc,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),t.Object({key:t.String({description:"Full Tsuga-generated ingestion API key secret. Returned only in the create response; list, get, and update responses expose only `keyLastCharacters`."})})],{title:"IngestionApiKeyCreated",example:k9}),YN=d({description:"Creates an ingestion API key for telemetry intake. Store the returned `key` immediately because Tsuga returns the full secret only in this response.",operationId:"createIngestionApiKey",tags:["ingestion-api-keys"],url:rc,method:"POST",body:BN,response:M9}),VN=d({description:"Updates ingestion API key metadata by ID, including name, owner, tags, and team override fields. The secret key value is not rotated by this operation.",operationId:"updateIngestionApiKey",tags:["ingestion-api-keys"],url:`${rc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to update. Use the `id` returned by ingestion API key list, get, or create responses."})}),body:HN,response:nc}),QN=d({description:"Deletes an ingestion API key by ID. Telemetry clients using the deleted key can no longer send data with it.",operationId:"deleteIngestionApiKey",tags:["ingestion-api-keys"],url:`${rc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to delete. Use the `id` returned by ingestion API key list, create, or update responses."})}),response:v});var D9={application:{webService:["azure_web_app","gcp_app_engine_service"]},data:{bucket:["aws_s3_bucket","gcp_bucket","azure_blob_storage_container"],messagingService:["aws_kinesis_data_stream","aws_sqs_queue","aws_sns_topic","azure_service_bus_namespace","azure_service_bus_queue","gcp_pubsub_topic","azure_event_grid_topic","azure_event_hub_namespace","azure_event_hub"],fileSystem:["aws_efs","azure_file_share"],contentDeliveryNetwork:["aws_cloudfront_distribution","gcp_cloud_cdn_configuration"],database:["aws_dynamodb_table","aws_elasticache","aws_rds_instance","azure_database_for_mysql_server","azure_database_for_postgres_server","azure_sql_database_server","azure_sql_database","gcp_bigtable_instance","gcp_cloud_sql_instance","gcp_firestore_database","gcp_spanner_instance","azure_cosmos_db_account"],storageAccount:["azure_storage_account"],volume:["aws_ebs_volume","gcp_compute_disk","azure_disk"]},compute:{virtualMachine:["aws_ec2_instance","gcp_compute_instance","azure_compute_virtual_machine"],serverless:["aws_lambda_function","gcp_cloud_run_function","gcp_cloud_run_job","gcp_cloud_run_service","azure_function_app"]},container:{kubernetesCluster:["aws_eks_cluster","gcp_gke_cluster","azure_aks_cluster"],containerRepository:["aws_ecr_repository","gcp_artifact_registry_repository","azure_container_registry"],containerCluster:["aws_ecs_cluster"],containerServiceTask:["aws_ecs_task"],containerService:["aws_ecs_service","azure_container_instance_group"],containerImage:["aws_ecr_image","gcp_artifact_registry_docker_image","azure_container_registry_image"]},network:{virtualNetwork:["aws_vpc","gcp_vpc","azure_virtual_network"],loadBalancer:["aws_elastic_load_balancer","gcp_forwarding_rule","azure_load_balancer","azure_traffic_manager_profile"],targetGroup:["aws_target_group"],certificate:["aws_acm_certificate","gcp_certificate_manager_certificate","azure_app_service_certificate"]}},[Irt,$l,oc]=G9(D9),Srt=Object.fromEntries($l.map(e=>[e,e]));function G9(e){let r=[],n=[],o=[],i=Object.keys(e);for(let a of i){r.push(a);let c=e[a];for(let l in c){n.push(l);let m=c[l];Array.isArray(m)&&o.push(...m)}}return[Eh(r),Eh(n),Eh(o)]}function Eh(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var _h=t.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),$9=t.Object({versioningStatus:t.Optional(t.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),F9=t.Object({domainName:t.Optional(t.String()),origins:t.Optional(t.Array(t.String()))}),j9=t.Object({allocatedStorageGib:t.Optional(t.Number()),encryptedAtRest:t.Optional(t.Boolean()),engine:t.Optional(t.String()),dynamoDbItemCount:t.Optional(t.Number()),dynamoDbActualSizeGib:t.Optional(t.Number())}),q9=t.Object({version:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnets:t.Optional(t.Array(t.String()))}),B9=t.Object({artifactRegistryFormat:t.Optional(t.Enum(["FORMAT_UNSPECIFIED","DOCKER","MAVEN","NPM","APT","YUM","PYTHON","KFP","GO","GENERIC"])),uri:t.Optional(t.String()),tagMutability:t.Optional(t.Enum(["MUTABLE","IMMUTABLE"])),scanOnPush:t.Optional(t.Boolean()),encryptionType:t.Optional(t.String())}),H9=t.Object({status:t.Optional(t.String()),activeServices:t.Optional(t.Number()),pendingTasks:t.Optional(t.Number()),runningTasks:t.Optional(t.Number()),registeredContainerInstances:t.Optional(t.Number()),capacityProviders:t.Optional(t.Array(t.String()))}),K9=t.Object({status:t.Optional(t.String()),desiredStatus:t.Optional(t.String()),healthStatus:t.Optional(t.String()),availabilityZone:t.Optional(t.String()),startedAt:t.Optional(S())}),z9=t.Object({isEncrypted:t.Optional(t.Boolean()),ownerId:t.Optional(t.String()),state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","updating"]))}),Y9=t.Object({type:t.Optional(t.String()),osType:t.Optional(t.String()),subnetIds:t.Optional(t.Array(t.String())),nbContainers:t.Optional(t.Number())}),V9=t.Object({digest:t.String(),imageTags:t.Array(t.String()),imageSizeBytes:t.Optional(t.Number()),imagePushedAt:t.Optional(S()),mediaType:t.Optional(t.String()),repositoryName:t.String(),repositoryId:t.Optional(t.String()),scanStatus:t.Optional(t.String())}),Q9=t.Object({url:t.Optional(t.String()),maxMessageSizeBytes:t.Optional(t.Number()),messageRetentionHours:t.Optional(t.Number())}),W9=t.Object({runtime:t.Optional(t.String()),memoryAllocationMib:t.Optional(t.Number()),timeoutMs:t.Optional(t.Number()),ephemeralStorageMib:t.Optional(t.Number({description:"Size of the temporary storage mounted on the function instance, in MiB. Only present for platforms that expose it, such as AWS Lambda."})),codeSha256:t.Optional(t.String())}),Z9=t.Object({kind:t.Optional(t.String())}),X9=t.Object({instanceId:t.String(),architecture:t.Optional(t.String()),instanceType:t.Optional(t.String()),operatingSystem:t.Optional(t.String()),memoryMib:t.Optional(t.Number()),vCpus:t.Optional(t.Number()),vpcId:t.Optional(t.String()),k8sClusterId:t.Optional(t.String())}),J9=t.Object({id:t.Optional(t.String()),ipCidrBlocks:t.Array(t.String())}),e6=t.Object({protocol:t.Optional(_h),port:t.Optional(t.Number()),instanceProtocol:t.Optional(_h),instancePort:t.Optional(t.Number())}),t6=t.Object({protocol:t.Optional(t.String()),ports:t.Optional(t.Array(t.String())),portRange:t.Optional(t.String()),allPorts:t.Optional(t.Boolean())}),r6=t.Object({name:t.String(),ip:t.Optional(t.String()),type:t.Enum(["public","private"])}),n6=t.Object({type:t.String(),name:t.String()}),o6=t.Object({frontendIp:t.Optional(r6),backendIpPools:t.Array(n6)}),i6=t.Object({targetId:t.String(),targetPort:t.Optional(t.Number()),targetType:t.Optional(t.Enum(["instance","ip","lambda","alb"])),healthState:t.Optional(t.String()),healthReason:t.Optional(t.String()),healthDescription:t.Optional(t.String()),availabilityZone:t.Optional(t.String())}),a6=t.Object({protocol:t.Optional(_h),port:t.Optional(t.Number()),type:t.Optional(t.Enum(["alb","lambda","instance","ip"])),name:t.Optional(t.String()),targetGroupArn:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),healthCheckProtocol:t.Optional(t.String()),healthCheckPort:t.Optional(t.String()),healthCheckPath:t.Optional(t.String()),healthCheckIntervalSeconds:t.Optional(t.Number()),healthCheckTimeoutSeconds:t.Optional(t.Number()),healthyThresholdCount:t.Optional(t.Number()),unhealthyThresholdCount:t.Optional(t.Number()),targets:t.Optional(t.Array(i6)),targetCount:t.Optional(t.Number()),healthyTargetCount:t.Optional(t.Number()),loadBalancerArns:t.Optional(t.Array(t.String()))}),s6=t.Object({first:t.Optional(t.String()),last:t.Optional(t.String()),scope:t.Optional(t.Number())}),c6=t.Object({type:t.Optional(t.String()),name:t.Optional(t.String()),alwaysServe:t.Optional(t.Boolean()),subnets:t.Optional(t.Array(t.Union([t.Number(),s6]))),target:t.Optional(t.String()),weight:t.Optional(t.Number()),priority:t.Optional(t.Number()),status:t.Optional(t.String())}),p6=t.Object({instanceId:t.Optional(t.String()),state:t.Optional(t.String()),reasonCode:t.Optional(t.String()),description:t.Optional(t.String())}),u6=t.Object({loadBalancerType:t.Optional(t.String()),dnsName:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnetIds:t.Array(t.String()),scheme:t.Optional(t.String()),listeners:t.Optional(t.Union([t.Array(e6),t.Array(t6)])),targets:t.Optional(t.Union([t.Array(t.String()),t.Array(p6),t.Array(c6)])),azureLoadBalancingRules:t.Optional(t.Array(o6))}),l6=t.Object({domainName:t.Optional(t.String()),expiresAt:t.Optional(S()),inUseBy:t.Optional(t.Array(t.String())),renewalEligibility:t.Optional(t.String()),revokedAt:t.Optional(S()),status:t.Optional(t.String()),type:t.Optional(t.String())}),m6=t.Object({state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","in-use"])),volumeType:t.Optional(t.Enum(["gp2","gp3","io1","io2","st1","sc1","standard"]))}),d6=t.Object({osType:t.Optional(t.Enum(["Windows","Linux"]))}),f6=t.Object({state:t.Optional(t.String()),volumeType:t.Optional(t.String())}),g6=t.Intersect([t.Object({isEncrypted:t.Optional(t.Boolean()),sizeGib:t.Optional(t.Number())}),t.Union([m6,f6,d6])]),h6=t.Object({instanceCount:t.Optional(t.Number()),hostnames:t.Optional(t.Array(t.String())),runtime:t.Optional(t.String())}),Fl=t.Union([t.Object({category:t.Literal("application"),resourceType:t.Literal("webService"),attributes:t.Optional(h6)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("bucket"),attributes:t.Optional($9)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("messagingService"),attributes:t.Optional(Q9)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("fileSystem"),attributes:t.Optional(z9)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("contentDeliveryNetwork"),attributes:t.Optional(F9)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("database"),attributes:t.Optional(j9)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("storageAccount"),attributes:t.Optional(Z9)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("volume"),attributes:t.Optional(g6)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("virtualMachine"),attributes:t.Optional(X9)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("serverless"),attributes:t.Optional(W9)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("kubernetesCluster"),attributes:t.Optional(q9)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerRepository"),attributes:t.Optional(B9)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerCluster"),attributes:t.Optional(H9)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerServiceTask"),attributes:t.Optional(K9)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerService"),attributes:t.Optional(Y9)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerImage"),attributes:t.Optional(V9)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("virtualNetwork"),attributes:t.Optional(J9)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("loadBalancer"),attributes:u6}),t.Object({category:t.Literal("network"),resourceType:t.Literal("targetGroup"),attributes:t.Optional(a6)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("certificate"),attributes:t.Optional(l6)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var Fo="/v0/inventory",WN=["scan_in_progress","success","failure","partial"],Sh=t.Object({id:t.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:t.Enum(Dn,{description:"Cloud platform where Tsuga discovered this resource."}),cloudAccount:t.String({description:"Cloud-native account identifier where Tsuga discovered this resource, such as an AWS account ID, GCP project ID, or Azure subscription ID."}),cloudRegion:t.Optional(t.String({description:"Cloud region where Tsuga discovered this resource, when the resource is regional."})),fullyQualifiedResourceId:t.String({description:"Cloud-native unique identifier for this resource, such as an AWS ARN, GCP resource name, or Azure resource ID."}),displayName:t.String({description:"Human-readable resource name shown in Tsuga. Derived from cloud provider metadata when available."}),nativeResourceType:t.String({description:"Cloud-native resource type reported by the inventory integration, for example `aws_ec2_instance` or `gcp_bucket`."}),resourceCreatedAt:t.Optional(S({description:"Timestamp when the resource was created in the cloud, when known."})),resourceUpdatedAt:t.Optional(S({description:"Timestamp when the resource was last updated in the cloud, when known."})),resourceLastSeenAt:S({description:"Timestamp when Tsuga last observed this resource during an inventory scan."}),tags:ve,nativeAttributes:t.Optional(t.Unsafe({type:"object",additionalProperties:!0})),covered:t.Optional(t.Boolean({description:"Whether the resource is covered by the configured infrastructure-as-code identifiers"}))}),fa={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},ZN=t.Object({cloudPlatforms:ce(t.Enum(Dn),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:Dn.length}),cloudAccounts:ce(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud accounts",maxItems:500}),cloudRegions:ce(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud regions",maxItems:500}),nativeResourceTypes:ce(t.Enum(oc),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:oc.length}),resourceTypes:ce(t.Enum($l),{description:"Restrict results to resources of any of these normalized resource types",maxItems:$l.length}),tags:ce(Mt.items,{description:"Restrict results to resources that have at least one of the listed key/value tags",maxItems:50}),isIacManaged:t.Boolean({description:"Restrict results by infrastructure-as-code coverage. When true, only resources covered by the configured IaC identifiers are returned; when false, only uncovered resources are returned."}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Case-insensitive substring matched against resource ID, display name, fully-qualified resource ID, cloud account, region, and resource type. Use the `tags` filter to narrow by tag. Wildcard characters are treated literally."}),exclude:t.Optional(t.Boolean({description:"If true, exclude resources matching this value instead of including them"}))},{description:"Search query filter for resources."})},{description:"Optional filters applied to narrow the returned resources"}),bh=t.Partial(t.Object({...ae,filters:t.Partial(ZN,{description:"Filters applied to narrow the returned resources."}),sort:t.Object({by:t.Enum([fa.DISPLAY_NAME,fa.CLOUD_ACCOUNT,fa.NATIVE_RESOURCE_TYPE,fa.CLOUD_REGION,fa.RESOURCE_TYPE,fa.RESOURCE_CREATED_AT],{description:"Field to sort the returned resources by"}),direction:Q},{description:"Optional sorting applied to the returned resources. Ties are broken by resource ID for stable pagination."})})),wrt=d({tags:["inventory"],method:"POST",url:`${Fo}/resources/query`,paginated:!0,body:bh,response:t.Array(t.Intersect([Sh,Fl]))}),y6=["resourceType","cloudAccount","isIacManaged"],vrt=d({tags:["inventory"],method:"POST",url:`${Fo}/resources/counts`,body:t.Object({filters:t.Optional(t.Partial(ZN)),groupBy:t.Enum(y6,{description:"Dimension to group the resource counts by."})}),response:t.Array(t.Object({value:t.String({description:'The group value the count belongs to: a resource type, a cloud account id, or "true"/"false" for IaC coverage.'}),count:t.Integer({description:"Number of resources in this group matching the requested filters."})}))}),Nrt=d({tags:["inventory"],method:"GET",url:`${Fo}/resources/filter-options`,response:t.Object({cloudRegions:t.Array(t.String(),{description:"Distinct cloud regions present across the tenant's resources."}),nativeResourceTypes:t.Array(t.String(),{description:"Distinct cloud-native resource types present across the tenant's resources."}),tags:kt})}),Lrt=x("type",[t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({description:"AWS account ID that Tsuga scans."}),externalId:t.String({description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:t.String({description:"ARN of the IAM role Tsuga assumes to read inventory in the account."})}),t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({description:"GCP project ID that Tsuga scans."}),serviceAccountId:t.String({description:"Service account Tsuga impersonates to read inventory."}),workloadIdentityProvider:t.String({description:"Workload identity provider resource name used for federated authentication."})}),t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({description:"Client ID of the Azure application Tsuga authenticates as."}),subscriptionId:t.String({description:"Azure subscription ID that Tsuga scans."}),tenantId:t.String({description:"Azure tenant ID that owns the subscription."})})]),T6="^[0-9]{12}$",E6="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",_6="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",I6="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",S6="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",Ih="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",b6=t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({pattern:T6,description:"AWS account ID that Tsuga scans.",errorMessage:{pattern:"Must be a 12-digit AWS account ID."}}),externalId:p({allowEmpty:!1,description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:t.String({pattern:E6,minLength:1,maxLength:2048,description:"ARN of the IAM role Tsuga assumes to read inventory in the account.",errorMessage:{pattern:"Must be an IAM role ARN, e.g. arn:aws:iam::123456789012:role/MyRole."}})},{$id:"AwsConnectionSettings"}),O6=t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({pattern:_6,minLength:6,maxLength:30,description:"GCP project ID that Tsuga scans.",errorMessage:{pattern:"Must be a GCP project ID (6-30 chars: lowercase letters, digits, hyphens)."}}),serviceAccountId:t.String({pattern:I6,minLength:1,maxLength:128,description:"Service account Tsuga impersonates to read inventory.",errorMessage:{pattern:"Must be a service account email, e.g. name@project.iam.gserviceaccount.com."}}),workloadIdentityProvider:t.String({pattern:S6,minLength:1,maxLength:256,description:"Full resource name of the workload identity provider used for federated authentication, e.g. //iam.googleapis.com/projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider.",errorMessage:{pattern:"Must be the full provider resource name: //iam.googleapis.com/projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/<POOL_ID>/providers/<PROVIDER_ID>."}})},{$id:"GcpConnectionSettings"}),A6=t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({pattern:Ih,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:t.String({pattern:Ih,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:t.String({pattern:Ih,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),XN=x("type",[b6,O6,A6],{description:"Credentials Tsuga uses to scan the account, in the provider-specific shape selected by `type`. Credentials are stored as provided and are not validated at creation time; failures surface through `lastScanStatus`."}),ga=t.Object({id:t.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:t.Enum(Dn,{description:"Cloud provider of the account."}),cloudAccountId:t.String({description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:t.Optional(t.String({description:"Human-readable name for the account shown in Tsuga."})),organizationId:t.Optional(t.String({description:"Cloud organization identifier, when known."})),createdBy:t.Optional(t.String({description:"Identifier of the user who created the account, when created by a user."})),createdAt:S({description:"Timestamp when the account was registered in Tsuga."}),lastScanStartedAt:t.Optional(S({description:"Timestamp when the most recent inventory scan started."})),lastScanFinishedAt:t.Optional(S({description:"Timestamp when the most recent inventory scan finished."})),lastScanStatus:t.Optional(t.Enum(WN,{description:"Status of the most recent inventory scan."}))}),Oh=t.Object({cloudType:t.Enum(Dn,{description:"Cloud provider of the account."}),cloudAccountId:p({allowEmpty:!1,description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:t.Optional(p({description:"Human-readable name for the account shown in Tsuga."})),organizationId:t.Optional(p({description:"Cloud organization identifier, when known."})),connectionSettings:XN,lastScanStatus:t.Optional(t.Enum(WN,{description:"Status of the most recent inventory scan."}))}),jo=`${Fo}/cloud-accounts`,krt=d({tags:["inventory"],url:jo,method:"GET",response:t.Array(ga)}),Mrt=d({tags:["inventory"],url:`${jo}/:id`,method:"GET",params:t.Object({id:p()}),response:ga}),Drt=d({tags:["inventory"],url:jo,method:"POST",body:Oh,response:ga}),Ah=t.Object({accountFriendlyName:p({description:"Human-readable name for the account shown in Tsuga."})}),Grt=d({tags:["inventory"],url:`${jo}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ah,response:ga}),$rt=d({tags:["inventory"],url:`${jo}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),Frt=d({tags:["inventory"],url:`${Fo}/trigger-scan`,method:"POST",body:t.Object({}),response:t.Object({success:t.Literal(!0)})}),jrt=d({tags:["inventory"],url:`${jo}/azure/onboarding`,method:"POST",body:t.Object({tenantId:p()}),response:t.Object({subjectId:t.String(),audience:t.String()})}),qrt=d({tags:["inventory"],method:"POST",url:`${jo}/validate/:type`,params:t.Object({type:p()}),body:t.Object({data:XN,id:t.Optional(p())}),response:t.Object({areAccountSettingsValid:t.Boolean(),message:t.Optional(t.String())})}),JN=`${Fo}/settings`,Brt=d({tags:["inventory"],url:JN,method:"GET",response:t.Object({settings:t.Optional(t.Object({id:t.String(),infrastructureIdentifiers:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))}))})}),x6=50,Hrt=d({tags:["inventory"],url:JN,method:"POST",body:t.Object({infrastructureIdentifiers:t.Array(t.Object({name:p({allowEmpty:!1}),value:t.Optional(p({allowEmpty:!1}))}),{maxItems:x6})}),response:t.Object({})}),Krt=d({tags:["inventory"],url:`${Fo}/iac-tags-proposal`,method:"GET",response:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))});var eL=`/${"v1"}/inventory`,R6=t.Omit(Sh,["nativeAttributes","covered"],{$id:"InventoryResourceBase",description:"Base fields shared by cloud resources discovered during inventory scans. Public inventory resources omit raw provider-native attributes and infrastructure-as-code coverage fields. See [Cloud resources](/documentation/categorize/cloud-resources)."}),tL=t.Intersect([R6,Fl],{$id:"InventoryResource",description:"Cloud resource discovered by an inventory scan, together with normalized category, resource type, and public category-specific attributes. See [Cloud resources](/documentation/categorize/cloud-resources)."}),C6={id:"123-456-abc",cloudPlatform:"aws",cloudAccount:"123456789012",cloudRegion:"us-east-1",fullyQualifiedResourceId:"arn:aws:s3:::tsuga-example-bucket",displayName:"tsuga-example-bucket",nativeResourceType:"aws_s3_bucket",resourceCreatedAt:"2024-01-01T08:00:00.000Z",resourceLastSeenAt:"2024-01-15T12:34:56.000Z",tags:[{key:"team",value:"platform"}],category:"data",resourceType:"bucket",attributes:{versioningStatus:"Enabled"}};Object.assign(tL,{examples:[C6]});var rL=t.Object({...bh.properties,...qe},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),P6={filters:{cloudPlatforms:{values:["aws"]},cloudAccounts:{values:["123456789012"]},cloudRegions:{values:["us-east-1"]},resourceTypes:{values:["bucket"]},nativeResourceTypes:{values:["aws_s3_bucket"]},tags:{values:[{key:"team",value:"platform"}]},isIacManaged:!0,searchQuery:{value:"tsuga-example"}},sort:{by:"displayName",direction:"asc"},limit:10,offset:0};Object.assign(rL,{examples:[P6]});var nL=d({description:"Queries cloud resources discovered by inventory scans, with optional filters, sorting, and pagination. Use this endpoint to build infrastructure inventories across connected cloud accounts.",operationId:"queryInventoryResources",tags:["inventory"],url:`${eL}/resources/query`,method:"POST",paginated:!0,body:rL,response:t.Array(tL)}),ic=`${eL}/cloud-accounts`,ac=t.Pick(ga,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),U6={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(ac,{examples:[U6]});var oL=t.Pick(Oh,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),w6={cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS",connectionSettings:{type:"aws",accountId:"123456789012",externalId:"tsuga-external-id",roleArn:"arn:aws:iam::123456789012:role/tsuga-inventory"}};Object.assign(oL,{examples:[w6]});var v6=t.Pick(Ah,["accountFriendlyName"]),ent=d({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:ic,method:"GET",response:t.Array(ac)}),tnt=d({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${ic}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to retrieve. Use the `id` returned by the cloud account list or create operations."})}),response:ac}),rnt=d({description:"Registers a cloud account for inventory scanning. Connection settings are stored as provided and are not validated at creation time; scan failures surface through `lastScanStatus`.",operationId:"createCloudAccount",tags:["inventory"],url:ic,method:"POST",body:oL,response:ac}),nnt=d({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${ic}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to update. Use the `id` returned by the cloud account list or create operations."})}),body:v6,response:ac}),ont=d({description:"Deletes a cloud account by ID. Future inventory scans stop for the account, and the trust relationship on the cloud side can be safely removed afterward.",operationId:"deleteCloudAccount",tags:["inventory"],url:`${ic}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to delete. Use the `id` returned by the cloud account list or create operations."})}),response:v});var sc="/v0/investigations",N6=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],L6=t.Object({type:t.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:t.String({description:"Identifier of the linked asset"})}),k6=t.Object({type:t.Enum(N6,{description:"Kind of linked asset"}),id:p({allowEmpty:!1,description:"Identifier of the linked asset"})}),cn=t.Object({id:t.String({description:"Identifier of the investigation"}),name:t.String({description:"Human readable name shown for the investigation"}),slug:t.Optional(t.String({description:'Immutable identifier supplied by the creating agent, e.g. "incident-2024-06-payments-5xx". Set once at creation and matched against the agent telemetry to link back to the run that created the investigation.'})),contentMd:t.Optional(t.String({description:"Markdown content capturing the investigation notes and findings"})),tags:ve,owner:t.String({description:"Team ID owning the investigation"}),env:t.Optional(t.String({description:'Environment the investigation relates to, e.g. "prod"'})),linkedAssets:t.Array(L6,{description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}),creator:t.Optional(pe),updater:t.Optional(pe),createdAt:S({description:"Timestamp the investigation was created at."}),updatedAt:S({description:"Timestamp the investigation was last updated at."})},{title:"Investigation"}),jl=t.Object({name:p({allowEmpty:!1,description:"Human readable name shown for the investigation"}),slug:p({type:"kebab-case",allowEmpty:!1,description:'Immutable, unique identifier supplied by the creating agent, used to link the investigation back to the agent run, e.g. "incident-2024-06-payments-5xx". The agent should also emit this value in its telemetry.'}),contentMd:Se(p({type:"long"}),{description:"Markdown content capturing the investigation notes and findings"}),tags:De,owner:p({allowEmpty:!1,description:"Team ID owning the investigation"}),env:Se(p({allowEmpty:!0}),{description:"Environment the investigation relates to"}),linkedAssets:t.Optional(t.Array(k6,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),xh=t.Object(t.Omit(jl,["slug"]).properties),mnt=d({tags:["investigations"],url:sc,method:"GET",paginated:!0,query:t.Object(ae),response:t.Array(cn)}),dnt=d({tags:["investigations"],url:`${sc}/:id`,params:t.Object({id:p()}),method:"GET",response:cn}),fnt=d({tags:["investigations"],url:sc,method:"POST",body:jl,response:cn}),gnt=d({tags:["investigations"],url:`${sc}/:id`,method:"PUT",body:xh,params:t.Object({id:p()}),response:cn}),hnt=d({tags:["investigations"],url:`${sc}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v});var cc=`/${"v1"}/investigations`,iL=d({description:"Retrieve all investigations",tags:["private"],url:cc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(cn)}),aL=d({description:"Retrieve an investigation by its id",tags:["private"],url:`${cc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:cn}),sL=d({description:"Create a new investigation",tags:["private"],url:cc,method:"POST",body:jl,response:cn}),cL=d({description:"Update an investigation by its id",tags:["private"],url:`${cc}/:id`,method:"PUT",body:xh,params:t.Object({id:p({allowEmpty:!1})}),response:cn}),pL=d({description:"Delete an investigation by its id",tags:["private"],url:`${cc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:v});var uL=15,ql={id:t.String({description:"Unique identifier of the processor within the route. Used to preserve processor identity during updates."}),description:t.Optional(t.String({description:"Optional user-provided processor note."})),tags:ve,updatedAt:t.Optional(S({description:"Timestamp when Tsuga last updated the processor."}))},Bl={id:p({allowEmpty:!1,description:"Unique identifier of the processor within the route. Preserve it across updates for existing processors."}),description:t.Optional(p({type:"long",description:"Optional processor note."})),tags:De,updatedAt:t.Optional(S({description:"Backend-maintained timestamp for this processor. Omit this field on create and update requests; Tsuga sets or preserves it based on processor changes."}))},lL={...ql,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},mL={...Bl,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},M6=x("subtype",[t.Object({targetAttribute:t.String({description:"Attribute that will receive the formatted value"}),formatString:t.String({description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:t.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Whether missing referenced attributes render as empty strings. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorFormatString"}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the computed value"}),formula:t.String({description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:t.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:t.Optional(t.Boolean({description:"Whether missing referenced attributes evaluate as zero. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorMathFormula"}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:t.String({description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:t.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(t.String({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:t.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"ProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),D6=x("subtype",[t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:p({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))},{$id:"InputProcessorParamsCreatorFormatString"}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the computed value"}),formula:p({allowEmpty:!1,type:"long",description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to evaluate as zero. Defaults to true."}))},{$id:"InputProcessorParamsCreatorMathFormula"}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:p({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:p({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:uL,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(p({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:t.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"InputProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),G6=t.Object({...lL,params:M6}),$6=t.Object({...mL,params:D6}),dL={...ql,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},fL={...Bl,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},F6=x("subtype",[t.Object({attributes:t.Array(t.Object({originAttribute:t.String({description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Whether the source attribute is preserved after mapping. If omitted, route processing treats this as false."})),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),targetAttribute:t.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"ProcessorParamsMapperMapAttributes"}),t.Object({attributeName:t.String({description:"Attribute whose value will determine the log level"}),subtype:t.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"ProcessorParamsMapperMapLevel"}),t.Object({attributeName:t.String({description:"Attribute whose value will determine the log timestamp"}),subtype:t.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"ProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),j6=x("subtype",[t.Object({attributes:t.Array(t.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:t.Optional(t.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:p({allowEmpty:!1,description:"Attribute name that will receive the mapped value"})}),{minItems:1,maxItems:50,description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"InputProcessorParamsMapperMapAttributes"}),t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:t.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"InputProcessorParamsMapperMapLevel"}),t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:t.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"InputProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),q6=t.Object({...fL,params:j6}),B6=t.Object({...dL,params:F6}),gL={...ql,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},hL={...Bl,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},yL=5,H6=x("subtype",[t.Object({attributeName:t.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(t.String({description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(t.String(),{description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:t.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the URL to parse"}),subtype:t.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the user agent string to parse"}),subtype:t.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the key/value string segment to parse"}),targetAttribute:t.String({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:t.String({description:"Delimiter separating keys from values in the source string"}),pairsSplitter:t.String({description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:t.Boolean({description:"Whether keys without explicit values are accepted by the parser."}),subtype:t.Literal("key-value",{description:"Parses delimited key/value text into attributes."})})],{description:"Parse processor configuration. The `subtype` discriminator selects which parser reads the source text attribute and which fields it extracts."}),K6=x("subtype",[t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(p({type:"long"}),{maxItems:yL,description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:t.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:t.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:t.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the key/value string segment to parse"}),targetAttribute:p({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:p({allowEmpty:!1,description:"Delimiter separating keys from values in the source string"}),pairsSplitter:p({allowEmpty:!0,description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:t.Boolean({description:"Set to true to accept keys without explicit values."}),subtype:t.Literal("key-value",{description:"Parses delimited key/value text into attributes."})})],{description:"Parse processor configuration. The `subtype` discriminator selects which parser reads the source text attribute and which fields it extracts."}),z6=t.Object({...gL,params:H6}),Y6=t.Object({...hL,params:K6}),V6=t.Object({...mL,params:x("subtype",[t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:p({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("format-string"),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:p({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:p({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:uL,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(p({description:"String category value used when no clause matches."})),subtype:t.Literal("category")})])}),Q6=t.Object({...fL,params:t.Object({attributes:t.Array(t.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:t.Optional(t.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:p({allowEmpty:!1,description:"Attribute name that will receive the mapped value"})}),{minItems:1,maxItems:50,description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes")})}),W6=t.Object({...hL,params:t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(p({type:"long"}),{maxItems:yL,description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),Pnt=x("type",[Q6,W6,V6]),Z6=t.Object({...lL,params:x("subtype",[t.Object({targetAttribute:t.String({description:"Attribute that will receive the formatted value"}),formatString:t.String({description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),subtype:t.Literal("format-string"),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Whether missing referenced attributes render as empty strings."}))}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:t.String({description:"Query that selects logs for this category clause."}),value:t.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value."}),defaultValue:t.Optional(t.String({description:"String category value used when no clause matches."})),subtype:t.Literal("category")})])}),X6=t.Object({...dL,params:t.Object({attributes:t.Array(t.Object({originAttribute:t.String({description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Whether the source attribute is preserved after mapping."})),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),targetAttribute:t.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes")})}),J6=t.Object({...gL,params:t.Object({attributeName:t.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(t.String({description:"Grok rule applied to parse text."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(t.String(),{description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),Unt=x("type",[X6,J6,Z6]),eQ=11,TL=t.Cyclic({OutputProcessor:t.Union([B6,z6,G6,t.Object({...ql,params:t.Object({items:t.Array(t.Object({query:t.String({description:"Query that determines whether logs enter this branch"}),processors:t.Array(t.Ref("OutputProcessor"),{description:"Processors executed when the branch query matches"})}),{description:"Conditional branches evaluated in order before falling back to the default"})}),type:t.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"OutputProcessor",{description:"Processing step executed sequentially on route logs"}),EL=t.Cyclic({InputProcessor:t.Union([q6,Y6,$6,t.Object({...Bl,params:t.Object({items:t.Array(t.Object({query:p({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:t.Array(t.Ref("InputProcessor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:eQ,description:"Conditional branches evaluated in order before falling back to the default"})}),type:t.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"InputProcessor",{description:"Processing step executed sequentially on route logs"});var tQ="/v0/logs",qr=`${tQ}/routes`,pn=t.Object({id:t.String({description:"Tsuga-generated log route ID assigned when the route is created."}),name:t.String({description:"Human-readable route name shown in Tsuga."}),description:t.Optional(t.String({description:"Optional free-text note about the route's purpose, set by the caller. This metadata is not evaluated when matching or processing logs."})),isEnabled:t.Boolean({description:"Whether this route is active for newly ingested logs. Disabled routes remain saved but do not process logs."}),query:t.String({description:"Tsuga query that selects which newly ingested logs enter the route processor chain."}),rank:t.Number({description:"Tsuga-assigned evaluation order, unique across all routes and dense (no gaps). Enabled routes are checked from lower rank to higher rank during ingestion, and every route whose query matches a log applies its processors to it \u2014 matching is not stopped after the first hit. New routes are appended with the highest rank; deleting a route shifts all higher ranks down by one to close the gap. Use `PUT /:id/modify-ranking` to move a route to a different rank, which shifts the routes between its old and new position accordingly."}),tags:ve,owner:t.String({description:"ID of the team that owns the route. Determines which team members can view and manage it, and which tag policies apply to it. Only an org admin or an admin of this team may change fields other than `processors`, or delete the route."}),processors:t.Array(TL,{description:"Processors applied in array order to logs that match the route, each transforming the output of the previous one. A `split` processor forks the chain into branches and cannot be followed by another processor at the same level."}),creator:t.Optional(pe),updater:t.Optional(pe),updatedAt:S({description:"Timestamp when Tsuga last updated the route."}),createdAt:S({description:"Timestamp when Tsuga created the route."}),assetUpdatedAt:S({description:"Timestamp when Tsuga last changed route behavior. This can differ from `updatedAt` when only metadata such as `description` or `tags` changed."})},{title:"LogRoute"}),pc=t.Object({name:p({allowEmpty:!1,description:"Human-readable log route name shown in Tsuga."}),description:Se(p({type:"long"}),{description:"Optional free-text note about the log route's purpose. This metadata is not evaluated when matching or processing logs."}),isEnabled:t.Boolean({description:"Set to true for the log route to process newly ingested matching logs. Set to false to save it without running it."}),query:p({type:"tsuga-query",description:"Tsuga query that selects which newly ingested logs enter the log route processor chain."}),tags:De,owner:p({allowEmpty:!1,description:"ID of the team that will own the log route, determining which team members can view and manage it and which tag policies apply. Only an org admin or an admin of this team may change fields other than `processors`, or delete the route."}),processors:t.Array(EL,{maxItems:50,description:"Processors applied in array order to logs that match the log route, each transforming the output of the previous one. Up to 50 are accepted. A `split` processor forks the chain into branches and cannot be followed by another processor at the same level."})});var rQ=["active","inactive"],nQ=["isEnabled","name","query","owner","tags","processors","rank","assetUpdatedAt"],_L=t.Object({owners:ce(p({allowEmpty:!1}),{description:"Restrict results to routes owned by any of these team IDs.",maxItems:50}),searchQuery:Wr({description:"Search query filter for routes.",valueDescription:"Case-insensitive substring matched against route name and ID."}),status:t.Enum(rQ,{description:"Restrict results to enabled (`active`) or disabled (`inactive`) routes."})}),oQ=t.Partial(t.Object({...ae,filters:t.Partial(_L),sort:t.Object({by:t.Enum(nQ,{description:"Field to sort the returned routes by."}),direction:Q})})),iQ=t.Object({filters:t.Optional(t.Partial(t.Omit(_L,["status"]),{description:"Filters applied before counting enabled and disabled routes."}))}),aQ=t.Object({totalCount:t.Integer({description:"Number of matching routes, whether they are enabled or disabled."}),active:t.Integer({description:"Number of matching routes that are enabled."}),inactive:t.Integer({description:"Number of matching routes that are disabled."})}),$nt=d({tags:["routes"],url:`${qr}/query`,method:"POST",paginated:!0,body:oQ,response:t.Array(pn,{description:"Matching log routes after they are filtered, sorted, and paginated."})}),Fnt=d({tags:["routes"],url:`${qr}/counts/query`,method:"POST",body:iQ,response:aQ}),jnt=d({tags:["routes"],url:qr,method:"GET",paginated:!0,query:t.Object(ae),response:t.Array(pn)}),qnt=d({tags:["routes"],url:`${qr}/:id`,params:t.Object({id:p()}),method:"GET",response:pn}),Bnt=d({tags:["routes"],url:qr,method:"POST",body:pc,response:pn}),Hnt=d({tags:["routes"],url:`${qr}/:id`,method:"PUT",body:pc,params:t.Object({id:p()}),response:pn}),Knt=d({tags:["routes"],url:`${qr}/:id/clone`,method:"POST",params:t.Object({id:p()}),body:pc,response:pn}),znt=d({tags:["routes"],url:`${qr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),Ynt=d({description:"Moves a route to a new rank, shifting the ranks of the routes between its old and new position by one to keep ranks dense and unique. Affects the route's evaluation order for newly ingested logs; does not change any route's processors or other fields.",tags:["routes"],url:`${qr}/:id/modify-ranking`,method:"PUT",params:t.Object({id:p()}),body:t.Object({rank:t.Integer({minimum:1,description:"Target rank for the route, from 1 to the total number of routes. Requests outside that range are rejected."})}),response:t.Object({})}),Vnt=d({description:"Sets a route's `isEnabled` state without changing any other field. Disabling a route stops it from processing newly ingested logs while keeping it saved and its rank unchanged.",tags:["routes"],url:`${qr}/:id/enable`,method:"PUT",params:t.Object({id:p()}),body:t.Object({enable:t.Boolean({description:"Set to true to enable the route, or false to disable it."})}),response:pn});var uc=`/${"v1"}/routes`,IL={name:"Enrich API Gateway Logs",description:"Adds service metadata and normalizes log format",isEnabled:!0,query:"service:api-gateway",tags:[{key:"category",value:"enrichment"}],owner:"team-123-abc",processors:[{id:"parse-gateway-message",type:"parse-attribute",tags:[],params:{subtype:"grok",attributeName:"message",rules:["%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:msg}"]}}]},SL={name:"Normalize Checkout Logs",description:"Maps service fields and extracts key/value details",isEnabled:!0,query:"context.service.name:checkout",tags:[{key:"category",value:"normalization"}],owner:"team-123-abc",processors:[{id:"map-service-name",type:"mapper",tags:[],params:{subtype:"map-attributes",attributes:[{originAttribute:"context.service.name",targetAttribute:"service",keepOrigin:!1,overrideTarget:!0}]}},{id:"parse-logfmt-message",type:"parse-attribute",tags:[],params:{subtype:"key-value",sourceAttribute:"message",targetAttribute:"logfmt",keyValueSplitter:"=",pairsSplitter:" ",acceptStandaloneKey:!1}}]},lc=t.Pick(pn,["id","name","description","isEnabled","query","tags","owner","processors"],{$id:"Route",description:"Team-owned log processing definition that selects newly ingested logs and applies ordered processors. See [Routes](/documentation/process/routes/index)."}),sQ={id:"123-456-abc",...IL},cQ={id:"456-789-def",...SL};Object.assign(lc,{examples:[sQ,cQ]});var bL=d({description:"Lists log routes visible to the authenticated operation key. Returned routes are ordered by evaluation order, with earlier routes evaluated first. Use this to inventory ingest-time processing definitions and owners. Pagination fields limit the returned page.",operationId:"listRoutes",tags:["routes"],url:uc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(lc)}),OL=d({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${uc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to retrieve. Use the `id` returned by route list or create responses."})}),response:lc}),Rh=t.Pick(pc,["name","description","isEnabled","query","tags","owner","processors"],{description:"Log route create or update request. Provide the route metadata, source query, owner team, enabled state, tags, and ordered processors."});Object.assign(Rh,{examples:[IL,SL]});var AL=d({description:"Creates a log route at the end of the evaluation order. Routes affect only newly ingested logs after the cluster receives the updated configuration.",operationId:"createRoute",tags:["routes"],url:uc,method:"POST",body:Rh,response:lc}),xL=d({description:"Updates an existing log route by ID without changing its evaluation order. Fields omitted from the request keep their existing values. Routes affect only newly ingested logs after the cluster receives the updated configuration.",operationId:"updateRoute",tags:["routes"],url:`${uc}/:id`,method:"PUT",body:Rh,params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to update. Use the `id` returned by route list, get, or create responses."})}),response:lc}),RL=d({description:"Deletes a log route by ID and compacts the evaluation order for remaining routes. The route stops processing future logs after the cluster receives the updated configuration.",operationId:"deleteRoute",tags:["routes"],url:`${uc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to delete. Use the `id` returned by route list, create, or update responses."})}),response:v});var mc=`/${"v1"}/monitors`,dc=t.Pick(an,["id","name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],{$id:"Monitor",description:"Saved alert definition that evaluates telemetry and creates alert transitions. Notification delivery is configured separately with notification rules. See [Monitors](/documentation/alert/monitors/index)."}),PL={name:"High Error Rate Alert",message:"Error rate exceeded threshold. Check the API gateway logs.",tags:[{key:"severity",value:"critical"}],configuration:{type:"log",timeframe:5,groupByFields:[],aggregationAlertLogic:"no_aggregation",queries:[{aggregate:{type:"count"},filter:"level:ERROR service:api-gateway"}],conditions:[{formula:"q1",operator:"greater_than",threshold:100}],noDataBehavior:"resolve"},priority:1,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},UL={name:"High CPU Utilization By Service",message:"More than half of grouped services are above the CPU threshold.",tags:[{key:"severity",value:"warning"}],configuration:{type:"metric",timeframe:10,groupByFields:[{fields:["context.service.name"],limit:10}],aggregationAlertLogic:"proportion",proportionAlertThreshold:50,queries:[{aggregate:{type:"average",field:"system.cpu.utilization"},filter:"context.service.name:checkout"}],conditions:[{formula:"q1",operator:"greater_than",threshold:.8}],noDataBehavior:"keep_last_status"},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},wL={name:"Certificate Expiry Warning",message:"A certificate is approaching expiry.",tags:[{key:"environment",value:"production"}],configuration:{type:"certificate-expiry",warnBeforeInDays:30,cloudAccounts:["aws-prod"],aggregationAlertLogic:"each",noDataBehavior:"resolve"},priority:3,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},vL={name:"New Error Pattern Detector",message:"A new error pattern was detected in the logs.",tags:[{key:"team",value:"platform"}],configuration:{type:"log-error-pattern",aggregationAlertLogic:"each",noDataBehavior:"keep_last_status",filter:{teamIds:["team-123-abc"],env:"production",services:["api-gateway"]}},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},pQ={id:"123-456-abc",...PL},uQ={id:"234-567-bcd",...UL},lQ={id:"345-678-cde",...wL},mQ={id:"456-789-def",...vL};Object.assign(dc,{examples:[pQ,uQ,lQ,mQ]});var CL=t.Pick(Og,["filters","sort","limit","offset"]),NL=t.Object({...CL.properties,...qe,filters:CL.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),dQ={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"service:api-gateway"},tags:{values:[{key:"paging",value:"true"}]},priorities:{values:[4,5],exclude:!0},types:{values:["threshold"]},activity:"active",clusterIds:{values:["cluster-123-abc"]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(NL,{examples:[dQ]});var LL=d({description:"Queries monitors visible to the authenticated operation key. Use this endpoint to inventory monitor definitions, filter by owner, tag, priority, type, activity, or cluster, and page through results. See [Monitors](/documentation/alert/monitors/index).",operationId:"queryMonitors",tags:["monitors"],url:`${mc}/query`,method:"POST",paginated:!0,body:NL,response:t.Array(dc)}),kL=d({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${mc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:dc}),ML=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],DL=t.Pick(qs,ML,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),GL=t.Pick(qs,ML,{$id:"UpdateMonitorRequest",description:"Monitor update request. Required fields and the submitted configuration are overwritten; omitted `message`, `tags`, and `clusterIds` keep their existing values. Omitting `dashboardId` clears the dashboard link."}),$L=PL,FL=UL,jL=wL,qL=vL;Object.assign(DL,{examples:[$L,FL,jL,qL]});Object.assign(GL,{examples:[$L,FL,jL,qL]});var BL=d({description:"Creates a monitor owned by the specified team. The monitor can evaluate logs, metrics, traces, anomaly behavior, certificate expiry, or new error patterns depending on its configuration.",operationId:"createMonitor",tags:["monitors"],url:mc,method:"POST",body:DL,response:dc}),HL=d({description:"Updates an existing monitor definition by ID. Required fields and the submitted configuration are overwritten; omitted `message`, `tags`, and `clusterIds` keep their existing values. Omitting `dashboardId` clears the dashboard link, and public updates clear any existing snooze because `pauseUntil` is not part of the public schema.",operationId:"updateMonitor",tags:["monitors"],url:`${mc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to update. Use the `id` returned by monitor query or create responses."})}),body:GL,response:dc}),fQ=t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to delete. Use the `id` returned by monitor query, create, or update responses."})}),KL=d({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${mc}/:id`,method:"DELETE",params:fQ,response:v});var fc=`/${"v1"}/notification-integrations`,gc=t.Pick(zs,["id","name","setting","tags"],{$id:"NotificationIntegration",description:"A reusable external destination that notification rules can send to. See [Integrations](/documentation/alert/notifications/index#integrations). Slack integrations are OAuth-based and are not readable, creatable, or editable through this API; connect Slack from the app."}),gQ={id:"456-def-abc",name:"Primary on-call",setting:{type:"pagerduty",integrationKeyLastChars:"ab12"},tags:[{key:"team",value:"platform"}]};Object.assign(gc,{examples:[gQ]});var zL=d({description:"Lists non-OAuth notification integrations visible to the authenticated operation key. Slack integrations do not appear here because they are OAuth-based. Pagination fields limit the returned page.",operationId:"listNotificationIntegrations",tags:["public","notification-integrations"],url:fc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(gc)}),YL=d({description:"Retrieves one non-OAuth notification integration by ID.",operationId:"getNotificationIntegration",tags:["notification-integrations"],url:`${fc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to retrieve. Use the `id` returned by notification integration list or create responses."})}),response:gc}),VL=t.Pick(Pg,["name","setting","tags"],{description:"Notification integration create request containing the display name, destination setting, and tags. `setting.type` cannot be `slack`; add Slack integrations from the app instead."}),hQ={name:"Primary on-call",setting:{type:"pagerduty",integrationKey:"abcdef1234567890ab12"},tags:[{key:"team",value:"platform"}]};Object.assign(VL,{examples:[hQ]});var QL=d({description:"Creates a non-OAuth notification integration that notification rules can target as a destination.",operationId:"createNotificationIntegration",tags:["notification-integrations"],url:fc,method:"POST",body:VL,response:gc}),WL=t.Pick(Ug,["name","setting","tags"],{description:"Notification integration update request. Omitted optional fields keep their existing values."}),yQ={name:"Primary on-call"};Object.assign(WL,{examples:[yQ]});var ZL=d({description:"Updates an existing non-OAuth notification integration by ID. The submitted `setting` is overwritten in full; omitted optional fields keep their existing values.",operationId:"updateNotificationIntegration",tags:["notification-integrations"],url:`${fc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to update. Use the `id` returned by notification integration list, get, or create responses."})}),body:WL,response:gc}),XL=d({description:"Deletes a non-OAuth notification integration by ID. Deletion is blocked while a notification rule still targets the integration; remove it from those rules first.",operationId:"deleteNotificationIntegration",tags:["notification-integrations"],url:`${fc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to delete. Use the `id` returned by notification integration list, get, or create responses."})}),response:v});var hc=`/${"v1"}/notification-rules`,yc=t.Pick(ko,["id","name","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","isActive","tags","targets"],{$id:"Rule",description:"Notification rule that matches alert transitions and routes notifications to one or more targets. See [Rules](/documentation/alert/notifications/rules)."}),JL={name:"Critical Alerts",queryString:"env:prod service:api",teamsFilter:{type:"all-public-teams"},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"],clusterIdsFilter:[],owner:"team-123-abc",isActive:!0,tags:[{key:"channel",value:"alerts"}],targets:[{id:"789-abc-def",rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}}]},TQ={id:"123-456-abc",...JL};Object.assign(yc,{examples:[TQ]});var ek=d({description:"Lists notification rules visible to the authenticated operation key. Use this endpoint to audit alert delivery routing. Pagination fields limit the returned page.",operationId:"listNotificationRules",tags:["notification-rules"],url:hc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(yc)}),tk=d({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${hc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to retrieve. Use the `id` returned by notification rule list or create responses."})}),response:yc}),Ch=t.Pick(Hs,["name","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","tags","isActive","targets"],{description:"Notification rule create or update request. Provide matching filters, owner, tags, active state, and delivery targets."}),EQ=JL;Object.assign(Ch,{examples:[EQ]});var rk=d({description:"Creates a notification rule that matches alert transitions and sends notifications to configured targets. Monitors keep evaluating separately from notification rules.",operationId:"createNotificationRule",tags:["notification-rules"],url:hc,method:"POST",body:Ch,response:yc}),nk=d({description:"Updates an existing notification rule by ID. Required fields and the submitted target list are overwritten; omitted optional fields keep their existing values.",operationId:"updateNotificationRule",tags:["notification-rules"],url:`${hc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to update. Use the `id` returned by notification rule list, get, or create responses."})}),body:Ch,response:yc}),_Q=t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to delete. Use the `id` returned by notification rule list, get, create, or update responses."})}),ok=d({description:"Deletes a notification rule by ID. Alerting monitors continue to evaluate, but this rule no longer sends notifications.",operationId:"deleteNotificationRule",tags:["notification-rules"],url:`${hc}/:id`,method:"DELETE",params:_Q,response:v});var ha=`${zi}/silences`,ik=t.Union([t.Literal("monday"),t.Literal("tuesday"),t.Literal("wednesday"),t.Literal("thursday"),t.Literal("friday"),t.Literal("saturday"),t.Literal("sunday")]),IQ=t.Partial(t.Record(ik,t.Array(t.Object({startTime:t.String({format:hd,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({format:hd,description:"Local end time for this recurring silence window on this day. It must be after `startTime`, and ranges on the same day cannot overlap."})},{title:"SilenceTimeRange"}),{minItems:1,description:"Silence windows for this day. Each window uses the schedule time zone, and windows on the same day cannot overlap."})),{description:"Recurring silence windows keyed by day of week, evaluated in the schedule `timeZone` or in UTC when it is omitted. At least one day must be listed, and a day with no entry is never silenced. Each window covers `startTime` up to but not including `endTime`."}),SQ=t.Partial(t.Record(ik,t.Array(t.Object({startTime:t.String({description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({description:"Local end time for this recurring silence window on this day. It must be after `startTime`, and ranges on the same day cannot overlap."})},{title:"SilenceTimeRange"}),{description:"Silence windows for this day. Each window uses the schedule time zone, and windows on the same day cannot overlap."})),{description:"Recurring silence windows keyed by day of week, evaluated in the schedule `timeZone` or in UTC when it is omitted. A day with no entry is never silenced. Each window covers `startTime` up to but not including `endTime`."}),Hl='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',ak="One-time silence schedule with specific start and end times",sk="Recurring weekly silence schedule",bQ=x("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({format:yd,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({format:yd,description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future."}),timeZone:t.Optional(t.String({format:go,description:Hl}))},{$id:"InputSilenceScheduleOneTime",description:ak}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:IQ,timeZone:t.Optional(t.String({format:go,description:Hl}))},{$id:"InputSilenceScheduleRecurring",description:sk})],{description:"Schedule defining when the silence is active. The `type` field discriminates between a `one-time` window and a `recurring` weekly window. Once a one-time schedule's `endTime` passes, or a recurring window closes, the silence stops suppressing notifications but is not deleted; delete it explicitly if it is no longer needed."}),OQ=x("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future when created or updated."}),timeZone:t.Optional(t.String({description:Hl}))},{$id:"OutputSilenceScheduleOneTime",description:ak}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:SQ,timeZone:t.Optional(t.String({description:Hl}))},{$id:"OutputSilenceScheduleRecurring",description:sk})],{description:"Schedule defining when the silence is active. The `type` field discriminates between a `one-time` window and a `recurring` weekly window. Once a one-time schedule's `endTime` passes, or a recurring window closes, the silence stops suppressing notifications but is not deleted; delete it explicitly if it is no longer needed."}),AQ="monitor_id",ck=`Query on the alerting monitor tags and group-by dimensions, e.g. \`env:prod AND service:bridge\`. The monitor itself can be targeted with \`${AQ}:<monitor id>\`.`,Kl=t.Object({name:p({description:"Display name of the silence"}),reason:p({allowEmpty:!1,type:"long",description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the silence"}),tags:De,isActive:t.Boolean({description:"Set to true for the silence to suppress matching notifications while its schedule is active. Set to false to keep the silence without suppressing anything."}),schedule:bQ,notificationRuleIds:Se(t.Array(p()),{description:"Notification rule IDs this silence applies to directly, matching any notification produced by one of these rules regardless of priority or transition type. Mutually exclusive with `prioritiesFilter`, `transitionTypesFilter`, and `queryString`: a request combining this field with any of those is rejected."}),queryString:Se(p({type:"tags-query"}),{description:ck}),teamsFilter:Rg,prioritiesFilter:t.Array(t.Enum(Ct),{maxItems:Ct.length,description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(Lo),{maxItems:Lo.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),ya=t.Object({id:t.String({description:"Tsuga-generated notification silence ID assigned when the silence is created."}),name:t.String({description:"Display name of the silence"}),reason:t.String({description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:t.String({description:"Team ID that owns and manages the silence"}),tags:ve,isActive:t.Boolean({description:"Whether the silence suppresses matching notifications while its schedule is active. When false, the silence is kept but never suppresses anything."}),schedule:OQ,notificationRuleIds:t.Optional(t.Array(t.String(),{description:"Notification rule IDs this silence applies to directly, matching any notification produced by one of these rules regardless of priority or transition type. Set only when `prioritiesFilter`, `transitionTypesFilter`, and `queryString` are not used to filter alerts."})),queryString:t.Optional(t.String({description:ck})),teamsFilter:xg,prioritiesFilter:t.Array(t.Enum(Ct),{description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(Lo),{description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."}),createdAt:S(),updatedAt:S(),creator:t.Optional(pe),updater:t.Optional(pe)}),Not=d({tags:["notification-silences"],url:ha,method:"GET",response:t.Array(ya)}),Lot=d({tags:["notification-silences"],url:`${ha}/:id`,params:t.Object({id:p()}),method:"GET",response:ya}),kot=d({tags:["notification-silences"],url:ha,method:"POST",body:Kl,response:ya}),Mot=d({tags:["notification-silences"],url:`${ha}/:id`,method:"PUT",params:t.Object({id:p()}),body:Kl,response:ya}),Dot=d({tags:["notification-silences"],url:`${ha}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),Got=d({tags:["notification-silences"],url:`${ha}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p(),{uniqueItems:!0})}),response:t.Object({})});var Tc=`/${"v1"}/notification-silences`,Ec=t.Pick(ya,["id","name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"],{$id:"NotificationSilence",description:"Scheduled mute rule that suppresses matching notification delivery while monitors continue evaluating. See [Silences](/documentation/alert/notifications/silences)."}),xQ={id:"sil-weekend-maintenance",name:"Weekend maintenance",reason:"Suppress expected alerts during the weekly maintenance window.",owner:"team-123-abc",tags:[{key:"environment",value:"production"}],isActive:!0,schedule:{type:"recurring",weeklySchedule:{saturday:[{startTime:"02:00",endTime:"06:00"}],sunday:[{startTime:"02:00",endTime:"06:00"}]},timeZone:"UTC"},teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"]},RQ={id:"sil-critical-routing",name:"Critical routing maintenance",reason:"Temporarily suppress notifications from the critical routing rule.",owner:"team-123-abc",tags:[{key:"change",value:"chg-1234"}],isActive:!0,schedule:{type:"one-time",startTime:"2026-07-04T02:00:00",endTime:"2026-07-04T04:00:00",timeZone:"UTC"},notificationRuleIds:["rule-critical-routing"],teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[],transitionTypesFilter:[]};Object.assign(Ec,{examples:[xQ,RQ]});var pk=d({description:"Lists notification silences visible to the authenticated operation key. Use this endpoint to audit maintenance windows and notification muting rules.",operationId:"listNotificationSilences",tags:["notification-silences"],url:Tc,method:"GET",response:t.Array(Ec)}),uk=d({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${Tc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to retrieve. Use the `id` returned by notification silence list or create responses."})}),response:Ec}),Ph=t.Pick(Kl,["name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"],{description:"Notification silence create or update request. Provide the mute reason, owner, schedule, filters, active state, and tags."}),CQ={name:"Weekend maintenance",reason:"Suppress expected alerts during the weekly maintenance window.",owner:"team-123-abc",tags:[{key:"environment",value:"production"}],isActive:!0,schedule:{type:"recurring",weeklySchedule:{saturday:[{startTime:"02:00",endTime:"06:00"}],sunday:[{startTime:"02:00",endTime:"06:00"}]},timeZone:"UTC"},teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"]},PQ={name:"Critical routing maintenance",reason:"Temporarily suppress notifications from the critical routing rule.",owner:"team-123-abc",tags:[{key:"change",value:"chg-1234"}],isActive:!0,schedule:{type:"one-time",startTime:"2026-07-04T02:00:00",endTime:"2026-07-04T04:00:00",timeZone:"UTC"},notificationRuleIds:["rule-critical-routing"],teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[],transitionTypesFilter:[]};Object.assign(Ph,{examples:[CQ,PQ]});var lk=d({description:"Creates a notification silence. Matching notifications that have not yet been sent are suppressed as soon as the schedule becomes active, including ones already queued when the silence is created; monitor evaluation itself is not paused, so alerts still transition and are visible in the UI.",operationId:"createNotificationSilence",tags:["notification-silences"],url:Tc,method:"POST",body:Ph,response:Ec}),mk=d({description:"Updates an existing notification silence by ID. Required fields are overwritten; omitted optional fields keep their existing values.",operationId:"updateNotificationSilence",tags:["notification-silences"],url:`${Tc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to update. Use the `id` returned by notification silence list, get, or create responses."})}),body:Ph,response:Ec}),UQ=t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to delete. Use the `id` returned by notification silence list, get, create, or update responses."})}),dk=d({description:"Deletes a notification silence. Any notification not yet sent is re-evaluated against the remaining silences and, if none match, is delivered normally; notifications already marked as silenced are not resent.",operationId:"deleteNotificationSilence",tags:["notification-silences"],url:`${Tc}/:id`,method:"DELETE",params:UQ,response:v});var wQ={critical:3,important:2,normal:1},le=e=>({label:e,weight:wQ[e]}),vQ={"unrouted-logs":{key:"unrouted-logs",title:"Logs with no matching route",summary:"Any log that reaches processing without a matched route is flagged.",rationale:"Close gaps by ensuring each event flows through a governed route.",objectType:"route",category:"observability-assets",impact:le("important"),recommendation:"Ensure each team maintains a route that captures all of its logs exactly once."},"no-over-routed-logs":{key:"no-over-routed-logs",title:"No logs matching 3+ routes",summary:"Detects logs that match 3 or more processing routes during the lookback window.",rationale:"A log usually only needs one or two routes. Matching many routes typically means the route queries overlap unintentionally, multiplying the processing and storage cost without adding observability value.",objectType:"route",category:"observability-assets",impact:le("important"),recommendation:"Review the route queries owned by this team for overlap. Tighten the filter on each route so a given log matches the minimum number of routes needed (usually one)."},"team-has-route":{key:"team-has-route",title:"\u22651 route per team",summary:"Each team owns at least one active route that filters on its team name.",rationale:"Provides clear governance boundaries for routing and enrichment.",objectType:"route",category:"observability-assets",impact:le("important"),recommendation:"Ensure every team manages a dedicated route scoped to its context.team value."},"no-team-override-mismatch":{key:"no-team-override-mismatch",title:`${Yd} matches ${Pu}`,summary:`Detects logs and spans whose ${Yd} resource attribute names a different team than the ${Pu} resolved at ingestion.`,rationale:`${Pu} is reserved and comes from the ingestion API key, so a \`team\` resource attribute never reassigns ownership. A disagreement means the sender expects an ownership Tsuga did not apply.`,objectType:"resource",category:"telemetry-hygiene",impact:le("important"),recommendation:"Drop the `team` resource attribute, or set the ingestion API key team override fields to read ownership from a differently named attribute."},"service-name-present":{key:"service-name-present",title:`${Uu} present`,summary:`Logs and spans must populate ${Uu} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:le("critical"),recommendation:`Populate ${Uu} in all log and span payloads.`},"no-orphan-spans":{key:"no-orphan-spans",title:"No orphan spans",summary:"Every span with parent_span_id references an existing span in the same trace.",rationale:"Trace integrity depends on preserving parent-child hierarchies.",objectType:"span",category:"telemetry-hygiene",impact:le("normal"),recommendation:"Emit parent spans before their children so references always resolve."},"metric-unit-consistency":{key:"metric-unit-consistency",title:"Name\u2192unit consistency",summary:"All series for a metric name report the same UCUM-compliant unit across the lookback period.",rationale:"Avoid ambiguity when charting and alerting on metrics with shared names.",objectType:"metric",category:"telemetry-hygiene",impact:le("important"),recommendation:"Align exporters so each metric name emits a single consistent unit across services and environments."},"host-name-present":{key:"host-name-present",title:`${Ss} presence`,summary:`Logs and spans must populate ${Ss} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:le("important"),recommendation:`Populate ${Ss} in all log and span payloads.`},"inconsistent-attribute-naming":{key:"inconsistent-attribute-naming",title:"Consistent attribute naming",summary:"Detects attributes with multiple naming variants (e.g., userId vs user_id).",rationale:"Consistent naming improves queryability.",objectType:"log",category:"telemetry-hygiene",impact:le("normal"),recommendation:"Standardize attribute naming conventions across all log sources."},"no-duplicate-attr-values":{key:"no-duplicate-attr-values",title:"No duplicate attribute values",summary:"Detects when different attributes consistently carry identical values across logs (e.g., err.type and error.type always having the same value).",rationale:"Redundant attributes waste storage and complicate querying. Consolidate to one.",objectType:"log",category:"telemetry-hygiene",impact:le("normal"),recommendation:"Consolidate duplicate attributes at the source to reduce storage costs."},"no-debug-logs-in-prod":{key:"no-debug-logs-in-prod",title:"No DEBUG logs in production",summary:"Detects DEBUG-level logs emitted in production environments.",rationale:"DEBUG logs in production increase costs and risk exposing sensitive data.",objectType:"log",category:"telemetry-hygiene",impact:le("important"),recommendation:"Remove DEBUG-level logging from production environment or adjust log level configuration."},"no-multiline-logs":{key:"no-multiline-logs",title:"No ungrouped multiline logs",summary:"Detects orphaned stack-trace and traceback continuation lines that should have been grouped into a single log entry by the collector.",rationale:"Ungrouped multiline logs fragment errors across many entries, making them harder to read, search, and alert on.",objectType:"log",category:"telemetry-hygiene",impact:le("important"),recommendation:"Configure multiline grouping on the log collector using a line_start_pattern (e.g. a timestamp regex) so stack traces are sent as a single entry."},"no-error-logs-as-info":{key:"no-error-logs-as-info",title:"No error logs mapped as info",summary:"Detects INFO-level logs that carry error fields such as error.*, err.*, exception.*, or a stack trace.",rationale:"A log with error or exception attributes but an INFO severity is never surfaced as an error, so teams miss real failures caused by a misconfigured level mapper or bad logging.",objectType:"log",category:"telemetry-hygiene",impact:le("important"),recommendation:"Map these logs to ERROR in the level mapper, or fix the source logging so errors and exceptions are emitted at the right severity."},"no-empty-dashboards":{key:"no-empty-dashboards",title:"No empty dashboards",summary:"Flags dashboards with 1 or fewer widgets.",rationale:"Empty or near-empty dashboards add clutter and make it harder to find useful dashboards.",objectType:"dashboard",category:"observability-assets",impact:le("normal"),recommendation:"Add meaningful widgets to dashboards or remove empty ones to reduce clutter."},"monitor-has-notification":{key:"monitor-has-notification",title:"No monitors without notification",summary:"Every monitor has at least one active notification destination configured.",rationale:"A monitor without notifications is effectively silent - it detects issues but nobody is alerted.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Add a notification destination to every monitor - a monitor without notifications is effectively silent."},"no-future-dated-logs":{key:"no-future-dated-logs",title:"No future-dated logs",summary:"Detects logs with timestamps more than 59 minutes ahead of their intake time.",rationale:"Future-dated logs break dashboards, alerting, and log ordering - they indicate clock skew or incorrect timestamp generation.",objectType:"log",category:"telemetry-hygiene",impact:le("important"),recommendation:"Fix clock synchronization or timestamp generation for services emitting future-dated logs - they break dashboards and alerting."},"metric-usage":{key:"metric-usage",title:"Metric usage",summary:"Percentage of ingested metrics that are referenced by a dashboard or monitor, or were queried in the last 30 days.",rationale:"Metrics that are never visualized, alerted on, or queried add ingestion cost and cardinality without providing value.",objectType:"metric",category:"telemetry-adoption",impact:le("important"),recommendation:"Stop emitting metrics that are never referenced or queried to reduce ingestion cost and cardinality.",scope:"global"},"no-stale-dashboards":{key:"no-stale-dashboards",title:"No stale dashboards",summary:"Flags dashboards that have not been edited in over 180 days.",rationale:"Stale dashboards may contain outdated queries or irrelevant data, making it harder for teams to find useful, up-to-date information.",objectType:"dashboard",category:"observability-assets",impact:le("normal"),recommendation:"Review and update dashboards that haven't been edited in 180+ days, or archive them if no longer relevant."},"no-unused-dashboards":{key:"no-unused-dashboards",title:"No unused dashboards",summary:"Flags dashboards with zero views in the last 60 days.",rationale:"Dashboards that nobody views add clutter and may confuse team members looking for relevant information.",objectType:"dashboard",category:"telemetry-adoption",impact:le("important"),recommendation:"Archive or delete dashboards that nobody has viewed in the last 60 days to reduce noise."},"no-orphan-monitors":{key:"no-orphan-monitors",title:"No monitors without dashboards",summary:"Every monitor should be linked to at least one dashboard.",rationale:"Monitors without a linked dashboard make it harder for teams to investigate alerts \u2014 responders need a dashboard to quickly understand the context and scope of an issue.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Link monitors to relevant dashboards so teams can quickly investigate when alerts fire."},"no-flapping-monitors":{key:"no-flapping-monitors",title:"No flappy monitors",summary:"P1/P2 monitors should not have any group (or the monitor itself) trigger 7+ alerts within 7 days.",rationale:"Monitors that constantly flip between alert and OK cause alert fatigue. Teams start ignoring notifications, increasing the risk of missing real incidents.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Tune thresholds, add hysteresis, or adjust evaluation windows to reduce flapping."},"no-noisy-group-monitors":{key:"no-noisy-group-monitors",title:"No noisy group-by monitors",summary:"P1/P2 group-by monitors should not have 5+ groups triggering alerts simultaneously on 2+ occasions within 7 days.",rationale:"When a group-by monitor triggers alerts for many groups at once repeatedly, the signal gets lost in noise. Responders cannot prioritize and the monitor effectively becomes useless.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Narrow the group-by scope, raise thresholds, or split into more targeted monitors."},"no-long-alert-monitors":{key:"no-long-alert-monitors",title:"No monitors stuck in alert",summary:"P1/P2 monitors should not remain in alert state for more than 15 days.",rationale:"A high-priority monitor stuck in alert for weeks signals an unresolved issue or a misconfigured threshold. Either way, the alert loses meaning and contributes to alert fatigue.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Investigate and resolve the underlying issue, adjust the threshold, or acknowledge and close the alert."},"no-redundant-monitors":{key:"no-redundant-monitors",title:"No redundant monitors",summary:"P1/P2 monitors should not always trigger at the same time as another monitor (3+ co-triggers within 7 days).",rationale:"A monitor that always fires alongside another monitor is redundant. It adds noise without providing additional signal, making it harder for responders to identify the root cause.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Investigate whether the redundant monitor can be removed or consolidated with the one it always co-triggers with."},"no-absent-log-fields":{key:"no-absent-log-fields",title:"No absent log fields",summary:"Dashboards and monitors should reference log fields that still appear in recent logs (last 24 hours).",rationale:"References to log fields that no longer exist silently break dashboards and monitors, eroding trust in observability.",objectType:"dashboard",category:"observability-assets",impact:le("important"),recommendation:"Remove, rename, or backfill log fields that are referenced by dashboards or monitors but have not been seen in the last 24 hours.",scope:"global"},"k8s-recommended-attributes":{key:"k8s-recommended-attributes",title:"Kubernetes recommended resource attributes",summary:"Kubernetes logs and spans should populate core identity attributes and at least one workload-ownership attribute.",rationale:"These attributes let Tsuga correlate telemetry with the Kubernetes objects that produced it, which is required for faulty-deployment detection and rollback suggestions.",objectType:"resource",category:"collection-coverage",impact:le("important"),recommendation:"Make sure every Kubernetes workload emits k8s.cluster.name, k8s.namespace.name, k8s.pod.name, k8s.pod.uid, k8s.container.name, k8s.node.name and one workload-ownership attribute (for example via the OpenTelemetry Collector k8s_attributes processor)."},"k8s-recommended-metrics":{key:"k8s-recommended-metrics",title:"Kubernetes recommended cluster metrics",summary:"All recommended Kubernetes cluster metrics are collected.",rationale:"These metrics are the primary signals for faulty-deployment detection; without k8s.container.status.reason and the usage/limit pairs, container crash loops and resource starvation cannot be diagnosed.",objectType:"metric",category:"collection-coverage",impact:le("important"),recommendation:"Enable the OpenTelemetry Collector k8s_cluster receiver (for example via the Tsuga Helm chart) so the required Kubernetes metrics are emitted.",scope:"global"},"k8s-recommended-change-events":{key:"k8s-recommended-change-events",title:"Kubernetes recommended change events",summary:"Change events are collected for the Kubernetes object kinds recommended for rollback suggestions.",rationale:"Faulty-deployment detection needs the history of ReplicaSet, Deployment, Pod and Node changes to identify failing revisions and propose rollbacks.",objectType:"log",category:"collection-coverage",impact:le("important"),recommendation:"Configure the Kubernetes change-event collector (for example the OpenTelemetry k8sobjects receiver) so change events for Pod, Deployment, ReplicaSet, StatefulSet, DaemonSet, Namespace and Node are ingested."},"otel-collector-self-metrics":{key:"otel-collector-self-metrics",title:"OpenTelemetry Collector self-metrics",summary:"A cluster collecting Kubernetes metrics through an OpenTelemetry Collector also emits the collector self-metrics (otelcol_*).",rationale:"The Kubernetes receivers feed the Kubernetes explorer. Without the collector self-metrics there is no way to tell a healthy pipeline from one that drops data or fails to export, so a stale or missing Kubernetes view cannot be explained.",objectType:"metric",category:"collection-coverage",impact:le("important"),recommendation:"Enable the collector's internal telemetry (service.telemetry.metrics) and export it to Tsuga so otelcol_* metrics are available.",scope:"global"},"use-standard-attributes":{key:"use-standard-attributes",title:"Standard attribute usage",summary:"Detects log attributes that should be remapped to Tsuga standard attributes.",rationale:"Standard attributes enable consistent querying, out-of-the-box dashboards, and cross-team correlation.",objectType:"log",category:"telemetry-hygiene",impact:le("important"),recommendation:"Use the attribute remapper in your routes to rename attributes to their standard equivalents."},"no-unused-operation-api-keys":{key:"no-unused-operation-api-keys",title:"No unused operation API keys",summary:"Flags operation API keys with no activity in the last 180 days.",rationale:"Long-idle operation credentials add risk if leaked and clutter the inventory. Tracking last-used activity makes it easy to rotate or delete the unused ones.",objectType:"api-key",category:"observability-assets",impact:le("important"),recommendation:"Rotate or delete operation API keys that have not been used in the last 180 days."},"no-unused-ingestion-api-keys":{key:"no-unused-ingestion-api-keys",title:"No unused ingestion API keys",summary:"Flags ingestion API keys with no telemetry in the last 30 days across any cluster.",rationale:"Dormant ingestion credentials add risk if leaked and clutter the inventory. Tracking key activity makes it easy to rotate or delete the unused ones.",objectType:"api-key",category:"observability-assets",impact:le("important"),recommendation:"Rotate or delete ingestion API keys that have sent no data in the last 30 days."},"db-logs-trace-correlation":{key:"db-logs-trace-correlation",title:"Database logs correlated with traces",summary:`Database logs should carry ${uR} so they can be tied back to the trace that issued the query.`,rationale:"Linking database server logs to client traces lets users jump from a slow request to the exact query log. Without a trace id, database logs cannot be joined to the request that produced them.",objectType:"log",category:"telemetry-hygiene",impact:le("normal"),recommendation:"Enable trace correlation on the database log pipeline (for example via SQLcommenter, which embeds the traceparent in each statement) so query logs carry a trace id.",scope:"team"}},fk={"postgresql-server-metrics-collected":{label:"PostgreSQL",systemValues:["postgresql"],metricPrefixes:["postgresql.","pg_"],receiver:"postgresqlreceiver"},"mysql-server-metrics-collected":{label:"MySQL",systemValues:["mysql","mariadb"],metricPrefixes:["mysql.","mysql_"],receiver:"mysqlreceiver"},"mongodb-server-metrics-collected":{label:"MongoDB",systemValues:["mongodb"],metricPrefixes:["mongodb.","mongodbatlas.","mongodb_"],receiver:"mongodbreceiver"},"redis-server-metrics-collected":{label:"Redis",systemValues:["redis"],metricPrefixes:["redis.","redis_"],receiver:"redisreceiver"},"memcached-server-metrics-collected":{label:"Memcached",systemValues:["memcached"],metricPrefixes:["memcached.","memcached_"],receiver:"memcachedreceiver"},"couchdb-server-metrics-collected":{label:"CouchDB",systemValues:["couchdb"],metricPrefixes:["couchdb.","couchdb_"],receiver:"couchdbreceiver"},"elasticsearch-server-metrics-collected":{label:"Elasticsearch",systemValues:["elasticsearch"],metricPrefixes:["elasticsearch.","elasticsearch_"],receiver:"elasticsearchreceiver"},"oracledb-server-metrics-collected":{label:"Oracle DB",systemValues:["oracle.db","oracle"],metricPrefixes:["oracledb.","oracledb_"],receiver:"oracledbreceiver"},"sqlserver-server-metrics-collected":{label:"Microsoft SQL Server",systemValues:["microsoft.sql_server","mssql"],metricPrefixes:["sqlserver.","mssql_"],receiver:"sqlserverreceiver"},"saphana-server-metrics-collected":{label:"SAP HANA",systemValues:["sap.hana","hanadb"],metricPrefixes:["saphana."],receiver:"saphanareceiver"},"cassandra-server-metrics-collected":{label:"Cassandra",systemValues:["cassandra"],metricPrefixes:["cassandra.","cassandra_"]},"clickhouse-server-metrics-collected":{label:"ClickHouse",systemValues:["clickhouse"],metricPrefixes:["ClickHouse"]},"couchbase-server-metrics-collected":{label:"Couchbase",systemValues:["couchbase"],metricPrefixes:["couchbase_"]},"neo4j-server-metrics-collected":{label:"Neo4j",systemValues:["neo4j"],metricPrefixes:["neo4j_"]},"opensearch-server-metrics-collected":{label:"OpenSearch",systemValues:["opensearch"],metricPrefixes:["opensearch_"]},"db2-server-metrics-collected":{label:"IBM Db2",systemValues:["ibm.db2","db2"],metricPrefixes:["ibm_db2_"]}},NQ=Object.fromEntries(Object.keys(fk).map(e=>{let{label:r,receiver:n}=fk[e];return[e,{key:e,title:`${r} server metrics collected`,summary:`${r} seen in client spans should have its server metrics collected.`,rationale:"Server metrics (connections, throughput, replication, contention) are needed to investigate database slowness beyond what client spans show. A detected database with no server metrics has a gap in its monitoring setup.",objectType:"metric",category:"collection-coverage",impact:le("important"),recommendation:n?`Configure the ${n} OpenTelemetry receiver so ${r} server metrics are collected.`:`Collect ${r} server metrics, for example via its Prometheus exporter.`,scope:"global"}]})),LQ=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),kQ=oc.filter(e=>e.startsWith("azure_")&&!LQ.has(e)),gk={"aws-sqs-metrics-collected":{label:"Amazon SQS",source:"AWS/SQS",nativeResourceTypes:["aws_sqs_queue"],metricPrefixes:["aws_sqs_"]},"aws-sns-metrics-collected":{label:"Amazon SNS",source:"AWS/SNS",nativeResourceTypes:["aws_sns_topic"],metricPrefixes:["aws_sns_"]},"aws-kinesis-metrics-collected":{label:"Amazon Kinesis Data Streams",source:"AWS/Kinesis",nativeResourceTypes:["aws_kinesis_data_stream"],metricPrefixes:["aws_kinesis_"]},"aws-dynamodb-metrics-collected":{label:"Amazon DynamoDB",source:"AWS/DynamoDB",nativeResourceTypes:["aws_dynamodb_table"],metricPrefixes:["aws_dynamodb_"]},"aws-rds-metrics-collected":{label:"Amazon RDS",source:"AWS/RDS",nativeResourceTypes:["aws_rds_instance"],metricPrefixes:["aws_rds_"]},"aws-elasticache-metrics-collected":{label:"Amazon ElastiCache",source:"AWS/ElastiCache",nativeResourceTypes:["aws_elasticache"],metricPrefixes:["aws_elasticache_"]},"aws-s3-metrics-collected":{label:"Amazon S3",source:"AWS/S3",nativeResourceTypes:["aws_s3_bucket"],metricPrefixes:["aws_s3_"]},"aws-ebs-metrics-collected":{label:"Amazon EBS",source:"AWS/EBS",nativeResourceTypes:["aws_ebs_volume"],metricPrefixes:["aws_ebs_"]},"aws-efs-metrics-collected":{label:"Amazon EFS",source:"AWS/EFS",nativeResourceTypes:["aws_efs"],metricPrefixes:["aws_efs_"]},"aws-ec2-metrics-collected":{label:"Amazon EC2",source:"AWS/EC2",nativeResourceTypes:["aws_ec2_instance"],metricPrefixes:["aws_ec2_"]},"aws-lambda-metrics-collected":{label:"AWS Lambda",source:"AWS/Lambda",nativeResourceTypes:["aws_lambda_function"],metricPrefixes:["aws_lambda_"]},"aws-ecs-metrics-collected":{label:"Amazon ECS",source:"AWS/ECS",nativeResourceTypes:["aws_ecs_cluster","aws_ecs_service","aws_ecs_task"],metricPrefixes:["aws_ecs_"]},"aws-ecr-metrics-collected":{label:"Amazon ECR",source:"AWS/ECR",nativeResourceTypes:["aws_ecr_repository"],metricPrefixes:["aws_ecr_"]},"aws-elb-metrics-collected":{label:"Elastic Load Balancing",source:"AWS/ApplicationELB, AWS/NetworkELB",nativeResourceTypes:["aws_elastic_load_balancer"],metricPrefixes:["aws_applicationelb_","aws_networkelb_","aws_gatewayelb_","aws_elb_"]},"aws-cloudfront-metrics-collected":{label:"Amazon CloudFront",source:"AWS/CloudFront",nativeResourceTypes:["aws_cloudfront_distribution"],metricPrefixes:["aws_cloudfront_"]},"aws-acm-metrics-collected":{label:"AWS Certificate Manager",source:"AWS/CertificateManager",nativeResourceTypes:["aws_acm_certificate"],metricPrefixes:["aws_certificatemanager_"]},"gcp-pubsub-metrics-collected":{label:"Google Cloud Pub/Sub",source:"pubsub.googleapis.com",nativeResourceTypes:["gcp_pubsub_topic"],metricPrefixes:["pubsub.googleapis.com/"]},"gcp-storage-metrics-collected":{label:"Google Cloud Storage",source:"storage.googleapis.com",nativeResourceTypes:["gcp_bucket"],metricPrefixes:["storage.googleapis.com/"]},"gcp-compute-metrics-collected":{label:"Google Compute Engine",source:"compute.googleapis.com",nativeResourceTypes:["gcp_compute_instance","gcp_compute_disk"],metricPrefixes:["compute.googleapis.com/"]},"gcp-cloud-sql-metrics-collected":{label:"Google Cloud SQL",source:"cloudsql.googleapis.com",nativeResourceTypes:["gcp_cloud_sql_instance"],metricPrefixes:["cloudsql.googleapis.com/"]},"gcp-gke-metrics-collected":{label:"Google Kubernetes Engine",source:"kubernetes.io, container.googleapis.com",nativeResourceTypes:["gcp_gke_cluster"],metricPrefixes:["kubernetes.io/","container.googleapis.com/"]},"gcp-cloud-run-metrics-collected":{label:"Google Cloud Run",source:"run.googleapis.com",nativeResourceTypes:["gcp_cloud_run_service","gcp_cloud_run_job","gcp_cloud_run_function"],metricPrefixes:["run.googleapis.com/"]},"gcp-artifact-registry-metrics-collected":{label:"Google Artifact Registry",source:"artifactregistry.googleapis.com",nativeResourceTypes:["gcp_artifact_registry_repository"],metricPrefixes:["artifactregistry.googleapis.com/"]},"gcp-load-balancing-metrics-collected":{label:"Google Cloud Load Balancing",source:"loadbalancing.googleapis.com",nativeResourceTypes:["gcp_forwarding_rule"],metricPrefixes:["loadbalancing.googleapis.com/"]},"gcp-bigtable-metrics-collected":{label:"Google Cloud Bigtable",source:"bigtable.googleapis.com",nativeResourceTypes:["gcp_bigtable_instance"],metricPrefixes:["bigtable.googleapis.com/"]},"gcp-spanner-metrics-collected":{label:"Google Cloud Spanner",source:"spanner.googleapis.com",nativeResourceTypes:["gcp_spanner_instance"],metricPrefixes:["spanner.googleapis.com/"]},"gcp-firestore-metrics-collected":{label:"Google Cloud Firestore",source:"firestore.googleapis.com",nativeResourceTypes:["gcp_firestore_database"],metricPrefixes:["firestore.googleapis.com/"]},"gcp-app-engine-metrics-collected":{label:"Google App Engine",source:"appengine.googleapis.com",nativeResourceTypes:["gcp_app_engine_service"],metricPrefixes:["appengine.googleapis.com/"]},"azure-metrics-collected":{label:"Azure",source:"Azure Monitor",nativeResourceTypes:kQ,metricPrefixes:["azure_"]}},MQ=Object.fromEntries(Object.keys(gk).map(e=>{let{label:r,source:n}=gk[e];return[e,{key:e,title:`${r} metrics collected`,summary:`${r} resources found in inventory should have their metrics collected.`,rationale:"A resource that appears in inventory but whose metrics are not collected leaves its dashboards and resource-explorer views empty and impossible to alert on.",objectType:"metric",category:"collection-coverage",impact:le("important"),recommendation:`Enable the ${n} metrics integration so ${r} metrics are ingested.`,scope:"global"}]})),DQ={...vQ,...NQ,...MQ},hk=Object.values(DQ);var yk=["passed","failed","ignored"],GQ=10,$Q=t.Enum(yk,{description:"Evaluation outcome for this rule row. Allowed values are passed, failed, and ignored; ignored means the rule was not applicable to the available data."}),FQ=["aws-sqs-metrics-collected","aws-sns-metrics-collected","aws-kinesis-metrics-collected","aws-dynamodb-metrics-collected","aws-rds-metrics-collected","aws-elasticache-metrics-collected","aws-s3-metrics-collected","aws-ebs-metrics-collected","aws-efs-metrics-collected","aws-ec2-metrics-collected","aws-lambda-metrics-collected","aws-ecs-metrics-collected","aws-ecr-metrics-collected","aws-elb-metrics-collected","aws-cloudfront-metrics-collected","aws-acm-metrics-collected","gcp-pubsub-metrics-collected","gcp-storage-metrics-collected","gcp-compute-metrics-collected","gcp-cloud-sql-metrics-collected","gcp-gke-metrics-collected","gcp-cloud-run-metrics-collected","gcp-artifact-registry-metrics-collected","gcp-load-balancing-metrics-collected","gcp-bigtable-metrics-collected","gcp-spanner-metrics-collected","gcp-firestore-metrics-collected","gcp-app-engine-metrics-collected","azure-metrics-collected"],jQ=["postgresql-server-metrics-collected","mysql-server-metrics-collected","mongodb-server-metrics-collected","redis-server-metrics-collected","memcached-server-metrics-collected","couchdb-server-metrics-collected","elasticsearch-server-metrics-collected","oracledb-server-metrics-collected","sqlserver-server-metrics-collected","saphana-server-metrics-collected","cassandra-server-metrics-collected","clickhouse-server-metrics-collected","couchbase-server-metrics-collected","neo4j-server-metrics-collected","opensearch-server-metrics-collected","db2-server-metrics-collected"],wh=["unrouted-logs","no-over-routed-logs","team-has-route","no-team-override-mismatch","service-name-present","no-orphan-spans","metric-unit-consistency","host-name-present","inconsistent-attribute-naming","no-duplicate-attr-values","no-debug-logs-in-prod","no-multiline-logs","no-error-logs-as-info","no-empty-dashboards","monitor-has-notification","no-future-dated-logs","metric-usage","no-stale-dashboards","no-unused-dashboards","no-orphan-monitors","no-flapping-monitors","no-noisy-group-monitors","no-long-alert-monitors","no-redundant-monitors","no-absent-log-fields","k8s-recommended-attributes","k8s-recommended-metrics","k8s-recommended-change-events","otel-collector-self-metrics","use-standard-attributes","no-unused-operation-api-keys","no-unused-ingestion-api-keys","db-logs-trace-correlation",...jQ,...FQ],Tk=t.Enum(wh),qQ=["log","metric","resource","span","api-key","dashboard","monitor","route"],BQ=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],HQ=["critical","important","normal"],KQ=["team","global"],vh=t.Object({key:t.Enum(wh),title:t.String(),summary:t.String(),rationale:t.String(),objectType:t.Enum(qQ),category:t.Enum(BQ),impact:t.Object({label:t.Enum(HQ),weight:t.Number()}),recommendation:t.String(),scope:t.Optional(t.Enum(KQ))}),_c=t.Object({type:t.String({description:"Tsuga asset or telemetry kind referenced by this example. Set by the rule evaluator from the failing object, record, or lookup result; examples include `monitor`, `dashboard`, `metric`, `log`, and `api-key`."}),label:t.String({description:"Human-readable summary of the example. Set by the rule evaluator from the asset name, telemetry identifier, or lookup result so clients can display the example without following the link."}),link:t.Object({to:t.String({description:"In-app route that opens the example in Tsuga. Set by the rule evaluator when the example has a product surface for inspection."}),search:t.Optional(t.Unknown({description:"Route search payload for the in-app link. Set when the destination needs query-string state such as a search query, time range, or table filter."})),params:t.Optional(t.Unknown({description:"Route params for the in-app link. Set when the destination route needs path parameters such as an asset identifier."}))},{description:"In-app deep link for inspecting the example. Returned when Tsuga can route from the quality-report row to a relevant product page."})}),Uh=t.Intersect([vh,t.Object({id:t.Optional(t.String()),status:$Q,normalizedScore:t.Number(),details:t.Optional(t.Record(t.String(),t.Unknown())),recommendation:t.Optional(t.String()),examples:t.Optional(t.Array(_c)),exampleCount:t.Optional(t.Integer())})]),zQ=t.Object({generatedAt:t.String(),overallScore:t.Optional(t.Number()),rules:t.Array(vh),teamResults:t.Array(t.Object({teamId:t.String(),teamName:t.String(),teamWeight:t.Number(),score:t.Number(),weightedScore:t.Number(),totalWeight:t.Number(),ruleResults:t.Array(Uh)})),globalResults:t.Optional(t.Object({score:t.Optional(t.Number()),ruleResults:t.Array(Uh)}))}),Nh=t.Object({id:t.String({description:"Identifier of this persisted quality-report row. Generated by Tsuga when report rows are stored. Returned on every row. Treat it as an opaque ID."}),reportId:t.String({description:"Identifier shared by rows from the same report generation for the same team or global cluster-wide scope. Generated by Tsuga when the report is stored. Returned on every row."}),ruleId:t.Enum(wh,{description:"Stable key for the telemetry-quality rule evaluated by this row. Set by Tsuga from the quality-rule catalog. Returned on every row. The enum may grow as Tsuga adds rules; clients should display unknown future values as opaque rule keys if they do not have local labels."}),owner:t.Optional(t.String({description:"Team identifier this row applies to. Set to the owning team ID for team-scoped rules. Returned for team rows; omitted for global cluster-wide rows."})),status:t.Enum(yk,{description:"Evaluation outcome for this rule row. Set by the rule evaluator when the report is generated. Returned on every row. Allowed values are passed, failed, and ignored; ignored means the rule was not applicable to the available data."}),score:t.Number({description:"Normalized score for this rule row. Set by the rule evaluator when the report is generated. Returned on every row. Values are between 0 and 1."}),weight:t.Number({description:"Impact weight of this rule, captured at report-generation time. Set by Tsuga from the rule's impact label: 1 for normal, 2 for important, 3 for critical. Used with score to compute reportOverallScore."}),reportOverallScore:t.Number({description:"Aggregate score for this row's report group. Calculated by Tsuga from non-ignored rows in the same team or global cluster-wide report. Returned on every row in that group with the same value."}),reportTotalWeight:t.Number({description:"Sum of non-ignored rule weights for this row's report group. Calculated by Tsuga when the report is generated. Returned on every row in that group with the same value."}),recommendation:t.Optional(t.String({description:"Recommendation stored with this row. Set by the rule evaluator when the report is generated. Returned when a recommendation was persisted; omitted otherwise. The latest-report endpoint does not recompute or default it at read time."})),examples:t.Optional(t.Array(_c,{description:`Assets, logs, metrics, or links supporting this rule result. Set by the rule evaluator when the report is generated. Returned when examples were persisted and visible to the caller; global row examples are returned only to admin users. Truncated to the first ${GQ}; compare against exampleCount to detect truncation.`})),exampleCount:t.Optional(t.Integer({description:"Total number of examples persisted for this row, before the preview truncation applied to examples. Returned whenever examples are visible to the caller."})),createdAt:t.String({description:"ISO timestamp the row was generated at"})}),eit=d({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:zQ}),zl=t.Optional(p({allowEmpty:!1,description:"Identifier of the cluster whose latest quality-report rows are returned. Use the id from the clusters API. Required when the organization has multiple clusters; omit only in single-cluster organizations. Unknown cluster IDs return RESOURCE_NOT_FOUND."})),tit=d({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:t.Object({clusterId:zl,team:t.Optional(p({allowEmpty:!1}))}),response:t.Array(Nh,{description:"Latest persisted rule evaluation rows for the cluster"})}),rit=d({tags:["quality-reports"],url:"/v0/quality-reports/:id/examples",method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:t.Object({examples:t.Array(_c)})}),nit=d({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:t.Object({ruleKey:Tk,teamId:t.Optional(p({allowEmpty:!1})),lookbackMinutes:t.Optional(t.Integer({minimum:1,maximum:60})),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Object({rule:vh,result:Uh,teamId:t.Optional(t.String()),teamName:t.Optional(t.String())})}),oit=d({tags:["quality-reports"],url:"/v0/quality-reports/auto-fix-stream",method:"POST",body:t.Object({ruleKey:Tk,teamId:t.Optional(p({allowEmpty:!1})),clusterId:zl,environmentId:p({allowEmpty:!1})}),response:t.Any()}),iit=new Map(hk.map(e=>[e.key,e]));var Ek=`/${"v1"}/quality-reports`,_k=t.Pick(Nh,["id","reportId","ruleId","owner","status","score","weight","reportOverallScore","reportTotalWeight","recommendation","examples","exampleCount","createdAt"],{$id:"QualityReportRow",description:"Persisted evaluation of one telemetry-quality rule for a team or cluster-wide scope. See [Quality reports](/documentation/account-and-settings/quality-reports)."}),YQ={id:"01j9x3z4vyabcdfghjkmnpqrst",reportId:"01j9x3z4vyabcdfghjkmnpqrsu",ruleId:"team-has-route",owner:"01j9x3z4vyabcdfghjkmnpqrr",status:"passed",score:1,weight:2,reportOverallScore:.85,reportTotalWeight:2,createdAt:"2026-02-26T12:00:00.000Z"};Object.assign(_k,{examples:[YQ]});var VQ=t.Object({clusterId:zl,team:t.Optional(p({allowEmpty:!1,description:"Team name used to scope the report. Matched against Tsuga team names. Optional; when set, returns only rows for that team and omits global rows. Unknown team names return RESOURCE_NOT_FOUND; teams the caller cannot access return an empty result."}))},{description:"Latest quality report lookup query."}),Ik=d({description:"Retrieves the latest persisted quality-report rows for a cluster, optionally scoped to one team. Use this to audit telemetry hygiene and routing recommendations.",operationId:"getLatestQualityReport",tags:["quality-reports"],url:`${Ek}/latest`,method:"GET",query:VQ,response:t.Array(_k)}),mit=d({description:"Retrieves every example stored for one quality-report row. The latest-report endpoint returns only a preview of each row's examples, so use this to page past that preview when exampleCount exceeds the number of examples returned there.",operationId:"getQualityReportExamples",tags:["quality-reports"],url:`${Ek}/:id/examples`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the quality-report row whose examples are returned. Use the id from the latest-report endpoint. Unknown ids, rows the caller cannot access, and cluster-wide rows requested by a non-admin all return RESOURCE_NOT_FOUND."})}),response:t.Object({examples:t.Array(_c,{description:"Every example stored for this row, untruncated. Empty when the rule evaluation produced none."})},{description:"All examples stored for one quality-report row."})});var Ic="/v0/admin-center";var Br=`${Ic}/retention-policies`,Sk=3650,QQ=t.Integer({description:"Number of days Tsuga retains matching telemetry."}),bk=t.Integer({minimum:1,maximum:Sk,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${Sk}.`}),un=t.Object({id:t.String({description:"Unique identifier of the retention policy. Generated by Tsuga."}),env:t.Optional(t.String({description:"Environment tag value this policy applies to. Omitted policies apply across environments unless a more specific policy exists."})),teamId:t.Optional(t.String({description:"Team ID this policy applies to. Omitted policies apply globally unless a team-specific policy exists."})),dataSource:t.Enum(vr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:QQ,isEnabled:t.Boolean({description:"Whether this policy participates in retention resolution."}),createdAt:S({description:"Timestamp when Tsuga created the retention policy."}),updatedAt:S({description:"Timestamp when Tsuga last updated the retention policy."})}),Yl=t.Object({env:Se(p(),{description:"Environment tag value this policy applies to. Omit for a policy that is not environment-specific."}),teamId:Se(p(),{description:"Team ID this policy applies to. Omit for a policy that is not team-specific."}),dataSource:t.Enum(vr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:bk,isEnabled:t.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),Ok=t.Array(t.Object({env:p(),dataSource:t.Enum(vr),durationDays:t.Union([bk,t.Null()]),isEnabled:t.Boolean()})),Ak=t.Object({inserted:t.Array(un),updated:t.Array(un),deleted:t.Array(un)}),Iit=d({tags:["retention-policies"],url:Br,method:"POST",body:Yl,response:un}),Sit=d({tags:["retention-policies"],url:Br,method:"GET",response:t.Array(un)}),bit=d({tags:["retention-policies"],url:`${Br}/:id`,method:"GET",params:t.Object({id:p()}),response:un}),Oit=d({tags:["retention-policies"],url:`${Br}/:id`,method:"PUT",params:t.Object({id:p()}),body:Yl,response:un}),Ait=d({tags:["retention-policies"],url:`${Br}/bulk-update`,method:"POST",body:Ok,response:Ak}),xit=d({tags:["retention-policies"],url:`${Br}/bulk-update-for-team`,method:"POST",body:t.Object({teamId:p(),policies:Ok}),response:Ak}),Rit=d({tags:["retention-policies"],url:`${Br}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),Sc=["past-24-hours","past-7-days","past-30-days"],Cit=d({tags:["retention-policies"],url:`${Br}/requested-history-percentile/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({percentile:t.Number({minimum:0,maximum:1}),observationWindow:t.Enum(Sc),dataSource:t.Enum(vr)}),response:t.Object({percentile:t.Number(),observationWindow:t.Enum(Sc),dataSource:t.Enum(vr),teamId:t.String(),requestedHistoryDays:t.Number()})}),WQ=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var ZQ=t.Array(t.Object({bucket:t.Enum(WQ),count:t.Number()})),Pit=d({tags:["retention-policies"],url:`${Br}/requested-history-histogram/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({observationWindow:t.Enum(Sc),dataSource:t.Enum(vr)}),response:t.Object({observationWindow:t.Enum(Sc),dataSource:t.Enum(vr),teamId:t.String(),histogram:ZQ})}),Uit=d({tags:["retention-policies"],url:`${Br}/top-teams-with-retention-surplus`,method:"POST",body:t.Object({dataSource:t.Enum(vr),observationWindow:t.Enum(Sc),percentile:t.Number({minimum:0,maximum:1}),topN:t.Optional(t.Number({minimum:1,maximum:20}))}),response:t.Array(t.Object({teamId:t.String(),retentionSurplusDays:t.Number()}))});var bc=`/${"v1"}/retention-policies`,Oc=t.Pick(un,["id","env","teamId","dataSource","durationDays","isEnabled"],{$id:"RetentionPolicy",description:"Retention rule for logs, metrics, or traces. Policies can apply globally, to an environment, or to a team depending on which scope fields are present. See [Retention](/documentation/account-and-settings/retention)."}),XQ={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Oc,{examples:[XQ]});var xk=d({description:"Lists retention policy rows visible to the authenticated operation key. Use this to audit retention duration by signal, environment, and team.",operationId:"listRetentionPolicies",tags:["retention-policies"],url:bc,method:"GET",response:t.Array(Oc)}),Rk=d({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${bc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to retrieve. Use the `id` returned by retention policy list or create responses."})}),response:Oc}),Lh=t.Pick(Yl,["env","teamId","dataSource","durationDays","isEnabled"],{description:"Retention policy create or update request. Provide the telemetry signal, retention duration, enabled state, and optional environment or team scope."}),JQ={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Lh,{examples:[JQ]});var Ck=d({description:"Creates a retention policy row for a telemetry signal, optionally scoped to an environment or team. Only one policy may exist per combination of data source, environment, and team; creating a duplicate combination fails.",operationId:"createRetentionPolicy",tags:["retention-policies"],url:bc,method:"POST",body:Lh,response:Oc}),Pk=d({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${bc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to update. Use the `id` returned by retention policy list, get, or create responses."})}),body:Lh,response:Oc}),Uk=d({description:"Deletes a retention policy by ID. Retention resolution falls back to the next broader matching policy when one exists.",operationId:"deleteRetentionPolicy",tags:["retention-policies"],url:`${bc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to delete. Use the `id` returned by retention policy list, create, or update responses."})}),response:v});var Ac=`/${"v1"}/slos`,e5=t.Pick(Lg,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),xc=t.Object({...t.Pick(Wi,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:t.Array(e5,{description:"Alerts attached to this SLO"})},{$id:"Slo",description:"Service Level Objective definition: its SLI configuration, target percentage, rolling timeframe, cluster scope, and attached alerts"}),t5={id:"123-456-abc",name:"API availability 99.9%",description:"Overall API gateway availability over the last 30 days",tags:[{key:"team",value:"platform"}],configuration:{type:"event",dataSource:"logs",goodQuery:{queries:[{filter:"status:ok",aggregate:{type:"count"}}],formula:"q1"},totalQuery:{queries:[{filter:"*",aggregate:{type:"count"}}],formula:"q1"},noDataBehavior:"good"},target:99.9,timeframeDays:30,owner:"team-123-abc",permissions:"all",clusterIds:[],alerts:[{id:"alert-123-abc",sloId:"123-456-abc",priority:1,configuration:{type:"burn-rate",burnRate:14.4}}]};Object.assign(xc,{examples:[t5]});var wk=t.Pick(Dg,["filters","sort","limit","offset"]),vk=t.Object({...wk.properties,...qe,filters:wk.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),r5={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"availability"},tags:{values:[{key:"team",value:"platform"}]},statuses:{values:["breached"]},clusterIds:{values:["cluster-123-abc"]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(vk,{examples:[r5]});var Nk=d({description:"Queries SLOs visible to the authenticated operation key. Use this endpoint to inventory SLO definitions, filter by owner, tag, status, or cluster, and page through results.",operationId:"querySlos",tags:["slos"],url:`${Ac}/query`,method:"POST",paginated:!0,body:vk,response:t.Array(xc)}),Lk=d({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${Ac}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:xc}),kk=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],Mk=t.Pick(El,kk,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),Dk=t.Pick(kg,kk,{$id:"UpdateSloRequest",description:"SLO update request. Send all required SLO fields and the full alert list. Alerts are reconciled to exactly the provided list: alerts with a known id are updated, alerts without an id are created, and existing alerts absent from the list are deleted. Omit `clusterIds` to preserve the current cluster scope; send an empty array to run on all clusters."}),Gk={name:"API availability 99.9%",description:"Overall API gateway availability over the last 30 days",tags:[{key:"team",value:"platform"}],configuration:{type:"event",dataSource:"logs",goodQuery:{queries:[{filter:"status:ok",aggregate:{type:"count"}}],formula:"q1"},totalQuery:{queries:[{filter:"*",aggregate:{type:"count"}}],formula:"q1"},noDataBehavior:"good"},target:99.9,timeframeDays:30,owner:"team-123-abc",permissions:"all",clusterIds:[],alerts:[{priority:1,configuration:{type:"burn-rate",burnRate:14.4}}]};Object.assign(Mk,{examples:[Gk]});Object.assign(Dk,{examples:[Gk]});var $k=d({description:"Creates an SLO owned by the specified team. The SLO can be event-based (good/total queries) or time-based (a thresholded query over evaluation slices) depending on its configuration.",operationId:"createSlo",tags:["slos"],url:Ac,method:"POST",body:Mk,response:xc}),Fk=d({description:"Replaces an existing SLO definition by ID. Send the full SLO input shape, including configuration, ownership, permissions, cluster scope, and the reconciled alert list. Changing configuration, target, timeframe, permissions, or cluster scope resets evaluated SLO state, so returned status and error budget are based on data evaluated after the update.",operationId:"updateSlo",tags:["slos"],url:`${Ac}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to update. Use the `id` returned by SLO query or create."})}),body:Dk,response:xc}),jk=d({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${Ac}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to delete. Use the `id` returned by SLO query or create."})}),response:v});var qo=`${Ic}/tag-policies`;var n5=["logs","metrics","traces"],kh=t.Array(t.Enum(n5,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),o5=t.Union([au,kh]),i5=t.Object({teamIds:t.Array(t.String(),{description:"Team IDs used by this policy scope."}),mode:t.Enum(["include","exclude"],{description:"`include` applies the policy only to listed teams. `exclude` applies it to all teams except the listed teams."})},{description:"Team scope that limits where this policy applies. Omitted means the policy applies to all teams."}),a5=x("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:kh,shouldInsertWarning:t.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:t.Optional(t.Number({description:"Percentage of non-compliant telemetry datapoints to drop. Omitted means no sampling drop is configured."}))},{title:"TelemetryTagPolicy"}),t.Object({type:t.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:au},{title:"TsugaAssetTagPolicy"})]),s5=x("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:kh,shouldInsertWarning:t.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:t.Optional(t.Number({minimum:0,maximum:100,description:"Percentage of non-compliant telemetry datapoints to drop. Valid values are 0 through 100."}))},{title:"TelemetryTagPolicy"}),t.Object({type:t.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:au},{title:"TsugaAssetTagPolicy"})]),qk="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",c5=t.Unsafe({...a5,description:qk}),p5=t.Unsafe({...s5,description:qk}),Ta=t.Object({id:t.String({description:"Tsuga-generated tag policy ID assigned when the policy is created."}),name:t.String({description:"Human-readable tag policy name."}),description:t.Optional(t.String({description:"Optional user-provided policy description."})),isActive:t.Boolean({description:"Whether Tsuga currently evaluates this policy. Reserved policies (for example the built-in `env` policy on ingestion API keys) cannot be set to false."}),tagKey:t.String({description:"Tag key enforced by this policy."}),allowedTagValues:t.Array(t.String(),{description:"Allowed values for `tagKey`. An empty array means any value is accepted when the tag exists."}),isRequired:t.Boolean({description:"Whether the tag must be present. If false, `allowedTagValues` is still enforced when the tag exists. Reserved policies cannot be set to false."}),teamScope:t.Optional(i5),configuration:c5,creator:t.Optional(pe),updater:t.Optional(pe),owner:t.Optional(t.String({description:"Team ID that owns and manages the policy."})),createdAt:S({description:"Timestamp when Tsuga created the tag policy."}),updatedAt:S({description:"Timestamp when Tsuga last updated the tag policy."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})});var Rc=t.Object({name:p({description:"Human-readable tag policy name."}),description:Se(p(),{description:"Optional policy description."}),isActive:t.Boolean({description:"Set to true for Tsuga to evaluate this policy. Reserved policies (for example the built-in `env` policy on ingestion API keys) reject a false value."}),tagKey:p({allowEmpty:!1,description:"Tag key enforced by this policy. Tsuga trims surrounding whitespace before storing the policy."}),allowedTagValues:t.Array(p({allowEmpty:!1}),{maxItems:1e3,description:"Allowed values for `tagKey`. Leave empty to allow any value when the tag exists. Tsuga trims each submitted value before storing the policy."}),isRequired:t.Boolean({description:"Set to true to require the tag. If false, allowed values still apply when the tag exists. Reserved policies reject a false value."}),teamScope:t.Optional(t.Object({teamIds:t.Array(p(),{minItems:1,maxItems:100,description:"Team IDs used by this policy scope."}),mode:t.Enum(["include","exclude"],{description:"`include` applies the policy only to listed teams. `exclude` applies it to all teams except the listed teams."})},{description:"Team scope to store for this policy. Omit this field to apply the policy to all teams."})),configuration:p5,owner:p({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),Jit=d({tags:["tag-policies"],url:qo,method:"GET",query:t.Object({teamIds:t.Optional(t.Array(p(),{maxItems:100})),assetTypes:t.Optional(o5),searchQuery:t.Optional(p())}),response:t.Array(Ta)}),eat=d({tags:["tag-policies"],url:`${qo}/:id`,method:"GET",params:t.Object({id:p()}),response:Ta}),tat=d({tags:["tag-policies"],url:qo,method:"POST",body:Rc,response:Ta}),rat=d({tags:["tag-policies"],url:`${qo}/:id`,method:"PUT",params:t.Object({id:p()}),body:Rc,response:Ta}),nat=d({tags:["tag-policies"],url:`${qo}/:id`,method:"DELETE",params:t.Object({id:p()}),response:v}),oat=d({tags:["tag-policies"],url:`${Ic}/applicable-tag-rules`,method:"GET",query:t.Object({assetType:t.Enum(ss),teamId:p()}),response:t.Array(t.Object({tagKey:t.String(),allowedTagValues:t.Array(t.String()),isRequired:t.Boolean(),tagPolicyId:t.String()}))}),Bk=t.Object({total:t.Number(),totalNonCompliant:t.Number(),idsNonCompliant:t.Array(t.String())}),Hk=t.Union([t.Literal("ingestion-api-key"),t.Literal("operation-api-key"),t.Literal("rum-public-token"),t.Literal("dashboard"),t.Literal("log-route"),t.Literal("metric-route"),t.Literal("monitor"),t.Literal("notification-rule"),t.Literal("notification-silence"),t.Literal("slo")]),u5=t.Object({total:t.Number(),totalNonCompliant:t.Number(),byAssetType:t.Record(Hk,Bk)}),l5=t.Omit(Bk,["total"]),m5=t.Object({totalNonCompliant:t.Number(),byAssetType:t.Record(Hk,l5)}),Kk=t.Object({totals:u5,byTeam:t.Record(t.String(),m5)}),iat=d({tags:["tag-policies"],url:`${qo}/:id/stats`,method:"GET",params:t.Object({id:p()}),response:Kk}),aat=d({tags:["tag-policies"],url:`${qo}/new-policy-stats`,method:"POST",body:Rc,response:Kk});var Cc=`/${"v1"}/tag-policies`,zk={name:"Required Environment Tag",description:"Requires dashboards and monitors to declare an environment.",isActive:!0,tagKey:"environment",allowedTagValues:["production","staging"],isRequired:!0,teamScope:{teamIds:["team-123-abc"],mode:"include"},configuration:{type:"tsuga_asset",assetTypes:["dashboard","monitor"]},owner:"team-123-abc"},Yk={name:"Telemetry Environment Policy",description:"Warns when telemetry is missing a known deployment environment.",isActive:!0,tagKey:"deployment.environment.name",allowedTagValues:["production","staging","development"],isRequired:!0,configuration:{type:"telemetry",assetTypes:[],shouldInsertWarning:!0,dropSample:25},owner:"team-123-abc"},d5={id:"123-456-abc",...zk},f5={id:"456-789-def",...Yk},Pc=t.Pick(Ta,["id","name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"],{$id:"TagPolicy",description:"Policy that enforces tag requirements on Tsuga-managed assets or telemetry data. See [Tag policies](/documentation/account-and-settings/tag-policies)."}),g5=d5,h5=f5;Object.assign(Pc,{examples:[g5,h5]});var Mh=t.Pick(Rc,["name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"],{description:"Tag policy create or update request. Provide policy identity, owner, enforced tag key, allowed values, team scope, active state, and asset or telemetry configuration."}),y5=zk,T5=Yk;Object.assign(Mh,{examples:[y5,T5]});var Vk=d({description:"Lists tag policies visible to the authenticated operation key. Use this to audit required tags, allowed values, team scope, and whether each policy applies to assets or telemetry.",operationId:"listTagPolicies",tags:["tag-policies"],url:Cc,method:"GET",response:t.Array(Pc)}),Qk=d({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${Cc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to retrieve. Use the `id` returned by tag policy list or create responses."})}),response:Pc}),Wk=d({description:"Creates a tag policy for Tsuga-managed assets or telemetry data. Use the configuration type to choose the policy surface.",operationId:"createTagPolicy",tags:["tag-policies"],url:Cc,method:"POST",body:Mh,response:Pc}),Zk=d({description:"Replaces an existing tag policy by ID, including scope, requiredness, allowed values, owner, active state, and configuration. Reserved policies (for example the built-in `env` policy on ingestion API keys) reject changes to `tagKey` and reject `isActive: false` or `isRequired: false`.",operationId:"updateTagPolicy",tags:["tag-policies"],url:`${Cc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to update. Use the `id` returned by tag policy list, get, or create responses."})}),body:Mh,response:Pc}),Xk=d({description:"Deletes a tag policy by ID. Tsuga stops evaluating the policy after deletion. Reserved policies (for example the built-in `env` policy on ingestion API keys) cannot be deleted.",operationId:"deleteTagPolicy",tags:["tag-policies"],url:`${Cc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to delete. Use the `id` returned by tag policy list, create, or update responses."})}),response:v});var Uc=`/${"v1"}/teams`,wc=t.Pick(Rn,["id","name","description","visibility","tags"],{$id:"Team",description:"Collection of users used to manage ownership, visibility, and access to team-owned Tsuga resources. See [Teams](/documentation/account-and-settings/teams)."}),E5={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(wc,{examples:[E5]});var Jk=d({description:"Lists teams visible to the authenticated operation key. Use this endpoint to inventory owners for resources, dashboards, monitors, routes, and policies. Pagination fields limit the returned page.",operationId:"listTeams",tags:["teams"],url:Uc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(wc)}),eM=d({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${Uc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to retrieve. Use the `id` returned by team list or create responses."})}),response:wc}),Dh=t.Pick(yu,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),_5={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Dh,{examples:[_5]});var tM=d({description:"Creates a team for ownership and access control. Use this before assigning resources to a new owner team. A new team sits outside every existing team, so the operation key must be scoped to all teams: a key scoped to its owning team cannot create teams, even with write access to teams.",operationId:"createTeam",tags:["teams"],url:Uc,method:"POST",body:Dh,response:wc}),rM=d({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${Uc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to update. Use the `id` returned by team list, get, or create responses."})}),body:Dh,response:wc}),nM=d({description:"Deletes a team. Fails while the team still owns resources (dashboards, monitors, routes, API keys, etc.); reassign or delete those first. Team memberships are removed automatically as part of the deletion.",operationId:"deleteTeam",tags:["teams"],url:`${Uc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to delete. Use the `id` returned by team list, create, or update responses."})}),response:v});function I5(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function oM(e,r){let n=Number(r);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${r})`);return n}function iM(e){let r={};return e.limit!==void 0&&(r.limit=oM("limit",e.limit)),e.offset!==void 0&&(r.offset=oM("offset",e.offset)),r}function Gh(e){let r=e.params;if(r?.properties){let n=Object.keys(r.properties);if(n.length===1&&n[0])return n[0]}return"id"}function aM(e,r,n){let o=e.command(r.commandName).description(r.description),i=r.singularOverride??GR(r.commandName).replace(/-/g," "),a=r.pluralOverride??r.commandName.replace(/-/g," "),c=I5(i),l=o.command("list").description(r.listDescription??`List all ${a}`);if(r.listOptions)for(let m of r.listOptions)l.option(m.flag,m.description);if(r.endpoints.list.paginated===!0&&l.option("--limit <n>",`Maximum number of items to return, up to ${_i} (default: ${iu})`).option("--offset <n>","Number of items to skip, to request a later page"),r.enableListBody?l.option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async m=>{if(m.generateSkeleton){W(Bi(r.endpoints.list));return}let f=m.data?Ui({data:m.data}):{},h=await n()(r.endpoints.list,{body:{...f,...iM(m)}});W(h)}):l.action(async m=>{let f=iM(m);if(r.listOptions)for(let E of r.listOptions){let I=m[E.queryParam];I!==void 0&&(f[E.queryParam]=I)}let h=await n()(r.endpoints.list,Object.keys(f).length>0?{query:f}:void 0);W(h)}),r.endpoints.get){let m=r.endpoints.get,f=Gh(m);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});W(E)})}if(r.endpoints.create){let m=r.endpoints.create;o.command("create").description(`Create a new ${i}`).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async f=>{if(f.generateSkeleton){W(Bi(m));return}let h=Ui(f),E=await n()(m,{body:h});W(E)})}if(r.endpoints.update){let m=r.endpoints.update,f=Gh(m);o.command("update <ID>").description(`Update ${c} ${i} by ID`).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async(h,E)=>{if(E.generateSkeleton){W(Bi(m));return}let I=Ui(E),g=await n()(m,{params:{[f]:h},body:I});W(g)})}if(r.endpoints.delete){let m=r.endpoints.delete,f=Gh(m);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});W(E)})}}var S5=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:nL},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:pN,get:uN,create:lN,update:mN,delete:dN},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:kN,get:MN,create:DN,update:GN,delete:$N},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:zN,create:YN,update:VN,delete:QN}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:iL,get:aL,create:sL,update:cL,delete:pL}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:LL,get:kL,create:BL,update:HL,delete:KL},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:ek,get:tk,create:rk,update:nk,delete:ok}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:pk,get:uk,create:lk,update:mk,delete:dk}},{commandName:"notification-integrations",description:"Manage notification integrations",endpoints:{list:zL,get:YL,create:QL,update:ZL,delete:XL}},{commandName:"quality-reports",description:"Get the latest quality report rows for a cluster",listDescription:"Get the latest quality report rows for a cluster (pass --cluster <CLUSTER_ID> when the org has more than one cluster)",endpoints:{list:Ik},listOptions:[{flag:"--team <TEAM_NAME>",description:"Only return rows for this team by name (omits cluster-wide global rows)",queryParam:"team"}]},{commandName:"retention-policies",description:"Manage retention policies",endpoints:{list:xk,get:Rk,create:Ck,update:Pk,delete:Uk}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:bL,get:OL,create:AL,update:xL,delete:RL}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:uv,get:lv}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:Nk,get:Lk,create:$k,update:Fk,delete:jk},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:Vk,get:Qk,create:Wk,update:Zk,delete:Xk}},{commandName:"teams",description:"Manage teams",endpoints:{list:Jk,get:eM,create:tM,update:rM,delete:nM}}];function sM(e,r){for(let n of S5)aM(e,n,r)}var cM=require("node:child_process");var Vl="@tsuga/cli@latest";function b5(){z(`Updating ${Vl}`),z(` $ npm install -g ${Vl}`);try{(0,cM.execFileSync)("npm",["install","-g",Vl],{stdio:["ignore","inherit","inherit"]})}catch(e){let r=e.status??1;throw new Error(`npm install -g ${Vl} exited ${r}`,{cause:e})}z("Updated. Run `tsuga --version` to confirm the new version.")}function pM(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{b5()})}var Kh=require("node:fs"),Hh=require("node:os"),_a=require("node:path");var O5=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,vc=class e extends Date{#t=!1;#r=!1;#e=null;constructor(r){let n=!0,o=!0,i="Z";if(typeof r=="string"){let a=r.match(O5);a?(a[1]||(n=!1,r=`0000-01-01T${r}`),o=!!a[2],o&&r[10]===" "&&(r=r.replace(" ","T")),a[2]&&+a[2]>23?r="":(i=a[3]||null,r=r.toUpperCase(),!i&&o&&(r+="Z"))):r=""}super(r),isNaN(this.getTime())||(this.#t=n,this.#r=o,this.#e=i)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let r=super.toISOString();if(this.isDate())return r.slice(0,10);if(this.isTime())return r.slice(11,23);if(this.#e===null)return r.slice(0,-1);if(this.#e==="Z")return r;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(r,n="Z"){let o=new e(r);return o.#e=n,o}static wrapAsLocalDateTime(r){let n=new e(r);return n.#e=null,n}static wrapAsLocalDate(r){let n=new e(r);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(r){let n=new e(r);return n.#t=!1,n.#e=null,n}};function A5(e,r){let n=e.slice(0,r).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function x5(e,r,n){let o=e.split(/\r\n|\n|\r/g),i="",a=(Math.log10(r+1)|0)+1;for(let c=r-1;c<=r+1;c++){let l=o[c-1];l&&(i+=c.toString().padEnd(a," "),i+=": ",i+=l,i+=`
146
- `,c===r&&(i+=" ".repeat(a+n+2),i+=`^
147
- `))}return i}var ee=class extends Error{line;column;codeblock;constructor(r,n){let[o,i]=A5(n.toml,n.ptr),a=x5(n.toml,o,i);super(`Invalid TOML document: ${r}
144
+ fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(r=>{let{rows:n,valueFlags:o}=x2(e);if(r==="bash")Y(R2(ZR(n),o));else if(r==="zsh")Y(C2(ZR(n),o));else if(r==="fish")Y(U2(P2(n),o));else throw new Error(`Unsupported shell "${r}". Supported: bash, zsh, fish.`)})}function eC(e){let r=e.command("config").description("Show or manage configuration");r.action(()=>{let n=e.opts(),o=Ri({clusterId:n.cluster});Y(sR(o,Cu()).trimEnd())}),r.command("set").description("Set a configuration value").command("default <FLAG_NAME> <VALUE>").description("Set a custom default value for a command flag").allowUnknownOption(!0).action((n,o)=>{oR(n,o),Y(`Default set: ${n} = ${o}`)}),r.command("reset").description("Reset configuration values").command("defaults").description("Clear all custom defaults").action(()=>{iR(),Y("Custom defaults cleared")})}var nf={kind:t.Enum(["doc","api"],{description:"`doc` for documentation pages (guides, references, release notes); `api` for API-reference endpoints indexed from the OpenAPI spec. Use this to decide how to present or follow up on the result."}),path:t.String({description:"Path identifying the result. Documentation pages use a slug path (e.g. `data-collection/guides/how-to-add-resource-attributes`). API-reference results use `api/<operationId>` (e.g. `api/aggregateScalar`)."}),title:t.String({description:'Title of the result (e.g. "How to Add Resource Attributes" or "POST /v1/aggregation/multi-query/scalar")'}),subsection:t.Optional(t.String({description:'For documentation pages: the heading path inside the page that matched (e.g. "Language setup"). For API results: the matched field or parameter breadcrumb (e.g. "Body \u203A queries"). Absent when the match is the page or endpoint intro.'})),tab:t.Optional(t.String({description:'Tab label inside the page that the result matched. Set when the matching content is inside a <Tabs><Tab label="\u2026"> block. Always absent for API results.'})),anchor:t.Optional(t.String({description:"For documentation pages: the slugified heading ID used as the URL fragment (e.g. `language-setup`). For API results: the Scalar deep-link fragment (`tag/<tag>/<METHOD><path>`). The `link` field already has this baked in."})),score:t.Number({description:"Relevance score between 0 and 1 (higher is more relevant)"}),excerpt:t.String({description:"Short snippet of matching content"}),link:t.String({description:"URL to the result in the Tsuga app. Documentation pages include the section anchor and tab query parameter when applicable. API results deep-link into the API reference at `/documentation/api#tag/\u2026`."})},N2=t.Object({...nf,breadcrumb:t.Array(t.String(),{description:'Heading path inside the page that matched, followed by the tab label when the match is inside a <Tabs><Tab label="\u2026"> block. Empty for a page intro or endpoint-level match.'})}),vDe=d({tags:["docs"],url:"/v0/docs/search",method:"GET",query:t.Object({query:p({allowEmpty:!1,description:"Search text to match against documentation and API-reference content."}),limit:t.Optional(t.Integer({minimum:1,maximum:50,description:"Maximum number of results to return."}))}),response:t.Array(N2)});var tC=`/${"v1"}/docs`,rC=t.Object({path:t.String({description:"Path identifying the page. Documentation pages use a slug path (e.g. `getting-started/send-your-first-logs`). API-reference pages use `api/<operationId>` (e.g. `api/aggregateScalar`)."}),title:t.String({description:'Title of the page (e.g. "Send your first logs" or "POST /v1/aggregation/multi-query/scalar")'}),content:t.String({description:"Raw markdown content of the page"})},{$id:"DocPage",description:"A documentation or API-reference page with its raw markdown content"}),w2={path:"getting-started/send-your-first-logs",title:"Send your first logs",content:`# Send your first logs
145
+ ...`};Object.assign(rC,{examples:[w2]});var nC=t.Object(nf,{$id:"DocSearchResult",description:"A documentation page or API-reference endpoint search result"}),v2={kind:"doc",path:"data-collection/guides/how-to-add-resource-attributes",title:"How to Add Resource Attributes",subsection:"Set resource attributes by language",tab:"Python",anchor:"set-resource-attributes-by-language",score:.9,excerpt:"...Python SDK setup should use the default resource detectors...",link:"https://www.app.tsuga.com/documentation/data-collection/guides/how-to-add-resource-attributes?tab=Python#set-resource-attributes-by-language"};Object.assign(nC,{examples:[v2]});var oC=d({description:"Retrieve the raw markdown content of a documentation or API-reference page by its path. Documentation pages use slug paths (e.g. `getting-started/send-your-first-logs`); API-reference pages use `api/<operationId>` (e.g. `api/aggregateScalar`).",operationId:"getDocPage",tags:["public","docs"],url:tC,method:"GET",query:t.Object({path:p({allowEmpty:!1,description:"Documentation path to fetch. Use page slug paths for docs or `api/<operationId>` for API-reference pages."})},{description:"Documentation page lookup query."}),response:rC}),iC=d({description:"Searches public documentation pages and API-reference endpoints. Use this to build help search or route users to Tsuga docs and API reference results. Results are ranked by relevance; an empty array means no page or endpoint matched the query.",operationId:"searchDocs",tags:["public","docs"],url:`${tC}/search`,method:"GET",query:t.Object({query:p({allowEmpty:!1,description:"Search text to match against documentation and API-reference content."})},{description:"Documentation search query."}),response:t.Array(nC)});function sC(e,r){let n=e.command("docs").description("Search and fetch Tsuga documentation and API-reference pages");n.command("get <DOC_PATH>").description("Get a documentation or API-reference page by path (e.g. 'getting-started/send-your-first-logs' or 'api/aggregateScalar')").action(async o=>{let i=await r()(oC,{query:{path:o}});W(i)}),n.command("search <SEARCH_TEXT>").description("Search Tsuga documentation and the full API reference, ranked by relevance").action(async o=>{let i=await r()(iC,{query:{query:o}});W(i)})}var xN=require("node:fs");var L2="/v0/profiles",k2=["cpu","samples","wall","off_cpu","space","inuse_space","objects","inuse_objects","alloc_space","alloc_objects","goroutine"],M2=20,Ca={service:p({allowEmpty:!1,description:"Service the profiles belong to, as it appears in `profile.{type}.{service}`."}),type:t.Enum(k2,{description:"pprof sample type."}),filter:t.Optional(p({type:"tsuga-query",description:"TQL over the profile labels. Only label equality, negation and wildcards are accepted."})),groupBy:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Labels to split the flamegraph by. The stack itself cannot be a group-by."})),limit:t.Optional(t.Integer({minimum:1,default:M2,description:"Maximum number of groups, ranked by total value."})),minFraction:t.Optional(t.Number({minimum:0,maximum:1,description:"Nodes below this share of the root total fold into their parent."}))},QDe=d({tags:["profiles"],url:`${L2}/query`,method:"POST",body:t.Object({...Ca,timeRange:kn,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),response:Ui});var aC=`/${"v1"}/aggregation`,cC=t.Object({id:t.String({description:"Result identifier. Query results use `q1`, `q2`, and so on; formula results use `formula`."}),group:t.Record(t.String(),t.Union([t.String(),t.Number()]),{description:"Group-by field values for this result. Empty when no group-by is requested."})}),pC=t.Object({results:t.Array(t.Object({...cC.properties,value:t.Number({description:"Aggregated value for this query or formula and group, over the full time range."})},{title:"ScalarResult"}),{description:"One aggregated value per query or formula and group."})},{$id:"ScalarAggregationResponse",title:"ScalarAggregationResponse",description:"Scalar aggregation response with one value per query or formula and group."}),D2={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(pC,{examples:[D2]});var Fu=t.Object({series:t.Array(t.Object({...cC.properties,points:t.Array(t.Object({timestamp:t.Integer({description:"Unix timestamp in milliseconds for this point, spaced by `aggregationWindow`."}),value:t.Number({description:"Aggregated value at this timestamp."})}),{description:"Ordered data points for this query or formula and group."})},{title:"Series"}),{description:"One time series per query or formula and group."})},{$id:"TimeseriesAggregationResponse",title:"TimeseriesAggregationResponse",description:"Timeseries aggregation response with timestamped points over time."}),G2={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign(Fu,{examples:[G2]});var $2=t.Omit(Ra.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),F2=t.Optional(Jr),uC={timeRange:Tt,queries:t.Array($2,{maxItems:xa,description:`Aggregations that may be combined together in the same query. Each item is referenced from \`formula\` as q1, q2, and so on, in submission order. Limited to ${xa} items. For dataSource "metrics", each aggregate's \`field\` is the metric name, not an attribute; to count distinct values of an attribute use unique-count with field "<metricName>.context.<attribute>" (e.g. "system.cpu.utilization.context.host.name").`}),groupBy:F2,dataSource:Wt,formula:t.Optional(Ao)},Pa=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),lC=t.Object(uC,{description:"Scalar aggregation request. Provide a time range, one or more queries, a telemetry data source, and optional grouping or formula. Omit `groupBy` for ungrouped results. Send `clusterId` as a query parameter, not in the JSON body."}),j2={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(lC,{examples:[j2]});var mC=d({description:"Runs one or more aggregation queries over logs, metrics, traces, or RUM events and returns scalar values. Use optional group-by and formula fields to compute grouped or derived results. See [Analytics queries](/documentation/visualize/analytics/queries).",operationId:"aggregateScalar",tags:["public","aggregation"],url:`${aC}/multi-query/scalar`,method:"POST",body:lC,query:Pa,response:pC}),dC=t.Object({...uC,aggregationWindow:p({description:"Time bucket size for timeseries aggregation, such as `10s`, `1m`, or `1h`."})},{description:"Timeseries aggregation request. Provide a time range, bucket size, one or more queries, a telemetry data source, and optional grouping or formula. Omit `groupBy` for ungrouped series. Send `clusterId` as a query parameter, not in the JSON body."}),q2={timeRange:{from:1782201500,to:1782203400},aggregationWindow:"1m",dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(dC,{examples:[q2]});var fC=d({description:"Runs one or more aggregation queries over logs, metrics, traces, or RUM events and returns timestamped series. Use `aggregationWindow` to choose the time bucket size. See [Analytics queries](/documentation/visualize/analytics/queries).",operationId:"aggregateTimeseries",tags:["public","aggregation"],url:`${aC}/multi-query/timeseries`,method:"POST",body:dC,query:Pa,response:Fu});var gC=`/${"v1"}/profiles`,hC=t.Object({...Ca,timeRange:Tt},{description:"Profile query request. Send clusterId as a query parameter, not in this JSON body.",examples:[{service:"api",type:"cpu",timeRange:{from:1782201500,to:1782203400},filter:"context.env:prod"}]}),B2=t.Object({stacks:t.Array(t.Object({stack:t.String({description:"Frames from the root to the leaf, joined with `;` (folded stack format)."}),group:t.Record(t.String(),t.String(),{description:"Group-by label values for this stack. Empty when no group-by is requested."}),value:t.Number({description:"Total sample value of this stack, in the unit of the profile type."})}),{description:"One entry per distinct leaf stack, after folding nodes below minFraction."})},{examples:[{stacks:[{stack:"main;handleRequest;encodeJson",group:{},value:125e7},{stack:"main;handleRequest;queryDb",group:{},value:8e8}]}]}),of=d({description:"Aggregates continuous profiling samples for a service into folded stacks, optionally split by profile labels.",tags:["private"],url:`${gC}/query`,method:"POST",body:hC,query:Pa,response:B2}),H2=t.Object({pprof:t.String({description:"Merged pprof profile, base64-encoded (standard alphabet, padded)."})}),yC=d({description:"Merges continuous profiling samples for a service into a single pprof profile.",tags:["private"],url:`${gC}/pprof`,method:"POST",body:hC,query:Pa,response:H2});var TC=fn(require("node:fs"));function wi(e){if(e.file){let r=TC.default.readFileSync(e.file==="-"?0:e.file,"utf-8");return JSON.parse(r)}if(e.data)return JSON.parse(e.data);throw new Error("Provide a request body with -f <FILE_PATH> or -d <JSON>. Use --generate-skeleton to get a template.")}function sf(e){return a.HasPropertyKey(e,"~refine")&&a.IsArray(e["~refine"])&&a.Every(e["~refine"],0,r=>a.IsObject(r)&&a.HasPropertyKey(r,"check")&&a.HasPropertyKey(r,"error")&&a.IsFunction(r.check)&&a.IsFunction(r.error))}function yr(e){return a.IsObject(e)&&!a.IsArray(e)}function ju(e){return a.IsBoolean(e)}function j(e){return yr(e)||ju(e)}function af(e){return a.HasPropertyKey(e,"additionalItems")&&j(e.additionalItems)}function en(e){return a.HasPropertyKey(e,"additionalProperties")&&j(e.additionalProperties)}function cf(e){return a.HasPropertyKey(e,"allOf")&&a.IsArray(e.allOf)&&e.allOf.every(r=>j(r))}function Ua(e){return a.HasPropertyKey(e,"$anchor")&&a.IsString(e.$anchor)}function pf(e){return a.HasPropertyKey(e,"anyOf")&&a.IsArray(e.anyOf)&&e.anyOf.every(r=>j(r))}function uf(e){return a.HasPropertyKey(e,"const")}function xo(e){return a.HasPropertyKey(e,"contains")&&j(e.contains)}function Zt(e){return a.HasPropertyKey(e,"default")}function lf(e){return a.HasPropertyKey(e,"dependencies")&&a.IsObject(e.dependencies)&&Object.values(e.dependencies).every(r=>j(r)||a.IsArray(r)&&r.every(n=>a.IsString(n)))}function mf(e){return a.HasPropertyKey(e,"dependentRequired")&&a.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(r=>a.IsArray(r)&&r.every(n=>a.IsString(n)))}function df(e){return a.HasPropertyKey(e,"dependentSchemas")&&a.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(r=>j(r))}function Gn(e){return a.HasPropertyKey(e,"$dynamicAnchor")&&a.IsString(e.$dynamicAnchor)}function ff(e){return a.HasPropertyKey(e,"$dynamicRef")&&a.IsString(e.$dynamicRef)}function gf(e){return a.HasPropertyKey(e,"else")&&j(e.else)}function hf(e){return a.HasPropertyKey(e,"enum")&&a.IsArray(e.enum)}function yf(e){return a.HasPropertyKey(e,"exclusiveMaximum")&&(a.IsNumber(e.exclusiveMaximum)||a.IsBigInt(e.exclusiveMaximum))}function tn(e){return a.HasPropertyKey(e,"exclusiveMinimum")&&(a.IsNumber(e.exclusiveMinimum)||a.IsBigInt(e.exclusiveMinimum))}function Na(e){return a.HasPropertyKey(e,"format")&&a.IsString(e.format)}function rn(e){return a.HasPropertyKey(e,"$id")&&a.IsString(e.$id)}function Tf(e){return a.HasPropertyKey(e,"if")&&j(e.if)}function vi(e){return a.HasPropertyKey(e,"items")&&(j(e.items)||a.IsArray(e.items)&&e.items.every(r=>j(r)))}function Ef(e){return vi(e)&&a.IsArray(e.items)}function _f(e){return a.HasPropertyKey(e,"maximum")&&(a.IsNumber(e.maximum)||a.IsBigInt(e.maximum))}function If(e){return a.HasPropertyKey(e,"maxContains")&&a.IsNumber(e.maxContains)}function qu(e){return a.HasPropertyKey(e,"maxItems")&&a.IsNumber(e.maxItems)}function Sf(e){return a.HasPropertyKey(e,"maxLength")&&a.IsNumber(e.maxLength)}function bf(e){return a.HasPropertyKey(e,"maxProperties")&&a.IsNumber(e.maxProperties)}function nn(e){return a.HasPropertyKey(e,"minimum")&&(a.IsNumber(e.minimum)||a.IsBigInt(e.minimum))}function Ro(e){return a.HasPropertyKey(e,"minContains")&&a.IsNumber(e.minContains)}function Li(e){return a.HasPropertyKey(e,"minItems")&&a.IsNumber(e.minItems)}function wa(e){return a.HasPropertyKey(e,"minLength")&&a.IsNumber(e.minLength)}function va(e){return a.HasPropertyKey(e,"minProperties")&&a.IsNumber(e.minProperties)}function Of(e){return a.HasPropertyKey(e,"multipleOf")&&(a.IsNumber(e.multipleOf)||a.IsBigInt(e.multipleOf))}function Af(e){return a.HasPropertyKey(e,"not")&&j(e.not)}function xf(e){return a.HasPropertyKey(e,"oneOf")&&a.IsArray(e.oneOf)&&e.oneOf.every(r=>j(r))}function La(e){return a.HasPropertyKey(e,"pattern")&&(a.IsString(e.pattern)||e.pattern instanceof RegExp)}function ka(e){return a.HasPropertyKey(e,"patternProperties")&&a.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(r=>j(r))}function ki(e){return a.HasPropertyKey(e,"prefixItems")&&a.IsArray(e.prefixItems)&&e.prefixItems.every(r=>j(r))}function Ma(e){return a.HasPropertyKey(e,"properties")&&a.IsObject(e.properties)&&Object.values(e.properties).every(r=>j(r))}function Rf(e){return a.HasPropertyKey(e,"propertyNames")&&(a.IsObject(e.propertyNames)||j(e.propertyNames))}function K2(e){return a.HasPropertyKey(e,"$recursiveAnchor")&&a.IsBoolean(e.$recursiveAnchor)}function Bu(e){return K2(e)&&a.IsEqual(e.$recursiveAnchor,!0)}function Cf(e){return a.HasPropertyKey(e,"$recursiveRef")&&a.IsString(e.$recursiveRef)}function Pf(e){return a.HasPropertyKey(e,"$ref")&&a.IsString(e.$ref)}function Co(e){return a.HasPropertyKey(e,"required")&&a.IsArray(e.required)&&e.required.every(r=>a.IsString(r))}function Uf(e){return a.HasPropertyKey(e,"then")&&j(e.then)}function Nf(e){return a.HasPropertyKey(e,"type")&&(a.IsString(e.type)||a.IsArray(e.type)&&e.type.every(r=>a.IsString(r)))}function Mi(e){return a.HasPropertyKey(e,"uniqueItems")&&a.IsBoolean(e.uniqueItems)}function Hu(e){return a.HasPropertyKey(e,"unevaluatedItems")&&j(e.unevaluatedItems)}function Ku(e){return a.HasPropertyKey(e,"unevaluatedProperties")&&j(e.unevaluatedProperties)}var Pt=class{constructor(){let r=new Set,n=new Set;this.stack=[{indices:r,keys:n}]}Push(){let r=new Set,n=new Set;return this.stack.push({indices:r,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(r){return this.GetIndices().add(r),!0}AddKey(r){return this.GetKeys().add(r),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(r){for(let n of r)n.GetIndices().forEach(o=>this.GetIndices().add(o)),n.GetKeys().forEach(o=>this.GetKeys().add(o));return!0}},Da=class extends Pt{constructor(r){super(),this.callback=r}AddError(r){return this.callback(r),!1}},ut=class extends Da{constructor(){super(r=>this.errors.push(r)),this.errors=[]}AddError(r){return this.errors.push(r),!1}GetErrors(){return this.errors}};function EC(e,r,n,o){return a.Every(n["~refine"],0,(i,s)=>i.check(o))}function _C(e,r,n,o,i,s){return a.EveryAll(i["~refine"],0,(c,l)=>c.check(s)||r.AddError({keyword:"~refine",schemaPath:n,instancePath:o,params:{index:l,message:c.error(s)}}))}function IC(e){return vi(e)&&a.IsArray(e.items)}function SC(e,r,n,o){return IC(n)?a.Every(o,0,(s,c)=>a.IsLessThan(c,n.items.length)||Xt(e,r,n.additionalItems,s)&&r.AddIndex(c)):!0}function bC(e,r,n,o,i,s){return IC(i)?a.Every(s,0,(l,m)=>{let f=`${n}/additionalItems`,h=`${o}/${m}`;return a.IsLessThan(m,i.items.length)||Jt(e,r,f,h,i.additionalItems,l)&&r.AddIndex(m)}):!0}function z2(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function OC(e){let r=[];return ka(e)&&r.push(...a.Keys(e.patternProperties)),Ma(e)&&r.push(...a.Keys(e.properties).map(z2)),a.IsEqual(r.length,0)?"(?!)":`(${r.join("|")})`}function AC(e,r,n,o){let i=new RegExp(OC(n));return a.Every(a.Keys(o),0,(c,l)=>i.test(c)||Xt(e,r,n.additionalProperties,o[c])&&r.AddKey(c))}function xC(e,r,n,o,i,s){let c=new RegExp(OC(i)),l=[];return a.EveryAll(a.Keys(s),0,(f,h)=>{let E=`${n}/additionalProperties`,I=`${o}/${f}`,g=new ut,T=c.test(f)||Jt(e,g,E,I,i.additionalProperties,s[f])&&r.AddKey(f);return T||l.push(f),T})||r.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:o,params:{additionalProperties:l}})}function RC(e,r,n,o){let i=n.allOf.reduce((s,c)=>{let l=new Pt;return se(e,l,c,o)?[...s,l]:s},[]);return a.IsEqual(i.length,n.allOf.length)&&r.Merge(i)}function CC(e,r,n,o,i,s){let c=[],l=i.allOf.reduce((f,h,E)=>{let I=`${n}/allOf/${E}`,g=new ut,T=be(e,g,I,o,h,s);return T||c.push(g),T?[...f,g]:f},[]),m=a.IsEqual(l.length,i.allOf.length)&&r.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>r.AddError(h))),m}function PC(e,r,n,o){let i=n.anyOf.reduce((s,c)=>{let l=new Pt;return se(e,l,c,o)?[...s,l]:s},[]);return a.IsGreaterThan(i.length,0)&&r.Merge(i)}function UC(e,r,n,o,i,s){let c=[],l=i.anyOf.reduce((f,h,E)=>{let I=new ut,g=`${n}/anyOf/${E}`,T=be(e,I,g,o,h,s);return T||c.push(I),T?[...f,I]:f},[]),m=a.IsGreaterThan(l.length,0)&&r.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>r.AddError(h))),m||r.AddError({keyword:"anyOf",schemaPath:n,instancePath:o,params:{}})}function vf(e,r,n,o){return n}function NC(e,r,n,o,i,s){return vf(e,r,i,s)||r.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function Lf(e,r,n,o){return a.IsValueLike(n.const)?a.IsEqual(o,n.const):a.IsDeepEqual(o,n.const)}function wC(e,r,n,o,i,s){return Lf(e,r,i,s)||r.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function Y2(e){return!(Ro(e)&&a.IsEqual(e.minContains,0))}function kf(e,r,n,o){return Y2(n)?!a.IsEqual(o.length,0)&&a.SomeAll(o,(i,s)=>se(e,r,n.contains,i)&&r.AddIndex(s)):!0}function vC(e,r,n,o,i,s){return kf(e,r,i,s)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function LC(e,r,n,o){let i=a.IsEqual(a.Keys(o).length,0),s=a.Every(a.Entries(n.dependencies),0,([c,l])=>!a.HasPropertyKey(o,c)||(a.IsArray(l)?l.every(m=>a.HasPropertyKey(o,m)):se(e,r,l,o)));return i||s}function kC(e,r,n,o,i,s){let c=a.IsEqual(a.Keys(s).length,0),l=a.EveryAll(a.Entries(i.dependencies),0,([m,f])=>{let h=`${n}/dependencies/${m}`;return!a.HasPropertyKey(s,m)||(a.IsArray(f)?f.every(E=>a.HasPropertyKey(s,E)||r.AddError({keyword:"dependencies",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})):be(e,r,h,o,f,s))});return c||l}function MC(e,r,n,o){let i=a.IsEqual(a.Keys(o).length,0),s=a.Every(a.Entries(n.dependentRequired),0,([c,l])=>!a.HasPropertyKey(o,c)||l.every(m=>a.HasPropertyKey(o,m)));return i||s}function DC(e,r,n,o,i,s){let c=a.IsEqual(a.Keys(s).length,0),l=a.EveryAll(a.Entries(i.dependentRequired),0,([m,f])=>!a.HasPropertyKey(s,m)||a.EveryAll(f,0,h=>a.HasPropertyKey(s,h)||r.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})));return c||l}function GC(e,r,n,o){let i=a.IsEqual(a.Keys(o).length,0),s=a.Every(a.Entries(n.dependentSchemas),0,([c,l])=>!a.HasPropertyKey(o,c)||se(e,r,l,o));return i||s}function $C(e,r,n,o,i,s){let c=a.IsEqual(a.Keys(s).length,0),l=a.EveryAll(a.Entries(i.dependentSchemas),0,([m,f])=>{let h=`${n}/dependentSchemas/${m}`;return!a.HasPropertyKey(s,m)||be(e,r,h,o,f,s)});return c||l}function FC(e,r,n,o){let i=e.DynamicRef(n)??!1;return j(i)&&se(e,r,i,o)}function jC(e,r,n,o,i,s){let c=e.DynamicRef(i)??!1;return j(c)&&be(e,r,"#",o,c,s)}function Gf(e,r,n,o){return a.Some(n.enum,i=>a.IsValueLike(i)?a.IsEqual(o,i):a.IsDeepEqual(o,i))}function qC(e,r,n,o,i,s){return Gf(e,r,i,s)||r.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function $f(e,r,n,o){return a.IsLessThan(o,n.exclusiveMaximum)}function BC(e,r,n,o,i,s){return $f(e,r,i,s)||r.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function Ff(e,r,n,o){return a.IsGreaterThan(o,n.exclusiveMinimum)}function HC(e,r,n,o,i,s){return Ff(e,r,i,s)||r.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var Fi={};rr(Fi,{Clear:()=>tP,Entries:()=>wK,Get:()=>kK,Has:()=>LK,IsDate:()=>Gi,IsDateTime:()=>zu,IsDuration:()=>Yu,IsEmail:()=>Vu,IsHostname:()=>Wu,IsIPv4:()=>Ju,IsIPv6:()=>el,IsIdnEmail:()=>Zu,IsIdnHostname:()=>Xu,IsIri:()=>rl,IsIriReference:()=>tl,IsJsonPointer:()=>ol,IsJsonPointerUriFragment:()=>nl,IsRegex:()=>il,IsRelativeJsonPointer:()=>sl,IsTime:()=>$i,IsUri:()=>ul,IsUriReference:()=>al,IsUriTemplate:()=>cl,IsUrl:()=>ll,IsUuid:()=>ml,Reset:()=>rP,Set:()=>vK,Test:()=>MK});var V2=[0,31,28,31,30,31,30,31,31,30,31,30,31],Q2=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function W2(e){return e%4===0&&(e%100!==0||e%400===0)}function Gi(e){let r=Q2.exec(e);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3];return o>=1&&o<=12&&i>=1&&i<=(o===2&&W2(n)?29:V2[o])}var Z2=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function $i(e,r=!0){let n=Z2.exec(e);if(!n)return!1;let o=+n[1],i=+n[2],s=+n[3],c=n[4]==="-"?-1:1,l=+(n[5]||0),m=+(n[6]||0);if(l>23||m>59||r&&!n[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(o<=23&&i<=59&&s<60)return!0;let f=i-m*c,h=o-l*c-(f<0?1:0);return(h===23||h===-1)&&(f===59||f===-1)&&s<61}function zu(e,r=!0){let n=e.split(/T/i);return n.length===2&&Gi(n[0])&&$i(n[1],r)}var X2=/^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;function Yu(e){return X2.test(e)}var J2=/^(?!.*\.\.)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i;function Vu(e){return J2.test(e)}var Po=36,Qu=1,jf=26,eK=38,tK=700,rK=72,nK=128;function oK(e,r,n){e=n?Math.floor(e/tK):e>>1,e+=Math.floor(e/r);let o=0;for(;e>(Po-Qu)*jf>>1;)e=Math.floor(e/(Po-Qu)),o+=Po;return o+Math.floor((Po-Qu+1)*e/(e+eK))}function KC(e){let r=[],n=nK,o=0,i=rK,s=e.lastIndexOf("-");if(s>0)for(let l=0;l<s;l++){let m=e.charCodeAt(l);if(m>=128)throw new Error("Invalid punycode: non-basic before delimiter");r.push(m)}let c=s<0?0:s+1;for(;c<e.length;){let l=o,m=1,f=Po;for(;;){if(c>=e.length)throw new Error("Invalid punycode: unexpected end of input");let E=e.charCodeAt(c++),I;if(E>=97&&E<=122)I=E-97;else if(E>=48&&E<=57)I=E-48+26;else if(E>=65&&E<=90)ye();else throw new Error("Invalid punycode: bad digit character");o+=I*m;let g=f<=i?Qu:f>=i+jf?jf:f-i;if(I<g)break;m*=Po-g,f+=Po}let h=r.length+1;i=oK(o-l,h,l===0),n+=Math.floor(o/h),o%=h,r.splice(o,0,n),o++}return globalThis.String.fromCodePoint(...r)}function sK(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function aK(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function cK(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function pK(e){return sK(e)||aK(e)||cK(e)}var uK=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),lK=new Set([2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,6980,7082,7083,43456,69702,69759,69817,69939,69940,70080,70197,70477,70722,70850,71103,71231,71350,72767,73028,73029]);function mK(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function dK(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function fK(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function gK(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function hK(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function yK(e){return e>=1632&&e<=1641}function TK(e){return e>=1776&&e<=1785}function zC(e){return lK.has(e)}function YC(e){if(e.length===0)return ye();let r=[...e].map(c=>c.codePointAt(0)),n=r.length;if(r[0]===45||r[n-1]===45||n>=4&&r[2]===45&&r[3]===45||pK(r[0]))return!1;let o=!1,i=!1,s=!1;for(let c=0;c<n;c++){let l=r[c];if(uK.has(l))return!1;(fK(l)||gK(l)||hK(l))&&(o=!0),yK(l)&&(i=!0),TK(l)&&(s=!0);let m=r[c-1],f=r[c+1];switch(l){case 183:if(m!==108||f!==108)return!1;break;case 885:if(f===void 0||!mK(f))return!1;break;case 1523:case 1524:if(m===void 0||!dK(m))return!1;break;case 8204:if(m===void 0||m<128&&!zC(m))return!1;break;case 8205:if(m===void 0||!zC(m))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o||i&&s)}function EK(e){if(e.charCodeAt(0)===45||e.charCodeAt(e.length-1)===45||e.length>=4&&e.charCodeAt(2)===45&&e.charCodeAt(3)===45)return!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45))return!1}return!0}function VC(e){return e.toLowerCase().startsWith("xn--")}function QC(e){try{let r=e.slice(4).toLowerCase();if(r.lastIndexOf("-")===0)return!1;let o=KC(r);return o?YC(o):!1}catch{return!1}}function WC(e){return e.length===0||e.length>63?!1:VC(e)?QC(e):YC(e)}function ZC(e){return e.length===0||e.length>63?!1:VC(e)?QC(e):EK(e)}function Wu(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(let r of e.split("."))if(!ZC(r))return!1;return!0}var IK=/^(?!.*\.\.)[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+(?:\.[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+)*@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?)*$/iu;function Zu(e){return IK.test(e)}function Xu(e){if(e.length===0||e.includes(" "))return!1;let r=e.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".");if(r.length>253)return!1;for(let n of r.split("."))if(!WC(n))return!1;return!0}function qf(e,r,n){let o=0,i=0,s=0,c=0;for(let l=r;l<n;l++){let m=e.charCodeAt(l);if(m===46){if(s===0||i>255||c===48&&s>1)return!1;o++,i=0,s=0,c=0}else if(m>=48&&m<=57)s===0&&(c=m),i=i*10+(m-48),s++;else return!1}return o===3&&s>0&&i<=255&&!(c===48&&s>1)}function Ju(e){return qf(e,0,e.length)}function SK(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function el(e){let r=e.length;if(r===0)return!1;let n=0,o=!1,i=0;if(e.charCodeAt(0)===58&&e.charCodeAt(1)===58){if(r===2)return!0;o=!0,i=2}for(;i<r;){let s=0,c=i;for(;i<r&&SK(e.charCodeAt(i));)i++,s++;if(s===0)return!1;let l=e.charCodeAt(i);if(l===46){if(!qf(e,c,r))return!1;n+=2,i=r;break}if(s>4)return!1;if(n++,i===r)break;if(l!==58)return!1;if(i++,e.charCodeAt(i)===58){if(o||e.charCodeAt(i+1)===58)return!1;if(o=!0,i++,i===r)break}}return o?n<=7:n===8}function XC(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function tl(e){if(e.includes(" ")||e.includes("\\")||/[\x00-\x1F\x7F]/.test(e)||/%(?![0-9a-fA-F]{2})/.test(e))return!1;if(e==="")return!0;let r=e.indexOf(":");return r>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,r))?XC(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&r===-1?!1:XC(e)}function rl(e){try{return new URL(e),!0}catch{return!1}}var bK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function nl(e){return bK.test(e)}var OK=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function ol(e){return OK.test(e)}function il(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var AK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function sl(e){return AK.test(e)}var xK=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function al(e){return xK.test(e)}var RK=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;function cl(e){return RK.test(e)}function JC(e){return e>=97&&e<=122||e>=65&&e<=90}function eP(e){return JC(e)||e>=48&&e<=57}function pl(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function CK(e){return eP(e)||e===43||e===45||e===46}function Bf(e){return eP(e)||e===45||e===46||e===95||e===126}function Hf(e){return e===33||e===36||e===38||e===39||e===40||e===41||e===42||e===43||e===44||e===59||e===61}function PK(e){return Bf(e)||Hf(e)||e===58||e===64}function ul(e){let r=e.length;if(r===0||!JC(e.charCodeAt(0)))return!1;let n=1;for(;n<r;){let o=e.charCodeAt(n);if(o===58)break;if(!CK(o))return!1;n++}if(e.charCodeAt(n)!==58)return!1;if(n++,e.charCodeAt(n)===47&&e.charCodeAt(n+1)===47){n+=2;let o=n,i=-1;for(let s=n;s<r;s++){let c=e.charCodeAt(s);if(c===64){i=s;break}if(c===47||c===63||c===35)break}if(i!==-1){for(let s=o;s<i;s++){let c=e.charCodeAt(s);if(c===91||c===93)return!1;if(c===37){if(s+2>=i||!pl(e.charCodeAt(s+1))||!pl(e.charCodeAt(s+2)))return!1;s+=2}else if(!Bf(c)&&!Hf(c)&&c!==58)return!1}n=i+1}if(e.charCodeAt(n)===91){for(n++;n<r&&e.charCodeAt(n)!==93;)n++;if(e.charCodeAt(n)!==93)return!1;n++}else for(;n<r;){let s=e.charCodeAt(n);if(s===47||s===63||s===35||s===58)break;if(s<128&&!Bf(s)&&!Hf(s))return!1;n++}if(e.charCodeAt(n)===58)for(n++;n<r;){let s=e.charCodeAt(n);if(s===47||s===63||s===35)break;if(s<48||s>57)return!1;n++}}for(;n<r;){let o=e.charCodeAt(n);if(o===37){if(n+2>=r||!pl(e.charCodeAt(n+1))||!pl(e.charCodeAt(n+2)))return!1;n+=2}else{if(o>127)return!1;if(!(PK(o)||o===47||o===63||o===35))return!1}n++}return!0}var UK=/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;function ll(e){return UK.test(e)}var NK=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function ml(e){return NK.test(e)}var Ce=new Map;function tP(){Ce.clear()}function wK(){return[...Ce.entries()]}function vK(e,r){Ce.set(e,r)}function LK(e){return Ce.has(e)}function kK(e){return Ce.get(e)}function MK(e,r){return Ce.get(e)?.(r)??!0}function rP(){tP(),Ce.set("date-time",zu),Ce.set("date",Gi),Ce.set("duration",Yu),Ce.set("email",Vu),Ce.set("hostname",Wu),Ce.set("idn-email",Zu),Ce.set("idn-hostname",Xu),Ce.set("ipv4",Ju),Ce.set("ipv6",el),Ce.set("iri-reference",tl),Ce.set("iri",rl),Ce.set("json-pointer-uri-fragment",nl),Ce.set("json-pointer",ol),Ce.set("regex",il),Ce.set("relative-json-pointer",sl),Ce.set("time",$i),Ce.set("uri-reference",al),Ce.set("uri-template",cl),Ce.set("uri",ul),Ce.set("url",ll),Ce.set("uuid",ml)}rP();function Kf(e,r,n,o){return Fi.Test(n.format,o)}function nP(e,r,n,o,i,s){return Kf(e,r,i,s)||r.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function oP(e,r,n,o){let i=Uf(n)?n.then:!0,s=gf(n)?n.else:!0;return se(e,r,n.if,o)?se(e,r,i,o):se(e,r,s,o)}function iP(e,r,n,o,i,s){let c=Uf(i)?i.then:!0,l=gf(i)?i.else:!0,m=new ut,f=be(e,m,`${n}/if`,o,i.if,s)?be(e,m,`${n}/then`,o,c,s)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"then"}}):be(e,r,`${n}/else`,o,l,s)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"else"}});return f&&r.Merge([m]),f}function DK(e,r,n,o){return a.Every(n.items,0,(i,s)=>a.IsLessEqualThan(o.length,s)||Xt(e,r,i,o[s])&&r.AddIndex(s))}function GK(e,r,n,o,i,s){return a.EveryAll(i.items,0,(c,l)=>{let m=`${n}/items/${l}`,f=`${o}/${l}`;return a.IsLessEqualThan(s.length,l)||Jt(e,r,m,f,c,s[l])&&r.AddIndex(l)})}function $K(e,r,n,o){let i=ki(n)?n.prefixItems.length:0;return a.Every(o,i,(s,c)=>Xt(e,r,n.items,s)&&r.AddIndex(c))}function FK(e,r,n,o,i,s){let c=ki(i)?i.prefixItems.length:0;return a.EveryAll(s,c,(l,m)=>{let f=`${n}/items`,h=`${o}/${m}`;return Jt(e,r,f,h,i.items,l)&&r.AddIndex(m)})}function sP(e,r,n,o){return Ef(n)?DK(e,r,n,o):$K(e,r,n,o)}function aP(e,r,n,o,i,s){return Ef(i)?GK(e,r,n,o,i,s):FK(e,r,n,o,i,s)}function jK(e){return xo(e)}function zf(e,r,n,o){if(!jK(n))return!0;let i=a.Counted(o,s=>se(e,r,n.contains,s));return a.IsLessEqualThan(i,n.maxContains)}function cP(e,r,n,o,i,s){let c=Ro(i)?i.minContains:1;return zf(e,r,i,s)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function Yf(e,r,n,o){return a.IsLessEqualThan(o,n.maximum)}function pP(e,r,n,o,i,s){return Yf(e,r,i,s)||r.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function Vf(e,r,n,o){return a.IsLessEqualThan(o.length,n.maxItems)}function uP(e,r,n,o,i,s){return Vf(e,r,i,s)||r.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function Qf(e,r,n,o){return a.IsMaxLength(o,n.maxLength)}function lP(e,r,n,o,i,s){return Qf(e,r,i,s)||r.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function Wf(e,r,n,o){return a.IsLessEqualThan(a.Keys(o).length,n.maxProperties)}function mP(e,r,n,o,i,s){return Wf(e,r,i,s)||r.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function qK(e){return xo(e)}function Zf(e,r,n,o){if(!qK(n))return!0;let i=a.Counted(o,(s,c)=>se(e,r,n.contains,s)&&r.AddIndex(c));return a.IsGreaterEqualThan(i,n.minContains)}function dP(e,r,n,o,i,s){return Zf(e,r,i,s)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function Xf(e,r,n,o){return a.IsGreaterEqualThan(o,n.minimum)}function fP(e,r,n,o,i,s){return Xf(e,r,i,s)||r.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function Jf(e,r,n,o){return a.IsGreaterEqualThan(o.length,n.minItems)}function gP(e,r,n,o,i,s){return Jf(e,r,i,s)||r.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function eg(e,r,n,o){return a.IsMinLength(o,n.minLength)}function hP(e,r,n,o,i,s){return eg(e,r,i,s)||r.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function tg(e,r,n,o){return a.IsGreaterEqualThan(a.Keys(o).length,n.minProperties)}function yP(e,r,n,o,i,s){return tg(e,r,i,s)||r.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function rg(e,r,n,o){return a.IsMultipleOf(o,n.multipleOf)}function TP(e,r,n,o,i,s){return rg(e,r,i,s)||r.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function ng(e,r,n,o){let i=new Pt;return!se(e,i,n.not,o)&&r.Merge([i])}function EP(e,r,n,o,i,s){return ng(e,r,i,s)||r.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function _P(e,r,n,o){let i=n.oneOf.reduce((s,c)=>{let l=new Pt;return se(e,l,c,o)?[...s,l]:s},[]);return a.IsEqual(i.length,1)&&r.Merge(i)}function IP(e,r,n,o,i,s){let c=[],l=[],m=i.oneOf.reduce((h,E,I)=>{let g=new ut,T=`${n}/oneOf/${I}`,O=be(e,g,T,o,E,s);return O&&l.push(I),O||c.push(g),O?[...h,g]:h},[]),f=a.IsEqual(m.length,1)&&r.Merge(m);return!f&&a.IsEqual(l.length,0)&&c.forEach(h=>h.GetErrors().forEach(E=>r.AddError(E))),f||r.AddError({keyword:"oneOf",schemaPath:n,instancePath:o,params:{passingSchemas:l}})}function og(e,r,n,o){return(a.IsString(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(o)}function SP(e,r,n,o,i,s){return og(e,r,i,s)||r.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function bP(e,r,n,o){return a.Every(a.Entries(n.patternProperties),0,([i,s])=>{let c=new RegExp(i,"u");return a.Every(a.Entries(o),0,([l,m])=>!c.test(l)||Xt(e,r,s,m)&&r.AddKey(l))})}function OP(e,r,n,o,i,s){return a.EveryAll(a.Entries(i.patternProperties),0,([c,l])=>{let m=`${n}/patternProperties/${c}`,f=new RegExp(c,"u");return a.EveryAll(a.Entries(s),0,([h,E])=>{let I=`${o}/${h}`;return!f.test(h)||Jt(e,r,m,I,l,E)&&r.AddKey(h)})})}function AP(e,r,n,o){return a.IsEqual(o.length,0)||a.Every(n.prefixItems,0,(i,s)=>a.IsLessEqualThan(o.length,s)||Xt(e,r,i,o[s])&&r.AddIndex(s))}function xP(e,r,n,o,i,s){return a.IsEqual(s.length,0)||a.EveryAll(i.prefixItems,0,(c,l)=>{let m=`${n}/prefixItems/${l}`,f=`${o}/${l}`;return a.IsLessEqualThan(s.length,l)||Jt(e,r,m,f,c,s[l])&&r.AddIndex(l)})}function ig(e,r){return e.includes(r)||st.Get().exactOptionalPropertyTypes}function sg(e,r){return a.IsUndefined(e[r])}function RP(e,r,n,o){let i=Co(n)?n.required:[];return a.Every(a.Entries(n.properties),0,([c,l])=>{let m=!a.HasPropertyKey(o,c)||Xt(e,r,l,o[c])&&r.AddKey(c);return ig(i,c)?m:sg(o,c)||m})}function CP(e,r,n,o,i,s){let c=Co(i)?i.required:[];return a.EveryAll(a.Entries(i.properties),0,([m,f])=>{let h=`${n}/properties/${m}`,E=`${o}/${m}`,I=()=>!a.HasPropertyKey(s,m)||Jt(e,r,h,E,f,s[m])&&r.AddKey(m);return ig(c,m)?I():sg(s,m)||I()})}function PP(e,r,n,o){return a.Every(a.Keys(o),0,(i,s)=>se(e,r,n.propertyNames,i))}function UP(e,r,n,o,i,s){let c=[];return a.EveryAll(a.Keys(s),0,(m,f)=>{let h=`${o}/${m}`,E=`${n}/propertyNames`,I=new ut,g=be(e,I,E,h,i.propertyNames,m);return g||c.push(m),g})||r.AddError({keyword:"propertyNames",schemaPath:n,instancePath:o,params:{propertyNames:c}})}function NP(e,r,n,o){let i=e.RecursiveRef(n)??!1;return j(i)&&se(e,r,i,o)}function wP(e,r,n,o,i,s){let c=e.RecursiveRef(i)??!1;return j(c)&&be(e,r,"#",o,c,s)}function vP(e,r,n,o){let i=e.Ref(n)??!1,s=new Pt,c=j(i)&&se(e,s,i,o);return c&&r.Merge([s]),c}function LP(e,r,n,o,i,s){let c=e.Ref(i)??!1,l=new ut,m=j(c)&&be(e,l,"#",o,c,s);return m&&r.Merge([l]),m||l.GetErrors().forEach(f=>r.AddError(f)),m}function kP(e,r,n,o){return a.Every(n.required,0,i=>a.HasPropertyKey(o,i))}function MP(e,r,n,o,i,s){let c=[];return a.EveryAll(i.required,0,m=>{let f=a.HasPropertyKey(s,m);return f||c.push(m),f})||r.AddError({keyword:"required",schemaPath:n,instancePath:o,params:{requiredProperties:c}})}function ag(e,r,n,o,i){return a.IsEqual(n,"object")?a.IsObjectNotArray(i):a.IsEqual(n,"array")?a.IsArray(i):a.IsEqual(n,"boolean")?a.IsBoolean(i):a.IsEqual(n,"integer")?a.IsInteger(i):a.IsEqual(n,"number")?a.IsNumber(i):a.IsEqual(n,"null")?a.IsNull(i):a.IsEqual(n,"string")?a.IsString(i):a.IsEqual(n,"bigint")?a.IsBigInt(i):a.IsEqual(n,"constructor")?a.IsConstructor(i):a.IsEqual(n,"function")?a.IsFunction(i):a.IsEqual(n,"symbol")?a.IsSymbol(i):a.IsEqual(n,"undefined")?a.IsUndefined(i):a.IsEqual(n,"void")?a.IsUndefined(i):!0}function DP(e,r,n,o,i){return a.Some(n,s=>ag(e,r,s,o,i))}function GP(e,r,n,o){return a.IsArray(n.type)?DP(e,r,n.type,n,o):ag(e,r,n.type,n,o)}function $P(e,r,n,o,i,s){return(a.IsArray(i.type)?DP(e,r,i.type,i,s):ag(e,r,i.type,i,s))||r.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function FP(e,r,n,o){let i=r.GetIndices();return a.Every(o,0,(s,c)=>(i.has(c)||se(e,r,n.unevaluatedItems,s))&&r.AddIndex(c))}function jP(e,r,n,o,i,s){let c=r.GetIndices(),l=[];return a.EveryAll(s,0,(f,h)=>{let E=new ut,I=(c.has(h)||be(e,E,n,o,i.unevaluatedItems,f))&&r.AddIndex(h);return I||l.push(h),I})||r.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:o,params:{unevaluatedItems:l}})}function qP(e,r,n,o){let i=r.GetKeys();return a.Every(a.Entries(o),0,([s,c])=>i.has(s)||se(e,r,n.unevaluatedProperties,c)&&r.AddKey(s))}function BP(e,r,n,o,i,s){let c=r.GetKeys(),l=[];return a.EveryAll(a.Entries(s),0,([f,h])=>{let E=new ut,I=c.has(f)||be(e,E,n,o,i.unevaluatedProperties,h)&&r.AddKey(f);return I||l.push(f),I})||r.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function HP(e){return!a.IsEqual(e.uniqueItems,!1)}function KP(e,r,n,o){if(!HP(n))return!0;let i=new Set(o.map(no.Hash)).size,s=o.length;return a.IsEqual(i,s)}function zP(e,r,n,o,i,s){if(!HP(i))return!0;let c=new Set,l=s.reduce((f,h,E)=>{let I=no.Hash(h);return c.has(I)?[...f,E]:(c.add(I),f)},[]);return a.IsEqual(l.length,0)||r.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:o,params:{duplicateItems:l}})}function Xt(e,r,n,o){return r.Push()&&se(e,r,n,o)&&r.Pop()}function se(e,r,n,o){e.Push(n);let i=ju(n)?vf(e,r,n,o):(!Nf(n)||GP(e,r,n,o))&&(!(a.IsObject(o)&&!a.IsArray(o))||(!Co(n)||kP(e,r,n,o))&&(!en(n)||AC(e,r,n,o))&&(!lf(n)||LC(e,r,n,o))&&(!mf(n)||MC(e,r,n,o))&&(!df(n)||GC(e,r,n,o))&&(!ka(n)||bP(e,r,n,o))&&(!Ma(n)||RP(e,r,n,o))&&(!Rf(n)||PP(e,r,n,o))&&(!va(n)||tg(e,r,n,o))&&(!bf(n)||Wf(e,r,n,o)))&&(!a.IsArray(o)||(!af(n)||SC(e,r,n,o))&&(!xo(n)||kf(e,r,n,o))&&(!vi(n)||sP(e,r,n,o))&&(!If(n)||zf(e,r,n,o))&&(!qu(n)||Vf(e,r,n,o))&&(!Ro(n)||Zf(e,r,n,o))&&(!Li(n)||Jf(e,r,n,o))&&(!ki(n)||AP(e,r,n,o))&&(!Mi(n)||KP(e,r,n,o)))&&(!a.IsString(o)||(!Sf(n)||Qf(e,r,n,o))&&(!wa(n)||eg(e,r,n,o))&&(!Na(n)||Kf(e,r,n,o))&&(!La(n)||og(e,r,n,o)))&&(!(a.IsNumber(o)||a.IsBigInt(o))||(!yf(n)||$f(e,r,n,o))&&(!tn(n)||Ff(e,r,n,o))&&(!_f(n)||Yf(e,r,n,o))&&(!nn(n)||Xf(e,r,n,o))&&(!Of(n)||rg(e,r,n,o)))&&(!Pf(n)||vP(e,r,n,o))&&(!Cf(n)||NP(e,r,n,o))&&(!ff(n)||FC(e,r,n,o))&&(!uf(n)||Lf(e,r,n,o))&&(!hf(n)||Gf(e,r,n,o))&&(!Tf(n)||oP(e,r,n,o))&&(!Af(n)||ng(e,r,n,o))&&(!cf(n)||RC(e,r,n,o))&&(!pf(n)||PC(e,r,n,o))&&(!xf(n)||_P(e,r,n,o))&&(!Hu(n)||!a.IsArray(o)||FP(e,r,n,o))&&(!Ku(n)||!a.IsObject(o)||qP(e,r,n,o))&&(!sf(n)||EC(e,r,n,o));return e.Pop(n),i}function Jt(e,r,n,o,i,s){return r.Push()&&be(e,r,n,o,i,s)&&r.Pop()}function be(e,r,n,o,i,s){e.Push(i);let c=ju(i)?NC(e,r,n,o,i,s):!!(+(!Nf(i)||$P(e,r,n,o,i,s))&+(!(a.IsObject(s)&&!a.IsArray(s))||!!(+(!Co(i)||MP(e,r,n,o,i,s))&+(!en(i)||xC(e,r,n,o,i,s))&+(!lf(i)||kC(e,r,n,o,i,s))&+(!mf(i)||DC(e,r,n,o,i,s))&+(!df(i)||$C(e,r,n,o,i,s))&+(!ka(i)||OP(e,r,n,o,i,s))&+(!Ma(i)||CP(e,r,n,o,i,s))&+(!Rf(i)||UP(e,r,n,o,i,s))&+(!va(i)||yP(e,r,n,o,i,s))&+(!bf(i)||mP(e,r,n,o,i,s))))&+(!a.IsArray(s)||!!(+(!af(i)||bC(e,r,n,o,i,s))&+(!xo(i)||vC(e,r,n,o,i,s))&+(!vi(i)||aP(e,r,n,o,i,s))&+(!If(i)||cP(e,r,n,o,i,s))&+(!qu(i)||uP(e,r,n,o,i,s))&+(!Ro(i)||dP(e,r,n,o,i,s))&+(!Li(i)||gP(e,r,n,o,i,s))&+(!ki(i)||xP(e,r,n,o,i,s))&+(!Mi(i)||zP(e,r,n,o,i,s))))&+(!a.IsString(s)||!!(+(!Sf(i)||lP(e,r,n,o,i,s))&+(!wa(i)||hP(e,r,n,o,i,s))&+(!Na(i)||nP(e,r,n,o,i,s))&+(!La(i)||SP(e,r,n,o,i,s))))&+(!(a.IsNumber(s)||a.IsBigInt(s))||!!(+(!yf(i)||BC(e,r,n,o,i,s))&+(!tn(i)||HC(e,r,n,o,i,s))&+(!_f(i)||pP(e,r,n,o,i,s))&+(!nn(i)||fP(e,r,n,o,i,s))&+(!Of(i)||TP(e,r,n,o,i,s))))&+(!Pf(i)||LP(e,r,n,o,i,s))&+(!Cf(i)||wP(e,r,n,o,i,s))&+(!ff(i)||jC(e,r,n,o,i,s))&+(!uf(i)||wC(e,r,n,o,i,s))&+(!hf(i)||qC(e,r,n,o,i,s))&+(!Tf(i)||iP(e,r,n,o,i,s))&+(!Af(i)||EP(e,r,n,o,i,s))&+(!cf(i)||CC(e,r,n,o,i,s))&+(!pf(i)||UC(e,r,n,o,i,s))&+(!xf(i)||IP(e,r,n,o,i,s))&+(!Hu(i)||!a.IsArray(s)||jP(e,r,n,o,i,s))&+(!Ku(i)||!a.IsObject(s)||BP(e,r,n,o,i,s)))&&(!sf(i)||_C(e,r,n,o,i,s));return e.Pop(i),c}var $n={};rr($n,{DynamicRef:()=>nz,Ref:()=>pg});var ji={};rr(ji,{Delete:()=>WK,Get:()=>VK,Has:()=>YK,Indices:()=>Fa,Set:()=>QK});function YP(e){if(e.length===0)throw Error("Cannot set root")}function VP(e){if(!a.IsObject(e))throw Error("Cannot set value")}function BK(e){if(a.IsUnsafePropertyKey(e))throw Error("Pointer contains unsafe property key")}function QP(e){for(let r of e)BK(r)}function HK(e){return/^(0|[1-9]\d*)$/.test(e)}function WP(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function KK(e,r){return a.IsObject(r)&&a.HasPropertyKey(r,e)}function zK(e,r){return a.IsObject(r)&&!a.IsUnsafePropertyKey(e)?r[e]:void 0}function cg(e,r){return e.reduce((n,o)=>zK(o,n),r)}function Fa(e){if(a.IsEqual(e.length,0))return[];let r=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return r.length>0&&r[0]===""?r.slice(1):r}function YK(e,r){let n=e;return Fa(r).every(o=>KK(o,n)?(n=n[o],!0):!1)}function VK(e,r){let n=Fa(r);return cg(n,e)}function QK(e,r,n){let o=Fa(r);YP(o),QP(o);let[i,s]=WP(o),c=cg(i,e);return VP(c),c[s]=n,e}function WK(e,r){let n=Fa(r);YP(n),QP(n);let[o,i]=WP(n),s=cg(o,e);return VP(s),a.IsArray(s)&&HK(i)?s.splice(+i,1):delete s[i],e}function ZK(e,r,n){if(e.$id===n.hash)return e;let o=new URL(e.$id,r.href),i=new URL(n.href,r.href);if(a.IsEqual(o.pathname,i.pathname))return n.hash.startsWith("#")?ZP(e,r,n):e}function XK(e,r,n){let o=new URL(`#${e.$anchor}`,r.href),i=new URL(n.href,r.href);return a.IsEqual(o.href,i.href)?e:void 0}function JK(e,r,n){let o=new URL(`#${e.$dynamicAnchor}`,r.href),i=new URL(n.href,r.href);return a.IsEqual(o.href,i.href)?e:void 0}function ZP(e,r,n){if(n.href.endsWith("#"))return e;if(!n.hash.startsWith("#"))return;let o=decodeURIComponent(n.hash.slice(1));if(o.startsWith("/"))return ji.Get(e,o)}function ez(e,r,n){if(rn(e)){let o=ZK(e,r,n);if(!a.IsUndefined(o))return o}if(Ua(e)){let o=XK(e,r,n);if(!a.IsUndefined(o))return o}if(Gn(e)){let o=JK(e,r,n);if(!a.IsUndefined(o))return o}return ZP(e,r,n)}function tz(e,r,n){return e.reduce((o,i)=>{let s=ug(i,r,n);return a.IsUndefined(s)?o:s},void 0)}function rz(e,r,n){return a.Keys(e).reduce((o,i)=>{let s=ug(e[i],r,n);return a.IsUndefined(s)?o:s},void 0)}function ug(e,r,n){let o=yr(e)&&rn(e)?new URL(e.$id,r.href):r;if(yr(e)){let i=ez(e,o,n);if(!a.IsUndefined(i))return i}if(a.IsArray(e))return tz(e,o,n);if(a.IsObject(e))return rz(e,o,n)}function pg(e,r){let n=new URL("http://unknown/"),o=rn(e)?new URL(e.$id,n.href):n,i=new URL(r,o.href);return ug(e,o,i)}function nz(e,r,n,o){let i=n.$dynamicRef.startsWith("#")?pg(r,n.$dynamicRef):pg(e,n.$dynamicRef);return a.IsUndefined(i)?void 0:!yr(i)||!Gn(i)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?i:o.find(l=>l.$dynamicAnchor===i.$dynamicAnchor)??i}var qi=function(e,r,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?e!==r||!o:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(e):o?o.value:r.get(e)},Fn,XP,JP,eU,tU,Uo=class{constructor(r,n){Fn.add(this),this.context=r,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((r,n)=>new URL(n.$id,r),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(r){yr(r)&&(rn(r)&&(this.ids.push(r),qi(this,Fn,"m",XP).call(this,r)),Ua(r)&&this.anchors.push(r),Bu(r)&&this.recursiveAnchors.push(r),Gn(r)&&this.dynamicAnchors.push(r))}Pop(r){yr(r)&&(rn(r)&&(this.ids.pop(),qi(this,Fn,"m",JP).call(this,r)),Ua(r)&&this.anchors.pop(),Bu(r)&&this.recursiveAnchors.pop(),Gn(r)&&this.dynamicAnchors.pop())}Ref(r){return qi(this,Fn,"m",eU).call(this,r)??qi(this,Fn,"m",tU).call(this,r)}RecursiveRef(r){return Bu(this.Base())?$n.Ref(this.recursiveAnchors[0],r.$recursiveRef):$n.Ref(this.Base(),r.$recursiveRef)}DynamicRef(r){let n=this.schema;return $n.DynamicRef(n,this.Base(),r,this.dynamicAnchors)}};Fn=new WeakSet,XP=function e(r,n=!0){if(!yr(r))return;let o=r;if(!(!n&&rn(o))){!n&&Gn(o)&&this.dynamicAnchors.push(o);for(let i of a.Keys(o))qi(this,Fn,"m",e).call(this,o[i],!1)}},JP=function e(r,n=!0){if(!yr(r))return;let o=r;if(!(!n&&rn(o))){!n&&Gn(o)&&this.dynamicAnchors.pop();for(let i of a.Keys(o))qi(this,Fn,"m",e).call(this,o[i],!1)}},eU=function(r){return a.HasPropertyKey(this.context,r.$ref)?this.context[r.$ref]:void 0},tU=function(r){let n=this.schema;return r.$ref.startsWith("#")?$n.Ref(this.Base(),r.$ref):$n.Ref(n,r.$ref)};function dl(...e){let[r,n,o]=ae.Match(e,{3:(h,E,I)=>[h,E,I],2:(h,E)=>[{},h,E]}),i=st.Get(),s=kT(),c=[],l=new Uo(r,n),m=new Da(h=>{if(!a.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...h,message:s(h)})});return[be(l,m,"#","",n,o),c]}function mg(...e){let[r,n,o]=ae.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),i=new Uo(r,n),s=new Pt;return se(i,s,n,o)}function Te(...e){let[r,n,o]=ae.Match(e,{3:(i,s,c)=>[i,s,c],2:(i,s)=>[{},i,s]});return mg(r,n,o)}function jn(...e){let[r,n,o]=ae.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),[i,s]=dl(r,n,o);return s}var qn=class extends Error{constructor(r,n,o){super(r),Object.defineProperty(this,"cause",{value:{source:r,errors:o,value:n},writable:!1,configurable:!1,enumerable:!1})}};function rU(e,r,n){return a.IsArray(n)?n.map(o=>lt(e,r.items,o)):n}function nU(e,r,n){return lt({...e,...r.$defs},at(r.$ref),n)}function sz(e,r){let n=a.HasPropertyKey(r,"unevaluatedProperties")?{additionalProperties:r.unevaluatedProperties}:{},o=or(e,r),i=yt(o);return $(i)?ou(i,n):i}function oU(e,r,n){let o=sz(e,r);return lt(e,o,n)}function fl(e){return a.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function iU(e,r,n){if(!a.IsObject(n)||a.IsArray(n))return n;let o=fl(r);for(let i of a.Keys(n)){if(a.HasPropertyKey(r.properties,i)){n[i]=lt(e,r.properties[i],n[i]);continue}if(a.IsBoolean(o)&&a.IsEqual(o,!0)||Le(o)&&Te(e,o,n[i])){n[i]=lt(e,o,n[i]);continue}delete n[i]}return n}function sU(e,r,n){if(!a.IsObject(n))return n;let o=fl(r),[i,s]=[new RegExp(pt(r)),xe(r)];for(let c of a.Keys(n)){if(i.test(c)){n[c]=lt(e,s,n[c]);continue}if(a.IsBoolean(o)&&a.IsEqual(o,!0)||Le(o)&&Te(e,o,n[c])){n[c]=lt(e,o,n[c]);continue}delete n[c]}return n}function aU(e,r,n){return a.HasPropertyKey(e,r.$ref)?lt(e,e[r.$ref],n):n}function cU(e,r,n){if(!a.IsArray(n))return n;let o=Math.min(n.length,r.items.length);for(let i=0;i<o;i++)n[i]=lt(e,r.items[i],n[i]);return a.IsGreaterThan(n.length,o)?n.slice(0,o):n}function Be(e){return eo(e)}function pU(e,r,n){for(let o of r.anyOf){let i=lt(e,o,Be(n));if(Te(e,o,i))return i}return n}function lt(e,r,n){return J(r)?rU(e,r,n):_e(r)?nU(e,r,n):G(r)?oU(e,r,n):$(r)?iU(e,r,n):he(r)?sU(e,r,n):me(r)?aU(e,r,n):Q(r)?cU(e,r,n):C(r)?pU(e,r,n):n}function az(e,r){for(let n of Jc.Keys(e))Jc.HasPropertyKey(r,n)||(r[n]=e[n]);return r}function cz(e){let r={};for(let n of Jc.Keys(e))r[n]=ja(e[n]);return r}function pz(e){return dg(AA(e))}function dg(e){return e.map(r=>ja(r))}function ja(e){let r=J(e)?Lt(ja(e.items),Xo(e)):G(e)?dt(dg(e.allOf)):C(e)?q(pz(e.anyOf)):$(e)?D(cz(e.properties)):he(e)?ai(In(e),ja(xe(e))):Q(e)?Fe(dg(e.items)):e;return az(e,r)}function Bi(e){return ja(e)}function Lr(...e){let[r,n,o]=ae.Match(e,{3:(s,c,l)=>[s,c,l],2:(s,c)=>[{},s,c]}),i=st.Get().unionPrioritySort?Bi(n):n;return lt(r,i,o)}var ce={};rr(ce,{Fail:()=>wo,IsOk:()=>fg,Ok:()=>k,TryArray:()=>uz,TryBigInt:()=>gg,TryBoolean:()=>Sz,TryNull:()=>Rz,TryNumber:()=>Nz,TryString:()=>wz,TryUndefined:()=>Dz});function fg(e){return a.IsObject(e)&&a.HasPropertyKey(e,"value")}function k(e){return{value:e}}function wo(){}function uz(e){return a.IsArray(e)?k(e):k([e])}function lz(e){return a.IsEqual(e,!0)?k(BigInt(1)):k(BigInt(0))}var mz=/^-?(0|[1-9]\d*)n$/,dz=/^-?(0|[1-9]\d*)\.\d+$/,fz=/^-?(0|[1-9]\d*)$/;function gz(e){return mz.test(e)}function hz(e){return dz.test(e)}function yz(e){return fz.test(e)}function Tz(e){let r=e.toLowerCase();return gz(e)?k(BigInt(e.slice(0,e.length-1))):hz(e)?k(BigInt(e.split(".")[0])):yz(e)?k(BigInt(e)):a.IsEqual(r,"false")?k(BigInt(0)):a.IsEqual(r,"true")?k(BigInt(1)):void 0}function gg(e){return a.IsBigInt(e)?k(e):a.IsBoolean(e)?lz(e):a.IsNumber(e)?k(BigInt(Math.trunc(e))):a.IsNull(e)?k(BigInt(0)):a.IsString(e)?Tz(e):a.IsUndefined(e)?k(BigInt(0)):void 0}function Ez(e){return a.IsEqual(e,BigInt(0))?k(!1):a.IsEqual(e,BigInt(1))?k(!0):void 0}function _z(e){return a.IsEqual(e,0)?k(!1):a.IsEqual(e,1)?k(!0):void 0}function Iz(e){return a.IsEqual(e.toLowerCase(),"false")?k(!1):a.IsEqual(e.toLowerCase(),"true")?k(!0):a.IsEqual(e,"0")?k(!1):a.IsEqual(e,"1")?k(!0):void 0}function Sz(e){return a.IsBigInt(e)?Ez(e):a.IsBoolean(e)?k(e):a.IsNumber(e)?_z(e):a.IsNull(e)?k(!1):a.IsString(e)?Iz(e):a.IsUndefined(e)?k(!1):void 0}function bz(e){return a.IsEqual(e,BigInt(0))?k(null):void 0}function Oz(e){return a.IsEqual(e,!1)?k(null):void 0}function Az(e){return a.IsEqual(e,0)?k(null):void 0}function xz(e){let r=e.toLowerCase();return a.IsEqual(r,"undefined")||a.IsEqual(r,"null")||a.IsEqual(e,"")||a.IsEqual(e,"0")?k(null):void 0}function Rz(e){return a.IsBigInt(e)?bz(e):a.IsBoolean(e)?Oz(e):a.IsNumber(e)?Az(e):a.IsNull(e)?k(null):a.IsString(e)?xz(e):a.IsUndefined(e)?k(null):void 0}var uU=BigInt(Number.MAX_SAFE_INTEGER),lU=BigInt(Number.MIN_SAFE_INTEGER);function Cz(e){return e<=uU&&e>=lU?k(Number(e)):void 0}function Pz(e){return k(e?1:0)}function Uz(e){let r=+e;if(a.IsNumber(r))return k(r);let n=e.toLowerCase();if(a.IsEqual(n,"false"))return k(0);if(a.IsEqual(n,"true"))return k(1);let o=gg(e);return fg(o)?o.value<=uU&&o.value>=lU?k(Number(o.value)):void 0:void 0}function Nz(e){return a.IsBigInt(e)?Cz(e):a.IsBoolean(e)?Pz(e):a.IsNumber(e)?k(e):a.IsNull(e)?k(0):a.IsString(e)?Uz(e):a.IsUndefined(e)?k(0):void 0}function wz(e){return a.IsBigInt(e)?k(e.toString()):a.IsBoolean(e)?k(e.toString()):a.IsNumber(e)?k(e.toString()):a.IsNull(e)?k("null"):a.IsString(e)?k(e):a.IsUndefined(e)?k(""):void 0}function vz(e){return a.IsEqual(e,BigInt(0))?k(void 0):void 0}function Lz(e){return a.IsEqual(e,!1)?k(void 0):void 0}function kz(e){return a.IsEqual(e,0)?k(void 0):void 0}function Mz(e){let r=e.toLowerCase();return a.IsEqual(r,"undefined")||a.IsEqual(r,"null")||a.IsEqual(e,"")||a.IsEqual(e,"0")?k(void 0):void 0}function Dz(e){return a.IsBigInt(e)?vz(e):a.IsBoolean(e)?Lz(e):a.IsNumber(e)?kz(e):a.IsNull(e)?k(void 0):a.IsString(e)?Mz(e):a.IsUndefined(e)?k(e):void 0}function mU(e,r,n){return ce.TryArray(n).value.map(i=>He(e,r.items,i))}function dU(e,r,n){let o=ce.TryBigInt(n);return ce.IsOk(o)?o.value:n}function fU(e,r,n){let o=ce.TryBoolean(n);return ce.IsOk(o)?o.value:n}function gU(e,r,n){return He({...e,...r.$defs},at(r.$ref),n)}function hU(e,r,n){return He(e,yt(r),n)}function yU(e,r,n){let o=ce.TryNumber(n);return ce.IsOk(o)?Math.trunc(o.value):n}function TU(e,r,n){let o=or(e,r),i=yt(o);return He(e,i,n)}function Gz(e,r,n){let o=ce.TryBigInt(n);return ce.IsOk(o)&&a.IsEqual(r.const,o.value)?o.value:n}function $z(e,r,n){let o=ce.TryBoolean(n);return ce.IsOk(o)&&a.IsEqual(r.const,o.value)?o.value:n}function Fz(e,r,n){let o=ce.TryNumber(n);return ce.IsOk(o)&&a.IsEqual(r.const,o.value)?o.value:n}function jz(e,r,n){let o=ce.TryString(n);return ce.IsOk(o)&&a.IsEqual(r.const,o.value)?o.value:n}function EU(e,r,n){return a.IsEqual(r.const,n)?n:HT(r)?Gz(e,r,n):KT(r)?$z(e,r,n):cp(r)?Fz(e,r,n):pp(r)?jz(e,r,n):ye()}function _U(e,r,n){let o=ce.TryNull(n);return ce.IsOk(o)?o.value:n}function IU(e,r,n){let o=ce.TryNumber(n);return ce.IsOk(o)?o.value:n}function gl(e,r,n,o){let i=a.Keys(o);for(let[s,c]of r)for(let l of i)s.test(l)||(o[l]=He(e,n,o[l]));return o}function qa(e,r,n){return nt(e)&&a.IsUndefined(n[r])}function qz(e,r,n){let o=a.EntriesRegExp(r.properties),i=a.Keys(n);for(let[s,c]of o)for(let l of i)!s.test(l)||qa(c,l,n)||(n[l]=He(e,c,n[l]));return a.HasPropertyKey(r,"additionalProperties")&&a.IsObject(r.additionalProperties)?gl(e,o,r.additionalProperties,n):n}function SU(e,r,n){return a.IsObjectNotArray(n)?qz(e,r,n):n}function Bz(e,r,n){let o=a.EntriesRegExp(r.patternProperties),i=a.Keys(n);for(let[s,c]of o)for(let l of i)s.test(l)&&(n[l]=He(e,c,n[l]));return a.HasPropertyKey(r,"additionalProperties")&&a.IsObject(r.additionalProperties)?gl(e,o,r.additionalProperties,n):n}function bU(e,r,n){return a.IsObjectNotArray(n)?Bz(e,r,n):n}function OU(e,r,n){return a.HasPropertyKey(e,r.$ref)?He(e,e[r.$ref],n):n}function AU(e,r,n){let o=ce.TryString(n);return ce.IsOk(o)?o.value:n}function xU(e,r,n){return He(e,yt(r),n)}function RU(e,r,n){if(!a.IsArray(n))return n;for(let o=0;o<Math.min(r.items.length,n.length);o++)n[o]=He(e,r.items[o],n[o]);return n}function CU(e,r,n){let o=ce.TryUndefined(n);return ce.IsOk(o)?o.value:n}function PU(e,r,n){if(r.anyOf.some(c=>Te(e,c,n)))return n;let s=r.anyOf.map(c=>He(e,c,Be(n))).find(c=>Te(e,r,c));return a.IsUndefined(s)?n:s}function UU(e,r,n){let o=ce.TryUndefined(n);return ce.IsOk(o)?void 0:n}function He(e,r,n){return J(r)?mU(e,r,n):Dt(r)?dU(e,r,n):xt(r)?fU(e,r,n):_e(r)?gU(e,r,n):Ze(r)?hU(e,r,n):ct(r)?yU(e,r,n):G(r)?TU(e,r,n):Z(r)?EU(e,r,n):Rr(r)?_U(e,r,n):Ne(r)?IU(e,r,n):$(r)?SU(e,r,n):he(r)?bU(e,r,n):me(r)?OU(e,r,n):tt(r)?AU(e,r,n):Ie(r)?xU(e,r,n):Q(r)?RU(e,r,n):gr(r)?CU(e,r,n):C(r)?PU(e,r,n):Ft(r)?UU(e,r,n):n}function Bn(...e){let[r,n,o]=ae.Match(e,{3:(i,s,c)=>[i,s,c],2:(i,s)=>[{},i,s]});return He(r,n,o)}function NU(e,r,n){if(!a.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=mt(e,r.items,n[o]);return n}function wU(e,r,n){return mt({...e,...r.$defs},at(r.$ref),n)}function vU(e,r){return a.IsUndefined(r)?a.IsFunction(e.default)?e.default():Be(e.default):r}function LU(e,r,n){let o=or(e,r),i=yt(o);return mt(e,i,n)}function kU(e,r,n){if(!a.IsObject(n))return n;let o=a.Keys(r.properties);for(let i of o){let s=mt(e,r.properties[i],n[i]);a.IsUndefined(s)&&(nt(r.properties[i])||!a.HasPropertyKey(r.properties[i],"default"))||(n[i]=s)}if(!en(r)||a.IsBoolean(r.additionalProperties))return n;for(let i of a.Keys(n))o.includes(i)||(n[i]=mt(e,r.additionalProperties,n[i]));return n}function MU(e,r,n){if(!a.IsObject(n))return n;let[o,i]=[new RegExp(pt(r)),xe(r)];for(let s of a.Keys(n))o.test(s)&&Zt(i)&&(n[s]=mt(e,i,n[s]));if(!en(r))return n;for(let s of a.Keys(n))o.test(s)||(n[s]=mt(e,r.additionalProperties,n[s]));return n}function DU(e,r,n){return a.HasPropertyKey(e,r.$ref)?mt(e,e[r.$ref],n):n}function GU(e,r,n){if(!a.IsArray(n))return n;let[o,i]=[r.items,Math.max(r.items.length,n.length)];for(let s=0;s<i;s++)s<o.length&&(n[s]=mt(e,o[s],n[s]));return n}function $U(e,r,n){for(let o of r.anyOf){let i=mt(e,o,Be(n));if(Te(e,o,i))return i}return n}function mt(e,r,n){let o=Zt(r)?vU(r,n):n;return J(r)?NU(e,r,o):_e(r)?wU(e,r,o):G(r)?LU(e,r,o):$(r)?kU(e,r,o):he(r)?MU(e,r,o):me(r)?DU(e,r,o):Q(r)?GU(e,r,o):C(r)?$U(e,r,o):o}function vo(...e){let[r,n,o]=ae.Match(e,{3:(i,s,c)=>[i,s,c],2:(i,s)=>[{},i,s]});return mt(r,n,o)}function Hi(e){return(...r)=>{let[n,o,i]=ae.Match(r,{3:(s,c,l)=>[s,c,l],2:(s,c)=>[{},s,c]});return e.reduce((s,c)=>c(n,o,s),i)}}function Hz(e,r,n){return r["~codec"].decode(n)}function Kz(e,r,n){return r["~codec"].encode(n)}function Pe(e,r,n,o){return oo(n)?a.IsEqual(e,"Decode")?Hz(r,n,o):Kz(r,n,o):o}function zz(e,r,n,o){if(!a.IsArray(o))return o;for(let i=0;i<o.length;i++)o[i]=ve(e,r,n.items,o[i]);return Pe(e,r,n,o)}function Yz(e,r,n,o){let i=Pe(e,r,n,o);if(!a.IsArray(i))return i;for(let s=0;s<i.length;s++)i[s]=ve(e,r,n.items,i[s]);return i}function FU(e,r,n,o){return a.IsEqual(e,"Decode")?zz(e,r,n,o):Yz(e,r,n,o)}function jU(e,r,n,o){return o=ve(e,{...r,...n.$defs},at(n.$ref),o),Pe(e,r,n,o)}function qU(e){return e.reduce((r,n)=>({...r,...n}),{})}function BU(e,r){for(let n of r)if(!a.IsDeepEqual(e,n))return n;return e}function Vz(e,r,n,o){if(a.IsEqual(n.allOf.length,0))return Pe(e,r,n,o);let i=n.allOf.map(l=>ve(e,r,l,Lr(l,Be(o)))),c=i.every(l=>a.IsObject(l))?qU(i):BU(o,i);return Pe(e,r,n,c)}function Qz(e,r,n,o){if(a.IsEqual(n.allOf.length,0))return Pe(e,r,n,o);let i=Pe(e,r,n,o),s=n.allOf.map(l=>ve(e,r,l,Lr(l,Be(i))));return s.every(l=>a.IsObject(l))?qU(s):BU(i,s)}function HU(e,r,n,o){return a.IsEqual(e,"Decode")?Vz(e,r,n,o):Qz(e,r,n,o)}function Wz(e,r,n,o){if(!a.IsObjectNotArray(o))return o;for(let i of a.Keys(n.properties))!a.HasPropertyKey(o,i)||qa(n.properties[i],i,o)||(o[i]=ve(e,r,n.properties[i],o[i]));return Pe(e,r,n,o)}function Zz(e,r,n,o){let i=Pe(e,r,n,o);if(!a.IsObjectNotArray(i))return i;for(let s of a.Keys(n.properties))!a.HasPropertyKey(i,s)||qa(n.properties[s],s,i)||(i[s]=ve(e,r,n.properties[s],i[s]));return i}function KU(e,r,n,o){return a.IsEqual(e,"Decode")?Wz(e,r,n,o):Zz(e,r,n,o)}function Xz(e,r,n,o){if(!a.IsObjectNotArray(o))return o;let i=new RegExp(pt(n));for(let s of a.Keys(o))i.test(s)&&(o[s]=ve(e,r,xe(n),o[s]));return Pe(e,r,n,o)}function Jz(e,r,n,o){let i=Pe(e,r,n,o);if(!a.IsObjectNotArray(i))return i;let s=new RegExp(pt(n));for(let c of a.Keys(i))s.test(c)&&(i[c]=ve(e,r,xe(n),i[c]));return i}function zU(e,r,n,o){return a.IsEqual(e,"Decode")?Xz(e,r,n,o):Jz(e,r,n,o)}function YU(e,r,n,o){return a.HasPropertyKey(r,n.$ref)?ve(e,r,r[n.$ref],o):o}function VU(e,r,n,o){return a.IsEqual(e,"Decode")?Pe(e,r,n,YU(e,r,n,o)):YU(e,r,n,Pe(e,r,n,o))}function eY(e,r,n,o){if(!a.IsArray(o))return o;for(let i=0;i<Math.min(n.items.length,o.length);i++)o[i]=ve(e,r,n.items[i],o[i]);return Pe(e,r,n,o)}function tY(e,r,n,o){let i=Pe(e,r,n,o);if(!a.IsArray(i))return o;for(let s=0;s<Math.min(n.items.length,i.length);s++)i[s]=ve(e,r,n.items[s],i[s]);return i}function QU(e,r,n,o){return a.IsEqual(e,"Decode")?eY(e,r,n,o):tY(e,r,n,o)}function rY(e,r,n,o){for(let i of n.anyOf){if(!Te(r,i,o))continue;let s=ve(e,r,i,o);return Pe(e,r,n,s)}return o}function nY(e,r,n,o){let i=Pe(e,r,n,o);for(let s of n.anyOf){let c=ve(e,r,s,Be(i));if(Te(r,s,c))return c}return i}function WU(e,r,n,o){return a.IsEqual(e,"Decode")?rY(e,r,n,o):nY(e,r,n,o)}function ve(e,r,n,o){return J(n)?FU(e,r,n,o):_e(n)?jU(e,r,n,o):G(n)?HU(e,r,n,o):$(n)?KU(e,r,n,o):he(n)?zU(e,r,n,o):me(n)?VU(e,r,n,o):Q(n)?QU(e,r,n,o):C(n)?WU(e,r,n,o):Pe(e,r,n,o)}var hg=class extends qn{constructor(r,n){super("Decode",r,n)}};function oY(e,r,n){if(!Te(e,r,n))throw new hg(n,jn(e,r,n));return n}function iY(e,r,n){let o=st.Get().unionPrioritySort?Bi(r):r;return ve("Decode",e,o,n)}var QQe=Hi([(e,r,n)=>Be(n),(e,r,n)=>vo(e,r,n),(e,r,n)=>Bn(e,r,n),(e,r,n)=>Lr(e,r,n),(e,r,n)=>oY(e,r,n),(e,r,n)=>iY(e,r,n)]);var yg=class extends qn{constructor(r,n){super("Encode",r,n)}};function sY(e,r,n){if(!Te(e,r,n))throw new yg(n,jn(e,r,n));return n}function aY(e,r,n){let o=st.Get().unionPrioritySort?Bi(r):r;return ve("Encode",e,o,n)}var c6e=Hi([(e,r,n)=>Be(n),(e,r,n)=>aY(e,r,n),(e,r,n)=>vo(e,r,n),(e,r,n)=>Bn(e,r,n),(e,r,n)=>Lr(e,r,n),(e,r,n)=>sY(e,r,n)]);var cr=class extends Error{constructor(r,n){super(n),this.type=r}};function ZU(e,r){return a.IsFunction(r.default)?r.default(r):a.IsObject(r.default)?Be(r.default):r.default}function XU(e,r){if(Mi(r)&&!Zt(r))throw new cr(r,"Arrays with uniqueItems constraints must specify a default annotation");let n=Li(r)?r.minItems:0;return Array.from({length:n},()=>Ke(e,r.items))}function JU(e,r){return tn(r)?BigInt(r.exclusiveMinimum)+BigInt(1):nn(r)?BigInt(r.minimum):BigInt(0)}function eN(e,r){return!1}function tN(e,r){let n=Ke(e,r.instanceType);return class{constructor(){Object.assign(this,n)}}}function rN(e,r){return Ke({...e,...r.$defs},at(r.$ref))}function nN(e,r){return Ke(e,yt(r))}function oN(e,r){let n=Ke(e,r.returnType);return()=>n}function iN(e,r){return tn(r)&&a.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:nn(r)?r.minimum:0}function sN(e,r){let n=or(e,r),o=yt(n);return Ke(e,o)}function aN(e,r){return r.const}function cN(e,r){throw new cr(r,"Cannot create TNever types")}function pN(e,r){return null}function uN(e,r){return tn(r)&&a.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:nn(r)?r.minimum:0}function lN(e,r){return(a.IsUndefined(r.required)?[]:r.required).reduce((o,i)=>({...o,[i]:Ke(e,r.properties[i])}),{})}function mN(e,r){if(va(r)&&!Zt(r))throw new cr(r,"Record with the minProperties constraint must have a default annotation");return{}}function dN(e,r){return a.HasPropertyKey(e,r.$ref)?Ke(e,e[r.$ref]):(()=>{throw new cr(r,"Unable to deref Ref")})()}function fN(e,r){if((La(r)||Na(r))&&!Zt(r))throw Error("Strings with format or pattern constraints must specify default");let o=wa(r)?r.minLength:0;return"".padEnd(o)}function gN(e,r){return Symbol()}function hN(e,r){let n=Gs(r.pattern);if(tt(n))throw new cr(r,"Unable to create TemplateLiteral due to infinite type expansion");return Ke(e,n)}function yN(e,r){return Array.from({length:r.minItems},(n,o)=>Ke(e,r.items[o]))}function TN(e,r){if(a.IsEqual(r.anyOf.length,0))throw Error("Unable to create Union with no variants");return Ke(e,r.anyOf[0])}function Ke(e,r){return Zt(r)?ZU(e,r):J(r)?XU(e,r):Dt(r)?JU(e,r):xt(r)?eN(e,r):Ve(r)?tN(e,r):_e(r)?rN(e,r):Ze(r)?nN(e,r):Qe(r)?oN(e,r):ct(r)?iN(e,r):G(r)?sN(e,r):Z(r)?aN(e,r):dr(r)?cN(e,r):Rr(r)?pN(e,r):Ne(r)?uN(e,r):$(r)?lN(e,r):he(r)?mN(e,r):me(r)?dN(e,r):tt(r)?fN(e,r):Cr(r)?gN(e,r):Ie(r)?hN(e,r):Q(r)?yN(e,r):gr(r)?void 0:C(r)?TN(e,r):Ft(r)?void 0:void 0}function kr(...e){let[r,n]=ae.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return Ke(r,n)}var Tg=class extends qn{constructor(r,n){super("Parse",r,n)}};function cY(e,r,n){if(!Te(e,r,n))throw new Tg(n,jn(e,r,n));return n}var P8e=Hi([(e,r,n)=>Be(n),(e,r,n)=>vo(e,r,n),(e,r,n)=>Bn(e,r,n),(e,r,n)=>Lr(e,r,n),(e,r,n)=>cY(e,r,n)]);var uY=D({type:V("insert"),path:Rt(),value:et()}),lY=Object({type:V("update"),path:Rt(),value:et()}),mY=D({type:V("delete"),path:Rt()}),M8e=q([uY,lY,mY]);function Ki(e){if(!e.body)throw new Error("This command does not accept a request body");let r=e.body;return r.examples?.length?r.examples[0]:kr(r)}function Tr(e,r,n,o,i){e.command(r).description(n).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async s=>{if(s.generateSkeleton){W(Ki(o));return}let c=wi(s),l=await i()(o,{body:c});W(l)})}var Ue=" (unix seconds, ISO 8601, or relative like -1h/-30m/now)";var gY=30,IN=["flat","flatPercent","cum","cumPercent","function"];function RN(e,r){let n=e.command("profiles").description("Query continuous profiling data");SN(n.command("top").description("Rank functions by self (flat) and inclusive (cum) sample value, like pprof -top")).option("--limit <COUNT>","Maximum number of functions to print",String(gY)).option("--fields <FIELDS>",`Comma-separated fields to project from each function (default for --output=tsv|csv: ${IN.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async o=>{let i=fa(o.output),s=o.fields===void 0?void 0:ga(o.fields),c=Number(o.limit);if(!Number.isInteger(c)||c<1)throw new qt(`--limit must be a positive integer (got: ${o.limit})`);let l=await r()(of,{body:bN(o)}),{total:m,functions:f}=hY(l.stacks),h=f.slice(0,c);if(i==="json"){W({total:m,functions:s?h.map(I=>ha(I,s)):h});return}let E=ya(i,h,s??IN);E.length>0&&Y(E)}),SN(n.command("pprof").description("Download a merged pprof profile (raw protobuf, not gzipped)")).option("-O, --output-file <FILE_PATH>","Write the profile to this file instead of stdout").action(async o=>{if(o.outputFile===void 0&&process.stdout.isTTY)throw new qt("Refusing to write a binary profile to the terminal. Use --output-file <FILE_PATH> or pipe stdout.");let i=await r()(yC,{body:bN(o)}),s=Buffer.from(i.pprof,"base64");if(o.outputFile===void 0){process.stdout.write(s);return}(0,xN.writeFileSync)(o.outputFile,s)}),Tr(n,"query","Run a raw profile query and print the folded stacks",of,r)}function SN(e){return e.requiredOption("--service <SERVICE_NAME>","Service the profiles belong to").addOption(new ur("--type <PROFILE_TYPE>","Profile type").choices(Ca.type.enum).makeOptionMandatory()).option("--from <TIMESTAMP>",`Start of time range${Ue}${AN("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${AN("to")}`).option("--filter <TSUGA_QUERY>","Tsuga query over profile labels (equality, negation, wildcards)")}function bN(e){return{service:e.service,type:e.type,timeRange:{from:ON("from",e.from),to:ON("to",e.to)},...e.filter===void 0?{}:{filter:e.filter}}}function hY(e){let r=new Map,n=new Map,o=0;for(let{stack:c,value:l}of e){let m=c.split(";"),f=m[m.length-1];if(f!==void 0){o+=l,r.set(f,(r.get(f)??0)+l);for(let h of new Set(m))n.set(h,(n.get(h)??0)+l)}}let i=c=>o===0?0:Math.round(c/o*1e4)/100,s=[...n.entries()].map(([c,l])=>{let m=r.get(c)??0;return{function:c,flat:m,flatPercent:i(m),cum:l,cumPercent:i(l)}}).sort((c,l)=>l.flat-c.flat||l.cum-c.cum||c.function.localeCompare(l.function));return{total:o,functions:s}}function ON(e,r){let n=r??ar(e);if(!n)throw new qt(`--${e} is required`);return Zo(n)}function AN(e){let r=ar(e);return r===void 0?"":` (default: ${r})`}function CN(e,r){let n=e.command("experimental").description("Experimental commands that may change or be removed without notice");RN(n,r)}var yY=`/${"v1"}/feedback`,PN=t.Object({id:t.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),TY={id:"request-123-abc"};Object.assign(PN,{examples:[TY]});var UN=t.Object({content:p({allowEmpty:!1,type:"long",description:"Free-text feedback content, e.g. what went wrong, what was confusing, or a suggestion. Required and must be non-empty."})}),EY={content:"The traces command times out for large services."};Object.assign(UN,{examples:[EY]});var NN=d({description:"Submit free-text feedback about Tsuga tools or APIs, e.g. a tool that failed, returned unusable output, or was confusing to use. Feedback is recorded for the Tsuga team to review and improve tooling.",operationId:"createFeedback",tags:["public","feedback"],url:yY,method:"POST",body:UN,response:PN});function wN(e,r){e.command("feedback <MESSAGE...>").description("Send feedback about Tsuga tools or APIs (e.g. a tool that failed or was confusing)").action(async n=>{let o=await r()(NN,{body:{content:n.join(" ")}});W(o)})}var Nt="/v0/monitors",zi=["alert","resolve","keep_last_status","consider_zero"],Yi=["alert","resolve","keep_last_status"];var LN=["no_aggregation","all","any","each","proportion"],kN=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var _Y=t.Object({formula:t.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(kN,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),IY=t.Object({formula:p({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(kN,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),SY=5,Eg=t.Array(_Y,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),_g=t.Array(IY,{minItems:1,maxItems:SY,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Ig=t.Object({formula:t.String({description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:t.Enum(["rate","error","cpu","general","to_be_set"],{description:"Anomaly model type Tsuga uses to classify expected behavior: `rate` flags downward anomalies (e.g. count rates), `error` and `cpu` flag upward anomalies (e.g. error counts/rates, CPU usage), `general` flags both directions, and `to_be_set` is a placeholder Tsuga replaces by inferring the model type from the monitor query when the monitor is created or updated."})},{description:"Anomaly detection condition evaluated by this monitor. The `formula` result is compared against behavior learned from historical query results, and the monitor alerts on deviations in the direction implied by `conditionType`."}),Sg=t.Object({formula:p({type:"tsuga-formula",description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:t.Enum(["rate","error","cpu","general","to_be_set"],{description:"Anomaly model type used to classify expected behavior: `rate` flags downward anomalies (e.g. count rates), `error` and `cpu` flag upward anomalies (e.g. error counts/rates, CPU usage), and `general` flags both directions. Use `to_be_set` to let Tsuga infer the model type from the monitor query during create or update."})},{description:"Anomaly detection condition evaluated by this monitor. The `formula` result is compared against behavior learned from historical query results, and the monitor alerts on deviations in the direction implied by `conditionType`."}),Ut=[1,2,3,4,5];var hl={timeframe:t.Number({description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over. Always a whole number, at least 1."}),groupByFields:t.Array(t.Object({fields:t.Array(t.String(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty means the monitor evaluates a single ungrouped series."}),limit:t.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:t.Optional(K),replaceNullWith:t.Optional(t.String({description:"Value used to group documents that have no value for a grouped field."}))}),{description:"Monitor group by configuration. The `limit` setting is currently ignored; evaluation applies a fixed limit of 100 groups per field."}),aggregationAlertLogic:t.Optional(t.Enum(LN,{description:"How grouped results are combined into alert state. Use `no_aggregation` only when `groupByFields` is empty; use `all`, `any`, `each`, or `proportion` with non-empty `groupByFields`. `proportion` also requires `proportionAlertThreshold`."})),proportionAlertThreshold:t.Optional(t.Integer({description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},yl={timeframe:t.Integer({minimum:1,description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over."}),groupByFields:t.Array(t.Object({fields:t.Array(p(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty or omitted means the monitor evaluates a single ungrouped series."}),limit:t.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:t.Optional(K),replaceNullWith:t.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))}),{maxItems:1,description:"Monitor group by configuration. The `limit` setting is currently ignored; evaluation applies a fixed limit of 100 groups per field."}),aggregationAlertLogic:t.Optional(t.Enum(LN,{description:"How grouped results are combined into alert state. Use `no_aggregation` only when `groupByFields` is empty; use `all`, `any`, `each`, or `proportion` with non-empty `groupByFields`. `proportion` also requires `proportionAlertThreshold`. On create, omitted query-monitor values default to `no_aggregation`; on update, omitted values keep the existing aggregation logic."})),proportionAlertThreshold:t.Optional(t.Integer({minimum:1,maximum:99,description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},bg={...hl,timeframe:t.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},Og={...yl,timeframe:t.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},MN=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Eg,noDataBehavior:t.Enum(zi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...hl,queries:Xr},{$id:"MonitorConfigurationMetric"}),DN=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:_g,noDataBehavior:t.Enum(zi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...yl,queries:Mn},{$id:"InputMonitorConfigurationMetric"}),GN=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Eg,noDataBehavior:t.Enum(zi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...hl,queries:Xr},{$id:"MonitorConfigurationLog"}),$N=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:_g,noDataBehavior:t.Enum(zi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...yl,queries:Mn},{$id:"InputMonitorConfigurationLog"}),FN=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Eg,noDataBehavior:t.Enum(zi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...hl,queries:Xr},{$id:"MonitorConfigurationTrace"}),bY=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:_g,noDataBehavior:t.Enum(zi,{description:"How the monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, `keep_last_status` preserves the previous state, and `consider_zero` evaluates missing values as zero."}),...yl,queries:Mn},{$id:"InputMonitorConfigurationTrace"}),jN=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Ig,noDataBehavior:t.Enum(Yi,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...bg,queries:Xr},{$id:"MonitorConfigurationAnomalyLog"}),qN=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Sg,noDataBehavior:t.Enum(Yi,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Og,queries:Mn},{$id:"InputMonitorConfigurationAnomalyLog"}),BN=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Ig,noDataBehavior:t.Enum(Yi,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...bg,queries:Xr},{$id:"MonitorConfigurationAnomalyMetric"}),HN=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Sg,noDataBehavior:t.Enum(Yi,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Og,queries:Mn},{$id:"InputMonitorConfigurationAnomalyMetric"}),KN=t.Object({type:t.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Use this configuration when Tsuga should learn historical trace query behavior and alert on unusual movement in trace-derived values."}),condition:Ig,noDataBehavior:t.Enum(Yi,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...bg,queries:Xr},{$id:"MonitorConfigurationAnomalyTrace"}),OY=t.Object({type:t.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Set this value to create or update an anomaly monitor that learns historical trace query behavior and alerts on unusual movement in trace-derived values."}),condition:Sg,noDataBehavior:t.Enum(Yi,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...Og,queries:Mn},{$id:"InputMonitorConfigurationAnomalyTrace"}),zN=t.Object({type:t.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:t.Integer({description:"Number of days before certificate expiry when the monitor should warn."}),cloudAccounts:t.Optional(t.Array(t.String(),{description:"Cloud account IDs whose certificates are checked. Omitted means certificates from all cloud accounts are checked."})),aggregationAlertLogic:t.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:t.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"MonitorConfigurationCertificateExpiry"}),AY=t.Object({type:t.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:t.Integer({minimum:1,maximum:365,description:"Number of days before certificate expiry when the monitor should warn. Valid values are 1 through 365."}),cloudAccounts:t.Optional(t.Array(t.String(),{minItems:1,description:"Cloud account IDs whose certificates are checked. Omit to check certificates from all cloud accounts."})),aggregationAlertLogic:t.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:t.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"InputMonitorConfigurationCertificateExpiry"}),xY=t.Object({type:t.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured environment, scoped by teams, services, or both. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:t.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:t.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:t.Object({teamIds:t.Optional(t.Array(t.String(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets."})),env:t.String({description:"Environment whose logs are searched for new error patterns."}),services:t.Optional(t.Array(t.String(),{description:"Service names whose logs are searched for new error patterns."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included, so sending both teams and services searches only the listed services owned by the listed teams. Send a non-empty `teamIds`, a non-empty `services`, or both."})},{$id:"MonitorConfigurationLogErrorPattern"}),RY=t.Object({type:t.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured environment, scoped by teams, services, or both. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:t.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:t.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:t.Object({teamIds:t.Optional(t.Array(p(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets.",minItems:1})),env:p({description:"Environment whose logs are searched for new error patterns."}),services:t.Optional(t.Array(p(),{description:"Service names whose logs are searched for new error patterns.",minItems:1}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included, so sending both teams and services searches only the listed services owned by the listed teams. Send a non-empty `teamIds`, a non-empty `services`, or both."})},{$id:"InputMonitorConfigurationLogErrorPattern"}),CY=x("type",[MN,GN,FN,jN,BN,xY,KN,zN],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),PY=x("type",[DN,$N,bY,qN,HN,OY,RY,AY],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var an=t.Object({id:t.String({description:"Tsuga-generated monitor ID assigned when the monitor is created."}),name:t.String({description:"Display name of the monitor and alert source."}),owner:t.String({description:"Team ID that owns and manages the monitor."}),message:t.Optional(t.String({description:"Caller-supplied message included in notifications triggered by this monitor. Omitted when the monitor was created or last updated without one."})),tags:we,configuration:CY,priority:t.Enum(Ut,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:Pn,dashboardId:t.Optional(t.String({description:"ID of the dashboard linked to this monitor for context when investigating alerts. Caller-supplied. Omitted when no dashboard is linked."})),pauseUntil:t.Optional(S({description:"Timestamp until which the monitor is snoozed."})),creator:t.Optional(pe),updater:t.Optional(pe),createdAt:S({description:"Timestamp when Tsuga created the monitor."}),updatedAt:S({description:"Timestamp when Tsuga last updated the monitor."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."}),clusterIds:t.Array(t.String(),{description:"Cluster IDs where the monitor is deployed. Empty means all eligible clusters."})},{title:"Monitor"}),UY=x("type",[MN,GN,FN,jN,BN,KN,zN]),rXe=t.Object({...an.properties,configuration:UY},{title:"Monitor"}),nXe=t.Object({...an.properties,configuration:x("type",[DN,$N,qN,HN])},{title:"Monitor"}),Ba=t.Object({name:p({description:"Display name of the monitor and alert source."}),message:Se(p({type:"long"}),{description:"Message included in notifications triggered by this monitor. Optional on create."}),tags:De,configuration:PY,priority:t.Enum(Ut,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the monitor."}),dashboardId:Se(p({allowEmpty:!1}),{description:"ID of the dashboard to link to this monitor for context when investigating alerts. On create: omit or send `null` to leave the monitor unlinked. On update: omit to skip updating this field, send `null` to clear an existing link."}),pauseUntil:Se(p({allowEmpty:!1,type:"date-time"}),{description:"ISO timestamp until which the monitor should be snoozed."}),permissions:Pn,clusterIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Cluster IDs where the monitor should be deployed. Empty or omitted means all eligible clusters for cluster-deployed monitor types."}))}),vN=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],Hn={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var Ag=t.Object({owners:ee(p({allowEmpty:!1}),{description:"Restrict results to monitors owned by any of these team IDs",maxItems:50}),searchQuery:hr({description:"Search query filter for monitors.",valueDescription:"Case-insensitive substring matched against monitor ID, monitor name, query filters, and aggregate fields. Wildcard characters are treated literally."}),tags:ee(St.items,{description:"Restrict results to monitors that have at least one of the listed key/value tags",maxItems:50}),priorities:ee(t.Enum(Ut),{description:"Restrict results to monitors with one of these priorities",maxItems:Ut.length}),types:ee(t.Enum(vN),{description:"Restrict results to monitors with these types",maxItems:vN.length}),activity:t.Enum(["active","snoozed"],{description:"Restrict results by activity status: active monitors or currently snoozed monitors"}),clusterIds:ee(p({allowEmpty:!1}),{description:"Restrict results to monitors deployed to any of these cluster IDs (monitors with no cluster restriction are always included)",maxItems:50})},{description:"Optional filters applied to narrow the returned monitors"}),Tl=t.Partial(Ag),xg=t.Partial(t.Object({...ne,filters:Tl,sort:t.Object({by:t.Enum([Hn.PRIORITY,Hn.TYPE,Hn.NAME,Hn.OWNER,Hn.TAGS,Hn.CLUSTER_IDS,Hn.PAUSE_UNTIL,Hn.ASSET_UPDATED_AT],{description:"Field to sort the returned monitors by. For `priority`, `desc` returns highest-priority monitors first because priority 1 is highest."}),direction:K},{description:"Optional sorting applied to the returned monitors. Ties are broken by creation time and monitor ID for stable pagination."})})),oXe=d({tags:["monitors"],url:`${Nt}/query`,method:"POST",paginated:!0,response:t.Array(an),body:xg}),iXe=d({tags:["monitors"],url:`${Nt}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(Ag,["tags"])))}),response:It}),sXe=d({tags:["monitors"],url:`${Nt}/counts/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(Ag,["activity"])))}),response:t.Object({all:t.Integer({description:"Total number of monitors matching the filters that the user can read."}),active:t.Integer({description:"Number of matching readable monitors that are not currently snoozed."}),snoozed:t.Integer({description:"Number of matching readable monitors that are currently snoozed."})})}),aXe=d({tags:["monitors"],url:`${Nt}/:id`,method:"GET",params:t.Object({id:p()}),response:an}),cXe=d({tags:["monitors"],url:Nt,method:"POST",body:Ba,response:an}),pXe=d({tags:["monitors"],url:`${Nt}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ba,response:an}),NY=Qt(Tl,{maxIds:100}),uXe=d({tags:["monitors"],url:`${Nt}/bulk-update`,method:"PUT",body:t.Object({selection:NY,owner:p({allowEmpty:!1})}),response:t.Object({})}),lXe=d({tags:["monitors"],url:`${Nt}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),wY=Qt(Tl),mXe=d({tags:["monitors"],url:`${Nt}/bulk-delete`,method:"DELETE",body:t.Object({selection:wY}),response:t.Object({})}),dXe=d({tags:["monitors"],url:`${Nt}/:id/snooze`,method:"POST",params:t.Object({id:p()}),body:t.Object({pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:an}),vY=Qt(Tl,{maxIds:100}),fXe=d({tags:["monitors"],url:`${Nt}/bulk-snooze`,method:"POST",body:t.Object({selection:vY,pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:t.Object({})}),LY=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],kY=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],MY=[...LY,...kY],Lo=t.Enum(MY),DY=x("type",[t.Object({type:t.Literal("each"),subStates:t.Record(t.String(),t.Object({stateValue:t.Union([Lo,t.Null()]),lastChangedAt:S()}))}),t.Object({type:t.Literal("no_aggregation"),stateValue:t.Optional(Lo)}),t.Object({type:t.Literal("any"),stateValue:t.Optional(Lo)}),t.Object({type:t.Literal("all"),stateValue:t.Optional(Lo)}),t.Object({type:t.Literal("proportion"),stateValue:t.Optional(Lo)})]),GY=t.Object({monitorId:t.String(),currentState:DY,lastChangedAt:t.Optional(S())}),gXe=d({tags:["monitors"],url:`${Nt}/states/:id`,method:"GET",params:t.Object({id:p()}),response:GY}),hXe=d({tags:["monitors"],url:`${Nt}/:id/transitions`,method:"GET",params:t.Object({id:p()}),query:t.Object({from:t.Number(),to:t.Number()}),response:t.Array(t.Object({id:t.String(),createdAt:S(),fromState:t.Optional(Lo),toState:t.Optional(Lo),dimension:t.Optional(t.String())}))}),$Y=["unprocessed","processed","failed-to-process"],yXe=d({tags:["monitors"],url:`${Nt}/:id/results`,method:"GET",params:t.Object({id:p()}),query:t.Object({from:t.Number(),to:t.Number()}),response:t.Object({isTruncated:t.Boolean(),results:t.Array(t.Object({id:t.String(),evaluationAt:S(),formulaResult:t.Object({groups:t.Array(t.Object({groupKey:t.Record(t.String(),Aa),results:t.Array(t.Union([t.Number(),t.Null()])),conditionMet:t.Enum(["true","false","nan-no-data"])}))}),createdAt:S(),status:t.Enum($Y)}))})});var Vi="/v0/notifications",Gr=`${Vi}/rules`,YN=`${Vi}/slack/setup`,Qi=`${Vi}/integrations`,ko=["triggered","resolved","no-data"],FY=["sent","stale","pending","rate-limited","failed","silenced"],jY=t.Optional(t.Object({maxMessages:t.Integer({description:"Maximum number of notifications this target can send during the rate-limiting window."}),minutes:t.Integer({description:"Length of the rate-limiting window, in minutes."})},{description:"Per-target rate limit used when sending notifications. If omitted, Tsuga allows up to 1000 notifications every 10 minutes for this target."})),Rg=t.Object({maxMessages:t.Integer({minimum:1,description:"Maximum number of notifications this target can send during the rate-limiting window. The ratio of `maxMessages` to `minutes` cannot exceed 100 notifications per minute."}),minutes:t.Integer({minimum:1,description:"Length of the rate-limiting window, in minutes. The ratio of `maxMessages` to `minutes` cannot exceed 100 notifications per minute."})},{description:"Per-target rate limit used when sending notifications. If omitted, Tsuga allows up to 1000 notifications every 10 minutes for this target."}),qY=t.Optional(Rg),Mr=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),Dr=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({minimum:1,description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),Ha=t.Object({id:t.String({description:"Identifier of the notification target within this rule, used with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:jY,config:x("type",[t.Object({type:t.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:t.String({description:"Slack channel ID that receives the notification"}),integrationId:t.String({description:"Slack workspace ID that receives the notification"}),integrationName:t.String({description:"Human readable name of the Slack integration"}),renotifyConfig:Mr},{$id:"RuleTargetConfigSlack"}),t.Object({type:t.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:t.String({description:"Identifier of the incident.io integration to use"}),integrationName:t.String({description:"Human readable name of the incident.io integration"}),renotifyConfig:Mr},{$id:"RuleTargetConfigIncidentIo"}),t.Object({type:t.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:t.Array(t.String(),{description:"Email addresses that will receive the alert"}),renotifyConfig:Mr},{$id:"RuleTargetConfigEmail"}),t.Object({type:t.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:t.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:t.String({description:"Human readable name of the Grafana IRM integration"}),renotifyConfig:Mr},{$id:"RuleTargetConfigGrafanaIrm"}),t.Object({type:t.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:t.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:t.String({description:"Human readable name of the PagerDuty integration"}),renotifyConfig:Mr},{$id:"RuleTargetConfigPagerDuty"}),t.Object({type:t.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:t.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:t.String({description:"Human readable name of the Microsoft Teams integration"}),renotifyConfig:Mr},{$id:"RuleTargetConfigMicrosoftTeams"}),t.Object({type:t.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:t.String({description:"Identifier of the webhook integration to use"}),integrationName:t.String({description:"Human readable name of the webhook integration"}),renotifyConfig:Mr},{$id:"RuleTargetConfigWebhook"}),t.Object({type:t.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:t.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:t.String({description:"Human readable name of the ServiceNow integration"}),renotifyConfig:Mr},{$id:"RuleTargetConfigServiceNow"}),t.Object({type:t.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:t.String({description:"Identifier of the Google Chat integration to use"}),integrationName:t.String({description:"Human readable name of the Google Chat integration"}),renotifyConfig:Mr},{$id:"RuleTargetConfigGoogleChat"}),t.Object({type:t.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:t.String({description:"Identifier of the Squadcast integration to use"}),integrationName:t.String({description:"Human readable name of the Squadcast integration"}),renotifyConfig:Mr},{$id:"RuleTargetConfigSquadcast"}),t.Object({type:t.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:t.String({description:"Identifier of the Jira integration to use"}),integrationName:t.String({description:"Human readable name of the Jira integration"}),projectKey:t.String({description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:t.String({description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:t.Optional(t.String({description:"Jira status the alert ticket is moved to right after it is filed for a firing alert. A later transition between two firing states leaves the ticket status alone."})),closedStatus:t.Optional(t.String({description:"Jira status the alert ticket is moved to when the alert resolves. Only takes effect when the rule delivers recovery transitions."}))},{$id:"RuleTargetConfigJira"})],{description:"Destination that received the notification. The `type` field discriminates the variant: `email` sends directly to the listed addresses, and every other type routes through the named integration referenced by `integrationId`."})}),Wi=t.Object({id:p({description:"Identifier of the notification target within this rule. Choose a stable ID that is unique among this rule's targets; Tsuga uses it with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:qY,config:x("type",[t.Object({type:t.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:p({allowEmpty:!1,description:"Slack channel ID that receives the notification"}),integrationId:p({allowEmpty:!1,description:"Slack workspace ID that receives the notification"}),renotifyConfig:Dr},{$id:"RuleTargetInputSlack"}),t.Object({type:t.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the incident.io integration to use"}),renotifyConfig:Dr},{$id:"RuleTargetInputIncidentIo"}),t.Object({type:t.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the PagerDuty integration to use"}),renotifyConfig:Dr},{$id:"RuleTargetInputPagerDuty"}),t.Object({type:t.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:t.Array(p({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"}),renotifyConfig:Dr},{$id:"RuleTargetInputEmail"}),t.Object({type:t.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Grafana IRM integration to use"}),renotifyConfig:Dr},{$id:"RuleTargetInputGrafanaIrm"}),t.Object({type:t.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Microsoft Teams integration to use"}),renotifyConfig:Dr},{$id:"RuleTargetInputMicrosoftTeams"}),t.Object({type:t.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the webhook integration to use"}),renotifyConfig:Dr},{$id:"RuleTargetInputWebhook"}),t.Object({type:t.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the ServiceNow integration to use"}),renotifyConfig:Dr},{$id:"RuleTargetInputServiceNow"}),t.Object({type:t.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Google Chat integration to use"}),renotifyConfig:Dr},{$id:"RuleTargetInputGoogleChat"}),t.Object({type:t.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Squadcast integration to use"}),renotifyConfig:Dr},{$id:"RuleTargetInputSquadcast"}),t.Object({type:t.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Jira integration to use"}),projectKey:p({allowEmpty:!1,description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:p({allowEmpty:!1,description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:t.Optional(p({allowEmpty:!1,description:"Jira status the alert ticket is moved to right after it is filed for a firing alert. A later transition between two firing states leaves the ticket status alone."})),closedStatus:t.Optional(p({allowEmpty:!1,description:"Jira status the alert ticket is moved to when the alert resolves. Only takes effect when the rule delivers recovery transitions."}))},{$id:"RuleTargetInputJira"})],{description:"Destination that should receive the notification. The `type` field discriminates the variant: `email` sends directly to the listed addresses and needs no integration; every other type routes through the integration identified by `integrationId`, which must already exist (create it first with the notification integration endpoints)."})}),Cg=x("type",[t.Object({type:t.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:t.Array(t.String(),{description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),t.Object({type:t.Literal("all-teams",{description:"Match alert transitions for every team in the organization. Public API callers need an API key with `all` scope to create or update this filter."})},{title:"AllTeams"}),t.Object({type:t.Literal("all-public-teams",{description:"Match alert transitions for all public teams. Public API callers need an API key with `all` or `owning-team-and-public` scope to create or update this filter."})},{title:"AllPublicTeams"})],{description:"Team visibility filter used when matching alert transitions. Tsuga validates create and update requests against the caller permissions."}),Pg=x("type",[t.Object({type:t.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:t.Array(p(),{minItems:1,maxItems:100,description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),t.Object({type:t.Literal("all-teams",{description:"Match alert transitions for every team in the organization. Public API callers need an API key with `all` scope to create or update this filter."})},{title:"AllTeams"}),t.Object({type:t.Literal("all-public-teams",{description:"Match alert transitions for all public teams. Public API callers need an API key with `all` or `owning-team-and-public` scope to create or update this filter."})},{title:"AllPublicTeams"})],{description:"Team visibility filter used when matching alert transitions. Tsuga validates create and update requests against the caller permissions."}),Mo=t.Object({id:t.String({description:"Tsuga-generated notification rule ID assigned when the rule is created."}),name:t.String({description:"Display name of the notification rule."}),queryString:t.Optional(t.String({description:"Optional query that narrows which alert transitions trigger the rule. Matches on the monitor transition group key and the monitor tags, e.g. `env:prod service:api`. Omit or leave empty to match regardless of tags."})),teamsFilter:Cg,prioritiesFilter:t.Array(t.Enum(Ut),{description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(ko),{description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:t.Array(t.String(),{description:"Cluster IDs that must match for this rule to fire. An empty array matches every cluster, as does a transition that has no cluster ID."}),owner:t.String({description:"Team ID that owns and manages the rule."}),createdAt:S({description:"Timestamp when Tsuga created the rule."}),updatedAt:S({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when its filters match."}),tags:we,targets:t.Array(Ha,{description:"Destinations that receive a notification whenever this rule matches an alert transition. Every target in the list is notified independently, subject to its own rate limit and renotification settings."}),creator:t.Optional(pe),updater:t.Optional(pe)}),Ka=t.Object({name:p({description:"Display name of the notification rule."}),queryString:Se(p({type:"tags-query"}),{description:"Optional query that narrows which alert transitions trigger the rule. Matches on the monitor transition group key and the monitor tags, e.g. `env:prod service:api`. Omit or leave empty to match regardless of tags."}),teamsFilter:Pg,prioritiesFilter:t.Array(t.Enum(Ut),{maxItems:Ut.length,description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(ko),{maxItems:ko.length,description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Cluster IDs that must match for this rule to fire. Omit it, or leave it empty, to match every cluster."})),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:De,isActive:t.Boolean({description:"Set to true for the rule to send notifications when its filters match."}),targets:t.Array(Wi,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),za=t.Object({id:t.String({description:"Unique identifier of the adaptive notification rule. Generated by Tsuga."}),name:t.String({description:"Display name of the adaptive notification rule."}),owner:t.String({description:"Team ID that owns and manages the rule."}),createdAt:S({description:"Timestamp when Tsuga created the rule."}),updatedAt:S({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when one of its monitors fires."}),shouldCreateInvestigation:t.Boolean({description:"Whether each page records an investigation holding the sampled traces and the call graph the destination was resolved from, linked from the notification body."}),tags:we,monitorIds:t.Array(t.String(),{description:"Monitors this rule reacts to."}),sloIds:t.Array(t.String(),{description:"SLOs this rule reacts to."}),fallbackTarget:Ha,creator:t.Optional(pe),updater:t.Optional(pe)}),VN=t.Object({name:p({description:"Display name of the adaptive notification rule."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:De,isActive:t.Boolean({description:"Set to true for the rule to send notifications when one of its monitors fires."}),shouldCreateInvestigation:t.Optional(t.Boolean({description:"Set to true to record an investigation for each page, holding the sampled traces and the call graph the destination was resolved from, and to link it from the notification body. Defaults to false."})),monitorIds:t.Optional(t.Array(p({allowEmpty:!1}),{maxItems:100,description:"Monitors this rule reacts to. Only trace monitors and metric monitors over OTel span metrics are eligible. Send at least one monitor or SLO."})),sloIds:t.Optional(t.Array(p({allowEmpty:!1}),{maxItems:100,description:"SLOs this rule reacts to. Only SLOs over traces or OTel span metrics are eligible. Omit for a rule that reacts to monitors only; send at least one monitor or SLO."})),fallbackTarget:Wi}),BY=["active","inactive"],HY=["name","isActive","owner","tags","clusterIdsFilter","targets","type","updatedAt"],QN=t.Object({owners:ee(p({allowEmpty:!1}),{description:"Restrict results to rules owned by any of these team IDs.",maxItems:50}),searchQuery:hr({description:"Search query filter for notification rules.",valueDescription:"Case-insensitive substring matched against rule name and ID."}),tags:ee(St.items,{description:"Restrict results to rules that have at least one of the listed key/value tags.",maxItems:50}),destinations:ee(p({allowEmpty:!1}),{description:"Restrict results to rules that route to any of these email addresses or integration IDs.",maxItems:50}),clusterIds:ee(p({allowEmpty:!1}),{description:"Restrict results to rules that run on any of these cluster IDs. Rules with no cluster restriction are treated as running on every cluster, including the requested ones.",maxItems:50}),status:t.Enum(BY,{description:"Restrict results to active or inactive rules."})}),KY=t.Partial(t.Object({...ne,filters:t.Partial(QN),sort:t.Object({by:t.Enum(HY,{description:"Field to sort the returned notification rules by."}),direction:K})})),zY=t.Object({type:t.Literal("standard",{description:"Standard notification rule matched by query, tags, and destinations."}),...Mo.properties}),YY=t.Object({type:t.Literal("adaptive",{description:"Adaptive notification rule matched by selected monitors or SLOs."}),...za.properties}),VY=x("type",[zY,YY]),QY=t.Object({value:t.String({description:"Email address or integration ID used when filtering destinations."}),label:t.String({description:"Display name of the destination."}),type:t.String({description:"Destination type, such as email or slack."})}),WY=t.Object({tags:It,destinations:t.Array(QY,{description:"Destination filter options from the matching rules."}),activeCounts:t.Object({totalCount:t.Integer({description:"Total number of matching rules regardless of whether they are active."}),active:t.Integer({description:"Number of matching rules that are active."}),inactive:t.Integer({description:"Number of matching rules that are inactive."})})}),ZY=t.Object({filters:t.Optional(t.Partial(QN,{description:"Filters applied before collecting tag, destination, and active-count options."}))}),xXe=d({tags:["notification-rules"],url:`${Gr}/query`,method:"POST",paginated:!0,body:KY,response:t.Array(VY,{description:"Matching standard and adaptive notification rules after they are merged, sorted, and paginated."})}),RXe=d({tags:["notification-rules"],url:`${Gr}/options/query`,method:"POST",body:ZY,response:WY}),CXe=d({tags:["notification-rules"],url:Gr,method:"GET",paginated:!0,query:t.Object(ne),response:t.Array(Mo)}),PXe=d({tags:["notification-rules"],url:`${Gr}/:id`,params:t.Object({id:p()}),method:"GET",response:Mo}),UXe=d({tags:["notification-rules"],url:Gr,method:"POST",body:Ka,response:Mo}),NXe=d({tags:["notification-rules"],url:`${Gr}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ka,response:Mo}),wXe=d({tags:["notification-rules"],url:`${Gr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),vXe=d({tags:["notification-rules"],url:`${Gr}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p(),{uniqueItems:!0})}),response:t.Object({})}),Zi=`${Vi}/adaptive-rules`,LXe=d({tags:["notification-rules"],url:Zi,method:"GET",paginated:!0,query:t.Object(ne),response:t.Array(za)}),kXe=d({tags:["notification-rules"],url:`${Zi}/:id`,params:t.Object({id:p()}),method:"GET",response:za}),MXe=d({tags:["notification-rules"],url:Zi,method:"POST",body:VN,response:za}),DXe=d({tags:["notification-rules"],url:`${Zi}/:id`,method:"PUT",params:t.Object({id:p()}),body:VN,response:za}),GXe=d({tags:["notification-rules"],url:`${Zi}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),$Xe=d({tags:["notification-rules"],url:`${Zi}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p(),{uniqueItems:!0})}),response:t.Object({})}),FXe=d({tags:["notification-integrations"],url:`${YN}/start`,method:"POST",response:t.Object({redirectUrl:t.String()})}),XY=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],WN=t.Object({id:t.String(),name:t.String(),type:t.Enum(XY),createdAt:S(),ruleCount:t.Number(),creator:t.Optional(pe)}),JY=["name","type","ruleCount","createdAt"],e4=t.Object({searchQuery:hr({description:"Search query filter for notification integrations.",valueDescription:"Case-insensitive substring matched against integration name and ID."})}),t4=t.Partial(t.Object({...ne,filters:t.Partial(e4),sort:t.Object({by:t.Enum(JY,{description:"Field to sort the returned notification integrations by."}),direction:K})})),jXe=d({tags:["notification-integrations"],url:`${Qi}/query`,method:"POST",paginated:!0,body:t4,response:t.Array(WN,{description:"Matching notification integrations after they are filtered, sorted, and paginated."})}),qXe=d({tags:["notification-integrations"],url:`${Gr}/integrations`,method:"GET",paginated:!0,query:t.Object(ne),response:t.Array(WN)}),BXe=d({tags:["notification-integrations"],url:`${YN}/callback`,method:"GET",query:t.Object({code:p()}),response:t.Object({success:t.Boolean()})}),Ug=["POST","PUT"],r4=t.Record(t.String(),t.String()),n4=t.Record(t.String(),t.Unknown()),o4=t.Record(t.String(),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))])),i4=x("type",[t.Object({type:t.Literal("json"),value:n4}),t.Object({type:t.Literal("form"),value:o4})]),s4=t.Object({ok:t.String(),alert:t.String()}),Ya=t.Object({id:t.String(),name:t.String(),owner:t.Optional(t.String({description:"ID of the team that owns the integration. Absent on integrations created before ownership was introduced."})),setting:x("type",[t.Object({type:t.Literal("incident-io"),alertSourceConfigId:t.String(),tokenLastChars:t.String()}),t.Object({type:t.Literal("grafana-irm"),urlLastChars:t.String()}),t.Object({type:t.Literal("pagerduty"),integrationKeyLastChars:t.String()}),t.Object({type:t.Literal("microsoft-teams"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("webhook"),urlLastChars:t.String(),method:t.Enum(Ug),authentication:x("type",[t.Object({type:t.Literal("bearer"),tokenLastChars:t.String()}),t.Object({type:t.Literal("basic"),username:t.String(),passwordLastChars:t.String()}),t.Object({type:t.Literal("custom-header"),key:t.String(),valueLastChars:t.String()}),t.Object({type:t.Literal("none")})]),customHeaders:t.Optional(r4),payloadTemplate:i4,eventNameMapping:t.Optional(s4)}),t.Object({type:t.Literal("servicenow"),instanceName:t.String(),username:t.String(),passwordLastChars:t.String()}),t.Object({type:t.Literal("google-chat"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("squadcast"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("jira"),siteUrl:t.String(),email:t.String(),apiTokenLastChars:t.String()})]),tags:we}),a4=t.Object({type:t.Literal("webhook"),url:p({type:"uri"}),method:t.Enum(Ug),authentication:x("type",[t.Object({type:t.Literal("bearer"),token:p({allowEmpty:!1})}),t.Object({type:t.Literal("basic"),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),t.Object({type:t.Literal("custom-header"),key:p({allowEmpty:!1}),value:p({allowEmpty:!1})}),t.Object({type:t.Literal("none")})]),customHeaders:t.Record(p({allowEmpty:!1}),p()),payloadTemplate:x("type",[t.Object({type:t.Literal("json"),value:t.Record(p({allowEmpty:!1}),t.Unknown())}),t.Object({type:t.Literal("form"),value:t.Record(p({allowEmpty:!1}),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))]))})]),eventNameMapping:t.Optional(t.Object({ok:p({allowEmpty:!1}),alert:p({allowEmpty:!1})}))}),ZN=t.Object({type:t.Literal("incident-io"),alertSourceConfigId:p(),token:p()}),XN=t.Object({type:t.Literal("grafana-irm"),url:p({type:"uri"})}),JN=t.Object({type:t.Literal("pagerduty"),integrationKey:p()}),ew=t.Object({type:t.Literal("microsoft-teams"),webhookUrl:p({type:"uri"})}),c4=t.Object({type:t.Literal("servicenow"),instanceName:p({allowEmpty:!1,description:'Instance name of the ServiceNow instance. This corresponds to the subdomain part of the instance URL, like "my-instance" in "my-instance.service-now.com"'}),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),p4=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),u4=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),l4=t.Object({type:t.Literal("jira"),siteUrl:p({type:"uri",allowEmpty:!1,description:'Base URL of the Jira Cloud site, like "https://your-company.atlassian.net". Tsuga files issues against this site.'}),email:p({type:"email",allowEmpty:!1,description:"Atlassian account email used together with the API token for Basic authentication."}),apiToken:p({allowEmpty:!1,description:"Atlassian API token minted for the account, used as the Basic auth password."})}),tw=p({allowEmpty:!1,description:"ID of the team that will own the integration, determining which team members can view and manage it. Only an org admin or an admin of this team may set it."}),Ng=t.Object({name:p(),owner:tw,setting:x("type",[ZN,XN,JN,ew,a4,c4,p4,u4,l4]),tags:De}),m4=t.Object({type:t.Literal("webhook"),url:t.Optional(p({type:"uri"})),method:t.Optional(t.Enum(Ug)),authentication:t.Optional(x("type",[t.Object({type:t.Literal("bearer"),token:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("basic"),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("custom-header"),key:t.Optional(p({allowEmpty:!1})),value:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("none")})])),customHeaders:t.Optional(t.Record(p({allowEmpty:!1}),p())),payloadTemplate:t.Optional(x("type",[t.Object({type:t.Literal("json"),value:t.Record(p({allowEmpty:!1}),t.Unknown())}),t.Object({type:t.Literal("form"),value:t.Record(p({allowEmpty:!1}),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))]))})])),eventNameMapping:Se(t.Object({ok:t.Optional(p({allowEmpty:!1})),alert:t.Optional(p({allowEmpty:!1}))}))}),d4=t.Object({type:t.Literal("servicenow"),instanceName:t.Optional(p({allowEmpty:!1})),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),f4=t.Object({type:t.Literal("jira"),siteUrl:t.Optional(p({type:"uri",allowEmpty:!1})),email:t.Optional(p({allowEmpty:!1})),apiToken:t.Optional(p({allowEmpty:!1}))}),g4=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),h4=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),wg=t.Object({name:t.Optional(p()),owner:tw,tags:De,setting:t.Optional(x("type",[ZN,XN,JN,ew,m4,d4,g4,h4,f4]))}),HXe=d({tags:["notification-integrations"],url:Qi,method:"POST",body:Ng,response:Ya}),KXe=d({tags:["notification-integrations"],url:`${Qi}/:id`,method:"GET",params:t.Object({id:p()}),response:Ya}),zXe=d({tags:["notification-integrations"],url:`${Qi}/:id`,method:"PATCH",params:t.Object({id:p()}),body:wg,response:Ya}),YXe=d({tags:["notification-integrations"],url:`${Qi}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),y4=x("status",[t.Object({status:t.Literal("ok",{description:"Tsuga reached Jira and listed the projects the credentials can file into."}),projects:t.Array(t.Object({key:t.String({description:'Jira project key, like "OPS".'}),name:t.String({description:"Human readable Jira project name."}),issueTypes:t.Array(t.String(),{description:"Issue type names available when creating an issue in this project."}),statuses:t.Optional(t.Array(t.String(),{description:"Status names an issue in this project can be transitioned to. Omitted when Jira refused the status lookup for this project."}))}),{description:"Projects the connected Jira account can file issues into."})},{title:"JiraMetadataOk"}),t.Object({status:t.Literal("error",{description:"Tsuga could not load Jira metadata with the stored credentials."}),message:t.String({description:"Human readable reason the Jira metadata could not be loaded."})},{title:"JiraMetadataError"})],{description:"Result of probing Jira for the projects, issue types and statuses reachable with a stored integration. Returns a typed error instead of failing so the rule editor can fall back to free-text entry."}),VXe=d({tags:["notification-integrations"],url:`${Qi}/:id/jira-metadata`,method:"GET",params:t.Object({id:p()}),response:y4}),QXe=d({tags:["notification-rules"],url:`${Nt}/:id/notifications`,method:"GET",params:t.Object({id:p()}),query:t.Optional(t.Object({from:t.Optional(t.Number()),to:t.Optional(t.Number())})),response:t.Object({notifications:t.Array(t.Object({id:t.String(),monitorId:t.String(),monitorResultId:t.String(),ruleId:t.Optional(t.String()),targetId:t.Optional(t.String()),status:t.Enum(FY),tryCount:t.Number(),nextTryAt:S(),createdAt:S(),updatedAt:S(),sentAt:t.Optional(S())})),isTruncated:t.Boolean()})}),T4=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],WXe=d({tags:["notification-rules"],url:`${Gr}/test`,method:"POST",body:t.Object({notificationRule:Ka,targetIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:t.Union([t.Object({success:t.Literal(!1),overallMessage:t.String({description:"Message when there is an overall error"})}),t.Object({success:t.Boolean(),results:t.Array(t.Object({targetId:t.String({description:"The ID of the target that was tested"}),targetType:t.Enum(T4,{description:"The type of the target (e.g., slack, webhook)"}),status:t.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:t.Optional(t.String({description:"Message if the notification failed for this specific target"}))}))})])});var cn="/v0/slos",E4=[7,30,90],_4=["good","bad"],iw=t.Enum(_4,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),I4=["good","bad","ignore"],sw=t.Enum(I4,{description:"How to treat time buckets with no data: good (count as meeting the SLO), bad (count as breaching it), or ignore (exclude from the error budget)"}),rw=30,nw=1440,aw=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],S4=["healthy","breached","no_data"],El=t.Enum(S4,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),ow={sli:t.Optional(t.Number({description:"Service level indicator for the latest evaluation; absent when there is no data"})),errorBudget:t.Optional(t.Number({description:"Remaining error budget at the latest evaluation; negative when exhausted, absent when there is no data"})),status:El},b4=t.Object({overall:t.Object(ow,{description:"Latest overall evaluation for the cluster"}),perGroup:t.Array(t.Object({groupKey:t.Record(t.String(),Aa,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...ow}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),cw=t.Record(t.String(),b4,{description:"Latest evaluation results keyed by cluster ID."}),vg=t.Object({queries:Xr,formula:$u},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Tsuga evaluates this query formula during SLO evaluation and returns it as part of the saved SLO configuration. Returned queries include Tsuga-derived missing-point fill: event SLO queries use zero fill, and time SLO queries keep missing points null."}),Lg=t.Object({queries:GR,formula:Ao},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Formulas reference queries as q1, q2, and so on. Do not send per-query fill; Tsuga derives the fill behavior from the SLO type."}),O4=t.Object({type:t.Literal("burn-rate",{description:"Alert configuration kind. Set to `burn-rate` for alerts that fire when the SLO consumes error budget faster than the configured multiplier."}),burnRate:t.Number({description:"Burn-rate multiplier that triggers this alert. The short and long evaluation windows are derived from the predefined template with the closest burn rate."})},{title:"BurnRateAlert"}),A4=t.Object({type:t.Literal("burn-rate",{description:"Alert configuration kind. Set to `burn-rate` for alerts that fire when the SLO consumes error budget faster than the configured multiplier."}),burnRate:t.Number({minimum:1,maximum:100,description:"Burn-rate multiplier that triggers this alert. Required for burn-rate alerts; valid input is 1 through 100. Non-template values are accepted; short and long evaluation windows are derived from the predefined template with the closest burn rate."})},{title:"BurnRateAlert"});var x4=t.Object({type:t.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:t.Number({description:"SLI percentage threshold for this alert. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),R4=t.Object({type:t.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"SLI percentage threshold for this alert. Required for threshold alerts; valid input is greater than 0 and less than 100. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),C4=x("type",[O4,x4],{description:"Alert trigger configuration: burn-rate or threshold"}),pw=x("type",[A4,R4],{description:"Alert trigger configuration: burn-rate or threshold"}),kg=t.Enum(Ut,{description:"Alert priority (1 is highest, 5 is lowest)"}),Mg=t.Object({id:t.String({description:"Tsuga-generated SLO alert ID assigned when the alert is created."}),sloId:t.String({description:"Parent SLO ID for this alert."}),priority:kg,configuration:C4,createdAt:S({description:"Timestamp when Tsuga created the alert."}),updatedAt:S({description:"Timestamp when Tsuga last updated the alert."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"SloAlert"}),P4=t.Object({priority:kg,configuration:pw}),U4=t.Object({id:t.Optional(p({allowEmpty:!1,description:"Identifier of an existing alert to update. Omit to create a new alert on this SLO."})),priority:kg,configuration:pw}),N4=x("type",[t.Object({type:t.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:Wt,goodQuery:vg,totalQuery:vg,groupByFields:t.Optional(Ni),noDataBehavior:iw},{title:"EventSloConfiguration"}),t.Object({type:t.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:Wt,query:vg,sliceSizeMinutes:t.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:t.Object({operator:t.Enum(aw,{description:"Comparison operator between the query value and the threshold"}),value:t.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:t.Optional(Ni),noDataBehavior:sw},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),w4=x("type",[t.Object({type:t.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:Wt,goodQuery:Lg,totalQuery:Lg,groupByFields:t.Optional(Jr),noDataBehavior:iw},{title:"EventSloConfiguration"}),t.Object({type:t.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:Wt,query:Lg,sliceSizeMinutes:t.Integer({minimum:rw,maximum:nw,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${rw} through ${nw}.`}),threshold:t.Object({operator:t.Enum(aw,{description:"Comparison operator between the query value and the threshold"}),value:t.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:t.Optional(Jr),noDataBehavior:sw},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),v4=t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),uw=t.Enum(E4,{type:"integer",description:"Rolling SLO evaluation window in days. Set by the caller on create or update and returned on read and list responses. Allowed values are 7, 30, and 90."}),L4=t.Array(t.String(),{description:"Cluster IDs this SLO is evaluated on. Omit or send an empty array on input to run on all clusters; responses use an empty array to mean all clusters. Non-empty input values must reference existing clusters."}),k4=t.Array(p({allowEmpty:!1}),{description:"Cluster IDs this SLO is evaluated on. Omit or send an empty array on input to run on all clusters; responses use an empty array to mean all clusters. Non-empty input values must reference existing clusters."}),Xi=t.Object({id:t.String({description:"Tsuga-generated SLO ID assigned when the SLO is created."}),name:t.String({description:"Display name of the SLO, set by the caller."}),description:t.Optional(t.String({description:"Free-form, caller-provided description of what the SLO measures. Absent when not set."})),tags:we,configuration:N4,target:t.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:uw,owner:t.String({description:"Team ID that owns the SLO"}),permissions:Pn,clusterIds:L4,creator:t.Optional(pe),updater:t.Optional(pe),alerts:t.Array(Mg,{description:"Alerts attached to this SLO"}),createdAt:S({description:"Timestamp when Tsuga created the SLO."}),updatedAt:S({description:"Timestamp when Tsuga last updated the SLO."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"Slo"}),M4=t.Object({...Xi.properties,results:cw},{title:"SloWithResults"}),_l=t.Object({name:p({allowEmpty:!1,description:"Display name of the SLO."}),description:Se(p({type:"long"}),{description:"Free-form, caller-provided description of what the SLO measures. Optional."}),tags:De,configuration:w4,target:v4,timeframeDays:uw,owner:p({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:Pn,clusterIds:t.Optional(k4),alerts:t.Array(P4,{description:"Alerts to create on this SLO. Send an empty array for none."})}),Dg=t.Object({...t.Omit(_l,["alerts"]).properties,alerts:t.Array(U4,{description:"Alerts attached to this SLO. The SLO owns its alerts: the set is reconciled to exactly this list \u2014 existing alerts are matched by id, alerts without an id are created, and existing alerts absent from the list are deleted. Send an empty array to clear all alerts."})}),lw=t.Object({owners:ee(p({allowEmpty:!1}),{description:"Restrict results to SLOs owned by any of these team IDs",maxItems:50}),searchQuery:hr({description:"Text filter for SLO names or IDs. Optional; `exclude: true` removes matching SLOs.",valueDescription:"Substring matched case-insensitively against the SLO name or SLO ID."}),tags:ee(St.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:ee(p({allowEmpty:!1}),{description:"Restrict results to SLOs that run against any of these cluster IDs (SLOs with no cluster restriction are always included)",maxItems:50}),statuses:ee(El,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),Gg=t.Partial(lw),D4=["name","owner","tags","updatedAt","sli","errorBudget","status"],$g=t.Partial(t.Object({...ne,filters:Gg,sort:t.Object({by:t.Enum(D4,{description:"Field to sort by"}),direction:K},{description:"Optional sorting applied to the returned SLOs"})})),cJe=d({tags:["slos"],url:`${cn}/query`,method:"POST",paginated:!0,response:t.Array(M4),body:$g}),pJe=d({tags:["slos"],url:`${cn}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(lw,["tags","statuses"])))}),response:It}),uJe=d({tags:["slos"],url:`${cn}/:id`,method:"GET",params:t.Object({id:p()}),response:Xi}),lJe=d({tags:["slos"],url:`${cn}/:id/results`,method:"GET",params:t.Object({id:p()}),response:cw}),mJe=d({tags:["slos"],url:cn,method:"POST",body:_l,response:Xi}),dJe=d({tags:["slos"],url:`${cn}/:id`,method:"PUT",params:t.Object({id:p()}),body:Dg,response:Xi}),fJe=d({tags:["slos"],url:`${cn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),G4=Qt(Gg),gJe=d({tags:["slos"],url:`${cn}/bulk-delete`,method:"DELETE",body:t.Object({selection:G4}),response:t.Object({})}),$4=Qt(Gg,{maxIds:100}),hJe=d({tags:["slos"],url:`${cn}/bulk-update`,method:"PUT",body:t.Object({selection:$4,owner:p({allowEmpty:!1})}),response:t.Object({})});var Ht="/v0/service-catalog",F4=t.Object({team:t.String({description:"Team name observed on telemetry for this service. The emitting service sets it through telemetry attributes. Returned when Tsuga has observed a team value for the service; metadata refreshes weekly or when a new service version appears."}),lastSeenAt:S({description:"Most recent time this team was observed for the service. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A team name observed on telemetry for this service, with the last time it was seen."}),j4=t.Object({ingestionApiKey:t.String({description:"Ingestion API key name or identifier observed on telemetry for this service. Tsuga sets it from the key used to ingest matching telemetry. Returned when key metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this ingestion key was observed for the service. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An ingestion API key observed on telemetry for this service, with the last time it was seen."}),q4=t.Object({version:t.String({description:"Service version value observed in telemetry. The emitting service sets it through `context.service.version`. Returned when Tsuga has observed a version for the service."}),firstSeenAt:S({description:"First time this version was observed for the service. Tsuga sets it from telemetry timestamps and refreshes observed versions on each service catalog pass."}),lastSeenAt:S({description:"Most recent time this version was observed for the service. Tsuga sets it from telemetry timestamps and refreshes observed versions on each service catalog pass."}),faulty:t.Optional(t.Boolean({description:"Whether Tsuga detected this version as associated with faulty behavior."})),faultyLatency:t.Optional(t.Boolean({description:"Whether the faulty behavior Tsuga detected for this version is a latency degradation. Only set by faulty deployment detection when it reports on latency; absent when the detection did not evaluate latency."})),detectionTriggered:t.Optional(t.Boolean({description:"Whether faulty deployment detection has already been triggered for this version. Set when the detection job is launched to avoid re-triggering it. Absent on versions predating this field."}))},{description:"A service version observed in telemetry, with first and last seen timestamps and faulty deployment detection results."}),B4=t.Object({language:t.String({description:"Programming language observed for this service. The OpenTelemetry SDK sets it through telemetry metadata. Returned when language metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this language was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A programming language observed for this service, with the last time it was seen."}),H4=t.Object({runtime:t.String({description:"Runtime observed for this service. The emitting service or OpenTelemetry instrumentation sets it through telemetry metadata. Returned when runtime metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this runtime was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A runtime observed for this service, with the last time it was seen."}),mw=t.Object({protocol:t.String({description:"Observed API protocol, such as `http`, `grpc`, or `graphql`. Tsuga infers it from span metadata. Returned when protocol metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this protocol was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An API protocol observed for this service, with the last time it was seen."}),K4=t.Object({framework:t.String({description:"Observed application framework, such as `express`, `fastify`, `django`, or `rails`. Tsuga detects it from OpenTelemetry instrumentation scope. Returned when framework metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this framework was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"An application framework detected from OpenTelemetry instrumentation scope, with the last time it was seen."}),z4=t.Object({platform:t.String({description:"Observed cloud or orchestration platform, such as `aws_eks` or `kubernetes`. The emitting service or collector sets it through telemetry resource attributes. Returned when platform metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this platform was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A cloud or orchestration platform this service runs on, with the last time it was seen."}),Y4=t.Object({provider:t.String({description:"Observed cloud provider, such as `aws`, `gcp`, or `azure`. The emitting service or collector sets it through telemetry resource attributes. Returned when provider metadata is available for the service."}),lastSeenAt:S({description:"Most recent time this provider was observed. Tsuga sets it from telemetry timestamps during service metadata refreshes."})},{description:"A cloud provider this service runs on, with the last time it was seen."}),Ji=t.Object({id:t.String({description:"Tsuga-generated identifier of this service notification target. Tsuga returns it when the target is created or listed, and clients use it to update or delete the target. It is unique across service targets."}),serviceId:t.String({description:"Identifier of the service catalog entry this target is attached to. Tsuga sets it from the service path parameter and returns it on read and write responses."}),config:Ha.properties.config,rateLimit:Ha.properties.rateLimit,createdAt:S({description:"Timestamp when the service notification target was created. Tsuga sets this value and returns it on private service-catalog responses."}),updatedAt:S({description:"Timestamp when the service notification target was last updated. Tsuga sets this value and returns it on private service-catalog responses."})}),Fg=t.Object({config:Wi.properties.config,rateLimit:Wi.properties.rateLimit},{description:"Service notification target create request. The caller provides the destination configuration and optional rate limit; Tsuga attaches the target to the service in the path."}),jg=t.Object({config:Wi.properties.config,rateLimit:t.Union([Rg,t.Null()],{description:"Per-target rate limit to apply when sending notifications. Set it to `null` to drop the current limit and fall back to the default of 1000 notifications every 10 minutes."})},{description:"Service notification target update request. The caller provides the replacement destination configuration and rate limit; omitted fields are not supported by this schema."}),Il=t.Object({id:t.String({description:"Unique identifier of this service. Use it with service detail and graph endpoints."}),serviceName:t.String({description:"OpenTelemetry service name observed in telemetry."}),serviceNamespace:t.Optional(t.String({description:"OpenTelemetry service namespace observed in telemetry."})),env:t.String({description:"Environment value observed for this service."}),teams:t.Array(F4,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:t.Array(j4,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:t.Array(q4,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:t.Array(B4,{description:"Programming languages observed for this service."}),runtimes:t.Array(H4,{description:"Runtime values observed for this service."}),serverProtocols:t.Array(mw,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:t.Array(mw,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:t.Array(K4,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:t.Array(z4,{description:"Cloud platforms this service is running on"}),cloudProviders:t.Array(Y4,{description:"Cloud providers this service is running on"}),lastSeenAt:S({description:"Most recent time Tsuga observed telemetry for this service."}),firstSeenAt:S({description:"First time Tsuga observed telemetry for this service."}),additionalUserFields:t.Optional(t.Unsafe({type:"object",additionalProperties:!0,description:"Additional user-defined service metadata, when configured."})),traceRequestRate:t.Optional(t.Number({description:"Requests per second observed for this service over the queried window, counting calls of its primary span kind. Omitted when the trace query failed, which is distinct from `0` (the service is quiet)."})),traceErrorRate:t.Optional(t.Number({description:"Percentage of this service\u2019s primary-span-kind calls over the queried window that ended with error status. Omitted when the trace query failed."})),notificationTargets:t.Array(Ji,{description:"Notification targets attached to this service, used by adaptive notification rules to page its owners."}),createdAt:S({description:"Timestamp when Tsuga created this service catalog entry."}),updatedAt:S({description:"Timestamp when Tsuga last updated this service catalog entry."})}),V4=t.Object({spanKind:t.Enum(fR),count:t.Number()}),qg=t.Object({...Il.properties,spanKindCounts:t.Array(V4)}),RJe=d({tags:["service-catalog"],query:t.Object({...ne,clusterId:t.Optional(p()),env:t.Optional(p())}),method:"GET",paginated:!0,url:`${Ht}/services`,response:t.Array(qg)}),Q4=["serviceName","env","lastDeploy","traceErrorRate","traceRequestRate","teams","api","frameworks","languages","pagingDestination"],W4=t.Object({searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against service names."})},{description:"Text filter for service names."}),teams:ee(p({allowEmpty:!1}),{description:"Restrict results to services observed under any of these team names",maxItems:50}),envs:ee(p({allowEmpty:!1}),{description:"Restrict results to services observed in any of these environments",maxItems:50}),versions:ee(p({allowEmpty:!1}),{description:"Restrict results to services whose latest observed version is one of these",maxItems:50}),languages:ee(p({allowEmpty:!1}),{description:"Restrict results to services written in any of these languages",maxItems:50}),hasRecentData:t.Boolean({description:"When true, only return services whose request rate over the queried window is non-zero"})}),Z4=["1h","4h","24h"];var X4=t.Partial(t.Object({...ne,clusterId:p(),filters:t.Partial(W4,{description:"Optional filters applied to narrow the returned services"}),sort:t.Object({by:t.Enum(Q4,{description:"Field to sort the returned services by"}),direction:K},{description:"Optional sorting applied to the returned services"}),statsWindow:t.Enum(Z4,{description:"Lookback used to compute the trace request rate and trace error rate fields, and the span-call totals that pick each service's primary environment. Defaults to `1h`."})})),CJe=d({tags:["service-catalog"],url:`${Ht}/v2/services/query`,method:"POST",paginated:!0,body:X4,response:t.Array(qg)}),PJe=d({tags:["service-catalog"],query:t.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:t.Optional(p({allowEmpty:!1})),env:p({allowEmpty:!1}),clusterId:t.Optional(p())}),method:"GET",url:`${Ht}/v2/service`,response:qg}),UJe=d({tags:["service-catalog"],query:t.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:t.Optional(p({allowEmpty:!1})),clusterId:t.Optional(p())}),method:"GET",url:`${Ht}/v2/service/envs`,response:t.Array(t.Object({env:t.String({description:"Environment the service was observed in."}),ingestedBytes:t.Number({description:"Trace bytes ingested for the service in this environment over the lookback."})}),{description:"Environments the service was observed in, busiest first."})}),NJe=d({tags:["service-catalog"],method:"GET",url:`${Ht}/services/:serviceId`,params:t.Object({serviceId:p()}),response:Il}),wJe=d({tags:["service-catalog"],method:"GET",url:`${Ht}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),response:t.Array(Ji)}),vJe=d({tags:["service-catalog"],method:"POST",url:`${Ht}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),body:Fg,response:Ji}),LJe=d({tags:["service-catalog"],method:"PUT",url:`${Ht}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),body:jg,response:Ji}),kJe=d({tags:["service-catalog"],method:"DELETE",url:`${Ht}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),response:w}),J4=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var dw=t.Object({id:t.String(),hostName:t.String(),env:t.Optional(t.String()),cpuUtilizationAverage:t.Number(),hostType:t.Enum(J4),teams:t.Array(t.String()),tags:t.Array(t.String()),firstSeenAt:S(),lastSeenAt:S(),clusterId:t.String()}),MJe=d({tags:["service-catalog"],method:"GET",url:`${Ht}/hosts`,response:t.Array(dw)}),DJe=d({tags:["service-catalog"],method:"GET",url:`${Ht}/hosts/:hostId`,params:t.Object({hostId:p()}),response:dw}),e3=["http","rpc","messaging","genai","object_store"],fw={name:t.String({description:"Service or inferred dependency name shown in the graph."}),env:t.Optional(t.String({description:"Environment observed from spans."}))},Bg=t.Object({...fw,nodeType:t.Literal("observed",{description:"Discriminator for this node variant. Always `observed` for a graph node matched to a service catalog entry by name and env."}),id:t.Union([t.String(),t.Null()],{description:"Service ID, or null when multiple namespaces match the observed service name."}),namespace:t.Union([t.String(),t.Null()],{description:"Service namespace, or null when multiple namespaces match the observed service name."}),errorRate:t.Optional(t.Number({description:"Ratio of entry requests with at least one error to total entry requests observed on this service. Omitted when no entry requests were observed. Computed from the raw sampled counts, so trace sampling does not affect it."})),entryErrorRequestCount:t.Number({description:"Estimated number of entry requests on this service where at least one entry span had error status, projected from the sampled traces onto the full population."}),entryRequestCount:t.Number({description:"Estimated number of entry requests on this service, projected from the sampled traces onto the full population. Observed as unique trace IDs that have at least one entry span on this service. An entry span is a consumer-kind span, a root span (no parent), or any span whose parent belongs to a different service."})}),gw={...fw,endpoint:t.Optional(t.String({description:"Inferred service endpoint address"})),resourceName:t.Optional(t.String({description:"Inferred resource name, e.g. table or queue name"}))},Hg=t.Object({...gw,nodeType:t.Literal("inferred_db",{description:"Discriminator for this node variant. Always `inferred_db` for a database dependency detected from client-span attributes that could not be matched to a service catalog entry."}),serviceType:t.Literal("db",{description:"Inferred dependency type. Always `db` for this node variant."}),databaseName:t.Optional(t.String({description:"Database name from span_attributes db.namespace. Matches the database catalog `name`."})),databaseSystem:t.String({description:"Database system from span_attributes db.system.name (falling back to legacy db.system). Matches the database catalog `databaseSystem`."})}),Kg=t.Object({...gw,nodeType:t.Literal("inferred",{description:"Discriminator for this node variant. Always `inferred` for a non-database dependency detected from client-span attributes (e.g. a queue or external HTTP call) that could not be matched to a service catalog entry. Database dependencies use the `inferred_db` variant."}),serviceType:t.Enum(e3,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),t3=x("nodeType",[Bg,Hg,Kg]),zg=t.Object({from:t.Object({env:t.Optional(t.String({description:"Environment of the source node"})),name:t.String({description:"Name of the source node"})},{description:"Reference to the caller node, i.e. the service or dependency that issued the request."}),to:t.Object({env:t.Optional(t.String({description:"Environment of the target node"})),name:t.String({description:"Name of the target node"}),databaseSystem:t.Optional(t.String({description:"Database system of the target when it is an inferred database node (`inferred_db`). Together with `name` and `env` it identifies the target node, distinguishing a database from a same-named service or a same-named database on another system."}))},{description:"Reference to the callee node, i.e. the service or dependency that received the request."}),count:t.Number({description:"Estimated number of cross-service transitions on this directed edge in the graph query window. The graph is built from a uniform sample of traces, so this is projected onto the full population rather than counted directly."}),errorRate:t.Optional(t.Number({description:"Ratio of errored client spans to total client spans observed on this edge. Omitted when no client spans were observed. For edges to inferred services, the originating span is treated as the client span regardless of its kind. Computed from the raw sampled counts, so trace sampling does not affect it."})),errorCount:t.Number({description:"Estimated number of client spans with error status on this edge, projected from the sampled traces onto the full population."}),clientSpanCount:t.Number({description:"Estimated number of client spans on this edge, projected from the sampled traces onto the full population."})},{description:"Directed dependency edge from a caller node (`from`) to a callee node (`to`) in the service graph, with call-volume and error counts observed over the query window."}),GJe=d({tags:["service-catalog"],url:`${Ht}/services/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p()}),query:t.Object({...it.properties,query:t.Optional(p({type:"tsuga-query"}))}),response:t.Object({clusterId:t.String(),nodes:t.Array(t3),edges:t.Array(zg)})}),r3=t.Object({monitors:t.Array(t.Object({id:t.String({description:"Identifier of the monitor"}),name:t.String({description:"Display name of the monitor"}),owner:t.String({description:"Team ID that owns the monitor"}),priority:t.Enum(Ut,{description:"Priority of the monitor"})})),slos:t.Array(t.Object({id:t.String({description:"Identifier of the SLO"}),name:t.String({description:"Display name of the SLO"}),owner:t.String({description:"Team ID that owns the SLO"}),statusCount:t.Partial(t.Record(El,t.Number()),{description:"Count of SLO statuses for this service: one entry per group matching the service when the SLO groups by service.name, otherwise the overall status"})}))}),$Je=d({tags:["service-catalog"],method:"GET",url:`${Ht}/services/:serviceId/related-resources`,params:t.Object({serviceId:p()}),response:r3}),FJe=d({tags:["service-catalog"],method:"GET",url:`${Ht}/services/by-api-keys`,response:t.Record(t.String(),t.Array(t.Object({serviceName:t.String(),serviceNamespace:t.Optional(t.String())})))});var Sl=`/${"v1"}/services`,Yg=t.Pick(Il,["id","serviceName","serviceNamespace","env","teams","versions","languages","runtimes","serverProtocols","clientProtocols","frameworks","cloudPlatforms","cloudProviders","lastSeenAt","firstSeenAt","traceRequestRate","traceErrorRate"],{$id:"Service",description:"Service inferred from telemetry, with observed metadata, activity counts, and version signals. See [Services](/documentation/categorize/services/index)."}),n3={id:"123-456-abc",serviceName:"api-gateway",serviceNamespace:"platform",env:"production",teams:[{team:"platform",lastSeenAt:"2024-01-15T12:34:56.000Z"}],versions:[{version:"1.2.3",firstSeenAt:"2024-01-01T08:00:00.000Z",lastSeenAt:"2024-01-15T12:34:56.000Z",faulty:!0,faultyLatency:!0}],languages:[{language:"go",lastSeenAt:"2024-01-15T12:34:56.000Z"}],runtimes:[{runtime:"go",lastSeenAt:"2024-01-15T12:34:56.000Z"}],serverProtocols:[{protocol:"http",lastSeenAt:"2024-01-15T12:34:56.000Z"}],clientProtocols:[{protocol:"grpc",lastSeenAt:"2024-01-15T12:34:56.000Z"}],frameworks:[{framework:"gin",lastSeenAt:"2024-01-15T12:34:56.000Z"}],cloudPlatforms:[{platform:"aws_eks",lastSeenAt:"2024-01-15T12:34:56.000Z"},{platform:"kubernetes",lastSeenAt:"2024-01-15T12:34:56.000Z"}],cloudProviders:[{provider:"aws",lastSeenAt:"2024-01-15T12:34:56.000Z"}],lastSeenAt:"2024-01-15T12:34:56.000Z",firstSeenAt:"2024-01-01T08:00:00.000Z",traceRequestRate:2.36,traceErrorRate:8.2};Object.assign(Yg,{examples:[n3]});var hw=d({description:"Lists services inferred from telemetry. Use this endpoint to inventory service ownership, environments, versions, runtimes, and recent activity. Pagination fields limit the returned page.",operationId:"listServices",tags:["services"],url:Sl,method:"GET",paginated:!0,query:t.Object({...qe,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Omit to use the first cluster in the organization; this does not query all clusters."})),env:t.Optional(p({allowEmpty:!1,description:"Environment whose activity and metadata each returned service is described by. Services not observed in it are omitted. Omit to describe each service by its busiest environment."}))},{description:"Service list query. Use pagination and optional cluster and environment scope."}),response:t.Array(Yg)}),yw=d({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${Sl}/:serviceId`,method:"GET",params:t.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to retrieve. Use the `id` returned by service list responses."})}),response:Yg}),o3=t.Pick(Bg,["name","env","nodeType","id","namespace","errorRate","entryErrorRequestCount","entryRequestCount"],{$id:"ObservedServiceGraphNode",description:"Service graph node matched to a service catalog entry by name and env. `id`/`namespace` are null when multiple namespaces share the observed service name."}),i3=t.Pick(Kg,["name","env","nodeType","serviceType","endpoint","resourceName"],{$id:"InferredServiceGraphNode",description:"Dependency node detected from client-span attributes (e.g. a queue or external HTTP call) that could not be matched to a service catalog entry. Database dependencies use the `inferred_db` variant."}),s3=t.Pick(Hg,["name","env","nodeType","serviceType","endpoint","resourceName"],{$id:"InferredDbServiceGraphNode",description:"Database dependency node detected from client-span attributes that could not be matched to a service catalog entry."}),a3=x("nodeType",[o3,s3,i3]),c3=t.Pick(zg,["from","to","count","errorRate","errorCount","clientSpanCount"],{$id:"ServiceGraphEdge",description:"Directed dependency edge from a caller node (`from`) to a callee node (`to`), with call-volume and error counts observed over the query window."}),p3=t.Optional(t.Integer({...it.properties.from,description:"Start of the service graph query window as a Unix timestamp in seconds. Provide both `from` and `to` for a deterministic graph window; otherwise Tsuga uses backend graph defaults."})),u3=t.Optional(t.Integer({...it.properties.to,description:"End of the service graph query window as a Unix timestamp in seconds. Provide both `from` and `to` for a deterministic graph window; otherwise Tsuga uses backend graph defaults."})),l3=p({type:"tsuga-query",default:"*",description:"Tsuga query used to filter spans considered for the graph. Defaults to `*`, which applies no additional filter beyond the service identity."}),Tw=d({description:"Retrieves a dependency graph for one service over an optional time range and query filter. Provide an explicit time range for deterministic results. Use this to inspect observed downstream and upstream service relationships. See [Service page](/documentation/categorize/services/service-page).",operationId:"getServiceGraph",tags:["services"],url:`${Sl}/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to use as the graph root. Use the `id` returned by service list or get responses."})}),query:t.Object({from:p3,to:u3,query:t.Optional(l3)},{description:"Service graph query. Use time range and optional span query filters."}),response:t.Object({clusterId:t.String({description:"Cluster ID the graph was built from"}),nodes:t.Array(a3,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:t.Array(c3,{description:"Directed dependency edges between graph nodes."})})}),bl=`${Sl}/:serviceId/notification-targets`,Ol=t.Pick(Ji,["id","serviceId","config","rateLimit"],{$id:"ServiceNotificationTarget",description:"Notification target attached to a service, used by adaptive notification rules to page the service owners. See [Rules](/documentation/alert/notifications/rules)."}),Vg={rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}},m3={id:"789-abc-def",serviceId:"123-456-abc",...Vg};Object.assign(Ol,{examples:[m3]});var Al=p({allowEmpty:!1,description:"Identifier of the service the notification target belongs to. Use the `id` returned by service list or get responses."}),QJe=d({description:"Lists the notification targets attached to one service. Use this to discover target IDs before updating or deleting a target.",operationId:"listServiceNotificationTargets",tags:["services"],url:bl,method:"GET",params:t.Object({serviceId:Al}),response:t.Array(Ol)}),d3=t.Pick(Fg,["config","rateLimit"],{description:"Service notification target create request. Provide the delivery destination and an optional per-target rate limit.",examples:[Vg]}),f3=t.Pick(jg,["config","rateLimit"],{description:"Service notification target update request. The submitted destination and rate limit overwrite the stored ones.",examples:[Vg]}),WJe=d({description:"Attaches a notification target to a service. Adaptive notification rules matching the service page this target on alert transitions.",operationId:"createServiceNotificationTarget",tags:["services"],url:bl,method:"POST",params:t.Object({serviceId:Al}),body:d3,response:Ol}),ZJe=d({description:"Updates one notification target attached to a service.",operationId:"updateServiceNotificationTarget",tags:["services"],url:`${bl}/:targetId`,method:"PUT",params:t.Object({serviceId:Al,targetId:p({allowEmpty:!1,description:"Identifier of the notification target to update. Use the `id` returned by service notification target list or create responses."})}),body:f3,response:Ol}),XJe=d({description:"Detaches a notification target from a service. Notification rules stop paging this destination for the service.",operationId:"deleteServiceNotificationTarget",tags:["services"],url:`${bl}/:targetId`,method:"DELETE",params:t.Object({serviceId:Al,targetId:p({allowEmpty:!1,description:"Identifier of the notification target to delete. Use the `id` returned by service notification target list or create responses."})}),response:w});function Ew(e,r){let n=r??ar(e);return n===void 0?void 0:Zo(n)}function Qg(e){let r=ar(e);return r===void 0?"":` (default: ${r})`}function _w(e,r){e.command("service-graph").description("Inspect service dependency graphs").command("get <SERVICE_ID>").description("Retrieve the dependency graph for a service").option("--from <TIMESTAMP>",`Start of time range${Ue}${Qg("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Qg("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${Qg("query")}`).action(async(o,i)=>{let s={},c=Ew("from",i.from),l=Ew("to",i.to);c!==void 0&&(s.from=c),l!==void 0&&(s.to=l),i.query!==void 0&&(s.query=i.query);let m=await r()(Tw,{params:{serviceId:o},query:s});W(m)})}var g3=`/${"v1"}/grok`,h3=25,y3=100,Iw=t.Object({rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok parsing rule to preview against each sample. The rule uses the same Grok syntax as the log route **Grok parser** processor, for example `pod:%{DATA:namespace}/%{DATA:name}`."}),{minItems:1,maxItems:h3,description:"Ordered Grok parsing rules to preview. For each sample, Tsuga tries the rules in order and returns the first successful match, matching route Grok processor semantics."}),samples:t.Array(p({allowEmpty:!1,type:"long",description:"Raw log line to parse with the provided Grok rules. The value is parsed as preview input only; this endpoint does not ingest or store the sample."}),{minItems:1,maxItems:y3,description:"Sample log lines to run against the rules. Results are returned in the same order as this array."})},{description:"Grok rules and sample log lines to preview extraction before saving a route processor. The endpoint uses the same parser as the route builder preview and does not create or update routes."}),T3={rules:['pod:%{DATA:pod_namespace}/%{DATA:pod_name}\\] "%{DATA:request}" HTTP/%{POSINT:status}'],samples:['[conn-id:abc pod:tsuga-events/tsuga-events-searcher-0] "/token" HTTP/200']};Object.assign(Iw,{examples:[T3]});var Sw=t.Object({results:t.Array(t.Object({sample:t.String({description:"Echo of the submitted log line, so results can be matched to the samples in the request."}),matched:t.Boolean({description:"Whether any submitted rule matched this sample. `true` means `extracted` contains the captured fields; `false` means no rule matched."}),extracted:t.Union([t.Record(t.String(),t.Unknown()),t.Null()],{description:"Fields extracted from the first matching Grok rule when `matched` is `true`; dotted capture names are expanded into nested objects. `null` when no rule matched."})}),{description:"Preview result for each submitted sample, in the same order as the request `samples` array."})},{description:"Grok extraction preview results from applying the ordered rules to each submitted sample."}),E3={results:[{sample:'[conn-id:abc pod:tsuga-events/tsuga-events-searcher-0] "/token" HTTP/200',matched:!0,extracted:{pod_namespace:"tsuga-events",pod_name:"tsuga-events-searcher-0",request:"/token",status:"200"}}]};Object.assign(Sw,{examples:[E3]});var bw=d({url:`${g3}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:Iw,response:Sw,description:"Parses sample log lines with Grok rules and returns extracted fields, using the same Grok engine as the log route processor. Use this endpoint to author and test route Grok rules before saving them. The operation requires public API read access to log routes. A rule that fails to compile returns a 400 response with error code `GROK_RULE_VALIDATION_ERROR` and structured details in `error.details.ruleErrors`."});function Ow(e,r){let n=e.command("grok").description("Test and preview grok parsing rules");Tr(n,"parse","Parse sample log lines with grok rules and return the extracted fields",bw,r)}var Aw=require("node:child_process"),xw=require("node:fs"),Rw=require("node:os"),Cl=require("node:path");var Do=require("node:fs");function Va(e,r){let n=`${e}.tmp.${process.pid}`;(0,Do.writeFileSync)(n,r),(0,Do.renameSync)(n,e)}function Qa(e){try{return(0,Do.readFileSync)(e,"utf8")}catch(r){if(r.code==="ENOENT")return;throw r}}function Wa(e,r){if(r===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,Do.writeFileSync)(n,r),n}function Go(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Wg="tsuga-dev/agent-plugins",xl="tsuga";function Rl(e,r){Y(` $ ${e} ${r.join(" ")}`);try{(0,Aw.execFileSync)(e,r,{stdio:["ignore","inherit","inherit"]})}catch(n){let o=n.status??1;throw new Error(`${e} ${r.join(" ")} exited ${o}`,{cause:n})}}function _3(e,r){Y("Claude Code \u2192 installing Tsuga plugin"),Rl("claude",["plugin","marketplace","add",Wg]),Rl("claude",["plugin","install",`tsuga@${xl}`]),r.autoUpdate&&I3(e)}function I3(e){let r=(0,Cl.join)(e,".claude","settings.json");Y(`Claude Code \u2192 ${r} (autoUpdate)`),(0,xw.mkdirSync)((0,Cl.dirname)(r),{recursive:!0});let n=Qa(r),o=JSON.parse(n??"{}");if(!Go(o))throw new Error(`${r} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!Go(i))throw new Error(`${r} "extraKnownMarketplaces" must be a JSON object`);let s=i[xl],c=Go(s)?s:{};o.extraKnownMarketplaces={...i,[xl]:{source:{source:"github",repo:Wg},...c,autoUpdate:!0}};let l=Wa(r,n);Va(r,`${JSON.stringify(o,null,2)}
146
+ `),Y(l===void 0?" created":` patched (backup: ${l})`)}function S3(){Y("Codex \u2192 installing Tsuga plugin"),Rl("codex",["plugin","marketplace","add",Wg]),Rl("codex",["plugin","add",`tsuga@${xl}`])}function Cw(e){let r=e.command("install").description("Install Tsuga plugins into local LLM CLIs").command("plugin").description("Install the Tsuga plugin into a specific LLM CLI");r.command("claude-code").description("Install the Tsuga plugin into Claude Code (requires the claude CLI in PATH)").option("--no-auto-update","Skip patching ~/.claude/settings.json with autoUpdate=true").action(n=>{_3((0,Rw.homedir)(),n),Y("Restart your claude session to load the new plugins.")}),r.command("codex").description("Install the Tsuga plugin into Codex (requires the codex CLI in PATH)").action(()=>{S3(),Y("Restart your codex session to load the new plugins.")})}var b3=10,O3=t.Object({key:p({allowEmpty:!1,description:"Telemetry attribute key to scope the ranking by: a service, environment, team, route, or other positive equality term in the population you want fields for. Use dot-path keys such as `context.service.name`."}),value:t.Optional(p({allowEmpty:!1,description:"Attribute value the scoped telemetry should match, when the scope is a specific service, environment, team, route, or other known value. When omitted, artifacts that reference the key match this entry at full weight regardless of value."})),valueMustMatch:t.Optional(t.Boolean({description:"When true, this entry is a hard filter rather than a weight: any widget or monitor that does not match it exactly (key = value) contributes no fields at all, instead of contributing at a reduced weight. Other widgets of the same dashboard still contribute if they match. Requires `value`."}))}),Zg=t.Object({field:t.String({description:"Field name to use in queries. For `kind: attribute`, this is an attribute dot path. For `kind: metric`, this is either a metric name or a `metricName.context.attribute` path when the metric query used a metric attribute."}),kind:t.Enum(["attribute","metric"],{description:"Whether the field is a telemetry attribute or a metric name. `metric` appears only in the metrics bucket, for fields referenced as the aggregated field of a metrics-source query."}),inferredType:t.Enum(["numeric","categorical","unknown"],{description:"Value type inferred from how the field is used: `numeric` when aggregated with sum/average/percentile, referenced by numeric or range filters, or a metric name; `categorical` when only grouped by or matched with equality/text filters; `unknown` otherwise. Evidence-based \u2014 a numeric field used only in equality filters reads as categorical."}),score:t.Number({description:"Relative relevance score computed by Tsuga from how strongly readable dashboards and monitors use this field for the requested scope, discounted when the field is common across the whole organization. Higher values mean stronger evidence that the field is useful for this scope. Scores are intended for ranking, not for comparison across unrelated scopes."}),artifacts:t.Number({description:"Number of distinct readable dashboards and monitors that reference this field and match the requested scope. Tsuga counts an artifact once per field even if it uses the field in multiple widgets or queries."}),globalArtifacts:t.Number({description:"Number of organization-wide dashboards and monitors that reference this field, regardless of the requested scope or caller permissions. Tsuga uses this anonymous baseline to down-rank fields that are common everywhere."}),usage:t.Object({groupBy:t.Number({description:"Number of distinct readable matching artifacts that use this field as a group-by or split dimension."}),filter:t.Number({description:"Number of distinct readable matching artifacts that filter on this field in widget queries, monitor queries, or dashboard-wide filters."}),measure:t.Number({description:"Number of distinct readable matching artifacts that aggregate this field as `aggregate.field`."}),column:t.Number({description:"Number of distinct readable matching artifacts that pin this field as a list-widget column."})},{description:"Distinct-artifact counts by usage kind, explaining why the field ranked where it did; a dashboard referencing the field the same way in many widgets counts once for that usage kind."})}),Xg=t.Object({logs:t.Array(Zg,{description:"Top log fields for the requested scope, ranked by score and mined from readable logs-sourced dashboards and monitors."}),traces:t.Array(Zg,{description:"Top trace fields for the requested scope, ranked by score and mined from readable traces-sourced dashboards and monitors."}),metrics:t.Array(Zg,{description:"Top metric names and metric-attribute fields for the requested scope, ranked by score and mined from readable metrics-sourced dashboards and monitors."}),dashboardsMatched:t.Number({description:"Number of dashboards that matched the requested scope and that the caller can read. Dashboards the caller cannot read are removed before field rankings are returned."}),monitorsMatched:t.Number({description:"Number of monitors that matched the requested scope and that the caller can read. Monitors the caller cannot read are removed before field rankings are returned."})}),Jg=t.Object({scope:t.Array(O3,{minItems:1,maxItems:b3,description:"Scope entries that define the population to rank fields for, drawn from positive equality pairs in a TQL query, such as service and environment. Tsuga matches entries softly by default: an artifact's contribution is weighted by the fraction of entries it matches."})}),bet=d({tags:["interesting-fields"],url:"/v0/interesting-fields",method:"POST",body:Jg,response:Xg});var A3=`/${"v1"}/interesting-fields`,x3={scope:[{key:"context.service.name",value:"payments"},{key:"context.env",value:"prod",valueMustMatch:!0}]},R3=t.Object(Jg.properties,{description:"The scope to rank fields for, as attribute key/value pairs such as a service name and an environment. Entries are matched softly by default: a widget contributes in proportion to how many entries it matches, so a broader scope returns a broader ranking. Set `valueMustMatch` on an entry to make it a hard filter instead: a widget that does not match it exactly contributes nothing, even when other entries match.",examples:[x3]}),Pw=d({url:A3,method:"POST",operationId:"getInterestingFields",tags:["public","interesting-fields"],body:R3,response:Xg,description:"Ranks the telemetry fields most relevant to a scope, mined from how the org already uses them in dashboards and monitors, bucketed by logs, traces, and metrics. Use this before guessing a field or metric name: a field that many scope-matching dashboards group or filter on is the one an operator would reach for. Ranking is TF-IDF style, so a field used everywhere in the org scores below one that is distinctive to the scope. Dashboards and monitors the caller cannot read never contribute field names, only the anonymous frequency baseline. The operation requires public API read access to dashboards and monitors."});function Uw(e,r){let n=e.command("interesting-fields").description("Discover the telemetry fields an org already uses for a scope");Tr(n,"list","Rank the log, trace and metric fields most relevant to a scope, mined from dashboards and monitors",Pw,r)}var er="/v0/kubernetes-explorer",C3="^[a-z0-9.-]+$",P3="^[A-Za-z0-9._-]+$",Nw=256,ww=t.Optional(p({allowEmpty:!1,description:"Tsuga cluster ID to target. Tsuga assigns it when a cluster is connected to the organization. Optional for single-cluster organizations and required for organizations with multiple clusters to scope the request to one cluster."}));var Kt=e=>t.Optional(t.Array(p({allowEmpty:!1}),{description:e})),eh=["clusters","namespaces","teams","envs"],Za="Names of other filter fields in this query whose values exclude rather than include. Set this to a field name to keep only the resources matching none of that field's values; fields left out keep the resources matching any of their values.",th={clusterId:ww,search:t.Optional(t.String({pattern:C3,minLength:1,maxLength:Nw,description:"Substring matched against the resource name. Kubernetes names are lowercase RFC 1123, so only lowercase letters, digits, `.` and `-` are accepted; uppercase and other characters are rejected. Wildcard and other query-syntax characters are treated literally."}))},vw={clusterId:ww,search:t.Optional(t.String({pattern:P3,minLength:1,maxLength:Nw,description:"Substring matched against the Kubernetes cluster name. Unlike Kubernetes resource names this is a collector-assigned identifier, so uppercase letters, digits, `.`, `-` and `_` are accepted. Wildcard and other query-syntax characters are treated literally."}))},Lw=t.Object(th),kw=t.Object(vw),es={...th,includeInternalNamespaces:t.Optional(t.Boolean({description:"When false or omitted, resources in internal namespaces (kube-system, kube-public, kube-node-lease, local-path-storage, gke-managed-*) are excluded."})),clusters:Kt("Restrict results to these Kubernetes cluster names."),namespaces:Kt("Restrict results to these namespaces."),teams:Kt("Restrict results to these team names."),envs:Kt("Restrict results to these environments."),exclusiveFilters:t.Optional(t.Array(t.Enum(eh),{description:Za})),...ne},U3=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],N3=[...eh,"nodes","deployments","statefulsets","daemonsets","podStatus"],w3={...es,nodes:Kt("Restrict results to pods scheduled on these nodes."),deployments:Kt("Restrict results to pods owned by these Deployments."),statefulsets:Kt("Restrict results to pods owned by these StatefulSets."),daemonsets:Kt("Restrict results to pods owned by these DaemonSets."),podStatus:Kt("Restrict results to pods whose resolved status matches any of these values. Typical values are the five Kubernetes phases plus Tsuga-derived CrashLoopBackOff and Error. Applied after stitching pod phase and container status reason telemetry, because phase is not a filterable metric attribute. When exclusiveFilters includes podStatus, keep pods whose status matches none of these values instead."),exclusiveFilters:t.Optional(t.Array(t.Enum(N3),{description:`${Za} Excluding podStatus is applied after stitching pod phase and container status reason telemetry, because phase is not a filterable metric attribute.`}))},v3=["deployment","statefulset","daemonset"],Mw=t.Object({kind:t.Enum(v3,{description:"Kind of Kubernetes workload associated with the pod. Derived from workload attributes in pod telemetry."}),name:t.String({description:"Name of the workload associated with the pod. Derived from workload attributes in pod telemetry."})},{description:"Kubernetes workload controller that owns the pod. Present when workload attributes are observed in pod telemetry."}),Dw=t.Object({podName:t.String({description:"Name of the Kubernetes pod. Set when the pod is created."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the pod. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that reported the pod. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the pod. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the pod, such as production or staging. Present when an environment label or mapping is observed."})),node:t.Optional(t.String({description:"Kubernetes node currently or most recently running the pod. Present when node telemetry is observed."})),phase:t.Enum(U3,{description:"Current or most recently observed pod status. From pod status and container state telemetry. Values include the Kubernetes phases Pending, Running, Succeeded, Failed, and Unknown, plus Tsuga-derived CrashLoopBackOff and Error values."}),readyContainers:t.Integer({description:"Number of containers in the pod that are currently ready. From container readiness telemetry. Zero or greater."}),totalContainers:t.Integer({description:"Number of observed containers for the pod based on container readiness telemetry. Zero or greater."}),restarts:t.Integer({description:"Total restart count across containers in the pod. From container restart telemetry. Zero or greater."}),createdAt:t.Optional(S({description:"Timestamp from pod start time telemetry for the selected pod instance. Present when pod start time telemetry is observed."}))}),rh=t.Object({...Dw.properties,workload:t.Optional(Mw),cpuUsageMilli:t.Optional(t.Number({description:"Recent pod CPU usage in millicores. Present when CPU usage telemetry is observed."})),cpuLimitMilli:t.Optional(t.Number({description:"Configured pod CPU limit in millicores, summed across observed containers. Present when a CPU limit is configured and observed."})),cpuRequestMilli:t.Optional(t.Number({description:"Configured pod CPU request in millicores, summed across observed containers. Present when a CPU request is configured and observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent pod memory usage in bytes. Present when memory usage telemetry is observed."})),memoryLimitBytes:t.Optional(t.Number({description:"Configured pod memory limit in bytes, summed across observed containers. Present when a memory limit is configured and observed."})),memoryRequestBytes:t.Optional(t.Number({description:"Configured pod memory request in bytes, summed across observed containers. Present when a memory request is configured and observed."})),cpuUtilization:t.Optional(t.Number({description:"Recent CPU usage divided by the configured CPU limit. Present when both usage and limit are observed."})),memoryUtilization:t.Optional(t.Number({description:"Recent memory usage divided by the configured memory limit. Present when both usage and limit are observed."})),cpuRequestUtilization:t.Optional(t.Number({description:"Recent CPU usage divided by the configured CPU request. Present when both usage and request are observed."})),memoryRequestUtilization:t.Optional(t.Number({description:"Recent memory usage divided by the configured memory request. Present when both usage and request are observed."}))}),L3=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],Met=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/pods`,query:t.Object({...w3,sortBy:t.Optional(t.Enum(L3,{description:"Field to sort pods by."})),sortDirection:t.Optional(K)}),paginated:!0,response:t.Array(rh)}),k3=["teams","envs"],nh=t.Object({cluster:t.String({description:"Kubernetes cluster name from cluster telemetry."}),teams:t.Optional(t.Array(t.String(),{description:"Team metadata values observed on pods in non-default Kubernetes namespaces on the cluster. Present when team labels or mappings are observed."})),envs:t.Optional(t.Array(t.String(),{description:"Environment metadata values observed on pods in non-default Kubernetes namespaces on the cluster. Present when environment labels or mappings are observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Aggregate recent CPU usage for observed pods in the cluster, excluding default Kubernetes namespaces, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Aggregate recent memory usage for observed pods in the cluster, excluding default Kubernetes namespaces, in bytes. Present when memory usage telemetry is observed."})),readyNodes:t.Optional(t.Integer({description:"Number of Kubernetes nodes in the cluster that are ready. Present when node readiness telemetry is observed."})),podPhaseCounts:t.Optional(t.Object({Pending:t.Integer({description:"Number of observed pods currently in the Pending phase."}),Running:t.Integer({description:"Number of observed pods currently in the Running phase."}),Succeeded:t.Integer({description:"Number of observed pods currently in the Succeeded phase."}),Failed:t.Integer({description:"Number of observed pods currently in the Failed phase."}),Unknown:t.Integer({description:"Number of observed pods currently in the Unknown phase."})},{description:"Counts of observed pods by Kubernetes phase, excluding default Kubernetes namespaces. Present when pod phase telemetry is observed."}))}),M3=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],Det=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/clusters`,query:t.Object({...vw,teams:Kt("Restrict to clusters that host workloads from these team names."),envs:Kt("Restrict to clusters that host workloads in these environments."),exclusiveFilters:t.Optional(t.Array(t.Enum(k3),{description:Za})),sortBy:t.Optional(t.Enum(M3,{description:"Field to sort clusters by."})),sortDirection:t.Optional(K),...ne}),paginated:!0,response:t.Array(nh)}),D3=["clusters"],G3=["Ready","NotReady","Unknown"],oh=t.Object({node:t.String({description:"Kubernetes node name from node telemetry."}),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the node. Present when cluster telemetry is observed."})),status:t.Optional(t.Enum(G3,{description:"Readiness of the node, derived from its Ready condition. Present when node condition telemetry is observed."})),instanceType:t.Optional(t.String({description:"Cloud instance type backing the node (for example `r7g.2xlarge`). Present when host telemetry is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods scheduled on the node, including pods in internal namespaces since they occupy node capacity. Present when pod telemetry is observed."})),allocatablePods:t.Optional(t.Integer({description:"Maximum number of pods the node can run. Present when node allocatable telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent CPU usage for the node, in millicores. Reported by the kubelet, so it is absent on nodes that only report cluster-level telemetry."})),cpuAllocatableMilli:t.Optional(t.Number({description:"CPU available to pods on the node, in millicores. Present when node allocatable telemetry is observed."})),cpuUtilization:t.Optional(t.Number({description:"Node CPU usage divided by allocatable CPU. Present when both usage and allocatable telemetry are observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent memory usage for the node, in bytes. Reported by the kubelet, so it is absent on nodes that only report cluster-level telemetry."})),memoryAllocatableBytes:t.Optional(t.Number({description:"Memory available to pods on the node, in bytes. Present when node allocatable telemetry is observed."})),memoryUtilization:t.Optional(t.Number({description:"Node memory usage divided by allocatable memory. Present when both usage and allocatable telemetry are observed."}))}),$3=["node","cluster","status","instanceType","pods","allocatablePods","cpuUsageMilli","cpuAllocatableMilli","cpuUtilization","memoryUsageBytes","memoryAllocatableBytes","memoryUtilization"],Get=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/nodes`,query:t.Object({...th,clusters:Kt("Restrict results to these Kubernetes cluster names."),exclusiveFilters:t.Optional(t.Array(t.Enum(D3),{description:Za})),sortBy:t.Optional(t.Enum($3,{description:"Field to sort nodes by."})),sortDirection:t.Optional(K),...ne}),paginated:!0,response:t.Array(oh)}),ih=t.Object({namespace:t.String({description:"Kubernetes namespace name from namespace telemetry. Includes namespaces with no observed pods when namespace telemetry is observed."}),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the namespace. Present when cluster telemetry is observed."})),teams:t.Optional(t.Array(t.String(),{description:"Team metadata values observed in workloads in the namespace. Present when team labels or mappings are observed."})),envs:t.Optional(t.Array(t.String(),{description:"Environment metadata values observed in workloads in the namespace. Present when environment labels or mappings are observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods in the namespace. Present when pod telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Aggregate recent CPU usage for observed pods in the namespace, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Aggregate recent memory usage for observed pods in the namespace, in bytes. Present when memory usage telemetry is observed."}))}),F3=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],$et=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/namespaces`,query:t.Object({...es,sortBy:t.Optional(t.Enum(F3,{description:"Field to sort namespaces by."})),sortDirection:t.Optional(K)}),paginated:!0,response:t.Array(ih)}),sh=t.Object({deployment:t.String({description:"Kubernetes Deployment name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the Deployment. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the Deployment. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the Deployment. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the Deployment. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the Deployment. Present when pod telemetry and workload attributes are observed."})),availableReplicas:t.Optional(t.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed Deployment pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed Deployment pods, in bytes. Present when memory usage telemetry is observed."}))}),j3=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],Fet=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/deployments`,query:t.Object({...es,sortBy:t.Optional(t.Enum(j3,{description:"Field to sort deployments by."})),sortDirection:t.Optional(K)}),paginated:!0,response:t.Array(sh)}),ah=t.Object({statefulSet:t.String({description:"Kubernetes StatefulSet name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the StatefulSet. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the StatefulSet. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the StatefulSet. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the StatefulSet. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the StatefulSet. Present when pod telemetry and workload attributes are observed."})),readyReplicas:t.Optional(t.Integer({description:"Number of ready StatefulSet replicas from StatefulSet status telemetry. Present when StatefulSet status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the StatefulSet. Present when StatefulSet spec telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed StatefulSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed StatefulSet pods, in bytes. Present when memory usage telemetry is observed."}))}),q3=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],jet=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/statefulsets`,query:t.Object({...es,sortBy:t.Optional(t.Enum(q3,{description:"Field to sort StatefulSets by."})),sortDirection:t.Optional(K)}),paginated:!0,response:t.Array(ah)}),ch=t.Object({daemonSet:t.String({description:"Kubernetes DaemonSet name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the DaemonSet. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the DaemonSet. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the DaemonSet. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the DaemonSet. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the DaemonSet. Present when pod telemetry and workload attributes are observed."})),readyNodes:t.Optional(t.Integer({description:"Number of eligible nodes with a ready DaemonSet pod. Present when DaemonSet status telemetry is observed."})),desiredNodes:t.Optional(t.Integer({description:"Number of eligible nodes where the DaemonSet should run a pod. Present when DaemonSet status telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed DaemonSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed DaemonSet pods, in bytes. Present when memory usage telemetry is observed."}))}),B3=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],qet=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/daemonsets`,query:t.Object({...es,sortBy:t.Optional(t.Enum(B3,{description:"Field to sort DaemonSets by."})),sortDirection:t.Optional(K)}),paginated:!0,response:t.Array(ch)}),ph=t.Object({overview:t.Object({...Dw.properties,workload:t.Optional(Mw)},{description:"Pod identity, status, and owning workload, derived from recent pod metrics."}),healthMetrics:t.Object({cpu:t.Object({usage:t.String({description:"Metric name callers can use to query pod CPU usage. This is not the current CPU value."}),limit:t.String({description:"Metric name callers can use to query configured container CPU limits for the pod. This is not the current CPU limit value."}),request:t.String({description:"Metric name callers can use to query configured container CPU requests for the pod. This is not the current CPU request value."})},{description:"Metric names for pod CPU usage and for configured container CPU limits and requests."}),memory:t.Object({usage:t.String({description:"Metric name callers can use to query pod memory usage. This is not the current memory value."}),limit:t.String({description:"Metric name callers can use to query configured container memory limits for the pod. This is not the current memory limit value."}),request:t.String({description:"Metric name callers can use to query configured container memory requests for the pod. This is not the current memory request value."})},{description:"Metric names for pod memory usage and for configured container memory limits and requests."})},{description:"Metric names callers can use to query pod CPU and memory telemetry. These are fixed metric identifiers, not current values."}),searchFilters:t.Object({logs:t.String({description:"TQL log search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."}),traces:t.String({description:"TQL trace search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."})},{description:"TQL filters scoped to this pod, ready to use as the query for log and trace search."})}),Gw=t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),podName:p({allowEmpty:!1})}),Bet=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/pod-details`,query:Gw,response:ph}),uh=t.Object({configuration:t.Optional(t.Object({spec:t.Record(t.String(),t.Unknown(),{description:"Kubernetes PodSpec from the latest observed pod manifest. Fields outside `object.spec` are stripped."}),lastObservedAt:S({description:"Timestamp when Tsuga last observed the pod manifest used for configuration."})},{description:"Pod configuration from the latest observed pod manifest. Present when a pod manifest log is found for the pod."})),labels:t.Record(t.String(),t.String(),{description:"Kubernetes labels on the pod from the latest observed pod manifest. Key-value strings."}),annotations:t.Record(t.String(),t.String(),{description:"Kubernetes annotations on the pod from the latest observed pod manifest. Key-value strings."}),deletedAt:t.Optional(S({description:"Timestamp when Tsuga last observed the pod deletion event. Present when the latest observed pod event is deleted."}))}),Het=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/pod-manifest`,query:Gw,response:uh}),lh=t.Object({podName:t.String({description:"Name of a pod instance associated with the workload. Resolved from recent pod usage telemetry and workload attributes."}),podUid:t.Optional(t.String({description:"Kubernetes UID for the pod replica. Present when UID telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent CPU usage for the pod replica, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent memory usage for the pod replica, in bytes. Present when memory usage telemetry is observed."}))},{description:"A single pod instance with recent CPU or memory telemetry for the workload, resolved from pod usage telemetry and workload attributes."}),mh=t.Object({overview:t.Object({deploymentName:t.String({description:"Kubernetes Deployment name for this detail response."}),namespace:t.Optional(t.String({description:"Kubernetes namespace for this detail response. Present when any deployment signal is found."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name for this detail response. Present when any deployment signal is found."})),team:t.Optional(t.String({description:"Team metadata from the Deployment available-replica metric. Present when the metric includes team metadata."})),env:t.Optional(t.String({description:"Environment metadata from the Deployment available-replica metric. Present when the metric includes environment metadata."})),availableReplicas:t.Optional(t.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),latestRevisionAt:t.Optional(S({description:"Latest ReplicaSet metadata.creationTimestamp observed for the Deployment. Present when ReplicaSet object telemetry is observed."}))}),podReplicas:t.Array(lh,{description:"Pod instances with recent CPU or memory telemetry for the Deployment. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({replicaSetName:t.String({description:"ReplicaSet name for a Deployment revision from workload telemetry."}),revision:t.Integer({description:"Deployment revision number from ReplicaSet annotations. Integer greater than or equal to zero."}),firstSeen:t.Optional(S({description:"ReplicaSet metadata.creationTimestamp from the latest observed ReplicaSet object. Present when creation time is observed."})),observedGeneration:t.Optional(t.Integer({description:"Latest generation observed for the ReplicaSet revision. Present when generation telemetry is observed."})),readyReplicas:t.Optional(t.Integer({description:"Number of ready replicas for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),replicas:t.Optional(t.Integer({description:"Total replica count for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),logsSearchFilter:t.String({description:"TQL log search filter scoped to this ReplicaSet revision. Built from cluster, namespace, and ReplicaSet identifiers."})}),{description:"Deployment rollout revisions from recent ReplicaSet object telemetry. Includes the latest observed event per ReplicaSet, excludes ReplicaSets whose latest observed spec.replicas is 0, and returns up to 8 revisions sorted by revision number descending."})}),Ket=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/deployment-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),deploymentName:p({allowEmpty:!1})}),response:mh}),H3=t.Object({overview:t.Object({statefulSetName:t.String(),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),team:t.Optional(t.String()),env:t.Optional(t.String()),readyReplicas:t.Optional(t.Integer()),desiredReplicas:t.Optional(t.Integer()),latestRevisionAt:t.Optional(S())}),podReplicas:t.Array(lh,{description:"Pod instances with recent CPU or memory telemetry for the StatefulSet. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({revisionName:t.String(),firstSeen:t.Optional(S())}))}),zet=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/statefulset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),statefulSetName:p({allowEmpty:!1})}),response:H3}),K3=t.Object({overview:t.Object({daemonSetName:t.String(),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),team:t.Optional(t.String()),env:t.Optional(t.String()),readyNodes:t.Optional(t.Integer()),desiredNodes:t.Optional(t.Integer()),latestRevisionAt:t.Optional(S())}),podReplicas:t.Array(lh,{description:"Pod instances with recent CPU or memory telemetry for the DaemonSet. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({observedGeneration:t.Integer(),firstSeen:t.Optional(S())}))}),Yet=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/daemonset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),daemonSetName:p({allowEmpty:!1})}),response:K3});var z3=t.Object({id:t.String(),timestamp:t.Number(),type:t.Optional(t.String()),reason:t.Optional(t.String()),message:t.Optional(t.String()),resourceName:t.Optional(t.String()),resourceKind:t.Optional(t.String()),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),count:t.Optional(t.Number())}),Y3=["timestamp","type","reason","resourceName","resourceKind","namespace","cluster","count"],V3=[...eh,"resourceKinds","resourceNames"],Vet=d({tags:["kubernetes-explorer"],method:"GET",url:`${er}/events`,query:t.Object({...es,resourceKinds:Kt("Restrict results to events about these resource kinds (Pod, Node, Deployment...)."),resourceNames:Kt("Restrict results to events about these resource names."),exclusiveFilters:t.Optional(t.Array(t.Enum(V3),{description:Za})),sortBy:t.Optional(t.Enum(Y3)),sortDirection:t.Optional(K)}),paginated:!0,response:t.Array(z3)});var $r=`/${"v1"}/kubernetes-explorer`,$w=t.Pick(rh,["podName","namespace","cluster","team","env","node","phase","readyContainers","totalContainers","restarts","createdAt","workload","cpuUsageMilli","cpuLimitMilli","memoryUsageBytes","memoryLimitBytes","cpuUtilization","memoryUtilization"],{description:"A Kubernetes pod with its current phase, owning workload, and resource usage."}),Q3={podName:"api-gateway-7d9f8c6b5-2xk4p",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",node:"ip-10-0-1-23.ec2.internal",phase:"Running",readyContainers:1,totalContainers:1,restarts:0,createdAt:"2024-01-15T12:34:56.000Z",workload:{kind:"deployment",name:"api-gateway"},cpuUsageMilli:125,cpuLimitMilli:500,memoryUsageBytes:134217728,memoryLimitBytes:536870912,cpuUtilization:.25,memoryUtilization:.25};Object.assign($w,{examples:[Q3]});var Fw=t.Pick(nh,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),W3={cluster:"prod-us-east",teams:["platform","payments"],envs:["production"],cpuUsageMilli:4200,memoryUsageBytes:8589934592,readyNodes:6,podPhaseCounts:{Pending:1,Running:42,Succeeded:3,Failed:0,Unknown:0}};Object.assign(Fw,{examples:[W3]});var jw=t.Pick(ih,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),Z3={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(jw,{examples:[Z3]});var qw=t.Pick(oh,["node","cluster","status","instanceType","pods","allocatablePods","cpuUsageMilli","cpuAllocatableMilli","cpuUtilization","memoryUsageBytes","memoryAllocatableBytes","memoryUtilization"],{description:"A Kubernetes node with its readiness, instance type, and usage against what it can allocate to pods."}),X3={node:"ip-10-0-1-23.ec2.internal",cluster:"prod-us-east",status:"Ready",instanceType:"r7g.2xlarge",pods:25,allocatablePods:234,cpuUsageMilli:4e3,cpuAllocatableMilli:8e3,cpuUtilization:.5,memoryUsageBytes:4e9,memoryAllocatableBytes:16e9,memoryUtilization:.25};Object.assign(qw,{examples:[X3]});var Bw=t.Pick(sh,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),J3={deployment:"api-gateway",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,availableReplicas:3,desiredReplicas:3,cpuUsageMilli:375,memoryUsageBytes:402653184};Object.assign(Bw,{examples:[J3]});var Hw=t.Pick(ah,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),eV={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(Hw,{examples:[eV]});var Kw=t.Pick(ch,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),tV={daemonSet:"otel-collector",namespace:"observability",cluster:"prod-us-east",team:"platform",env:"production",pods:6,readyNodes:6,desiredNodes:6,cpuUsageMilli:300,memoryUsageBytes:805306368};Object.assign(Kw,{examples:[tV]});var zw=t.Pick(ph,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),rV={overview:{podName:"api-gateway-7d9f8c6b5-2xk4p",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",node:"ip-10-0-1-23.ec2.internal",phase:"Running",readyContainers:1,totalContainers:1,restarts:0,createdAt:"2024-01-15T12:34:56.000Z",workload:{kind:"deployment",name:"api-gateway"}},healthMetrics:{cpu:{usage:"k8s.pod.cpu.usage",limit:"k8s.container.cpu_limit",request:"k8s.container.cpu_request"},memory:{usage:"k8s.pod.memory.working_set",limit:"k8s.container.memory_limit",request:"k8s.container.memory_request"}},searchFilters:{logs:'context.k8s.cluster.name:"prod-us-east" AND context.k8s.namespace.name:"production" AND context.k8s.pod.name:"api-gateway-7d9f8c6b5-2xk4p"',traces:'context.k8s.cluster.name:"prod-us-east" AND context.k8s.namespace.name:"production" AND context.k8s.pod.name:"api-gateway-7d9f8c6b5-2xk4p"'}};Object.assign(zw,{examples:[rV]});var Yw=t.Pick(uh,["configuration","labels","annotations","deletedAt"],{description:"Manifest-derived details for a single Kubernetes pod: the pod manifest spec, labels, and annotations from the pod's most recently observed manifest."}),nV={configuration:{spec:{restartPolicy:"Always",serviceAccountName:"api-gateway"},lastObservedAt:"2024-01-15T12:30:00.000Z"},labels:{app:"api-gateway","pod-template-hash":"7d9f8c6b5"},annotations:{"prometheus.io/scrape":"true"}};Object.assign(Yw,{examples:[nV]});var Vw=t.Pick(mh,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),oV={overview:{deploymentName:"api-gateway",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",availableReplicas:3,desiredReplicas:3,latestRevisionAt:"2024-01-15T12:00:00.000Z"},podReplicas:[{podName:"api-gateway-7d9f8c6b5-2xk4p",podUid:"a1b2c3d4-e5f6-7890-abcd-ef1234567890",cpuUsageMilli:125,memoryUsageBytes:134217728}],revisions:[{replicaSetName:"api-gateway-7d9f8c6b5",revision:7,firstSeen:"2024-01-15T12:00:00.000Z",observedGeneration:7,readyReplicas:3,replicas:3,logsSearchFilter:'context.k8s.cluster.name:"prod-us-east" context.k8s.namespace.name:"production" context.k8s.replicaset.name:"api-gateway-7d9f8c6b5"'}]};Object.assign(Vw,{examples:[oV]});var Qw=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Tsuga cluster ID to target. Tsuga assigns it when a cluster is connected to the organization. Optional for single-cluster organizations and required for organizations with multiple clusters to scope the request to one cluster."}))}),ts=t.Pick(Lw,["clusterId","search"]),iV=t.Pick(kw,["clusterId","search"]),Ww=d({description:"Lists Kubernetes pods observed across the organization with their current phase, owning workload, and resource usage.",operationId:"listKubernetesPods",tags:["public","kubernetes-explorer"],method:"GET",url:`${$r}/pods`,query:ts,response:t.Array($w)}),Zw=d({description:"Lists Kubernetes clusters observed across the organization with aggregate resource usage, node readiness, and pod phase counts.",operationId:"listKubernetesClusters",tags:["public","kubernetes-explorer"],method:"GET",url:`${$r}/clusters`,query:iV,response:t.Array(Fw)}),Xw=d({description:"Lists Kubernetes namespaces observed across the organization with pod counts and aggregate resource usage.",operationId:"listKubernetesNamespaces",tags:["public","kubernetes-explorer"],method:"GET",url:`${$r}/namespaces`,query:ts,response:t.Array(jw)}),Jw=d({description:"Lists Kubernetes nodes observed across the organization with their readiness, instance type, and resource usage against allocatable capacity.",operationId:"listKubernetesNodes",tags:["public","kubernetes-explorer"],method:"GET",url:`${$r}/nodes`,query:ts,response:t.Array(qw)}),ev=d({description:"Lists Kubernetes deployments observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesDeployments",tags:["public","kubernetes-explorer"],method:"GET",url:`${$r}/deployments`,query:ts,response:t.Array(Bw)}),tv=d({description:"Lists Kubernetes StatefulSets observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesStatefulSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${$r}/statefulsets`,query:ts,response:t.Array(Hw)}),rv=d({description:"Lists Kubernetes DaemonSets observed across the organization with eligible-node readiness and aggregate resource usage.",operationId:"listKubernetesDaemonSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${$r}/daemonsets`,query:ts,response:t.Array(Kw)}),nv=t.Object({...Qw.properties,k8sCluster:p({allowEmpty:!1,description:"Kubernetes cluster name that contains the pod. From cluster telemetry. Required to identify the pod because pod names are only unique within a namespace and cluster."}),k8sNamespace:p({allowEmpty:!1,description:"Kubernetes namespace that contains the pod. From pod metadata. Required to identify the pod because pod names are only unique within a namespace and cluster."}),podName:p({allowEmpty:!1,description:"Kubernetes pod name to retrieve. Set when the pod is created. Required to fetch pod details for the selected cluster and namespace."})}),ov=d({description:"Retrieves metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and ready-to-use log and trace filters. Manifest configuration, labels, and annotations are served by the pod-manifest endpoint.",operationId:"getKubernetesPodDetails",tags:["public","kubernetes-explorer"],method:"GET",url:`${$r}/pod-details`,query:nv,response:zw}),iv=d({description:"Retrieves the manifest-derived details for a single Kubernetes pod: the pod manifest spec, labels, and annotations from the pod's most recently observed manifest.",operationId:"getKubernetesPodManifest",tags:["public","kubernetes-explorer"],method:"GET",url:`${$r}/pod-manifest`,query:nv,response:Yw}),sv=d({description:"Retrieves detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions with ready-to-use log filters.",operationId:"getKubernetesDeploymentDetails",tags:["public","kubernetes-explorer"],method:"GET",url:`${$r}/deployment-details`,query:t.Object({...Qw.properties,k8sCluster:p({allowEmpty:!1,description:"Kubernetes cluster name that contains the Deployment. From cluster telemetry. Required to identify the Deployment because names are only unique within a namespace and cluster."}),k8sNamespace:p({allowEmpty:!1,description:"Kubernetes namespace that contains the Deployment. From workload metadata. Required to identify the Deployment because names are only unique within a namespace and cluster."}),deploymentName:p({allowEmpty:!1,description:"Kubernetes Deployment name to retrieve. From workload telemetry. Required to fetch deployment details for the selected cluster and namespace."})}),response:Vw});var sV="clusterId";function av(e,r,n){let o=r.query.properties??{},i=Object.keys(o).filter(s=>s!==sV);for(let s of i){let c=s.replace(/([A-Z])/g,"-$1").toLowerCase(),l=c.replace(/-/g,"_").toUpperCase(),m=o[s]?.description??"";n?e.requiredOption(`--${c} <${l}>`,m):e.option(`--${c} <${l}>`,m)}return i}function $o(e,r,n,o){let i=e.command(r).description(n.description??`List Kubernetes ${r}`),s=av(i,n,!1);i.action(async c=>{let l={};for(let m of s)c[m]!==void 0&&(l[m]=c[m]);W(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function dh(e,r,n,o){let i=e.command(r).description(n.description??`Get Kubernetes ${r}`),s=av(i,n,!0);i.action(async c=>{let l={};for(let m of s)l[m]=c[m];W(await o()(n,{query:l}))})}function cv(e,r){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");$o(n,"pods",Ww,r),$o(n,"clusters",Zw,r),$o(n,"namespaces",Xw,r),$o(n,"nodes",Jw,r),$o(n,"deployments",ev,r),$o(n,"statefulsets",tv,r),$o(n,"daemonsets",rv,r),dh(n,"pod-details",ov,r),dh(n,"pod-manifest",iv,r),dh(n,"deployment-details",sv,r)}var aV=t.Union([t.Literal("scalar"),t.Literal("timeseries")]),cV="/v0/promql",Pl=t.Object({query:p({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:kn,step:p({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:t.Optional(aV),executionOptions:Wd,shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),pV={query:'rate({"otel.trace.span_processor.spans"}[5m])',timeRange:{from:17822015e5,to:17822034e5},step:"1m",executionOptions:{parallelism:1,engine:"q"},clusterId:"cluster-abc"};Object.assign(Pl,{examples:[pV]});var ltt=d({tags:["promql"],url:cV,method:"POST",body:Pl,response:Ui});var uV=`/${"v1"}/promql`,lV=t.Object({...t.Pick(Pl,["query","step"]).properties,timeRange:Tt},{description:"PromQL range-query request. Send clusterId as a query parameter, not in this JSON body.",examples:[{query:'sum by ("context.service.name") (sum_over_time({"traces.span.metrics.calls", "span.kind"="SPAN_KIND_SERVER"}[5m]))',timeRange:{from:1782201500,to:1782203400},step:"1m"}]}),mV=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to query. Set by the client as the clusterId query parameter, not in the JSON body. Required when the organization has multiple clusters; omit only for single-cluster organizations. Unknown cluster IDs return 404."}))}),pv=d({description:"Runs a PromQL range query over Tsuga metric data and returns timeseries results. Authenticate with a bearer operation API key or OAuth access token that can read metrics. Send clusterId as a query parameter; multi-cluster organizations must provide it. See [How to write PromQL queries](/documentation/visualize/guides/how-to-write-promql-queries) for query syntax and examples.",operationId:"queryPromql",tags:["public","promql"],url:uV,method:"POST",body:lV,query:mV,response:Fu});function uv(e,r){let n=e.command("promql").description("Run PromQL queries over metric data");Tr(n,"query","Run a PromQL range query over metric data",pv,r)}var ns="/v0/dashboard-folders",os=t.Object({id:t.String({description:"Tsuga-generated dashboard folder ID assigned when the folder is created. Use it as dashboard `folderId` or child-folder `parentFolderId`."}),name:t.String({description:"Display name of the dashboard folder. Set by the caller on create or update."}),owner:t.String({description:"ID of the team that owns the dashboard folder. Set by the caller on create or update and used for folder access control."}),parentFolderId:t.Optional(t.String({description:"ID of the top-level parent folder when this folder is nested. Set by the caller on create or update. Returned only for child folders; omitted for top-level folders."})),tags:we,creator:t.Optional(pe),updater:t.Optional(pe),createdAt:S(),updatedAt:S()},{title:"DashboardFolder"}),fh=t.Object({...os.properties,dashboardCount:t.Number({description:"Number of dashboards directly assigned to this folder that the caller can read. Returned only by folder list responses; callers without dashboard read access see 0."})}),Ul=t.Object({name:p({allowEmpty:!1,description:"Display name of the dashboard folder. Required and non-empty."}),owner:p({allowEmpty:!1,description:"ID of the team that owns the dashboard folder. Required and used for folder access control."}),parentFolderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"ID of the top-level folder to nest this folder under. Omit on create or pass null to create a top-level folder; omit on update to keep the current parent; pass null on update to move the folder to top level. Non-null values must name a readable top-level folder. Folders can be nested at most two levels deep."})),tags:De}),Nl=t.Partial(t.Object({owners:ee(p({allowEmpty:!1}),{description:"Restrict results to dashboard folders owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard folder names or folder IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:t.Optional(t.Boolean({description:"If true, exclude dashboard folders matching this value instead of including them"}))},{description:"Text filter for dashboard folder names or IDs. Optional; `exclude: true` returns folders whose name and ID do not match the substring."}),tags:ee(St.items,{description:"Restrict results to dashboard folders that have at least one of the listed key/value tags",maxItems:50}),parentFolderId:t.Union([t.Null(),p({allowEmpty:!1})],{description:"Parent folder filter for dashboard folder query results. Optional; pass a folder ID to return the child folders nested directly under it, or null to return only top-level folders. Omit to return all folders."})},{description:"Optional filters applied to narrow the returned dashboard folders"})),rs={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},gh=[rs.OWNER,rs.TAGS,rs.DASHBOARD_COUNT,rs.UPDATED_AT,rs.NAME],dV=t.Partial(t.Object({...ne,filters:Nl,sort:t.Object({by:t.Enum([...gh,rs.IS_FAVORITE],{description:"Field to sort the returned dashboard folders by"}),direction:K},{description:"Optional sorting applied to the returned dashboard folders"})})),Utt=d({tags:["dashboard-folders"],url:`${ns}/query`,method:"POST",paginated:!0,body:dV,response:t.Array(fh)}),Ntt=d({tags:["dashboard-folders"],url:`${ns}/:id`,method:"GET",params:t.Object({id:p()}),response:os}),wtt=d({tags:["dashboard-folders"],url:ns,method:"POST",body:Ul,response:os}),vtt=d({tags:["dashboard-folders"],url:`${ns}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ul,response:os}),Ltt=d({tags:["dashboard-folders"],url:`${ns}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),ktt=d({tags:["dashboard-folders"],url:`${ns}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit(Nl,["tags"]))}),response:It});var Xa=`/${"v1"}/dashboard-folders`,wl=t.Pick(os,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),lv={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(wl,{examples:[lv]});var mv=t.Pick(fh,["id","name","owner","parentFolderId","tags","dashboardCount"],{$id:"DashboardFolderWithDashboardCount",description:"Folder used to organize dashboards into a two-level hierarchy, including the number of readable dashboards it directly contains."}),fV={...lv,dashboardCount:10};Object.assign(mv,{examples:[fV]});var hh=t.Pick(Ul,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),gV={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(hh,{examples:[gV]});var hV=t.Object({by:t.Enum(gh,{description:"Field to sort the returned dashboard folders by: `owner` sorts by owning team name, `tags` sorts by tag key/value pairs, `dashboardCount` sorts by the number of readable dashboards directly in the folder, `updatedAt` sorts by last-updated timestamp, and `name` sorts alphabetically by folder name."}),direction:K},{description:"Optional sorting applied to the returned dashboard folders"}),dv=t.Object({...qe,filters:t.Optional(t.Pick(Nl,["owners","searchQuery","tags","parentFolderId"])),sort:t.Optional(hV)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),yV={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"Platform"},tags:{values:[{key:"team",value:"platform"}]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(dv,{examples:[yV]});var fv=d({description:"Queries dashboard folders visible to the authenticated operation key. Returns all folders unless the `parentFolderId` filter is set: pass a folder ID to select the children of that folder, or null to return only top-level folders. Results are ordered by most recently updated folder first unless `sort` is set, and include the number of readable dashboards directly assigned to each folder. Use filters to narrow by owning team, name or ID substring, or tags.",operationId:"queryDashboardFolders",tags:["dashboard-folders"],url:`${Xa}/query`,method:"POST",paginated:!0,body:dv,response:t.Array(mv)}),gv=d({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${Xa}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to retrieve. Use the `id` returned by folder list, get, create, or update responses."})}),response:wl}),hv=d({description:"Creates a dashboard folder owned by the specified team. To create a child folder, set `parentFolderId` to a readable top-level folder.",operationId:"createDashboardFolder",tags:["dashboard-folders"],url:Xa,method:"POST",body:hh,response:wl}),yv=d({description:"Updates an existing dashboard folder by ID. Send the folder name, owner, tags, and parent relationship; omit `parentFolderId` to keep the current parent or send null to move the folder to top level.",operationId:"updateDashboardFolder",tags:["dashboard-folders"],url:`${Xa}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to update. Use the `id` returned by folder list, get, create, or update responses."})}),body:hh,response:wl}),Tv=d({description:"Deletes an empty dashboard folder by ID. The request fails if the folder still contains dashboards or child folders; dashboards and child folders are not moved or deleted automatically.",operationId:"deleteDashboardFolder",tags:["dashboard-folders"],url:`${Xa}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to delete. Use the `id` returned by folder list, get, create, or update responses."})}),response:w});var Fr="/v0/dashboards",_v=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],TV=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],trt=[...TV,"note","slo"];var EV=["ns","us","ms","s","m","h","days"];var _V=["B","KB","MB","GB","TB","PB"];var IV=20;var Iv=t.Object({type:t.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),Sv=t.Object({type:t.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:t.Enum(EV,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),bv=t.Object({type:t.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:t.Enum(_V,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),Ov=t.Object({type:t.Literal("percent",{description:"Formats numeric values as percentages. Use it when the raw value is already on a 0-100 scale, for example `25` to display `25%`."})},{$id:"DataNormalizerPercent",title:"Percent"}),Av=t.Object({type:t.Literal("percent-fraction",{description:"Formats numeric values as percentages. Use it when the raw value is a 0-1 fraction; Tsuga multiplies the value by 100 for display, for example `0.2` to display `20%`."})},{$id:"DataNormalizerPercentFraction",title:"Percent Fraction"}),xv=t.Object({type:t.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),Rv=t.Object({type:t.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),Cv=t.Object({type:t.Literal("none",{description:"Displays raw values without a unit. Records an explicit removal of the unit, so it is not re-derived from metric metadata"})},{$id:"DataNormalizerNone",title:"None"}),SV=t.Object({type:t.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:t.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"}),bV=t.Object({type:t.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:t.String({description:"Text label describing the custom unit. Must not be empty.",minLength:1,maxLength:IV})},{$id:"InputDataNormalizerCustom",title:"Custom"}),wt=x("type",[Sv,bv,Ov,Av,xv,Rv,Iv,Cv,SV],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),vt=x("type",[Sv,bv,Ov,Av,xv,Rv,Iv,Cv,bV],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),yh=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(wt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),Th=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(vt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),is=["background","no-background"],OV=["table","legend-only","no-legend"];var AV=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],Pv=["alert","warning","success"],jr=t.Object({operator:t.Enum(AV,{description:"Comparator used to evaluate the metric value"}),value:t.Number({description:"Threshold value used when evaluating the operator"}),color:t.Enum(Pv,{description:"Color applied when the condition is met"})},{title:"ConditionalFormatting",description:"Color rule evaluated against the displayed value. The first matching rule in the array is applied."}),xV=t.Object({value:t.Number({description:"Y-axis value where the threshold marker is placed"}),level:t.Enum(Pv,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),RV=["sec","min","hour","day"],zn=t.Object({time:t.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:t.Enum(RV,{description:"Unit used to measure the bucket width"})},{description:"Time bucket width for time-based chart widgets. Optional; when present, `time` and `metric` together define the bucket width."});var Kn=t.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),ss=t.Object({formula:t.Optional(t.String({description:"Optional alias for formula (only used for display in the UI)"})),queries:t.Optional(t.Record(t.String(),t.String({description:'Display name for this query series in the legend, keyed by the zero-based query index as a string ("0" = first query, "1" = second, and so on). This differs from `formula`, which references queries as "q1", "q2". Omit to fall back to an auto-generated label like "Count on <filter>".'}),{description:"Display names for individual query series, keyed by the zero-based query index as a string."}))},{description:"Display names used for the formula series and the individual query series instead of auto-generated labels."}),as=t.Object({formula:t.Optional(p({type:"short",description:"Optional alias for formula (only used for display in the UI)"})),queries:t.Optional(t.Record(t.String(),p({type:"short",description:'Display name for this query series in the legend, keyed by the zero-based query index as a string ("0" = first query, "1" = second, and so on). This differs from `formula`, which references queries as "q1", "q2". Omit to fall back to an auto-generated label like "Count on <filter>".'}),{description:"Display names for individual query series, keyed by the zero-based query index as a string."}))},{description:"Display names used for the formula series and the individual query series instead of auto-generated labels."}),Ll={source:Wt,queries:DR,formula:t.Optional($u),aliases:t.Optional(ss),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},kl={source:Wt,queries:Ra,formula:t.Optional(Ao),aliases:t.Optional(as),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},qr=t.Optional(t.Enum(["relative","absolute"],{description:"`absolute` keeps each group at its own value; `relative` shows it as a percentage of the ungrouped total (defaults to absolute)"})),cs={...Ll,groupBy:t.Optional(Ni)},ps={...kl,groupBy:t.Optional(Jr)},ze=t.Enum(OV,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),Ee=t.Optional(t.Union([t.Number(),t.Literal("max")],{description:"Display precision for numeric labels, tooltips, tables, and scalar values. Use a number of decimal places to round displayed values, or `max` to display the full submitted precision."})),pr=t.Optional(t.Array(xV,{description:"Threshold markers displayed on the chart"})),CV=t.Object({name:t.String({description:"Display name of the table column"}),...Ll,source:Wt,normalizer:t.Optional(wt),precision:Ee},{title:"TableColumn",description:"Table column backed by its own aggregation. `defaultSorting` and `columnSizes` reference it as `col-<index>`, using its zero-based position in `columns`."}),PV=t.Object({name:p({description:"Display name of the table column"}),...kl,source:Wt,normalizer:t.Optional(vt),precision:Ee},{title:"TableColumn",description:"Table column backed by its own aggregation. `defaultSorting` and `columnSizes` reference it as `col-<index>`, using its zero-based position in `columns`."}),UV=t.Array(t.Object({id:t.String({description:"ID of the column to sort by"}),desc:t.Boolean({description:"Whether the sort is descending"})},{title:"TableDefaultSorting"}),{description:"Default sorting applied to a table widget. Column IDs are `label` for the grouping column and `col-<index>` for each entry in `columns`. Users can still change sorting by selecting columns in the rendered table."}),NV=t.Array(t.Object({id:p({description:"ID of the column to sort by"}),desc:t.Boolean({description:"Whether the sort is descending"})},{title:"TableDefaultSorting"}),{description:"Default sorting applied to a table widget. Column IDs are `label` for the grouping column and `col-<index>` for each entry in `columns`. Users can still change sorting by selecting columns in the rendered table."}),Eh=t.Array(t.Object({id:t.String({description:"Column attribute used for the default list sort. It matches an attribute in `listColumns` or a built-in list column for the selected list source."}),desc:t.Boolean({description:"Sort direction for the default list sort. `true` sorts descending; `false` sorts ascending."})},{title:"ListDefaultSorting"}),{description:"Default sorting applied to a list widget. Applies to log, span, or connection list widgets. Users can still change sorting by selecting columns in the rendered list."}),_h=t.Array(t.Object({id:p({description:"Column attribute used for the default list sort. Set this to an attribute in `listColumns` or a built-in list column for the selected list source."}),desc:t.Boolean({description:"Sort direction for the default list sort. Set `true` for descending order or `false` for ascending order."})},{title:"ListDefaultSorting"}),{description:"Default sorting applied to a list widget. Optional on create or update for log, span, or connection list widgets. Users can still change sorting by selecting columns in the rendered list."}),Uv=["horizontal","vertical"],wV=t.Object({type:t.Literal("list",{description:"Displays matching logs in a tabular list"}),query:t.String({description:"Query that selects logs for the list"}),listColumns:t.Optional(t.Array(yh,{description:"Custom columns to display for each log"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets."})),defaultSorting:t.Optional(Eh)},{$id:"GraphVisualizationList",title:"List"}),vV=t.Object({type:t.Literal("list",{description:"Displays matching logs in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects logs for the list"}),listColumns:t.Optional(t.Array(Th,{description:"Custom columns to display for each log"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(_h)},{$id:"InputGraphVisualizationList",title:"List"}),vl=x("type",[t.Object({type:t.Literal("auto",{description:"Automatically choose this axis bound"})}),t.Object({type:t.Literal("number",{description:"Use a fixed numeric axis bound"}),value:t.Number({description:"Fixed numeric axis bound value"})})],{description:"Axis bound mode: automatic or fixed numeric value"}),us=t.Object({min:vl,max:vl,scale:x("type",[t.Object({type:t.Literal("pow",{description:"Power scale"}),exponent:t.Number({description:"Exponent used by the power scale"})}),t.Object({type:t.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:t.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets."}),ls=t.Object({min:vl,max:vl,scale:x("type",[t.Object({type:t.Literal("pow",{description:"Power scale"}),exponent:t.Number({minimum:0,description:"Exponent used by the power scale"})}),t.Object({type:t.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:t.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets. Optional on create or update."}),LV=t.Array(t.Integer({description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"}),kV=t.Array(t.Integer({minimum:0,maximum:100,description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"});var MV=["regular","dashed"],ms=t.Record(t.String(),t.Object({groupId:t.String(),lineStyle:t.Enum(MV)}),{description:"Line style of each series, keyed by 1-based query index. The last index is the formula when there is one. For widgets with a single query, only the `1` entry is read and it applies to every series. Defaults to regular."}),DV=t.Object({type:t.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(ze),thresholds:pr,yAxisSettings:t.Optional(us),lineStyleOptions:t.Optional(ms)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),GV=t.Object({type:t.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(ze),thresholds:pr,yAxisSettings:t.Optional(ls),lineStyleOptions:t.Optional(ms)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),$V=t.Object({type:t.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),query:t.String({description:"The read-only SQL query to execute against the connection."}),listColumns:t.Optional(t.Array(yh,{description:"Custom columns to display for each database row"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets."})),defaultSorting:t.Optional(Eh)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),FV=t.Object({type:t.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),query:p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),listColumns:t.Optional(t.Array(Th,{description:"Custom columns to display for each database row"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(_h)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),jV=t.Object({type:t.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."}))},{$id:"GraphVisualizationTopListConnection",title:"TopListConnection"}),qV=t.Object({type:t.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1})},{$id:"InputGraphVisualizationTopListConnection",title:"TopListConnection"}),BV=t.Object({type:t.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(ze)},{$id:"GraphVisualizationPieConnection",title:"PieConnection"}),HV=t.Object({type:t.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),KV=t.Object({type:t.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(ze),thresholds:pr,yAxisSettings:t.Optional(us)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),zV=t.Object({type:t.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(ze),thresholds:pr,yAxisSettings:t.Optional(ls)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),YV=t.Object({type:t.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),backgroundMode:t.Optional(t.Enum(is,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(jr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(wt),legendMode:t.Optional(ze)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),VV=t.Object({type:t.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),backgroundMode:t.Optional(t.Enum(is,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(jr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(vt),legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),QV=t.Object({type:t.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:t.String({description:"Tsuga query that selects logs to cluster into patterns"}),layout:t.Optional(t.Enum(Uv,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),WV=t.Object({type:t.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:p({type:"tsuga-query",description:"Tsuga query that selects logs to cluster into patterns"}),layout:t.Optional(t.Enum(Uv,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),ZV=t.Object({type:t.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:t.String({description:"Query that selects trace spans for the list"}),listColumns:t.Optional(t.Array(yh,{description:"Custom columns to display for each span"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets."})),defaultSorting:t.Optional(Eh)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),XV=t.Object({type:t.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects trace spans for the list"}),listColumns:t.Optional(t.Array(Th,{description:"Custom columns to display for each span"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(_h)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),Ja=t.Array(t.String({description:"Raw PromQL expression for this widget, returned exactly as stored."}),{description:"PromQL expressions configured for this widget. PromQL-backed widgets require at least one query."}),ec=t.Array(p({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),JV=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Ja,aliases:t.Optional(ss),timeBucket:t.Optional(zn),normalizer:t.Optional(wt),precision:Ee,legendMode:t.Optional(ze),thresholds:pr,yAxisSettings:t.Optional(us),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:t.Optional(ms)},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),e9=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:ec,aliases:t.Optional(as),timeBucket:t.Optional(zn),normalizer:t.Optional(vt),precision:Ee,legendMode:t.Optional(ze),thresholds:pr,yAxisSettings:t.Optional(ls),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:t.Optional(ms)},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),t9=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Ja,aliases:t.Optional(ss),backgroundMode:t.Optional(t.Enum(is,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(jr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(wt),legendMode:t.Optional(ze)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),r9=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:ec,aliases:t.Optional(as),backgroundMode:t.Optional(t.Enum(is,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(jr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(vt),legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),n9=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Ja,aliases:t.Optional(ss),normalizer:t.Optional(wt),precision:Ee,conditions:t.Optional(t.Array(jr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),o9=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:ec,aliases:t.Optional(as),normalizer:t.Optional(vt),precision:Ee,conditions:t.Optional(t.Array(jr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),i9=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Ja,aliases:t.Optional(ss),normalizer:t.Optional(wt),precision:Ee,legendMode:t.Optional(ze)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),s9=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:ec,aliases:t.Optional(as),normalizer:t.Optional(vt),precision:Ee,legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),a9=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Ja,aliases:t.Optional(ss),timeBucket:t.Optional(zn),precision:Ee,normalizer:t.Optional(wt),thresholds:pr,legendMode:t.Optional(ze),yAxisSettings:t.Optional(us)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),c9=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:ec,aliases:t.Optional(as),timeBucket:t.Optional(zn),precision:Ee,normalizer:t.Optional(vt),thresholds:pr,legendMode:t.Optional(ze),yAxisSettings:t.Optional(ls)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),p9=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...cs,groupByMode:qr,timeBucket:t.Optional(zn),normalizer:t.Optional(wt),precision:Ee,legendMode:t.Optional(ze),thresholds:pr,yAxisSettings:t.Optional(us),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:t.Optional(ms)},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),u9=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...ps,groupByMode:qr,timeBucket:t.Optional(zn),normalizer:t.Optional(vt),precision:Ee,legendMode:t.Optional(ze),thresholds:pr,yAxisSettings:t.Optional(ls),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"})),lineStyleOptions:t.Optional(ms)},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),Nv="Requests stacked rendering for a top-list widget. Tsuga renders stacked rows only for one count or sum query with exactly two grouped fields, no formula, non-negative values, and a single-cluster context; otherwise the widget renders as a normal top list.",l9=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...cs,groupByMode:qr,normalizer:t.Optional(wt),precision:Ee,conditions:t.Optional(t.Array(jr,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:t.Optional(t.Boolean({description:Nv}))},{$id:"GraphVisualizationTopList",title:"TopList"}),m9=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...ps,groupByMode:qr,normalizer:t.Optional(vt),precision:Ee,conditions:t.Optional(t.Array(jr,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:t.Optional(t.Boolean({description:Nv}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),d9=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...cs,groupByMode:qr,normalizer:t.Optional(wt),precision:Ee,legendMode:t.Optional(ze)},{$id:"GraphVisualizationPie",title:"Pie"}),f9=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...ps,groupByMode:qr,normalizer:t.Optional(vt),precision:Ee,legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationPie",title:"Pie"}),g9=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Ll,backgroundMode:t.Optional(t.Enum(is,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(jr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(wt),legendMode:t.Optional(ze)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),h9=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...kl,backgroundMode:t.Optional(t.Enum(is,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(jr,{description:"Conditional formatting rules applied to the displayed value"})),precision:Ee,normalizer:t.Optional(vt),legendMode:t.Optional(ze)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),y9=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...cs,groupByMode:qr,timeBucket:t.Optional(zn),precision:Ee,normalizer:t.Optional(wt),thresholds:pr,legendMode:t.Optional(ze),yAxisSettings:t.Optional(us)},{$id:"GraphVisualizationBar",title:"Bar"}),T9=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...ps,groupByMode:qr,timeBucket:t.Optional(zn),precision:Ee,normalizer:t.Optional(vt),thresholds:pr,legendMode:t.Optional(ze),yAxisSettings:t.Optional(ls)},{$id:"InputGraphVisualizationBar",title:"Bar"}),wv='Attribute that switches the count to "Groups" mode: records are grouped by this attribute, the aggregation produces one value per group, and the chart buckets those per-group values. When omitted, individual records are bucketed.',vv=t.String({description:wv}),Lv=p({description:wv}),E9=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...cs,group:t.Optional(vv),precision:Ee,normalizer:t.Optional(wt),percentileMarkers:t.Optional(LV),boundsScale:t.Optional(Gu)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),_9=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...ps,group:t.Optional(Lv),precision:Ee,normalizer:t.Optional(vt),percentileMarkers:t.Optional(kV),boundsScale:t.Optional(Gu)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),kv=["red","pink","violet","blue","cyan","green","yellow","orange"],Mv=t.Enum(kv,{description:"Color palette used to render the heatmap intensity gradient"}),I9=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...cs,group:t.Optional(vv),precision:Ee,normalizer:t.Optional(wt),palette:t.Optional(Mv)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),S9=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...ps,group:t.Optional(Lv),precision:Ee,normalizer:t.Optional(vt),palette:t.Optional(Mv)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),Dv=t.Object({from:t.Number({description:"Lower bound of the Gauge color threshold; runs up to the next threshold or the max"}),color:t.Enum(kv,{description:"Color applied to the band starting at this value"})},{title:"GaugeColorThreshold",description:"Color band of the gauge range. Bands are ordered by `from`, so entries may be listed in any order."}),b9=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Ll,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(Dv,{description:"Color thresholds inside the gauge range"})),precision:Ee,normalizer:t.Optional(wt)},{$id:"GraphVisualizationGauge",title:"Gauge"}),O9=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...kl,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(Dv,{description:"Color thresholds inside the gauge range"})),precision:Ee,normalizer:t.Optional(vt)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),A9=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(CV,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Ni),groupByMode:qr,defaultSorting:t.Optional(UV),columnSizes:t.Optional(t.Record(t.String(),t.Number({description:"Column width by column id"}),{description:"Table column widths in pixels, keyed by column id: `label` for the grouping column and `col-<index>` for each entry in `columns`. Columns without an entry keep their default width."}))},{$id:"GraphVisualizationTable",title:"Table"}),x9=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(PV,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Jr),groupByMode:qr,defaultSorting:t.Optional(NV),columnSizes:t.Optional(t.Record(t.String(),t.Number({description:"Column width by column id"}),{description:"Table column widths in pixels, keyed by column id: `label` for the grouping column and `col-<index>` for each entry in `columns`. Columns without an entry keep their default width."}))},{$id:"InputGraphVisualizationTable",title:"Table"}),R9=t.Object({type:t.Literal("note",{description:"Displays static text on the dashboard"}),note:t.Optional(t.String({description:"Markdown-compatible text shown in the note"})),noteColor:t.Optional(t.Enum(_v,{description:"Background color used to render the note"})),noteAlign:t.Optional(Kn),noteJustifyContent:t.Optional(Kn)},{$id:"GraphVisualizationNote",title:"Note"}),C9=t.Object({type:t.Literal("note",{description:"Displays static text on the dashboard"}),note:t.Optional(p({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:t.Optional(t.Enum(_v,{description:"Background color used to render the note"})),noteAlign:t.Optional(Kn),noteJustifyContent:t.Optional(Kn)},{$id:"InputGraphVisualizationNote",title:"Note"}),P9=t.Object({type:t.Literal("slo-uptime",{description:"Displays the SLI percentage of an SLO computed over the dashboard time range, colored against the SLO target. Experimental."}),sloId:t.String({description:"Id of the SLO to display"})},{$id:"GraphVisualizationSloUptime",title:"SloUptime"}),U9=t.Object({type:t.Literal("slo-uptime",{description:"Displays the SLI percentage of an SLO computed over the dashboard time range, colored against the SLO target. Experimental."}),sloId:p({allowEmpty:!1,description:"Id of the SLO to display"})},{$id:"InputGraphVisualizationSloUptime",title:"SloUptime"}),N9=t.Object({type:t.Literal("slo-over-time",{description:"Displays the good and bad events, or the per-slice status, of an SLO over the dashboard time range. Experimental."}),sloId:t.String({description:"Id of the SLO to display"})},{$id:"GraphVisualizationSloOverTime",title:"SloOverTime"}),w9=t.Object({type:t.Literal("slo-over-time",{description:"Displays the good and bad events, or the per-slice status, of an SLO over the dashboard time range. Experimental."}),sloId:p({allowEmpty:!1,description:"Id of the SLO to display"})},{$id:"InputGraphVisualizationSloOverTime",title:"SloOverTime"}),v9=x("type",[DV,$V,jV,BV,KV,YV,JV,t9,n9,i9,a9,p9,l9,d9,g9,b9,y9,E9,I9,A9,wV,R9,QV,ZV,P9,N9],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),L9=x("type",[GV,FV,qV,HV,zV,VV,e9,r9,o9,s9,c9,u9,m9,f9,h9,O9,T9,_9,S9,x9,vV,C9,WV,XV,U9,w9],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),Ml=t.Object({id:t.String({description:"Unique identifier of the graph widget inside the dashboard. Set by the caller when the graph is created; use it to target the graph in later update requests."}),name:t.Optional(t.String({description:"Display name of the graph widget."})),description:t.Optional(t.String({description:"Optional text shown with the graph widget."})),descriptionAlign:t.Optional(Kn),descriptionJustifyContent:t.Optional(Kn),visualization:v9,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid. Dashboard validation uses this with `h` and the widget type to reject layouts below the widget minimum."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall. Dashboard validation uses this with `w` and the widget type to reject layouts below the widget minimum."})},{description:`Grid position and size of the widget. Optional; when provided, the size must be at least ${Xd}\xD7${Jd} (width\xD7height) grid units, except note widgets which can go down to 1\xD71.`}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),Dl=t.Object({id:p({description:"Unique identifier of the graph widget inside the dashboard. Assign it when the graph is created; use it to target the graph in later update requests."}),name:t.Optional(p({description:"Display name of the graph widget."})),description:t.Optional(t.String({minLength:1,maxLength:800,description:"Text shown with the graph widget."})),descriptionAlign:t.Optional(Kn),descriptionJustifyContent:t.Optional(Kn),visualization:L9,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid. Dashboard validation uses this with `h` and the widget type to reject layouts below the widget minimum."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall. Dashboard validation uses this with `w` and the widget type to reject layouts below the widget minimum."})},{description:`Grid position and size of the widget. Optional; when provided, the size must be at least ${Xd}\xD7${Jd} (width\xD7height) grid units, except note widgets which can go down to 1\xD71.`}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),Ev=10,k9=t.Array(t.Object({key:t.String({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:t.Array(t.String({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:t.Optional(t.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{description:"Dashboard-wide filters applied to every widget on the dashboard."}),M9=t.Array(t.Object({key:p({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:t.Array(p({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:t.Optional(t.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{maxItems:Ev,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${Ev} filters are allowed.`}),ds=t.Object({id:t.String({description:"Tsuga-generated dashboard ID assigned when the dashboard is created."}),name:t.String({description:"Display name of the dashboard. Set by the caller on create or update."}),owner:t.String({description:"ID of the team that owns the dashboard. Set by the caller on create or update and used for dashboard access control."}),graphs:t.Array(Ml,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(k9),createdAt:S({description:"Timestamp when Tsuga created the dashboard."}),updatedAt:S({description:"Timestamp when Tsuga last updated the dashboard."}),creator:t.Optional(pe),updater:t.Optional(pe),tags:we,timePreset:t.Optional(t.Enum(pm,{description:"Relative time preset used when opening the dashboard."})),folderId:t.Optional(t.String({description:"Folder that contains the dashboard. Set from the dashboard's saved folder relationship. Returned when the dashboard is in a folder; omitted when it is not."}))}),Gl=t.Object({name:p({description:"Display name of the dashboard."}),owner:p({allowEmpty:!1,description:"ID of the team that owns the dashboard. Required and used for dashboard access control."}),graphs:t.Array(Dl,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(M9),tags:De,timePreset:t.Optional(t.Enum(pm,{description:"Relative time preset used when opening the dashboard. Optional; create defaults to `past-30-minutes` when omitted, and update omission preserves the current value."})),folderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder that should contain the dashboard. Optional; omit on update to keep the current folder, pass null to clear the folder, or pass a readable dashboard-folder ID to move it."}))}),Er={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},Gv=[Er.OWNER,Er.TAGS,Er.WIDGET_COUNT,Er.UPDATED_AT,Er.NAME],Fo=t.Partial(t.Object({owners:ee(p({allowEmpty:!1}),{description:"Restrict results to dashboards owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard names or dashboard IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:t.Optional(t.Boolean({description:"If true, exclude dashboards matching this value instead of including them"}))},{description:"Text filter for dashboard names or IDs. Optional; `exclude: true` returns dashboards whose name and ID do not match the substring."}),tags:ee(St.items,{description:"Restrict results to dashboards that have at least one of the listed key/value tags",maxItems:50}),folderId:t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder filter for dashboard query results. Optional; pass a folder ID to return dashboards in that folder, or null to return only dashboards that are not in any folder."})},{description:"Optional filters applied to narrow the returned dashboards"})),D9=t.Partial(t.Object({...ne,filters:Fo,sort:t.Object({by:t.Enum([Er.IS_FAVORITE,Er.OWNER,Er.TAGS,Er.WIDGET_COUNT,Er.UPDATED_AT,Er.NAME],{description:"Field to sort the returned dashboards by"}),direction:K},{description:"Optional sorting applied to the returned dashboards"})})),rrt=d({tags:["dashboards"],url:`${Fr}/query`,method:"POST",paginated:!0,response:t.Array(ds),body:D9}),nrt=d({tags:["dashboards"],url:`${Fr}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit(Fo,["tags"]))}),response:It}),ort=d({tags:["dashboards"],url:`${Fr}/counts/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(Fo))}),response:t.Object({all:t.Integer({description:"Total number of dashboards matching the filters that the user can read."})})}),irt=d({tags:["dashboards"],url:`${Fr}/:id`,method:"GET",params:t.Object({id:p()}),response:ds}),srt=d({tags:["dashboards"],url:Fr,method:"POST",body:Gl,response:ds}),art=d({tags:["dashboards"],url:`${Fr}/:id`,method:"PATCH",params:t.Object({id:p()}),body:t.Partial(Gl),response:ds}),G9=Qt(Fo,{maxIds:100}),crt=d({tags:["dashboards"],url:`${Fr}/bulk-update`,method:"PUT",body:t.Object({selection:G9,owner:t.Optional(p({allowEmpty:!1,description:"Owning team ID to apply to every dashboard. Optional when folderId is provided; omit to keep the current owner."})),folderId:Se(p({allowEmpty:!1}),{description:"Folder that should contain every dashboard. Optional when owner is provided; omit to keep the current folder, pass null to clear the folder, or pass a dashboard-folder ID to move dashboards."})}),response:t.Object({})}),prt=d({tags:["dashboards"],url:`${Fr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),urt=d({tags:["dashboards"],url:`${Fr}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1}),graphId:p({allowEmpty:!1})}),body:t.Omit(Dl,["id"]),response:Ml}),$9=Qt(Fo),lrt=d({tags:["dashboards"],url:`${Fr}/bulk-delete`,method:"DELETE",body:t.Object({selection:$9}),response:t.Object({})});var fs=`/${"v1"}/dashboards`,tc=t.Pick(ds,["id","name","owner","graphs","filters","tags","timePreset","folderId"],{$id:"Dashboard",description:"Saved visualization made of dashboard-wide filters and ordered graphs. Use dashboards to preserve reusable views for a team or workflow. See [Dashboards](/documentation/visualize/dashboards/index)."}),F9={id:"123-456-abc",name:"API Performance Overview",owner:"team-123-abc",graphs:[{id:"789-abc-def",name:"Request Latency P99",visualization:{type:"timeseries",source:"metrics",queries:[{aggregate:{type:"percentile",field:"duration",percentile:99},filter:"service:api-gateway"}]},layout:{x:0,y:0,w:6,h:4}}],filters:[{key:"env",values:["production"]}],tags:[{key:"team",value:"platform"}],timePreset:"past-1-hour"};Object.assign(tc,{examples:[F9]});var j9=t.Object({by:t.Enum([...Gv],{description:"Field to sort the returned dashboards by: `owner` sorts by owning team ID, `tags` sorts by tag key/value pairs, `widgetCount` sorts by the number of graphs on the dashboard, `updatedAt` sorts by last-updated timestamp, and `name` sorts alphabetically by dashboard name."}),direction:K},{description:"Optional sorting applied to the returned dashboards"}),$v=t.Object({...qe,filters:t.Optional(t.Pick(Fo,["owners","searchQuery","tags","folderId"])),sort:t.Optional(j9)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),q9={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"API"},tags:{values:[{key:"service",value:"api-gateway"}]},folderId:"folder-123-abc"},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign($v,{examples:[q9]});var Fv=d({description:"Queries dashboards visible to the authenticated operation key. Use this endpoint to build dashboard inventories or synchronize dashboard metadata. Pagination fields limit the returned page; use the response metadata to request additional pages. See [Dashboards](/documentation/visualize/dashboards/index).",operationId:"queryDashboards",tags:["dashboards"],url:`${fs}/query`,method:"POST",paginated:!0,body:$v,response:t.Array(tc)}),jv=d({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${fs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to retrieve. Use the `id` returned by dashboard query, create, or update responses."})}),response:tc}),Ih=t.Pick(Gl,["name","owner","graphs","filters","tags","timePreset","folderId"],{description:"Dashboard create or update request. Provide the dashboard identity, owner team, widgets, filters, tags, and optional time preset."}),B9={name:"API Performance Overview",owner:"team-123-abc",graphs:[{id:"789-abc-def",name:"Request Latency P99",visualization:{type:"timeseries",source:"metrics",queries:[{aggregate:{type:"percentile",field:"duration",percentile:99},filter:"service:api-gateway"}]},layout:{x:0,y:0,w:6,h:4}}],filters:[{key:"env",values:["production"]}],tags:[{key:"team",value:"platform"}],timePreset:"past-1-hour",folderId:null};Object.assign(Ih,{examples:[B9]});var H9=t.Omit(Dl,["id"],{description:"Dashboard graph update request. The graph identifier is supplied in the `graphId` path parameter; provide the replacement graph definition without an `id` field."}),qv=d({description:"Creates a dashboard owned by the specified team. Use this to provision dashboards from automation or templates. The response returns the saved dashboard definition.",operationId:"createDashboard",tags:["dashboards"],url:fs,method:"POST",body:Ih,response:tc}),Bv=d({description:"Updates an existing dashboard by ID. Fields are patched from the request body; omitted fields keep their current values.",operationId:"updateDashboard",tags:["dashboards"],url:`${fs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to update. Use the `id` returned by dashboard query, get, or create responses."})}),body:t.Partial(Ih),response:tc}),K9=t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to delete. Use the `id` returned by dashboard query, get, create, or update responses."})}),Hv=d({description:"Deletes a dashboard by ID. Use only after confirming no users or automation still rely on the dashboard.",operationId:"deleteDashboard",tags:["dashboards"],url:`${fs}/:id`,method:"DELETE",params:K9,response:w}),Ert=d({description:"Updates one graph inside a dashboard without replacing the full dashboard. Use this for targeted widget edits when you already know the dashboard ID and graph ID.",operationId:"updateDashboardGraph",tags:["dashboards"],url:`${fs}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard that contains the graph to update. Use the `id` returned by dashboard responses."}),graphId:p({allowEmpty:!1,description:"Identifier of the graph to update within the dashboard. Use graph IDs from the dashboard response."})}),body:H9,response:Ml});var Kv=100,zv=3,gs=t.Object({id:t.String({description:"Tsuga-generated ingestion API key ID assigned when the key is created."}),name:t.String({description:"Human-readable key name. Names must be kebab-case when creating or updating keys."}),keyLastCharacters:t.String({description:"Last visible characters of the secret key. Use this to identify a key without exposing the full secret."}),owner:t.String({description:"Team ID that owns and manages the ingestion API key."}),tags:It,teamOverrideFields:t.Optional(t.Array(t.String(),{description:"Telemetry attribute names used to override ownership for data sent with this key."})),updatedAt:S({description:"Timestamp when Tsuga last updated the key metadata."}),createdAt:S({description:"Timestamp when Tsuga created the key."}),creator:t.Optional(pe),updater:t.Optional(pe),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})}),rc=t.Object({name:t.String({format:_i,minLength:1,maxLength:Kv,description:`Kebab-case name for the ingestion API key. Maximum length is ${Kv} characters.`}),owner:p({allowEmpty:!1,description:"Team ID that will own and manage the ingestion API key."}),tags:St,teamOverrideFields:t.Union([t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:zv,description:`Array form. Up to ${zv} fields are allowed.`}),t.Null({description:"Clear any existing team override fields."})],{description:"Telemetry attribute names used to override ownership for data sent with this key. Send null to clear existing override fields."})}),hs="/v0/ingestion-api-keys",Crt=d({tags:["ingestion-api-keys"],url:hs,method:"POST",body:rc,response:t.Intersect([gs,t.Object({key:t.String({description:"Full secret value of the ingestion API key. Generated by Tsuga and returned only in this create response; subsequent get and list responses expose only `keyLastCharacters`. Store it immediately, since it cannot be retrieved again after this response."})})])}),Prt=d({tags:["ingestion-api-keys"],url:hs,method:"GET",paginated:!0,query:t.Object(ne),response:t.Array(gs)}),Urt=d({tags:["ingestion-api-keys"],url:`${hs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:gs}),Nrt=d({tags:["ingestion-api-keys"],url:`${hs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1})}),body:rc,response:gs}),wrt=d({tags:["ingestion-api-keys"],url:`${hs}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:w}),vrt=d({tags:["ingestion-api-keys"],url:`${hs}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p({allowEmpty:!1}),{uniqueItems:!0})}),response:t.Object({})});var nc=`/${"v1"}/ingestion-api-keys`,oc=t.Pick(gs,["id","name","owner","tags","teamOverrideFields","keyLastCharacters"],{$id:"IngestionApiKey",description:"API key used to send telemetry data to Tsuga. The full key secret is returned only when the key is created. See [API keys](/documentation/account-and-settings/api-keys)."}),Yv={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(oc,{examples:[Yv]});var Vv=t.Pick(rc,["name","owner","tags","teamOverrideFields"],{$id:"CreateIngestionApiKeyRequest",description:"Ingestion API key creation request. Provide a kebab-case name, owner team, required tags, and required team override fields as an array of fields or null."}),Qv=t.Pick(rc,["name","owner","tags","teamOverrideFields"],{$id:"UpdateIngestionApiKeyRequest",description:"Ingestion API key update request. Provide the full metadata definition, including name, owner team, tags, and team override fields."}),Wv={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(Vv,{examples:[Wv]});Object.assign(Qv,{examples:[Wv]});var z9={...Yv,key:"tsuga_in:v1:abc123xyx7Qm"},Zv=d({description:"Lists ingestion API keys visible to the authenticated operation key. Use this to inventory telemetry intake keys, owners, tags, and team override fields. Pagination fields limit the returned page.",operationId:"listIngestionApiKeys",tags:["ingestion-api-keys"],url:nc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(oc)}),jrt=d({description:"Retrieves one ingestion API key by ID. The response never includes the full secret key value; only the last visible characters are returned.",operationId:"getIngestionApiKey",tags:["ingestion-api-keys"],url:`${nc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to retrieve. Use the `id` returned by ingestion API key list or create responses."})}),response:oc}),Y9=t.Intersect([t.Pick(oc,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),t.Object({key:t.String({description:"Full Tsuga-generated ingestion API key secret. Returned only in the create response; list, get, and update responses expose only `keyLastCharacters`."})})],{title:"IngestionApiKeyCreated",example:z9}),Xv=d({description:"Creates an ingestion API key for telemetry intake. Store the returned `key` immediately because Tsuga returns the full secret only in this response.",operationId:"createIngestionApiKey",tags:["ingestion-api-keys"],url:nc,method:"POST",body:Vv,response:Y9}),Jv=d({description:"Updates ingestion API key metadata by ID, including name, owner, tags, and team override fields. The secret key value is not rotated by this operation.",operationId:"updateIngestionApiKey",tags:["ingestion-api-keys"],url:`${nc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to update. Use the `id` returned by ingestion API key list, get, or create responses."})}),body:Qv,response:oc}),eL=d({description:"Deletes an ingestion API key by ID. Telemetry clients using the deleted key can no longer send data with it.",operationId:"deleteIngestionApiKey",tags:["ingestion-api-keys"],url:`${nc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to delete. Use the `id` returned by ingestion API key list, create, or update responses."})}),response:w});var V9={application:{webService:["azure_web_app","gcp_app_engine_service"]},data:{bucket:["aws_s3_bucket","gcp_bucket","azure_blob_storage_container"],messagingService:["aws_kinesis_data_stream","aws_sqs_queue","aws_sns_topic","azure_service_bus_namespace","azure_service_bus_queue","gcp_pubsub_topic","azure_event_grid_topic","azure_event_hub_namespace","azure_event_hub"],fileSystem:["aws_efs","azure_file_share"],contentDeliveryNetwork:["aws_cloudfront_distribution","gcp_cloud_cdn_configuration"],database:["aws_dynamodb_table","aws_elasticache","aws_rds_instance","azure_database_for_mysql_server","azure_database_for_postgres_server","azure_sql_database_server","azure_sql_database","gcp_bigtable_instance","gcp_cloud_sql_instance","gcp_firestore_database","gcp_spanner_instance","azure_cosmos_db_account"],storageAccount:["azure_storage_account"],volume:["aws_ebs_volume","gcp_compute_disk","azure_disk"]},compute:{virtualMachine:["aws_ec2_instance","gcp_compute_instance","azure_compute_virtual_machine"],serverless:["aws_lambda_function","gcp_cloud_run_function","gcp_cloud_run_job","gcp_cloud_run_service","azure_function_app"]},container:{kubernetesCluster:["aws_eks_cluster","gcp_gke_cluster","azure_aks_cluster"],containerRepository:["aws_ecr_repository","gcp_artifact_registry_repository","azure_container_registry"],containerCluster:["aws_ecs_cluster"],containerServiceTask:["aws_ecs_task"],containerService:["aws_ecs_service","azure_container_instance_group"],containerImage:["aws_ecr_image","gcp_artifact_registry_docker_image","azure_container_registry_image"]},network:{virtualNetwork:["aws_vpc","gcp_vpc","azure_virtual_network"],loadBalancer:["aws_elastic_load_balancer","gcp_forwarding_rule","azure_load_balancer","azure_traffic_manager_profile"],targetGroup:["aws_target_group"],certificate:["aws_acm_certificate","gcp_certificate_manager_certificate","azure_app_service_certificate"]}},[Krt,$l,ic]=Q9(V9),zrt=Object.fromEntries($l.map(e=>[e,e]));function Q9(e){let r=[],n=[],o=[],i=Object.keys(e);for(let s of i){r.push(s);let c=e[s];for(let l in c){n.push(l);let m=c[l];Array.isArray(m)&&o.push(...m)}}return[Sh(r),Sh(n),Sh(o)]}function Sh(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var bh=t.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),W9=t.Object({versioningStatus:t.Optional(t.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),Z9=t.Object({domainName:t.Optional(t.String()),origins:t.Optional(t.Array(t.String()))}),X9=t.Object({allocatedStorageGib:t.Optional(t.Number()),encryptedAtRest:t.Optional(t.Boolean()),engine:t.Optional(t.String()),dynamoDbItemCount:t.Optional(t.Number()),dynamoDbActualSizeGib:t.Optional(t.Number())}),J9=t.Object({version:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnets:t.Optional(t.Array(t.String()))}),eQ=t.Object({artifactRegistryFormat:t.Optional(t.Enum(["FORMAT_UNSPECIFIED","DOCKER","MAVEN","NPM","APT","YUM","PYTHON","KFP","GO","GENERIC"])),uri:t.Optional(t.String()),tagMutability:t.Optional(t.Enum(["MUTABLE","IMMUTABLE"])),scanOnPush:t.Optional(t.Boolean()),encryptionType:t.Optional(t.String())}),tQ=t.Object({status:t.Optional(t.String()),activeServices:t.Optional(t.Number()),pendingTasks:t.Optional(t.Number()),runningTasks:t.Optional(t.Number()),registeredContainerInstances:t.Optional(t.Number()),capacityProviders:t.Optional(t.Array(t.String()))}),rQ=t.Object({status:t.Optional(t.String()),desiredStatus:t.Optional(t.String()),healthStatus:t.Optional(t.String()),availabilityZone:t.Optional(t.String()),startedAt:t.Optional(S())}),nQ=t.Object({isEncrypted:t.Optional(t.Boolean()),ownerId:t.Optional(t.String()),state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","updating"]))}),oQ=t.Object({type:t.Optional(t.String()),osType:t.Optional(t.String()),subnetIds:t.Optional(t.Array(t.String())),nbContainers:t.Optional(t.Number())}),iQ=t.Object({digest:t.String(),imageTags:t.Array(t.String()),imageSizeBytes:t.Optional(t.Number()),imagePushedAt:t.Optional(S()),mediaType:t.Optional(t.String()),repositoryName:t.String(),repositoryId:t.Optional(t.String()),scanStatus:t.Optional(t.String())}),sQ=t.Object({url:t.Optional(t.String()),maxMessageSizeBytes:t.Optional(t.Number()),messageRetentionHours:t.Optional(t.Number())}),aQ=t.Object({runtime:t.Optional(t.String()),memoryAllocationMib:t.Optional(t.Number()),timeoutMs:t.Optional(t.Number()),ephemeralStorageMib:t.Optional(t.Number({description:"Size of the temporary storage mounted on the function instance, in MiB. Only present for platforms that expose it, such as AWS Lambda."})),codeSha256:t.Optional(t.String())}),cQ=t.Object({kind:t.Optional(t.String())}),pQ=t.Object({instanceId:t.String(),architecture:t.Optional(t.String()),instanceType:t.Optional(t.String()),operatingSystem:t.Optional(t.String()),memoryMib:t.Optional(t.Number()),vCpus:t.Optional(t.Number()),vpcId:t.Optional(t.String()),k8sClusterId:t.Optional(t.String())}),uQ=t.Object({id:t.Optional(t.String()),ipCidrBlocks:t.Array(t.String())}),lQ=t.Object({protocol:t.Optional(bh),port:t.Optional(t.Number()),instanceProtocol:t.Optional(bh),instancePort:t.Optional(t.Number())}),mQ=t.Object({protocol:t.Optional(t.String()),ports:t.Optional(t.Array(t.String())),portRange:t.Optional(t.String()),allPorts:t.Optional(t.Boolean())}),dQ=t.Object({name:t.String(),ip:t.Optional(t.String()),type:t.Enum(["public","private"])}),fQ=t.Object({type:t.String(),name:t.String()}),gQ=t.Object({frontendIp:t.Optional(dQ),backendIpPools:t.Array(fQ)}),hQ=t.Object({targetId:t.String(),targetPort:t.Optional(t.Number()),targetType:t.Optional(t.Enum(["instance","ip","lambda","alb"])),healthState:t.Optional(t.String()),healthReason:t.Optional(t.String()),healthDescription:t.Optional(t.String()),availabilityZone:t.Optional(t.String())}),yQ=t.Object({protocol:t.Optional(bh),port:t.Optional(t.Number()),type:t.Optional(t.Enum(["alb","lambda","instance","ip"])),name:t.Optional(t.String()),targetGroupArn:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),healthCheckProtocol:t.Optional(t.String()),healthCheckPort:t.Optional(t.String()),healthCheckPath:t.Optional(t.String()),healthCheckIntervalSeconds:t.Optional(t.Number()),healthCheckTimeoutSeconds:t.Optional(t.Number()),healthyThresholdCount:t.Optional(t.Number()),unhealthyThresholdCount:t.Optional(t.Number()),targets:t.Optional(t.Array(hQ)),targetCount:t.Optional(t.Number()),healthyTargetCount:t.Optional(t.Number()),loadBalancerArns:t.Optional(t.Array(t.String()))}),TQ=t.Object({first:t.Optional(t.String()),last:t.Optional(t.String()),scope:t.Optional(t.Number())}),EQ=t.Object({type:t.Optional(t.String()),name:t.Optional(t.String()),alwaysServe:t.Optional(t.Boolean()),subnets:t.Optional(t.Array(t.Union([t.Number(),TQ]))),target:t.Optional(t.String()),weight:t.Optional(t.Number()),priority:t.Optional(t.Number()),status:t.Optional(t.String())}),_Q=t.Object({instanceId:t.Optional(t.String()),state:t.Optional(t.String()),reasonCode:t.Optional(t.String()),description:t.Optional(t.String())}),IQ=t.Object({loadBalancerType:t.Optional(t.String()),dnsName:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnetIds:t.Array(t.String()),scheme:t.Optional(t.String()),listeners:t.Optional(t.Union([t.Array(lQ),t.Array(mQ)])),targets:t.Optional(t.Union([t.Array(t.String()),t.Array(_Q),t.Array(EQ)])),azureLoadBalancingRules:t.Optional(t.Array(gQ))}),SQ=t.Object({domainName:t.Optional(t.String()),expiresAt:t.Optional(S()),inUseBy:t.Optional(t.Array(t.String())),renewalEligibility:t.Optional(t.String()),revokedAt:t.Optional(S()),status:t.Optional(t.String()),type:t.Optional(t.String())}),bQ=t.Object({state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","in-use"])),volumeType:t.Optional(t.Enum(["gp2","gp3","io1","io2","st1","sc1","standard"]))}),OQ=t.Object({osType:t.Optional(t.Enum(["Windows","Linux"]))}),AQ=t.Object({state:t.Optional(t.String()),volumeType:t.Optional(t.String())}),xQ=t.Intersect([t.Object({isEncrypted:t.Optional(t.Boolean()),sizeGib:t.Optional(t.Number())}),t.Union([bQ,AQ,OQ])]),RQ=t.Object({instanceCount:t.Optional(t.Number()),hostnames:t.Optional(t.Array(t.String())),runtime:t.Optional(t.String())}),Fl=t.Union([t.Object({category:t.Literal("application"),resourceType:t.Literal("webService"),attributes:t.Optional(RQ)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("bucket"),attributes:t.Optional(W9)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("messagingService"),attributes:t.Optional(sQ)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("fileSystem"),attributes:t.Optional(nQ)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("contentDeliveryNetwork"),attributes:t.Optional(Z9)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("database"),attributes:t.Optional(X9)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("storageAccount"),attributes:t.Optional(cQ)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("volume"),attributes:t.Optional(xQ)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("virtualMachine"),attributes:t.Optional(pQ)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("serverless"),attributes:t.Optional(aQ)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("kubernetesCluster"),attributes:t.Optional(J9)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerRepository"),attributes:t.Optional(eQ)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerCluster"),attributes:t.Optional(tQ)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerServiceTask"),attributes:t.Optional(rQ)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerService"),attributes:t.Optional(oQ)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerImage"),attributes:t.Optional(iQ)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("virtualNetwork"),attributes:t.Optional(uQ)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("loadBalancer"),attributes:IQ}),t.Object({category:t.Literal("network"),resourceType:t.Literal("targetGroup"),attributes:t.Optional(yQ)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("certificate"),attributes:t.Optional(SQ)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var jo="/v0/inventory",tL=["scan_in_progress","success","failure","partial"],Ah=t.Object({id:t.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:t.Enum(Dn,{description:"Cloud platform where Tsuga discovered this resource."}),cloudAccount:t.String({description:"Cloud-native account identifier where Tsuga discovered this resource, such as an AWS account ID, GCP project ID, or Azure subscription ID."}),cloudRegion:t.Optional(t.String({description:"Cloud region where Tsuga discovered this resource, when the resource is regional."})),fullyQualifiedResourceId:t.String({description:"Cloud-native unique identifier for this resource, such as an AWS ARN, GCP resource name, or Azure resource ID."}),displayName:t.String({description:"Human-readable resource name shown in Tsuga. Derived from cloud provider metadata when available."}),nativeResourceType:t.String({description:"Cloud-native resource type reported by the inventory integration, for example `aws_ec2_instance` or `gcp_bucket`."}),resourceCreatedAt:t.Optional(S({description:"Timestamp when the resource was created in the cloud, when known."})),resourceUpdatedAt:t.Optional(S({description:"Timestamp when the resource was last updated in the cloud, when known."})),resourceLastSeenAt:S({description:"Timestamp when Tsuga last observed this resource during an inventory scan."}),tags:we,nativeAttributes:t.Optional(t.Unsafe({type:"object",additionalProperties:!0})),covered:t.Optional(t.Boolean({description:"Whether the resource is covered by the configured infrastructure-as-code identifiers"}))}),ys={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},rL=t.Object({cloudPlatforms:ee(t.Enum(Dn),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:Dn.length}),cloudAccounts:ee(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud accounts",maxItems:500}),cloudRegions:ee(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud regions",maxItems:500}),nativeResourceTypes:ee(t.Enum(ic),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:ic.length}),resourceTypes:ee(t.Enum($l),{description:"Restrict results to resources of any of these normalized resource types",maxItems:$l.length}),tags:ee(St.items,{description:"Restrict results to resources that have at least one of the listed key/value tags",maxItems:50}),isIacManaged:t.Boolean({description:"Restrict results by infrastructure-as-code coverage. When true, only resources covered by the configured IaC identifiers are returned; when false, only uncovered resources are returned."}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Case-insensitive substring matched against resource ID, display name, fully-qualified resource ID, cloud account, region, and resource type. Use the `tags` filter to narrow by tag. Wildcard characters are treated literally."}),exclude:t.Optional(t.Boolean({description:"If true, exclude resources matching this value instead of including them"}))},{description:"Search query filter for resources."})},{description:"Optional filters applied to narrow the returned resources"}),xh=t.Partial(t.Object({...ne,filters:t.Partial(rL,{description:"Filters applied to narrow the returned resources."}),sort:t.Object({by:t.Enum([ys.DISPLAY_NAME,ys.CLOUD_ACCOUNT,ys.NATIVE_RESOURCE_TYPE,ys.CLOUD_REGION,ys.RESOURCE_TYPE,ys.RESOURCE_CREATED_AT],{description:"Field to sort the returned resources by"}),direction:K},{description:"Optional sorting applied to the returned resources. Ties are broken by resource ID for stable pagination."})})),tnt=d({tags:["inventory"],method:"POST",url:`${jo}/resources/query`,paginated:!0,body:xh,response:t.Array(t.Intersect([Ah,Fl]))}),CQ=["resourceType","cloudAccount","isIacManaged"],rnt=d({tags:["inventory"],method:"POST",url:`${jo}/resources/counts`,body:t.Object({filters:t.Optional(t.Partial(rL)),groupBy:t.Enum(CQ,{description:"Dimension to group the resource counts by."})}),response:t.Array(t.Object({value:t.String({description:'The group value the count belongs to: a resource type, a cloud account id, or "true"/"false" for IaC coverage.'}),count:t.Integer({description:"Number of resources in this group matching the requested filters."})}))}),nnt=d({tags:["inventory"],method:"GET",url:`${jo}/resources/filter-options`,response:t.Object({cloudRegions:t.Array(t.String(),{description:"Distinct cloud regions present across the tenant's resources."}),nativeResourceTypes:t.Array(t.String(),{description:"Distinct cloud-native resource types present across the tenant's resources."}),tags:It})}),ont=x("type",[t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({description:"AWS account ID that Tsuga scans."}),externalId:t.String({description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:t.String({description:"ARN of the IAM role Tsuga assumes to read inventory in the account."})}),t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({description:"GCP project ID that Tsuga scans."}),serviceAccountId:t.String({description:"Service account Tsuga impersonates to read inventory."}),workloadIdentityProvider:t.String({description:"Workload identity provider resource name used for federated authentication."})}),t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({description:"Client ID of the Azure application Tsuga authenticates as."}),subscriptionId:t.String({description:"Azure subscription ID that Tsuga scans."}),tenantId:t.String({description:"Azure tenant ID that owns the subscription."})})]),PQ="^[0-9]{12}$",UQ="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",NQ="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",wQ="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",vQ="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",Oh="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",LQ=t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({pattern:PQ,description:"AWS account ID that Tsuga scans.",errorMessage:{pattern:"Must be a 12-digit AWS account ID."}}),externalId:p({allowEmpty:!1,description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:t.String({pattern:UQ,minLength:1,maxLength:2048,description:"ARN of the IAM role Tsuga assumes to read inventory in the account.",errorMessage:{pattern:"Must be an IAM role ARN, e.g. arn:aws:iam::123456789012:role/MyRole."}})},{$id:"AwsConnectionSettings"}),kQ=t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({pattern:NQ,minLength:6,maxLength:30,description:"GCP project ID that Tsuga scans.",errorMessage:{pattern:"Must be a GCP project ID (6-30 chars: lowercase letters, digits, hyphens)."}}),serviceAccountId:t.String({pattern:wQ,minLength:1,maxLength:128,description:"Service account Tsuga impersonates to read inventory.",errorMessage:{pattern:"Must be a service account email, e.g. name@project.iam.gserviceaccount.com."}}),workloadIdentityProvider:t.String({pattern:vQ,minLength:1,maxLength:256,description:"Full resource name of the workload identity provider used for federated authentication, e.g. //iam.googleapis.com/projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider.",errorMessage:{pattern:"Must be the full provider resource name: //iam.googleapis.com/projects/<PROJECT_NUMBER>/locations/global/workloadIdentityPools/<POOL_ID>/providers/<PROVIDER_ID>."}})},{$id:"GcpConnectionSettings"}),MQ=t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({pattern:Oh,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:t.String({pattern:Oh,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:t.String({pattern:Oh,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),nL=x("type",[LQ,kQ,MQ],{description:"Credentials Tsuga uses to scan the account, in the provider-specific shape selected by `type`. Credentials are stored as provided and are not validated at creation time; failures surface through `lastScanStatus`."}),Ts=t.Object({id:t.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:t.Enum(Dn,{description:"Cloud provider of the account."}),cloudAccountId:t.String({description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:t.Optional(t.String({description:"Human-readable name for the account shown in Tsuga."})),organizationId:t.Optional(t.String({description:"Cloud organization identifier, when known."})),createdBy:t.Optional(t.String({description:"Identifier of the user who created the account, when created by a user."})),createdAt:S({description:"Timestamp when the account was registered in Tsuga."}),lastScanStartedAt:t.Optional(S({description:"Timestamp when the most recent inventory scan started."})),lastScanFinishedAt:t.Optional(S({description:"Timestamp when the most recent inventory scan finished."})),lastScanStatus:t.Optional(t.Enum(tL,{description:"Status of the most recent inventory scan."}))}),Rh=t.Object({cloudType:t.Enum(Dn,{description:"Cloud provider of the account."}),cloudAccountId:p({allowEmpty:!1,description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:t.Optional(p({description:"Human-readable name for the account shown in Tsuga."})),organizationId:t.Optional(p({description:"Cloud organization identifier, when known."})),connectionSettings:nL,lastScanStatus:t.Optional(t.Enum(tL,{description:"Status of the most recent inventory scan."}))}),qo=`${jo}/cloud-accounts`,int=d({tags:["inventory"],url:qo,method:"GET",response:t.Array(Ts)}),snt=d({tags:["inventory"],url:`${qo}/:id`,method:"GET",params:t.Object({id:p()}),response:Ts}),ant=d({tags:["inventory"],url:qo,method:"POST",body:Rh,response:Ts}),Ch=t.Object({accountFriendlyName:p({description:"Human-readable name for the account shown in Tsuga."})}),cnt=d({tags:["inventory"],url:`${qo}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ch,response:Ts}),pnt=d({tags:["inventory"],url:`${qo}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),unt=d({tags:["inventory"],url:`${jo}/trigger-scan`,method:"POST",body:t.Object({}),response:t.Object({success:t.Literal(!0)})}),lnt=d({tags:["inventory"],url:`${qo}/azure/onboarding`,method:"POST",body:t.Object({tenantId:p()}),response:t.Object({subjectId:t.String(),audience:t.String()})}),mnt=d({tags:["inventory"],method:"POST",url:`${qo}/validate/:type`,params:t.Object({type:p()}),body:t.Object({data:nL,id:t.Optional(p())}),response:t.Object({areAccountSettingsValid:t.Boolean(),message:t.Optional(t.String())})}),oL=`${jo}/settings`,dnt=d({tags:["inventory"],url:oL,method:"GET",response:t.Object({settings:t.Optional(t.Object({id:t.String(),infrastructureIdentifiers:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))}))})}),DQ=50,fnt=d({tags:["inventory"],url:oL,method:"POST",body:t.Object({infrastructureIdentifiers:t.Array(t.Object({name:p({allowEmpty:!1}),value:t.Optional(p({allowEmpty:!1}))}),{maxItems:DQ})}),response:t.Object({})}),gnt=d({tags:["inventory"],url:`${jo}/iac-tags-proposal`,method:"GET",response:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))});var iL=`/${"v1"}/inventory`,GQ=t.Omit(Ah,["nativeAttributes","covered"],{$id:"InventoryResourceBase",description:"Base fields shared by cloud resources discovered during inventory scans. Public inventory resources omit raw provider-native attributes and infrastructure-as-code coverage fields. See [Cloud resources](/documentation/categorize/cloud-resources)."}),sL=t.Intersect([GQ,Fl],{$id:"InventoryResource",description:"Cloud resource discovered by an inventory scan, together with normalized category, resource type, and public category-specific attributes. See [Cloud resources](/documentation/categorize/cloud-resources)."}),$Q={id:"123-456-abc",cloudPlatform:"aws",cloudAccount:"123456789012",cloudRegion:"us-east-1",fullyQualifiedResourceId:"arn:aws:s3:::tsuga-example-bucket",displayName:"tsuga-example-bucket",nativeResourceType:"aws_s3_bucket",resourceCreatedAt:"2024-01-01T08:00:00.000Z",resourceLastSeenAt:"2024-01-15T12:34:56.000Z",tags:[{key:"team",value:"platform"}],category:"data",resourceType:"bucket",attributes:{versioningStatus:"Enabled"}};Object.assign(sL,{examples:[$Q]});var aL=t.Object({...xh.properties,...qe},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),FQ={filters:{cloudPlatforms:{values:["aws"]},cloudAccounts:{values:["123456789012"]},cloudRegions:{values:["us-east-1"]},resourceTypes:{values:["bucket"]},nativeResourceTypes:{values:["aws_s3_bucket"]},tags:{values:[{key:"team",value:"platform"}]},isIacManaged:!0,searchQuery:{value:"tsuga-example"}},sort:{by:"displayName",direction:"asc"},limit:10,offset:0};Object.assign(aL,{examples:[FQ]});var cL=d({description:"Queries cloud resources discovered by inventory scans, with optional filters, sorting, and pagination. Use this endpoint to build infrastructure inventories across connected cloud accounts.",operationId:"queryInventoryResources",tags:["inventory"],url:`${iL}/resources/query`,method:"POST",paginated:!0,body:aL,response:t.Array(sL)}),sc=`${iL}/cloud-accounts`,ac=t.Pick(Ts,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),jQ={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(ac,{examples:[jQ]});var pL=t.Pick(Rh,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),qQ={cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS",connectionSettings:{type:"aws",accountId:"123456789012",externalId:"tsuga-external-id",roleArn:"arn:aws:iam::123456789012:role/tsuga-inventory"}};Object.assign(pL,{examples:[qQ]});var BQ=t.Pick(Ch,["accountFriendlyName"]),Ont=d({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:sc,method:"GET",response:t.Array(ac)}),Ant=d({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${sc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to retrieve. Use the `id` returned by the cloud account list or create operations."})}),response:ac}),xnt=d({description:"Registers a cloud account for inventory scanning. Connection settings are stored as provided and are not validated at creation time; scan failures surface through `lastScanStatus`.",operationId:"createCloudAccount",tags:["inventory"],url:sc,method:"POST",body:pL,response:ac}),Rnt=d({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${sc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to update. Use the `id` returned by the cloud account list or create operations."})}),body:BQ,response:ac}),Cnt=d({description:"Deletes a cloud account by ID. Future inventory scans stop for the account, and the trust relationship on the cloud side can be safely removed afterward.",operationId:"deleteCloudAccount",tags:["inventory"],url:`${sc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to delete. Use the `id` returned by the cloud account list or create operations."})}),response:w});var cc="/v0/investigations",HQ=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],KQ=t.Object({type:t.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:t.String({description:"Identifier of the linked asset"})}),zQ=t.Object({type:t.Enum(HQ,{description:"Kind of linked asset"}),id:p({allowEmpty:!1,description:"Identifier of the linked asset"})}),pn=t.Object({id:t.String({description:"Identifier of the investigation"}),name:t.String({description:"Human readable name shown for the investigation"}),slug:t.Optional(t.String({description:'Immutable identifier supplied by the creating agent, e.g. "incident-2024-06-payments-5xx". Set once at creation and matched against the agent telemetry to link back to the run that created the investigation.'})),contentMd:t.Optional(t.String({description:"Markdown content capturing the investigation notes and findings"})),tags:we,owner:t.String({description:"Team ID owning the investigation"}),env:t.Optional(t.String({description:'Environment the investigation relates to, e.g. "prod"'})),linkedAssets:t.Array(KQ,{description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}),creator:t.Optional(pe),updater:t.Optional(pe),createdAt:S({description:"Timestamp the investigation was created at."}),updatedAt:S({description:"Timestamp the investigation was last updated at."})},{title:"Investigation"}),jl=t.Object({name:p({allowEmpty:!1,description:"Human readable name shown for the investigation"}),slug:p({type:"kebab-case",allowEmpty:!1,description:'Immutable, unique identifier supplied by the creating agent, used to link the investigation back to the agent run, e.g. "incident-2024-06-payments-5xx". The agent should also emit this value in its telemetry.'}),contentMd:Se(p({type:"long"}),{description:"Markdown content capturing the investigation notes and findings"}),tags:De,owner:p({allowEmpty:!1,description:"Team ID owning the investigation"}),env:Se(p({allowEmpty:!0}),{description:"Environment the investigation relates to"}),linkedAssets:t.Optional(t.Array(zQ,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),Ph=t.Object(t.Omit(jl,["slug"]).properties),Mnt=d({tags:["investigations"],url:cc,method:"GET",paginated:!0,query:t.Object(ne),response:t.Array(pn)}),Dnt=d({tags:["investigations"],url:`${cc}/:id`,params:t.Object({id:p()}),method:"GET",response:pn}),Gnt=d({tags:["investigations"],url:cc,method:"POST",body:jl,response:pn}),$nt=d({tags:["investigations"],url:`${cc}/:id`,method:"PUT",body:Ph,params:t.Object({id:p()}),response:pn}),Fnt=d({tags:["investigations"],url:`${cc}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w});var pc=`/${"v1"}/investigations`,uL=d({description:"Retrieve all investigations",tags:["private"],url:pc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(pn)}),lL=d({description:"Retrieve an investigation by its id",tags:["private"],url:`${pc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:pn}),mL=d({description:"Create a new investigation",tags:["private"],url:pc,method:"POST",body:jl,response:pn}),dL=d({description:"Update an investigation by its id",tags:["private"],url:`${pc}/:id`,method:"PUT",body:Ph,params:t.Object({id:p({allowEmpty:!1})}),response:pn}),fL=d({description:"Delete an investigation by its id",tags:["private"],url:`${pc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:w});var gL=15,ql={id:t.String({description:"Unique identifier of the processor within the route. Used to preserve processor identity during updates."}),description:t.Optional(t.String({description:"Optional user-provided processor note."})),tags:we,updatedAt:t.Optional(S({description:"Timestamp when Tsuga last updated the processor."}))},Bl={id:p({allowEmpty:!1,description:"Unique identifier of the processor within the route. Preserve it across updates for existing processors."}),description:t.Optional(p({type:"long",description:"Optional processor note."})),tags:De,updatedAt:t.Optional(S({description:"Backend-maintained timestamp for this processor. Omit this field on create and update requests; Tsuga sets or preserves it based on processor changes."}))},hL={...ql,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},yL={...Bl,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},YQ=x("subtype",[t.Object({targetAttribute:t.String({description:"Attribute that will receive the formatted value"}),formatString:t.String({description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:t.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Whether missing referenced attributes render as empty strings. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorFormatString"}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the computed value"}),formula:t.String({description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:t.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:t.Optional(t.Boolean({description:"Whether missing referenced attributes evaluate as zero. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorMathFormula"}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:t.String({description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:t.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(t.String({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:t.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"ProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),VQ=x("subtype",[t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:p({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))},{$id:"InputProcessorParamsCreatorFormatString"}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the computed value"}),formula:p({allowEmpty:!1,type:"long",description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to evaluate as zero. Defaults to true."}))},{$id:"InputProcessorParamsCreatorMathFormula"}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:p({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:p({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:gL,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(p({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:t.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"InputProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),QQ=t.Object({...hL,params:YQ}),WQ=t.Object({...yL,params:VQ}),TL={...ql,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},EL={...Bl,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},ZQ=x("subtype",[t.Object({attributes:t.Array(t.Object({originAttribute:t.String({description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Whether the source attribute is preserved after mapping. If omitted, route processing treats this as false."})),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),targetAttribute:t.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"ProcessorParamsMapperMapAttributes"}),t.Object({attributeName:t.String({description:"Attribute whose value will determine the log level"}),subtype:t.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"ProcessorParamsMapperMapLevel"}),t.Object({attributeName:t.String({description:"Attribute whose value will determine the log timestamp"}),subtype:t.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"ProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),XQ=x("subtype",[t.Object({attributes:t.Array(t.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:t.Optional(t.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:p({allowEmpty:!1,description:"Attribute name that will receive the mapped value"})}),{minItems:1,maxItems:50,description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"InputProcessorParamsMapperMapAttributes"}),t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:t.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"InputProcessorParamsMapperMapLevel"}),t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:t.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"InputProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),JQ=t.Object({...EL,params:XQ}),e6=t.Object({...TL,params:ZQ}),_L={...ql,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},IL={...Bl,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},SL=5,t6=x("subtype",[t.Object({attributeName:t.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(t.String({description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(t.String(),{description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:t.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the URL to parse"}),subtype:t.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the user agent string to parse"}),subtype:t.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the key/value string segment to parse"}),targetAttribute:t.String({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:t.String({description:"Delimiter separating keys from values in the source string"}),pairsSplitter:t.String({description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:t.Boolean({description:"Whether keys without explicit values are accepted by the parser."}),subtype:t.Literal("key-value",{description:"Parses delimited key/value text into attributes."})})],{description:"Parse processor configuration. The `subtype` discriminator selects which parser reads the source text attribute and which fields it extracts."}),r6=x("subtype",[t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(p({type:"long"}),{maxItems:SL,description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:t.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:t.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:t.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the key/value string segment to parse"}),targetAttribute:p({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:p({allowEmpty:!1,description:"Delimiter separating keys from values in the source string"}),pairsSplitter:p({allowEmpty:!0,description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:t.Boolean({description:"Set to true to accept keys without explicit values."}),subtype:t.Literal("key-value",{description:"Parses delimited key/value text into attributes."})})],{description:"Parse processor configuration. The `subtype` discriminator selects which parser reads the source text attribute and which fields it extracts."}),n6=t.Object({..._L,params:t6}),o6=t.Object({...IL,params:r6}),i6=t.Object({...yL,params:x("subtype",[t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:p({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("format-string"),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:p({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:p({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:gL,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(p({description:"String category value used when no clause matches."})),subtype:t.Literal("category")})])}),s6=t.Object({...EL,params:t.Object({attributes:t.Array(t.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:t.Optional(t.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:p({allowEmpty:!1,description:"Attribute name that will receive the mapped value"})}),{minItems:1,maxItems:50,description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes")})}),a6=t.Object({...IL,params:t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(p({type:"long"}),{maxItems:SL,description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),Jnt=x("type",[s6,a6,i6]),c6=t.Object({...hL,params:x("subtype",[t.Object({targetAttribute:t.String({description:"Attribute that will receive the formatted value"}),formatString:t.String({description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),subtype:t.Literal("format-string"),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Whether missing referenced attributes render as empty strings."}))}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:t.String({description:"Query that selects logs for this category clause."}),value:t.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value."}),defaultValue:t.Optional(t.String({description:"String category value used when no clause matches."})),subtype:t.Literal("category")})])}),p6=t.Object({...TL,params:t.Object({attributes:t.Array(t.Object({originAttribute:t.String({description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Whether the source attribute is preserved after mapping."})),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),targetAttribute:t.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes")})}),u6=t.Object({..._L,params:t.Object({attributeName:t.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(t.String({description:"Grok rule applied to parse text."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(t.String(),{description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),eot=x("type",[p6,u6,c6]),l6=11,bL=t.Cyclic({OutputProcessor:t.Union([e6,n6,QQ,t.Object({...ql,params:t.Object({items:t.Array(t.Object({query:t.String({description:"Query that determines whether logs enter this branch"}),processors:t.Array(t.Ref("OutputProcessor"),{description:"Processors executed when the branch query matches"})}),{description:"Conditional branches evaluated in order before falling back to the default"})}),type:t.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"OutputProcessor",{description:"Processing step executed sequentially on route logs"}),OL=t.Cyclic({InputProcessor:t.Union([JQ,o6,WQ,t.Object({...Bl,params:t.Object({items:t.Array(t.Object({query:p({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:t.Array(t.Ref("InputProcessor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:l6,description:"Conditional branches evaluated in order before falling back to the default"})}),type:t.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"InputProcessor",{description:"Processing step executed sequentially on route logs"});var m6="/v0/logs",Br=`${m6}/routes`,un=t.Object({id:t.String({description:"Tsuga-generated log route ID assigned when the route is created."}),name:t.String({description:"Human-readable route name shown in Tsuga."}),description:t.Optional(t.String({description:"Optional free-text note about the route's purpose, set by the caller. This metadata is not evaluated when matching or processing logs."})),isEnabled:t.Boolean({description:"Whether this route is active for newly ingested logs. Disabled routes remain saved but do not process logs."}),query:t.String({description:"Tsuga query that selects which newly ingested logs enter the route processor chain."}),rank:t.Number({description:"Tsuga-assigned evaluation order, unique across all routes and dense (no gaps). Enabled routes are checked from lower rank to higher rank during ingestion, and every route whose query matches a log applies its processors to it \u2014 matching is not stopped after the first hit. New routes are appended with the highest rank; deleting a route shifts all higher ranks down by one to close the gap. Use `PUT /:id/modify-ranking` to move a route to a different rank, which shifts the routes between its old and new position accordingly."}),tags:we,owner:t.String({description:"ID of the team that owns the route. Determines which team members can view and manage it, and which tag policies apply to it. Only an org admin or an admin of this team may change fields other than `processors`, or delete the route."}),processors:t.Array(bL,{description:"Processors applied in array order to logs that match the route, each transforming the output of the previous one. A `split` processor forks the chain into branches and cannot be followed by another processor at the same level."}),creator:t.Optional(pe),updater:t.Optional(pe),updatedAt:S({description:"Timestamp when Tsuga last updated the route."}),createdAt:S({description:"Timestamp when Tsuga created the route."}),assetUpdatedAt:S({description:"Timestamp when Tsuga last changed route behavior. This can differ from `updatedAt` when only metadata such as `description` or `tags` changed."})},{title:"LogRoute"}),uc=t.Object({name:p({allowEmpty:!1,description:"Human-readable log route name shown in Tsuga."}),description:Se(p({type:"long"}),{description:"Optional free-text note about the log route's purpose. This metadata is not evaluated when matching or processing logs."}),isEnabled:t.Boolean({description:"Set to true for the log route to process newly ingested matching logs. Set to false to save it without running it."}),query:p({type:"tsuga-query",description:"Tsuga query that selects which newly ingested logs enter the log route processor chain."}),tags:De,owner:p({allowEmpty:!1,description:"ID of the team that will own the log route, determining which team members can view and manage it and which tag policies apply. Only an org admin or an admin of this team may change fields other than `processors`, or delete the route."}),processors:t.Array(OL,{maxItems:50,description:"Processors applied in array order to logs that match the log route, each transforming the output of the previous one. Up to 50 are accepted. A `split` processor forks the chain into branches and cannot be followed by another processor at the same level."})});var d6=["active","inactive"],f6=["isEnabled","name","query","owner","tags","processors","rank","assetUpdatedAt"],AL=t.Object({owners:ee(p({allowEmpty:!1}),{description:"Restrict results to routes owned by any of these team IDs.",maxItems:50}),searchQuery:hr({description:"Search query filter for routes.",valueDescription:"Case-insensitive substring matched against route name and ID."}),status:t.Enum(d6,{description:"Restrict results to enabled (`active`) or disabled (`inactive`) routes."})}),g6=t.Partial(t.Object({...ne,filters:t.Partial(AL),sort:t.Object({by:t.Enum(f6,{description:"Field to sort the returned routes by."}),direction:K})})),h6=t.Object({filters:t.Optional(t.Partial(t.Omit(AL,["status"]),{description:"Filters applied before counting enabled and disabled routes."}))}),y6=t.Object({totalCount:t.Integer({description:"Number of matching routes, whether they are enabled or disabled."}),active:t.Integer({description:"Number of matching routes that are enabled."}),inactive:t.Integer({description:"Number of matching routes that are disabled."})}),pot=d({tags:["routes"],url:`${Br}/query`,method:"POST",paginated:!0,body:g6,response:t.Array(un,{description:"Matching log routes after they are filtered, sorted, and paginated."})}),uot=d({tags:["routes"],url:`${Br}/counts/query`,method:"POST",body:h6,response:y6}),lot=d({tags:["routes"],url:Br,method:"GET",paginated:!0,query:t.Object(ne),response:t.Array(un)}),mot=d({tags:["routes"],url:`${Br}/:id`,params:t.Object({id:p()}),method:"GET",response:un}),dot=d({tags:["routes"],url:Br,method:"POST",body:uc,response:un}),fot=d({tags:["routes"],url:`${Br}/:id`,method:"PUT",body:uc,params:t.Object({id:p()}),response:un}),got=d({tags:["routes"],url:`${Br}/:id/clone`,method:"POST",params:t.Object({id:p()}),body:uc,response:un}),hot=d({tags:["routes"],url:`${Br}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),yot=d({description:"Moves a route to a new rank, shifting the ranks of the routes between its old and new position by one to keep ranks dense and unique. Affects the route's evaluation order for newly ingested logs; does not change any route's processors or other fields.",tags:["routes"],url:`${Br}/:id/modify-ranking`,method:"PUT",params:t.Object({id:p()}),body:t.Object({rank:t.Integer({minimum:1,description:"Target rank for the route, from 1 to the total number of routes. Requests outside that range are rejected."})}),response:t.Object({})}),Tot=d({description:"Sets a route's `isEnabled` state without changing any other field. Disabling a route stops it from processing newly ingested logs while keeping it saved and its rank unchanged.",tags:["routes"],url:`${Br}/:id/enable`,method:"PUT",params:t.Object({id:p()}),body:t.Object({enable:t.Boolean({description:"Set to true to enable the route, or false to disable it."})}),response:un});var lc=`/${"v1"}/routes`,xL={name:"Enrich API Gateway Logs",description:"Adds service metadata and normalizes log format",isEnabled:!0,query:"service:api-gateway",tags:[{key:"category",value:"enrichment"}],owner:"team-123-abc",processors:[{id:"parse-gateway-message",type:"parse-attribute",tags:[],params:{subtype:"grok",attributeName:"message",rules:["%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:msg}"]}}]},RL={name:"Normalize Checkout Logs",description:"Maps service fields and extracts key/value details",isEnabled:!0,query:"context.service.name:checkout",tags:[{key:"category",value:"normalization"}],owner:"team-123-abc",processors:[{id:"map-service-name",type:"mapper",tags:[],params:{subtype:"map-attributes",attributes:[{originAttribute:"context.service.name",targetAttribute:"service",keepOrigin:!1,overrideTarget:!0}]}},{id:"parse-logfmt-message",type:"parse-attribute",tags:[],params:{subtype:"key-value",sourceAttribute:"message",targetAttribute:"logfmt",keyValueSplitter:"=",pairsSplitter:" ",acceptStandaloneKey:!1}}]},mc=t.Pick(un,["id","name","description","isEnabled","query","tags","owner","processors"],{$id:"Route",description:"Team-owned log processing definition that selects newly ingested logs and applies ordered processors. See [Routes](/documentation/process/routes/index)."}),T6={id:"123-456-abc",...xL},E6={id:"456-789-def",...RL};Object.assign(mc,{examples:[T6,E6]});var CL=d({description:"Lists log routes visible to the authenticated operation key. Returned routes are ordered by evaluation order, with earlier routes evaluated first. Use this to inventory ingest-time processing definitions and owners. Pagination fields limit the returned page.",operationId:"listRoutes",tags:["routes"],url:lc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(mc)}),PL=d({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${lc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to retrieve. Use the `id` returned by route list or create responses."})}),response:mc}),Uh=t.Pick(uc,["name","description","isEnabled","query","tags","owner","processors"],{description:"Log route create or update request. Provide the route metadata, source query, owner team, enabled state, tags, and ordered processors."});Object.assign(Uh,{examples:[xL,RL]});var UL=d({description:"Creates a log route at the end of the evaluation order. Routes affect only newly ingested logs after the cluster receives the updated configuration.",operationId:"createRoute",tags:["routes"],url:lc,method:"POST",body:Uh,response:mc}),NL=d({description:"Updates an existing log route by ID without changing its evaluation order. Fields omitted from the request keep their existing values. Routes affect only newly ingested logs after the cluster receives the updated configuration.",operationId:"updateRoute",tags:["routes"],url:`${lc}/:id`,method:"PUT",body:Uh,params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to update. Use the `id` returned by route list, get, or create responses."})}),response:mc}),wL=d({description:"Deletes a log route by ID and compacts the evaluation order for remaining routes. The route stops processing future logs after the cluster receives the updated configuration.",operationId:"deleteRoute",tags:["routes"],url:`${lc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to delete. Use the `id` returned by route list, create, or update responses."})}),response:w});var dc=`/${"v1"}/monitors`,fc=t.Pick(an,["id","name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],{$id:"Monitor",description:"Saved alert definition that evaluates telemetry and creates alert transitions. Notification delivery is configured separately with notification rules. See [Monitors](/documentation/alert/monitors/index)."}),LL={name:"High Error Rate Alert",message:"Error rate exceeded threshold. Check the API gateway logs.",tags:[{key:"severity",value:"critical"}],configuration:{type:"log",timeframe:5,groupByFields:[],aggregationAlertLogic:"no_aggregation",queries:[{aggregate:{type:"count"},filter:"level:ERROR service:api-gateway"}],conditions:[{formula:"q1",operator:"greater_than",threshold:100}],noDataBehavior:"resolve"},priority:1,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},kL={name:"High CPU Utilization By Service",message:"More than half of grouped services are above the CPU threshold.",tags:[{key:"severity",value:"warning"}],configuration:{type:"metric",timeframe:10,groupByFields:[{fields:["context.service.name"],limit:10}],aggregationAlertLogic:"proportion",proportionAlertThreshold:50,queries:[{aggregate:{type:"average",field:"system.cpu.utilization"},filter:"context.service.name:checkout"}],conditions:[{formula:"q1",operator:"greater_than",threshold:.8}],noDataBehavior:"keep_last_status"},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},ML={name:"Certificate Expiry Warning",message:"A certificate is approaching expiry.",tags:[{key:"environment",value:"production"}],configuration:{type:"certificate-expiry",warnBeforeInDays:30,cloudAccounts:["aws-prod"],aggregationAlertLogic:"each",noDataBehavior:"resolve"},priority:3,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},DL={name:"New Error Pattern Detector",message:"A new error pattern was detected in the logs.",tags:[{key:"team",value:"platform"}],configuration:{type:"log-error-pattern",aggregationAlertLogic:"each",noDataBehavior:"keep_last_status",filter:{teamIds:["team-123-abc"],env:"production",services:["api-gateway"]}},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},_6={id:"123-456-abc",...LL},I6={id:"234-567-bcd",...kL},S6={id:"345-678-cde",...ML},b6={id:"456-789-def",...DL};Object.assign(fc,{examples:[_6,I6,S6,b6]});var vL=t.Pick(xg,["filters","sort","limit","offset"]),GL=t.Object({...vL.properties,...qe,filters:vL.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),O6={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"service:api-gateway"},tags:{values:[{key:"paging",value:"true"}]},priorities:{values:[4,5],exclude:!0},types:{values:["threshold"]},activity:"active",clusterIds:{values:["cluster-123-abc"]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign(GL,{examples:[O6]});var $L=d({description:"Queries monitors visible to the authenticated operation key. Use this endpoint to inventory monitor definitions, filter by owner, tag, priority, type, activity, or cluster, and page through results. See [Monitors](/documentation/alert/monitors/index).",operationId:"queryMonitors",tags:["monitors"],url:`${dc}/query`,method:"POST",paginated:!0,body:GL,response:t.Array(fc)}),FL=d({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${dc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:fc}),jL=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],qL=t.Pick(Ba,jL,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),BL=t.Pick(Ba,jL,{$id:"UpdateMonitorRequest",description:"Monitor update request. Required fields and the submitted configuration are overwritten; omitted `message`, `tags`, and `clusterIds` keep their existing values. Omitting `dashboardId` clears the dashboard link."}),HL=LL,KL=kL,zL=ML,YL=DL;Object.assign(qL,{examples:[HL,KL,zL,YL]});Object.assign(BL,{examples:[HL,KL,zL,YL]});var VL=d({description:"Creates a monitor owned by the specified team. The monitor can evaluate logs, metrics, traces, anomaly behavior, certificate expiry, or new error patterns depending on its configuration.",operationId:"createMonitor",tags:["monitors"],url:dc,method:"POST",body:qL,response:fc}),QL=d({description:"Updates an existing monitor definition by ID. Required fields and the submitted configuration are overwritten; omitted `message`, `tags`, and `clusterIds` keep their existing values. Omitting `dashboardId` clears the dashboard link, and public updates clear any existing snooze because `pauseUntil` is not part of the public schema.",operationId:"updateMonitor",tags:["monitors"],url:`${dc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to update. Use the `id` returned by monitor query or create responses."})}),body:BL,response:fc}),A6=t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to delete. Use the `id` returned by monitor query, create, or update responses."})}),WL=d({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${dc}/:id`,method:"DELETE",params:A6,response:w});var gc=`/${"v1"}/notification-integrations`,hc=t.Pick(Ya,["id","name","owner","setting","tags"],{$id:"NotificationIntegration",description:"A reusable external destination that notification rules can send to. See [Integrations](/documentation/alert/notifications/index#integrations). Slack integrations are OAuth-based and are not readable, creatable, or editable through this API; connect Slack from the app."}),x6={id:"456-def-abc",name:"Primary on-call",owner:"team-123-abc",setting:{type:"pagerduty",integrationKeyLastChars:"ab12"},tags:[{key:"team",value:"platform"}]};Object.assign(hc,{examples:[x6]});var ZL=d({description:"Lists non-OAuth notification integrations visible to the authenticated operation key. Slack integrations do not appear here because they are OAuth-based. Pagination fields limit the returned page.",operationId:"listNotificationIntegrations",tags:["public","notification-integrations"],url:gc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(hc)}),XL=d({description:"Retrieves one non-OAuth notification integration by ID.",operationId:"getNotificationIntegration",tags:["notification-integrations"],url:`${gc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to retrieve. Use the `id` returned by notification integration list or create responses."})}),response:hc}),JL=t.Pick(Ng,["name","owner","setting","tags"],{description:"Notification integration create request containing the display name, owning team, destination setting, and tags. `setting.type` cannot be `slack`; add Slack integrations from the app instead."}),R6={name:"Primary on-call",owner:"team-123-abc",setting:{type:"pagerduty",integrationKey:"abcdef1234567890ab12"},tags:[{key:"team",value:"platform"}]};Object.assign(JL,{examples:[R6]});var ek=d({description:"Creates a non-OAuth notification integration that notification rules can target as a destination.",operationId:"createNotificationIntegration",tags:["notification-integrations"],url:gc,method:"POST",body:JL,response:hc}),tk=t.Pick(wg,["name","owner","setting","tags"],{description:"Notification integration update request. `owner` has to be sent on every update; the other omitted fields keep their existing values."}),C6={name:"Primary on-call",owner:"team-123-abc"};Object.assign(tk,{examples:[C6]});var rk=d({description:"Updates an existing non-OAuth notification integration by ID. `owner` has to be sent on every update, even when it does not change. The submitted `setting` is overwritten in full; the other omitted fields keep their existing values.",operationId:"updateNotificationIntegration",tags:["notification-integrations"],url:`${gc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to update. Use the `id` returned by notification integration list, get, or create responses."})}),body:tk,response:hc}),nk=d({description:"Deletes a non-OAuth notification integration by ID. Deletion is blocked while a notification rule still targets the integration; remove it from those rules first.",operationId:"deleteNotificationIntegration",tags:["notification-integrations"],url:`${gc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification integration to delete. Use the `id` returned by notification integration list, get, or create responses."})}),response:w});var yc=`/${"v1"}/notification-rules`,Tc=t.Pick(Mo,["id","name","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","isActive","tags","targets"],{$id:"Rule",description:"Notification rule that matches alert transitions and routes notifications to one or more targets. See [Rules](/documentation/alert/notifications/rules)."}),ok={name:"Critical Alerts",queryString:"env:prod service:api",teamsFilter:{type:"all-public-teams"},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"],clusterIdsFilter:[],owner:"team-123-abc",isActive:!0,tags:[{key:"channel",value:"alerts"}],targets:[{id:"789-abc-def",rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}}]},P6={id:"123-456-abc",...ok};Object.assign(Tc,{examples:[P6]});var ik=d({description:"Lists notification rules visible to the authenticated operation key. Use this endpoint to audit alert delivery routing. Pagination fields limit the returned page.",operationId:"listNotificationRules",tags:["notification-rules"],url:yc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(Tc)}),sk=d({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${yc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to retrieve. Use the `id` returned by notification rule list or create responses."})}),response:Tc}),Nh=t.Pick(Ka,["name","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","tags","isActive","targets"],{description:"Notification rule create or update request. Provide matching filters, owner, tags, active state, and delivery targets."}),U6=ok;Object.assign(Nh,{examples:[U6]});var ak=d({description:"Creates a notification rule that matches alert transitions and sends notifications to configured targets. Monitors keep evaluating separately from notification rules.",operationId:"createNotificationRule",tags:["notification-rules"],url:yc,method:"POST",body:Nh,response:Tc}),ck=d({description:"Updates an existing notification rule by ID. Required fields and the submitted target list are overwritten; omitted optional fields keep their existing values.",operationId:"updateNotificationRule",tags:["notification-rules"],url:`${yc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to update. Use the `id` returned by notification rule list, get, or create responses."})}),body:Nh,response:Tc}),N6=t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to delete. Use the `id` returned by notification rule list, get, create, or update responses."})}),pk=d({description:"Deletes a notification rule by ID. Alerting monitors continue to evaluate, but this rule no longer sends notifications.",operationId:"deleteNotificationRule",tags:["notification-rules"],url:`${yc}/:id`,method:"DELETE",params:N6,response:w});var Yn=`${Vi}/silences`,w6=["active","inactive"],lk=t.Union([t.Literal("monday"),t.Literal("tuesday"),t.Literal("wednesday"),t.Literal("thursday"),t.Literal("friday"),t.Literal("saturday"),t.Literal("sunday")]),v6=t.Partial(t.Record(lk,t.Array(t.Object({startTime:t.String({format:hd,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({format:hd,description:"Local end time for this recurring silence window on this day. It must be after `startTime`, and ranges on the same day cannot overlap."})},{title:"SilenceTimeRange"}),{minItems:1,description:"Silence windows for this day. Each window uses the schedule time zone, and windows on the same day cannot overlap."})),{description:"Recurring silence windows keyed by day of week, evaluated in the schedule `timeZone` or in UTC when it is omitted. At least one day must be listed, and a day with no entry is never silenced. Each window covers `startTime` up to but not including `endTime`."}),L6=t.Partial(t.Record(lk,t.Array(t.Object({startTime:t.String({description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({description:"Local end time for this recurring silence window on this day. It must be after `startTime`, and ranges on the same day cannot overlap."})},{title:"SilenceTimeRange"}),{description:"Silence windows for this day. Each window uses the schedule time zone, and windows on the same day cannot overlap."})),{description:"Recurring silence windows keyed by day of week, evaluated in the schedule `timeZone` or in UTC when it is omitted. A day with no entry is never silenced. Each window covers `startTime` up to but not including `endTime`."}),Hl='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',mk="One-time silence schedule with specific start and end times",dk="Recurring weekly silence schedule",k6=x("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({format:yd,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({format:yd,description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future."}),timeZone:t.Optional(t.String({format:ho,description:Hl}))},{$id:"InputSilenceScheduleOneTime",description:mk}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:v6,timeZone:t.Optional(t.String({format:ho,description:Hl}))},{$id:"InputSilenceScheduleRecurring",description:dk})],{description:"Schedule defining when the silence is active. The `type` field discriminates between a `one-time` window and a `recurring` weekly window. Once a one-time schedule's `endTime` passes, or a recurring window closes, the silence stops suppressing notifications but is not deleted; delete it explicitly if it is no longer needed."}),M6=x("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future when created or updated."}),timeZone:t.Optional(t.String({description:Hl}))},{$id:"OutputSilenceScheduleOneTime",description:mk}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:L6,timeZone:t.Optional(t.String({description:Hl}))},{$id:"OutputSilenceScheduleRecurring",description:dk})],{description:"Schedule defining when the silence is active. The `type` field discriminates between a `one-time` window and a `recurring` weekly window. Once a one-time schedule's `endTime` passes, or a recurring window closes, the silence stops suppressing notifications but is not deleted; delete it explicitly if it is no longer needed."}),D6="monitor_id",fk=`Query on the alerting monitor tags and group-by dimensions, e.g. \`env:prod AND service:bridge\`. The monitor itself can be targeted with \`${D6}:<monitor id>\`.`,Kl=t.Object({name:p({description:"Display name of the silence"}),reason:p({allowEmpty:!1,type:"long",description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the silence"}),tags:De,isActive:t.Boolean({description:"Set to true for the silence to suppress matching notifications while its schedule is active. Set to false to keep the silence without suppressing anything."}),schedule:k6,notificationRuleIds:Se(t.Array(p()),{description:"Notification rule IDs this silence applies to directly, matching any notification produced by one of these rules regardless of priority or transition type. Mutually exclusive with `prioritiesFilter`, `transitionTypesFilter`, and `queryString`: a request combining this field with any of those is rejected."}),queryString:Se(p({type:"tags-query"}),{description:fk}),teamsFilter:Pg,prioritiesFilter:t.Array(t.Enum(Ut),{maxItems:Ut.length,description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(ko),{maxItems:ko.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),Bo=t.Object({id:t.String({description:"Tsuga-generated notification silence ID assigned when the silence is created."}),name:t.String({description:"Display name of the silence"}),reason:t.String({description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:t.String({description:"Team ID that owns and manages the silence"}),tags:we,isActive:t.Boolean({description:"Whether the silence suppresses matching notifications while its schedule is active. When false, the silence is kept but never suppresses anything."}),schedule:M6,notificationRuleIds:t.Optional(t.Array(t.String(),{description:"Notification rule IDs this silence applies to directly, matching any notification produced by one of these rules regardless of priority or transition type. Set only when `prioritiesFilter`, `transitionTypesFilter`, and `queryString` are not used to filter alerts."})),queryString:t.Optional(t.String({description:fk})),teamsFilter:Cg,prioritiesFilter:t.Array(t.Enum(Ut),{description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(ko),{description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."}),createdAt:S(),updatedAt:S(),creator:t.Optional(pe),updater:t.Optional(pe)}),uk=["one-time","recurring"];var G6=["name","isActive","schedule","owner","tags","updatedAt"],gk=t.Object({owners:ee(p({allowEmpty:!1}),{description:"Restrict results to silences owned by any of these team IDs.",maxItems:50}),searchQuery:hr({description:"Search query filter for notification silences.",valueDescription:"Case-insensitive substring matched against silence name and ID."}),tags:ee(St.items,{description:"Restrict results to silences that have at least one of the listed key/value tags.",maxItems:50}),scheduleTypes:ee(t.Enum(uk),{description:"Restrict results to silences with these schedule types.",maxItems:uk.length}),status:t.Enum(w6,{description:"Restrict results to effectively active or inactive silences."})}),$6=t.Partial(t.Object({...ne,filters:t.Partial(gk),sort:t.Object({by:t.Enum(G6,{description:"Field to sort the returned notification silences by."}),direction:K})})),F6=t.Object({tags:It,activeCounts:t.Object({totalCount:t.Integer({description:"Total number of matching silences regardless of whether they are active."}),active:t.Integer({description:"Number of matching silences that are active, meaning enabled with a schedule that has not expired."}),inactive:t.Integer({description:"Number of matching silences that are disabled or whose schedule has expired."})})}),j6=t.Object({filters:t.Optional(t.Partial(gk,{description:"Filters applied before collecting tag and active-count options."}))}),ait=d({tags:["notification-silences"],url:`${Yn}/query`,method:"POST",paginated:!0,body:$6,response:t.Array(Bo,{description:"Matching notification silences after they are filtered, sorted, and paginated."})}),cit=d({tags:["notification-silences"],url:`${Yn}/options/query`,method:"POST",body:j6,response:F6}),pit=d({tags:["notification-silences"],url:Yn,method:"GET",response:t.Array(Bo)}),uit=d({tags:["notification-silences"],url:`${Yn}/:id`,params:t.Object({id:p()}),method:"GET",response:Bo}),lit=d({tags:["notification-silences"],url:Yn,method:"POST",body:Kl,response:Bo}),mit=d({tags:["notification-silences"],url:`${Yn}/:id`,method:"PUT",params:t.Object({id:p()}),body:Kl,response:Bo}),dit=d({tags:["notification-silences"],url:`${Yn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),fit=d({tags:["notification-silences"],url:`${Yn}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p(),{uniqueItems:!0})}),response:t.Object({})});var Ec=`/${"v1"}/notification-silences`,_c=t.Pick(Bo,["id","name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"],{$id:"NotificationSilence",description:"Scheduled mute rule that suppresses matching notification delivery while monitors continue evaluating. See [Silences](/documentation/alert/notifications/silences)."}),q6={id:"sil-weekend-maintenance",name:"Weekend maintenance",reason:"Suppress expected alerts during the weekly maintenance window.",owner:"team-123-abc",tags:[{key:"environment",value:"production"}],isActive:!0,schedule:{type:"recurring",weeklySchedule:{saturday:[{startTime:"02:00",endTime:"06:00"}],sunday:[{startTime:"02:00",endTime:"06:00"}]},timeZone:"UTC"},teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"]},B6={id:"sil-critical-routing",name:"Critical routing maintenance",reason:"Temporarily suppress notifications from the critical routing rule.",owner:"team-123-abc",tags:[{key:"change",value:"chg-1234"}],isActive:!0,schedule:{type:"one-time",startTime:"2026-07-04T02:00:00",endTime:"2026-07-04T04:00:00",timeZone:"UTC"},notificationRuleIds:["rule-critical-routing"],teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[],transitionTypesFilter:[]};Object.assign(_c,{examples:[q6,B6]});var hk=d({description:"Lists notification silences visible to the authenticated operation key. Use this endpoint to audit maintenance windows and notification muting rules.",operationId:"listNotificationSilences",tags:["notification-silences"],url:Ec,method:"GET",response:t.Array(_c)}),yk=d({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${Ec}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to retrieve. Use the `id` returned by notification silence list or create responses."})}),response:_c}),wh=t.Pick(Kl,["name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"],{description:"Notification silence create or update request. Provide the mute reason, owner, schedule, filters, active state, and tags."}),H6={name:"Weekend maintenance",reason:"Suppress expected alerts during the weekly maintenance window.",owner:"team-123-abc",tags:[{key:"environment",value:"production"}],isActive:!0,schedule:{type:"recurring",weeklySchedule:{saturday:[{startTime:"02:00",endTime:"06:00"}],sunday:[{startTime:"02:00",endTime:"06:00"}]},timeZone:"UTC"},teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"]},K6={name:"Critical routing maintenance",reason:"Temporarily suppress notifications from the critical routing rule.",owner:"team-123-abc",tags:[{key:"change",value:"chg-1234"}],isActive:!0,schedule:{type:"one-time",startTime:"2026-07-04T02:00:00",endTime:"2026-07-04T04:00:00",timeZone:"UTC"},notificationRuleIds:["rule-critical-routing"],teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[],transitionTypesFilter:[]};Object.assign(wh,{examples:[H6,K6]});var Tk=d({description:"Creates a notification silence. Matching notifications that have not yet been sent are suppressed as soon as the schedule becomes active, including ones already queued when the silence is created; monitor evaluation itself is not paused, so alerts still transition and are visible in the UI.",operationId:"createNotificationSilence",tags:["notification-silences"],url:Ec,method:"POST",body:wh,response:_c}),Ek=d({description:"Updates an existing notification silence by ID. Required fields are overwritten; omitted optional fields keep their existing values.",operationId:"updateNotificationSilence",tags:["notification-silences"],url:`${Ec}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to update. Use the `id` returned by notification silence list, get, or create responses."})}),body:wh,response:_c}),z6=t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to delete. Use the `id` returned by notification silence list, get, create, or update responses."})}),_k=d({description:"Deletes a notification silence. Any notification not yet sent is re-evaluated against the remaining silences and, if none match, is delivered normally; notifications already marked as silenced are not resent.",operationId:"deleteNotificationSilence",tags:["notification-silences"],url:`${Ec}/:id`,method:"DELETE",params:z6,response:w});var Y6={critical:3,important:2,normal:1},le=e=>({label:e,weight:Y6[e]}),V6={"unrouted-logs":{key:"unrouted-logs",title:"Logs with no matching route",summary:"Any log that reaches processing without a matched route is flagged.",rationale:"Close gaps by ensuring each event flows through a governed route.",objectType:"route",category:"observability-assets",impact:le("important"),recommendation:"Ensure each team maintains a route that captures all of its logs exactly once."},"no-over-routed-logs":{key:"no-over-routed-logs",title:"No logs matching 3+ routes",summary:"Detects logs that match 3 or more processing routes during the lookback window.",rationale:"A log usually only needs one or two routes. Matching many routes typically means the route queries overlap unintentionally, multiplying the processing and storage cost without adding observability value.",objectType:"route",category:"observability-assets",impact:le("important"),recommendation:"Review the route queries owned by this team for overlap. Tighten the filter on each route so a given log matches the minimum number of routes needed (usually one)."},"team-has-route":{key:"team-has-route",title:"\u22651 route per team",summary:"Each team owns at least one active route that filters on its team name.",rationale:"Provides clear governance boundaries for routing and enrichment.",objectType:"route",category:"observability-assets",impact:le("important"),recommendation:"Ensure every team manages a dedicated route scoped to its context.team value."},"no-team-override-mismatch":{key:"no-team-override-mismatch",title:`${Yd} matches ${Uu}`,summary:`Detects logs and spans whose ${Yd} resource attribute names a different team than the ${Uu} resolved at ingestion.`,rationale:`${Uu} is reserved and comes from the ingestion API key, so a \`team\` resource attribute never reassigns ownership. A disagreement means the sender expects an ownership Tsuga did not apply.`,objectType:"resource",category:"telemetry-hygiene",impact:le("important"),recommendation:"Drop the `team` resource attribute, or set the ingestion API key team override fields to read ownership from a differently named attribute."},"service-name-present":{key:"service-name-present",title:`${Nu} present`,summary:`Logs and spans must populate ${Nu} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:le("critical"),recommendation:`Populate ${Nu} in all log and span payloads.`},"no-orphan-spans":{key:"no-orphan-spans",title:"No orphan spans",summary:"Every span with parent_span_id references an existing span in the same trace.",rationale:"Trace integrity depends on preserving parent-child hierarchies.",objectType:"span",category:"telemetry-hygiene",impact:le("normal"),recommendation:"Emit parent spans before their children so references always resolve."},"metric-unit-consistency":{key:"metric-unit-consistency",title:"Name\u2192unit consistency",summary:"All series for a metric name report the same UCUM-compliant unit across the lookback period.",rationale:"Avoid ambiguity when charting and alerting on metrics with shared names.",objectType:"metric",category:"telemetry-hygiene",impact:le("important"),recommendation:"Align exporters so each metric name emits a single consistent unit across services and environments."},"host-name-present":{key:"host-name-present",title:`${ba} presence`,summary:`Logs and spans must populate ${ba} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:le("important"),recommendation:`Populate ${ba} in all log and span payloads.`},"inconsistent-attribute-naming":{key:"inconsistent-attribute-naming",title:"Consistent attribute naming",summary:"Detects attributes with multiple naming variants (e.g., userId vs user_id).",rationale:"Consistent naming improves queryability.",objectType:"log",category:"telemetry-hygiene",impact:le("normal"),recommendation:"Standardize attribute naming conventions across all log sources."},"no-duplicate-attr-values":{key:"no-duplicate-attr-values",title:"No duplicate attribute values",summary:"Detects when different attributes consistently carry identical values across logs (e.g., err.type and error.type always having the same value).",rationale:"Redundant attributes waste storage and complicate querying. Consolidate to one.",objectType:"log",category:"telemetry-hygiene",impact:le("normal"),recommendation:"Consolidate duplicate attributes at the source to reduce storage costs."},"no-debug-logs-in-prod":{key:"no-debug-logs-in-prod",title:"No DEBUG logs in production",summary:"Detects DEBUG-level logs emitted in production environments.",rationale:"DEBUG logs in production increase costs and risk exposing sensitive data.",objectType:"log",category:"telemetry-hygiene",impact:le("important"),recommendation:"Remove DEBUG-level logging from production environment or adjust log level configuration."},"no-multiline-logs":{key:"no-multiline-logs",title:"No ungrouped multiline logs",summary:"Detects orphaned stack-trace and traceback continuation lines that should have been grouped into a single log entry by the collector.",rationale:"Ungrouped multiline logs fragment errors across many entries, making them harder to read, search, and alert on.",objectType:"log",category:"telemetry-hygiene",impact:le("important"),recommendation:"Configure multiline grouping on the log collector using a line_start_pattern (e.g. a timestamp regex) so stack traces are sent as a single entry."},"no-error-logs-as-info":{key:"no-error-logs-as-info",title:"No error logs mapped as info",summary:"Detects INFO-level logs that carry error fields such as error.*, err.*, exception.*, or a stack trace.",rationale:"A log with error or exception attributes but an INFO severity is never surfaced as an error, so teams miss real failures caused by a misconfigured level mapper or bad logging.",objectType:"log",category:"telemetry-hygiene",impact:le("important"),recommendation:"Map these logs to ERROR in the level mapper, or fix the source logging so errors and exceptions are emitted at the right severity."},"no-empty-dashboards":{key:"no-empty-dashboards",title:"No empty dashboards",summary:"Flags dashboards with 1 or fewer widgets.",rationale:"Empty or near-empty dashboards add clutter and make it harder to find useful dashboards.",objectType:"dashboard",category:"observability-assets",impact:le("normal"),recommendation:"Add meaningful widgets to dashboards or remove empty ones to reduce clutter."},"monitor-has-notification":{key:"monitor-has-notification",title:"No monitors without notification",summary:"Every monitor has at least one active notification destination configured.",rationale:"A monitor without notifications is effectively silent - it detects issues but nobody is alerted.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Add a notification destination to every monitor - a monitor without notifications is effectively silent."},"no-future-dated-logs":{key:"no-future-dated-logs",title:"No future-dated logs",summary:"Detects logs with timestamps more than 59 minutes ahead of their intake time.",rationale:"Future-dated logs break dashboards, alerting, and log ordering - they indicate clock skew or incorrect timestamp generation.",objectType:"log",category:"telemetry-hygiene",impact:le("important"),recommendation:"Fix clock synchronization or timestamp generation for services emitting future-dated logs - they break dashboards and alerting."},"metric-usage":{key:"metric-usage",title:"Metric usage",summary:"Percentage of ingested metrics that are referenced by a dashboard or monitor, or were queried in the last 30 days.",rationale:"Metrics that are never visualized, alerted on, or queried add ingestion cost and cardinality without providing value.",objectType:"metric",category:"telemetry-adoption",impact:le("important"),recommendation:"Stop emitting metrics that are never referenced or queried to reduce ingestion cost and cardinality.",scope:"global"},"no-stale-dashboards":{key:"no-stale-dashboards",title:"No stale dashboards",summary:"Flags dashboards that have not been edited in over 180 days.",rationale:"Stale dashboards may contain outdated queries or irrelevant data, making it harder for teams to find useful, up-to-date information.",objectType:"dashboard",category:"observability-assets",impact:le("normal"),recommendation:"Review and update dashboards that haven't been edited in 180+ days, or archive them if no longer relevant."},"no-unused-dashboards":{key:"no-unused-dashboards",title:"No unused dashboards",summary:"Flags dashboards with zero views in the last 60 days.",rationale:"Dashboards that nobody views add clutter and may confuse team members looking for relevant information.",objectType:"dashboard",category:"telemetry-adoption",impact:le("important"),recommendation:"Archive or delete dashboards that nobody has viewed in the last 60 days to reduce noise."},"no-orphan-monitors":{key:"no-orphan-monitors",title:"No monitors without dashboards",summary:"Every monitor should be linked to at least one dashboard.",rationale:"Monitors without a linked dashboard make it harder for teams to investigate alerts \u2014 responders need a dashboard to quickly understand the context and scope of an issue.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Link monitors to relevant dashboards so teams can quickly investigate when alerts fire."},"no-flapping-monitors":{key:"no-flapping-monitors",title:"No flappy monitors",summary:"P1/P2 monitors should not have any group (or the monitor itself) trigger 7+ alerts within 7 days.",rationale:"Monitors that constantly flip between alert and OK cause alert fatigue. Teams start ignoring notifications, increasing the risk of missing real incidents.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Tune thresholds, add hysteresis, or adjust evaluation windows to reduce flapping."},"no-noisy-group-monitors":{key:"no-noisy-group-monitors",title:"No noisy group-by monitors",summary:"P1/P2 group-by monitors should not have 5+ groups triggering alerts simultaneously on 2+ occasions within 7 days.",rationale:"When a group-by monitor triggers alerts for many groups at once repeatedly, the signal gets lost in noise. Responders cannot prioritize and the monitor effectively becomes useless.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Narrow the group-by scope, raise thresholds, or split into more targeted monitors."},"no-long-alert-monitors":{key:"no-long-alert-monitors",title:"No monitors stuck in alert",summary:"P1/P2 monitors should not remain in alert state for more than 15 days.",rationale:"A high-priority monitor stuck in alert for weeks signals an unresolved issue or a misconfigured threshold. Either way, the alert loses meaning and contributes to alert fatigue.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Investigate and resolve the underlying issue, adjust the threshold, or acknowledge and close the alert."},"no-redundant-monitors":{key:"no-redundant-monitors",title:"No redundant monitors",summary:"P1/P2 monitors should not always trigger at the same time as another monitor (3+ co-triggers within 7 days).",rationale:"A monitor that always fires alongside another monitor is redundant. It adds noise without providing additional signal, making it harder for responders to identify the root cause.",objectType:"monitor",category:"observability-assets",impact:le("important"),recommendation:"Investigate whether the redundant monitor can be removed or consolidated with the one it always co-triggers with."},"no-absent-log-fields":{key:"no-absent-log-fields",title:"No absent log fields",summary:"Dashboards and monitors should reference log fields that still appear in recent logs (last 24 hours).",rationale:"References to log fields that no longer exist silently break dashboards and monitors, eroding trust in observability.",objectType:"dashboard",category:"observability-assets",impact:le("important"),recommendation:"Remove, rename, or backfill log fields that are referenced by dashboards or monitors but have not been seen in the last 24 hours.",scope:"global"},"k8s-recommended-attributes":{key:"k8s-recommended-attributes",title:"Kubernetes recommended resource attributes",summary:"Kubernetes logs and spans should populate core identity attributes and at least one workload-ownership attribute.",rationale:"These attributes let Tsuga correlate telemetry with the Kubernetes objects that produced it, which is required for faulty-deployment detection and rollback suggestions.",objectType:"resource",category:"collection-coverage",impact:le("important"),recommendation:"Make sure every Kubernetes workload emits k8s.cluster.name, k8s.namespace.name, k8s.pod.name, k8s.pod.uid, k8s.container.name, k8s.node.name and one workload-ownership attribute (for example via the OpenTelemetry Collector k8s_attributes processor)."},"k8s-recommended-metrics":{key:"k8s-recommended-metrics",title:"Kubernetes recommended cluster metrics",summary:"All recommended Kubernetes cluster metrics are collected.",rationale:"These metrics are the primary signals for faulty-deployment detection; without k8s.container.status.reason and the usage/limit pairs, container crash loops and resource starvation cannot be diagnosed.",objectType:"metric",category:"collection-coverage",impact:le("important"),recommendation:"Enable the OpenTelemetry Collector k8s_cluster receiver (for example via the Tsuga Helm chart) so the required Kubernetes metrics are emitted.",scope:"global"},"k8s-recommended-change-events":{key:"k8s-recommended-change-events",title:"Kubernetes recommended change events",summary:"Change events are collected for the Kubernetes object kinds recommended for rollback suggestions.",rationale:"Faulty-deployment detection needs the history of ReplicaSet, Deployment, Pod and Node changes to identify failing revisions and propose rollbacks.",objectType:"log",category:"collection-coverage",impact:le("important"),recommendation:"Configure the Kubernetes change-event collector (for example the OpenTelemetry k8sobjects receiver) so change events for Pod, Deployment, ReplicaSet, StatefulSet, DaemonSet, Namespace and Node are ingested."},"otel-collector-self-metrics":{key:"otel-collector-self-metrics",title:"OpenTelemetry Collector self-metrics",summary:"A cluster collecting Kubernetes metrics through an OpenTelemetry Collector also emits the collector self-metrics (otelcol_*).",rationale:"The Kubernetes receivers feed the Kubernetes explorer. Without the collector self-metrics there is no way to tell a healthy pipeline from one that drops data or fails to export, so a stale or missing Kubernetes view cannot be explained.",objectType:"metric",category:"collection-coverage",impact:le("important"),recommendation:"Enable the collector's internal telemetry (service.telemetry.metrics) and export it to Tsuga so otelcol_* metrics are available.",scope:"global"},"use-standard-attributes":{key:"use-standard-attributes",title:"Standard attribute usage",summary:"Detects log attributes that should be remapped to Tsuga standard attributes.",rationale:"Standard attributes enable consistent querying, out-of-the-box dashboards, and cross-team correlation.",objectType:"log",category:"telemetry-hygiene",impact:le("important"),recommendation:"Use the attribute remapper in your routes to rename attributes to their standard equivalents."},"no-unused-operation-api-keys":{key:"no-unused-operation-api-keys",title:"No unused operation API keys",summary:"Flags operation API keys with no activity in the last 180 days.",rationale:"Long-idle operation credentials add risk if leaked and clutter the inventory. Tracking last-used activity makes it easy to rotate or delete the unused ones.",objectType:"api-key",category:"observability-assets",impact:le("important"),recommendation:"Rotate or delete operation API keys that have not been used in the last 180 days."},"no-unused-ingestion-api-keys":{key:"no-unused-ingestion-api-keys",title:"No unused ingestion API keys",summary:"Flags ingestion API keys with no telemetry in the last 30 days across any cluster.",rationale:"Dormant ingestion credentials add risk if leaked and clutter the inventory. Tracking key activity makes it easy to rotate or delete the unused ones.",objectType:"api-key",category:"observability-assets",impact:le("important"),recommendation:"Rotate or delete ingestion API keys that have sent no data in the last 30 days."},"db-logs-trace-correlation":{key:"db-logs-trace-correlation",title:"Database logs correlated with traces",summary:`Database logs should carry ${dR} so they can be tied back to the trace that issued the query.`,rationale:"Linking database server logs to client traces lets users jump from a slow request to the exact query log. Without a trace id, database logs cannot be joined to the request that produced them.",objectType:"log",category:"telemetry-hygiene",impact:le("normal"),recommendation:"Enable trace correlation on the database log pipeline (for example via SQLcommenter, which embeds the traceparent in each statement) so query logs carry a trace id.",scope:"team"}},Ik={"postgresql-server-metrics-collected":{label:"PostgreSQL",systemValues:["postgresql"],metricPrefixes:["postgresql.","pg_"],receiver:"postgresqlreceiver"},"mysql-server-metrics-collected":{label:"MySQL",systemValues:["mysql","mariadb"],metricPrefixes:["mysql.","mysql_"],receiver:"mysqlreceiver"},"mongodb-server-metrics-collected":{label:"MongoDB",systemValues:["mongodb"],metricPrefixes:["mongodb.","mongodbatlas.","mongodb_"],receiver:"mongodbreceiver"},"redis-server-metrics-collected":{label:"Redis",systemValues:["redis"],metricPrefixes:["redis.","redis_"],receiver:"redisreceiver"},"memcached-server-metrics-collected":{label:"Memcached",systemValues:["memcached"],metricPrefixes:["memcached.","memcached_"],receiver:"memcachedreceiver"},"couchdb-server-metrics-collected":{label:"CouchDB",systemValues:["couchdb"],metricPrefixes:["couchdb.","couchdb_"],receiver:"couchdbreceiver"},"elasticsearch-server-metrics-collected":{label:"Elasticsearch",systemValues:["elasticsearch"],metricPrefixes:["elasticsearch.","elasticsearch_"],receiver:"elasticsearchreceiver"},"oracledb-server-metrics-collected":{label:"Oracle DB",systemValues:["oracle.db","oracle"],metricPrefixes:["oracledb.","oracledb_"],receiver:"oracledbreceiver"},"sqlserver-server-metrics-collected":{label:"Microsoft SQL Server",systemValues:["microsoft.sql_server","mssql"],metricPrefixes:["sqlserver.","mssql_"],receiver:"sqlserverreceiver"},"saphana-server-metrics-collected":{label:"SAP HANA",systemValues:["sap.hana","hanadb"],metricPrefixes:["saphana."],receiver:"saphanareceiver"},"cassandra-server-metrics-collected":{label:"Cassandra",systemValues:["cassandra"],metricPrefixes:["cassandra.","cassandra_"]},"clickhouse-server-metrics-collected":{label:"ClickHouse",systemValues:["clickhouse"],metricPrefixes:["ClickHouse"]},"couchbase-server-metrics-collected":{label:"Couchbase",systemValues:["couchbase"],metricPrefixes:["couchbase_"]},"neo4j-server-metrics-collected":{label:"Neo4j",systemValues:["neo4j"],metricPrefixes:["neo4j_"]},"opensearch-server-metrics-collected":{label:"OpenSearch",systemValues:["opensearch"],metricPrefixes:["opensearch_"]},"db2-server-metrics-collected":{label:"IBM Db2",systemValues:["ibm.db2","db2"],metricPrefixes:["ibm_db2_"]}},Q6=Object.fromEntries(Object.keys(Ik).map(e=>{let{label:r,receiver:n}=Ik[e];return[e,{key:e,title:`${r} server metrics collected`,summary:`${r} seen in client spans should have its server metrics collected.`,rationale:"Server metrics (connections, throughput, replication, contention) are needed to investigate database slowness beyond what client spans show. A detected database with no server metrics has a gap in its monitoring setup.",objectType:"metric",category:"collection-coverage",impact:le("important"),recommendation:n?`Configure the ${n} OpenTelemetry receiver so ${r} server metrics are collected.`:`Collect ${r} server metrics, for example via its Prometheus exporter.`,scope:"global"}]})),W6=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),Z6=ic.filter(e=>e.startsWith("azure_")&&!W6.has(e)),Sk={"aws-sqs-metrics-collected":{label:"Amazon SQS",source:"AWS/SQS",nativeResourceTypes:["aws_sqs_queue"],metricPrefixes:["aws_sqs_"]},"aws-sns-metrics-collected":{label:"Amazon SNS",source:"AWS/SNS",nativeResourceTypes:["aws_sns_topic"],metricPrefixes:["aws_sns_"]},"aws-kinesis-metrics-collected":{label:"Amazon Kinesis Data Streams",source:"AWS/Kinesis",nativeResourceTypes:["aws_kinesis_data_stream"],metricPrefixes:["aws_kinesis_"]},"aws-dynamodb-metrics-collected":{label:"Amazon DynamoDB",source:"AWS/DynamoDB",nativeResourceTypes:["aws_dynamodb_table"],metricPrefixes:["aws_dynamodb_"]},"aws-rds-metrics-collected":{label:"Amazon RDS",source:"AWS/RDS",nativeResourceTypes:["aws_rds_instance"],metricPrefixes:["aws_rds_"]},"aws-elasticache-metrics-collected":{label:"Amazon ElastiCache",source:"AWS/ElastiCache",nativeResourceTypes:["aws_elasticache"],metricPrefixes:["aws_elasticache_"]},"aws-s3-metrics-collected":{label:"Amazon S3",source:"AWS/S3",nativeResourceTypes:["aws_s3_bucket"],metricPrefixes:["aws_s3_"]},"aws-ebs-metrics-collected":{label:"Amazon EBS",source:"AWS/EBS",nativeResourceTypes:["aws_ebs_volume"],metricPrefixes:["aws_ebs_"]},"aws-efs-metrics-collected":{label:"Amazon EFS",source:"AWS/EFS",nativeResourceTypes:["aws_efs"],metricPrefixes:["aws_efs_"]},"aws-ec2-metrics-collected":{label:"Amazon EC2",source:"AWS/EC2",nativeResourceTypes:["aws_ec2_instance"],metricPrefixes:["aws_ec2_"]},"aws-lambda-metrics-collected":{label:"AWS Lambda",source:"AWS/Lambda",nativeResourceTypes:["aws_lambda_function"],metricPrefixes:["aws_lambda_"]},"aws-ecs-metrics-collected":{label:"Amazon ECS",source:"AWS/ECS",nativeResourceTypes:["aws_ecs_cluster","aws_ecs_service","aws_ecs_task"],metricPrefixes:["aws_ecs_"]},"aws-ecr-metrics-collected":{label:"Amazon ECR",source:"AWS/ECR",nativeResourceTypes:["aws_ecr_repository"],metricPrefixes:["aws_ecr_"]},"aws-elb-metrics-collected":{label:"Elastic Load Balancing",source:"AWS/ApplicationELB, AWS/NetworkELB",nativeResourceTypes:["aws_elastic_load_balancer"],metricPrefixes:["aws_applicationelb_","aws_networkelb_","aws_gatewayelb_","aws_elb_"]},"aws-cloudfront-metrics-collected":{label:"Amazon CloudFront",source:"AWS/CloudFront",nativeResourceTypes:["aws_cloudfront_distribution"],metricPrefixes:["aws_cloudfront_"]},"aws-acm-metrics-collected":{label:"AWS Certificate Manager",source:"AWS/CertificateManager",nativeResourceTypes:["aws_acm_certificate"],metricPrefixes:["aws_certificatemanager_"]},"gcp-pubsub-metrics-collected":{label:"Google Cloud Pub/Sub",source:"pubsub.googleapis.com",nativeResourceTypes:["gcp_pubsub_topic"],metricPrefixes:["pubsub.googleapis.com/"]},"gcp-storage-metrics-collected":{label:"Google Cloud Storage",source:"storage.googleapis.com",nativeResourceTypes:["gcp_bucket"],metricPrefixes:["storage.googleapis.com/"]},"gcp-compute-metrics-collected":{label:"Google Compute Engine",source:"compute.googleapis.com",nativeResourceTypes:["gcp_compute_instance","gcp_compute_disk"],metricPrefixes:["compute.googleapis.com/"]},"gcp-cloud-sql-metrics-collected":{label:"Google Cloud SQL",source:"cloudsql.googleapis.com",nativeResourceTypes:["gcp_cloud_sql_instance"],metricPrefixes:["cloudsql.googleapis.com/"]},"gcp-gke-metrics-collected":{label:"Google Kubernetes Engine",source:"kubernetes.io, container.googleapis.com",nativeResourceTypes:["gcp_gke_cluster"],metricPrefixes:["kubernetes.io/","container.googleapis.com/"]},"gcp-cloud-run-metrics-collected":{label:"Google Cloud Run",source:"run.googleapis.com",nativeResourceTypes:["gcp_cloud_run_service","gcp_cloud_run_job","gcp_cloud_run_function"],metricPrefixes:["run.googleapis.com/"]},"gcp-artifact-registry-metrics-collected":{label:"Google Artifact Registry",source:"artifactregistry.googleapis.com",nativeResourceTypes:["gcp_artifact_registry_repository"],metricPrefixes:["artifactregistry.googleapis.com/"]},"gcp-load-balancing-metrics-collected":{label:"Google Cloud Load Balancing",source:"loadbalancing.googleapis.com",nativeResourceTypes:["gcp_forwarding_rule"],metricPrefixes:["loadbalancing.googleapis.com/"]},"gcp-bigtable-metrics-collected":{label:"Google Cloud Bigtable",source:"bigtable.googleapis.com",nativeResourceTypes:["gcp_bigtable_instance"],metricPrefixes:["bigtable.googleapis.com/"]},"gcp-spanner-metrics-collected":{label:"Google Cloud Spanner",source:"spanner.googleapis.com",nativeResourceTypes:["gcp_spanner_instance"],metricPrefixes:["spanner.googleapis.com/"]},"gcp-firestore-metrics-collected":{label:"Google Cloud Firestore",source:"firestore.googleapis.com",nativeResourceTypes:["gcp_firestore_database"],metricPrefixes:["firestore.googleapis.com/"]},"gcp-app-engine-metrics-collected":{label:"Google App Engine",source:"appengine.googleapis.com",nativeResourceTypes:["gcp_app_engine_service"],metricPrefixes:["appengine.googleapis.com/"]},"azure-metrics-collected":{label:"Azure",source:"Azure Monitor",nativeResourceTypes:Z6,metricPrefixes:["azure_"]}},X6=Object.fromEntries(Object.keys(Sk).map(e=>{let{label:r,source:n}=Sk[e];return[e,{key:e,title:`${r} metrics collected`,summary:`${r} resources found in inventory should have their metrics collected.`,rationale:"A resource that appears in inventory but whose metrics are not collected leaves its dashboards and resource-explorer views empty and impossible to alert on.",objectType:"metric",category:"collection-coverage",impact:le("important"),recommendation:`Enable the ${n} metrics integration so ${r} metrics are ingested.`,scope:"global"}]})),J6={...V6,...Q6,...X6},bk=Object.values(J6);var Ok=["passed","failed","ignored"],e5=10,t5=t.Enum(Ok,{description:"Evaluation outcome for this rule row. Allowed values are passed, failed, and ignored; ignored means the rule was not applicable to the available data."}),r5=["aws-sqs-metrics-collected","aws-sns-metrics-collected","aws-kinesis-metrics-collected","aws-dynamodb-metrics-collected","aws-rds-metrics-collected","aws-elasticache-metrics-collected","aws-s3-metrics-collected","aws-ebs-metrics-collected","aws-efs-metrics-collected","aws-ec2-metrics-collected","aws-lambda-metrics-collected","aws-ecs-metrics-collected","aws-ecr-metrics-collected","aws-elb-metrics-collected","aws-cloudfront-metrics-collected","aws-acm-metrics-collected","gcp-pubsub-metrics-collected","gcp-storage-metrics-collected","gcp-compute-metrics-collected","gcp-cloud-sql-metrics-collected","gcp-gke-metrics-collected","gcp-cloud-run-metrics-collected","gcp-artifact-registry-metrics-collected","gcp-load-balancing-metrics-collected","gcp-bigtable-metrics-collected","gcp-spanner-metrics-collected","gcp-firestore-metrics-collected","gcp-app-engine-metrics-collected","azure-metrics-collected"],n5=["postgresql-server-metrics-collected","mysql-server-metrics-collected","mongodb-server-metrics-collected","redis-server-metrics-collected","memcached-server-metrics-collected","couchdb-server-metrics-collected","elasticsearch-server-metrics-collected","oracledb-server-metrics-collected","sqlserver-server-metrics-collected","saphana-server-metrics-collected","cassandra-server-metrics-collected","clickhouse-server-metrics-collected","couchbase-server-metrics-collected","neo4j-server-metrics-collected","opensearch-server-metrics-collected","db2-server-metrics-collected"],Lh=["unrouted-logs","no-over-routed-logs","team-has-route","no-team-override-mismatch","service-name-present","no-orphan-spans","metric-unit-consistency","host-name-present","inconsistent-attribute-naming","no-duplicate-attr-values","no-debug-logs-in-prod","no-multiline-logs","no-error-logs-as-info","no-empty-dashboards","monitor-has-notification","no-future-dated-logs","metric-usage","no-stale-dashboards","no-unused-dashboards","no-orphan-monitors","no-flapping-monitors","no-noisy-group-monitors","no-long-alert-monitors","no-redundant-monitors","no-absent-log-fields","k8s-recommended-attributes","k8s-recommended-metrics","k8s-recommended-change-events","otel-collector-self-metrics","use-standard-attributes","no-unused-operation-api-keys","no-unused-ingestion-api-keys","db-logs-trace-correlation",...n5,...r5],Ak=t.Enum(Lh),o5=["log","metric","resource","span","api-key","dashboard","monitor","route"],i5=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],s5=["critical","important","normal"],a5=["team","global"],kh=t.Object({key:t.Enum(Lh),title:t.String(),summary:t.String(),rationale:t.String(),objectType:t.Enum(o5),category:t.Enum(i5),impact:t.Object({label:t.Enum(s5),weight:t.Number()}),recommendation:t.String(),scope:t.Optional(t.Enum(a5))}),Ic=t.Object({type:t.String({description:"Tsuga asset or telemetry kind referenced by this example. Set by the rule evaluator from the failing object, record, or lookup result; examples include `monitor`, `dashboard`, `metric`, `log`, and `api-key`."}),label:t.String({description:"Human-readable summary of the example. Set by the rule evaluator from the asset name, telemetry identifier, or lookup result so clients can display the example without following the link."}),link:t.Object({to:t.String({description:"In-app route that opens the example in Tsuga. Set by the rule evaluator when the example has a product surface for inspection."}),search:t.Optional(t.Unknown({description:"Route search payload for the in-app link. Set when the destination needs query-string state such as a search query, time range, or table filter."})),params:t.Optional(t.Unknown({description:"Route params for the in-app link. Set when the destination route needs path parameters such as an asset identifier."}))},{description:"In-app deep link for inspecting the example. Returned when Tsuga can route from the quality-report row to a relevant product page."})}),vh=t.Intersect([kh,t.Object({id:t.Optional(t.String()),status:t5,normalizedScore:t.Number(),details:t.Optional(t.Record(t.String(),t.Unknown())),recommendation:t.Optional(t.String()),examples:t.Optional(t.Array(Ic)),exampleCount:t.Optional(t.Integer())})]),c5=t.Object({generatedAt:t.String(),overallScore:t.Optional(t.Number()),rules:t.Array(kh),teamResults:t.Array(t.Object({teamId:t.String(),teamName:t.String(),teamWeight:t.Number(),score:t.Number(),weightedScore:t.Number(),totalWeight:t.Number(),ruleResults:t.Array(vh)})),globalResults:t.Optional(t.Object({score:t.Optional(t.Number()),ruleResults:t.Array(vh)}))}),Mh=t.Object({id:t.String({description:"Identifier of this persisted quality-report row. Generated by Tsuga when report rows are stored. Returned on every row. Treat it as an opaque ID."}),reportId:t.String({description:"Identifier shared by rows from the same report generation for the same team or global cluster-wide scope. Generated by Tsuga when the report is stored. Returned on every row."}),ruleId:t.Enum(Lh,{description:"Stable key for the telemetry-quality rule evaluated by this row. Set by Tsuga from the quality-rule catalog. Returned on every row. The enum may grow as Tsuga adds rules; clients should display unknown future values as opaque rule keys if they do not have local labels."}),owner:t.Optional(t.String({description:"Team identifier this row applies to. Set to the owning team ID for team-scoped rules. Returned for team rows; omitted for global cluster-wide rows."})),status:t.Enum(Ok,{description:"Evaluation outcome for this rule row. Set by the rule evaluator when the report is generated. Returned on every row. Allowed values are passed, failed, and ignored; ignored means the rule was not applicable to the available data."}),score:t.Number({description:"Normalized score for this rule row. Set by the rule evaluator when the report is generated. Returned on every row. Values are between 0 and 1."}),weight:t.Number({description:"Impact weight of this rule, captured at report-generation time. Set by Tsuga from the rule's impact label: 1 for normal, 2 for important, 3 for critical. Used with score to compute reportOverallScore."}),reportOverallScore:t.Number({description:"Aggregate score for this row's report group. Calculated by Tsuga from non-ignored rows in the same team or global cluster-wide report. Returned on every row in that group with the same value."}),reportTotalWeight:t.Number({description:"Sum of non-ignored rule weights for this row's report group. Calculated by Tsuga when the report is generated. Returned on every row in that group with the same value."}),recommendation:t.Optional(t.String({description:"Recommendation stored with this row. Set by the rule evaluator when the report is generated. Returned when a recommendation was persisted; omitted otherwise. The latest-report endpoint does not recompute or default it at read time."})),examples:t.Optional(t.Array(Ic,{description:`Assets, logs, metrics, or links supporting this rule result. Set by the rule evaluator when the report is generated. Returned when examples were persisted and visible to the caller; global row examples are returned only to admin users. Truncated to the first ${e5}; compare against exampleCount to detect truncation.`})),exampleCount:t.Optional(t.Integer({description:"Total number of examples persisted for this row, before the preview truncation applied to examples. Returned whenever examples are visible to the caller."})),createdAt:t.String({description:"ISO timestamp the row was generated at"})}),Uit=d({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:c5}),zl=t.Optional(p({allowEmpty:!1,description:"Identifier of the cluster whose latest quality-report rows are returned. Use the id from the clusters API. Required when the organization has multiple clusters; omit only in single-cluster organizations. Unknown cluster IDs return RESOURCE_NOT_FOUND."})),Nit=d({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:t.Object({clusterId:zl,team:t.Optional(p({allowEmpty:!1}))}),response:t.Array(Mh,{description:"Latest persisted rule evaluation rows for the cluster"})}),wit=d({tags:["quality-reports"],url:"/v0/quality-reports/:id/examples",method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:t.Object({examples:t.Array(Ic)})}),vit=d({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:t.Object({ruleKey:Ak,teamId:t.Optional(p({allowEmpty:!1})),lookbackMinutes:t.Optional(t.Integer({minimum:1,maximum:60})),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Object({rule:kh,result:vh,teamId:t.Optional(t.String()),teamName:t.Optional(t.String())})}),Lit=d({tags:["quality-reports"],url:"/v0/quality-reports/auto-fix-stream",method:"POST",body:t.Object({ruleKey:Ak,teamId:t.Optional(p({allowEmpty:!1})),clusterId:zl,environmentId:p({allowEmpty:!1})}),response:t.Any()}),kit=new Map(bk.map(e=>[e.key,e]));var xk=`/${"v1"}/quality-reports`,Rk=t.Pick(Mh,["id","reportId","ruleId","owner","status","score","weight","reportOverallScore","reportTotalWeight","recommendation","examples","exampleCount","createdAt"],{$id:"QualityReportRow",description:"Persisted evaluation of one telemetry-quality rule for a team or cluster-wide scope. See [Quality reports](/documentation/account-and-settings/quality-reports)."}),p5={id:"01j9x3z4vyabcdfghjkmnpqrst",reportId:"01j9x3z4vyabcdfghjkmnpqrsu",ruleId:"team-has-route",owner:"01j9x3z4vyabcdfghjkmnpqrr",status:"passed",score:1,weight:2,reportOverallScore:.85,reportTotalWeight:2,createdAt:"2026-02-26T12:00:00.000Z"};Object.assign(Rk,{examples:[p5]});var u5=t.Object({clusterId:zl,team:t.Optional(p({allowEmpty:!1,description:"Team name used to scope the report. Matched against Tsuga team names. Optional; when set, returns only rows for that team and omits global rows. Unknown team names return RESOURCE_NOT_FOUND; teams the caller cannot access return an empty result."}))},{description:"Latest quality report lookup query."}),Ck=d({description:"Retrieves the latest persisted quality-report rows for a cluster, optionally scoped to one team. Use this to audit telemetry hygiene and routing recommendations.",operationId:"getLatestQualityReport",tags:["quality-reports"],url:`${xk}/latest`,method:"GET",query:u5,response:t.Array(Rk)}),qit=d({description:"Retrieves every example stored for one quality-report row. The latest-report endpoint returns only a preview of each row's examples, so use this to page past that preview when exampleCount exceeds the number of examples returned there.",operationId:"getQualityReportExamples",tags:["quality-reports"],url:`${xk}/:id/examples`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the quality-report row whose examples are returned. Use the id from the latest-report endpoint. Unknown ids, rows the caller cannot access, and cluster-wide rows requested by a non-admin all return RESOURCE_NOT_FOUND."})}),response:t.Object({examples:t.Array(Ic,{description:"Every example stored for this row, untruncated. Empty when the rule evaluation produced none."})},{description:"All examples stored for one quality-report row."})});var Sc="/v0/admin-center";var Hr=`${Sc}/retention-policies`,Pk=3650,l5=t.Integer({description:"Number of days Tsuga retains matching telemetry."}),Uk=t.Integer({minimum:1,maximum:Pk,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${Pk}.`}),ln=t.Object({id:t.String({description:"Unique identifier of the retention policy. Generated by Tsuga."}),env:t.Optional(t.String({description:"Environment tag value this policy applies to. Omitted policies apply across environments unless a more specific policy exists."})),teamId:t.Optional(t.String({description:"Team ID this policy applies to. Omitted policies apply globally unless a team-specific policy exists."})),dataSource:t.Enum(vr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:l5,isEnabled:t.Boolean({description:"Whether this policy participates in retention resolution."}),createdAt:S({description:"Timestamp when Tsuga created the retention policy."}),updatedAt:S({description:"Timestamp when Tsuga last updated the retention policy."})}),Yl=t.Object({env:Se(p(),{description:"Environment tag value this policy applies to. Omit for a policy that is not environment-specific."}),teamId:Se(p(),{description:"Team ID this policy applies to. Omit for a policy that is not team-specific."}),dataSource:t.Enum(vr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:Uk,isEnabled:t.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),Nk=t.Array(t.Object({env:p(),dataSource:t.Enum(vr),durationDays:t.Union([Uk,t.Null()]),isEnabled:t.Boolean()})),wk=t.Object({inserted:t.Array(ln),updated:t.Array(ln),deleted:t.Array(ln)}),Zit=d({tags:["retention-policies"],url:Hr,method:"POST",body:Yl,response:ln}),Xit=d({tags:["retention-policies"],url:Hr,method:"GET",response:t.Array(ln)}),Jit=d({tags:["retention-policies"],url:`${Hr}/:id`,method:"GET",params:t.Object({id:p()}),response:ln}),est=d({tags:["retention-policies"],url:`${Hr}/:id`,method:"PUT",params:t.Object({id:p()}),body:Yl,response:ln}),tst=d({tags:["retention-policies"],url:`${Hr}/bulk-update`,method:"POST",body:Nk,response:wk}),rst=d({tags:["retention-policies"],url:`${Hr}/bulk-update-for-team`,method:"POST",body:t.Object({teamId:p(),policies:Nk}),response:wk}),nst=d({tags:["retention-policies"],url:`${Hr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),bc=["past-24-hours","past-7-days","past-30-days"],ost=d({tags:["retention-policies"],url:`${Hr}/requested-history-percentile/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({percentile:t.Number({minimum:0,maximum:1}),observationWindow:t.Enum(bc),dataSource:t.Enum(vr)}),response:t.Object({percentile:t.Number(),observationWindow:t.Enum(bc),dataSource:t.Enum(vr),teamId:t.String(),requestedHistoryDays:t.Number()})}),m5=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var d5=t.Array(t.Object({bucket:t.Enum(m5),count:t.Number()})),ist=d({tags:["retention-policies"],url:`${Hr}/requested-history-histogram/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({observationWindow:t.Enum(bc),dataSource:t.Enum(vr)}),response:t.Object({observationWindow:t.Enum(bc),dataSource:t.Enum(vr),teamId:t.String(),histogram:d5})}),sst=d({tags:["retention-policies"],url:`${Hr}/top-teams-with-retention-surplus`,method:"POST",body:t.Object({dataSource:t.Enum(vr),observationWindow:t.Enum(bc),percentile:t.Number({minimum:0,maximum:1}),topN:t.Optional(t.Number({minimum:1,maximum:20}))}),response:t.Array(t.Object({teamId:t.String(),retentionSurplusDays:t.Number()}))});var Oc=`/${"v1"}/retention-policies`,Ac=t.Pick(ln,["id","env","teamId","dataSource","durationDays","isEnabled"],{$id:"RetentionPolicy",description:"Retention rule for logs, metrics, or traces. Policies can apply globally, to an environment, or to a team depending on which scope fields are present. See [Retention](/documentation/account-and-settings/retention)."}),f5={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Ac,{examples:[f5]});var vk=d({description:"Lists retention policy rows visible to the authenticated operation key. Use this to audit retention duration by signal, environment, and team.",operationId:"listRetentionPolicies",tags:["retention-policies"],url:Oc,method:"GET",response:t.Array(Ac)}),Lk=d({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${Oc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to retrieve. Use the `id` returned by retention policy list or create responses."})}),response:Ac}),Dh=t.Pick(Yl,["env","teamId","dataSource","durationDays","isEnabled"],{description:"Retention policy create or update request. Provide the telemetry signal, retention duration, enabled state, and optional environment or team scope."}),g5={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Dh,{examples:[g5]});var kk=d({description:"Creates a retention policy row for a telemetry signal, optionally scoped to an environment or team. Only one policy may exist per combination of data source, environment, and team; creating a duplicate combination fails.",operationId:"createRetentionPolicy",tags:["retention-policies"],url:Oc,method:"POST",body:Dh,response:Ac}),Mk=d({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${Oc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to update. Use the `id` returned by retention policy list, get, or create responses."})}),body:Dh,response:Ac}),Dk=d({description:"Deletes a retention policy by ID. Retention resolution falls back to the next broader matching policy when one exists.",operationId:"deleteRetentionPolicy",tags:["retention-policies"],url:`${Oc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to delete. Use the `id` returned by retention policy list, create, or update responses."})}),response:w});var xc=`/${"v1"}/slos`,h5=t.Pick(Mg,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),Rc=t.Object({...t.Pick(Xi,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:t.Array(h5,{description:"Alerts attached to this SLO"})},{$id:"Slo",description:"Service Level Objective definition: its SLI configuration, target percentage, rolling timeframe, cluster scope, and attached alerts"}),y5={id:"123-456-abc",name:"API availability 99.9%",description:"Overall API gateway availability over the last 30 days",tags:[{key:"team",value:"platform"}],configuration:{type:"event",dataSource:"logs",goodQuery:{queries:[{filter:"status:ok",aggregate:{type:"count"}}],formula:"q1"},totalQuery:{queries:[{filter:"*",aggregate:{type:"count"}}],formula:"q1"},noDataBehavior:"good"},target:99.9,timeframeDays:30,owner:"team-123-abc",permissions:"all",clusterIds:[],alerts:[{id:"alert-123-abc",sloId:"123-456-abc",priority:1,configuration:{type:"burn-rate",burnRate:14.4}}]};Object.assign(Rc,{examples:[y5]});var Gk=t.Pick($g,["filters","sort","limit","offset"]),$k=t.Object({...Gk.properties,...qe,filters:Gk.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),T5={filters:{owners:{values:["team-123-abc"]},searchQuery:{value:"availability"},tags:{values:[{key:"team",value:"platform"}]},statuses:{values:["breached"]},clusterIds:{values:["cluster-123-abc"]}},sort:{by:"name",direction:"asc"},limit:10,offset:0};Object.assign($k,{examples:[T5]});var Fk=d({description:"Queries SLOs visible to the authenticated operation key. Use this endpoint to inventory SLO definitions, filter by owner, tag, status, or cluster, and page through results.",operationId:"querySlos",tags:["slos"],url:`${xc}/query`,method:"POST",paginated:!0,body:$k,response:t.Array(Rc)}),jk=d({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${xc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:Rc}),qk=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],Bk=t.Pick(_l,qk,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),Hk=t.Pick(Dg,qk,{$id:"UpdateSloRequest",description:"SLO update request. Send all required SLO fields and the full alert list. Alerts are reconciled to exactly the provided list: alerts with a known id are updated, alerts without an id are created, and existing alerts absent from the list are deleted. Omit `clusterIds` to preserve the current cluster scope; send an empty array to run on all clusters."}),Kk={name:"API availability 99.9%",description:"Overall API gateway availability over the last 30 days",tags:[{key:"team",value:"platform"}],configuration:{type:"event",dataSource:"logs",goodQuery:{queries:[{filter:"status:ok",aggregate:{type:"count"}}],formula:"q1"},totalQuery:{queries:[{filter:"*",aggregate:{type:"count"}}],formula:"q1"},noDataBehavior:"good"},target:99.9,timeframeDays:30,owner:"team-123-abc",permissions:"all",clusterIds:[],alerts:[{priority:1,configuration:{type:"burn-rate",burnRate:14.4}}]};Object.assign(Bk,{examples:[Kk]});Object.assign(Hk,{examples:[Kk]});var zk=d({description:"Creates an SLO owned by the specified team. The SLO can be event-based (good/total queries) or time-based (a thresholded query over evaluation slices) depending on its configuration.",operationId:"createSlo",tags:["slos"],url:xc,method:"POST",body:Bk,response:Rc}),Yk=d({description:"Replaces an existing SLO definition by ID. Send the full SLO input shape, including configuration, ownership, permissions, cluster scope, and the reconciled alert list. Changing configuration, target, timeframe, permissions, or cluster scope resets evaluated SLO state, so returned status and error budget are based on data evaluated after the update.",operationId:"updateSlo",tags:["slos"],url:`${xc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to update. Use the `id` returned by SLO query or create."})}),body:Hk,response:Rc}),Vk=d({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${xc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to delete. Use the `id` returned by SLO query or create."})}),response:w});var Ho=`${Sc}/tag-policies`;var E5=["logs","metrics","traces"],Gh=t.Array(t.Enum(E5,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),_5=t.Union([au,Gh]),I5=t.Object({teamIds:t.Array(t.String(),{description:"Team IDs used by this policy scope."}),mode:t.Enum(["include","exclude"],{description:"`include` applies the policy only to listed teams. `exclude` applies it to all teams except the listed teams."})},{description:"Team scope that limits where this policy applies. Omitted means the policy applies to all teams."}),S5=x("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:Gh,shouldInsertWarning:t.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:t.Optional(t.Number({description:"Percentage of non-compliant telemetry datapoints to drop. Omitted means no sampling drop is configured."}))},{title:"TelemetryTagPolicy"}),t.Object({type:t.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:au},{title:"TsugaAssetTagPolicy"})]),b5=x("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:Gh,shouldInsertWarning:t.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:t.Optional(t.Number({minimum:0,maximum:100,description:"Percentage of non-compliant telemetry datapoints to drop. Valid values are 0 through 100."}))},{title:"TelemetryTagPolicy"}),t.Object({type:t.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:au},{title:"TsugaAssetTagPolicy"})]),Qk="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",O5=t.Unsafe({...S5,description:Qk}),A5=t.Unsafe({...b5,description:Qk}),Es=t.Object({id:t.String({description:"Tsuga-generated tag policy ID assigned when the policy is created."}),name:t.String({description:"Human-readable tag policy name."}),description:t.Optional(t.String({description:"Optional user-provided policy description."})),isActive:t.Boolean({description:"Whether Tsuga currently evaluates this policy. Reserved policies (for example the built-in `env` policy on ingestion API keys) cannot be set to false."}),tagKey:t.String({description:"Tag key enforced by this policy."}),allowedTagValues:t.Array(t.String(),{description:"Allowed values for `tagKey`. An empty array means any value is accepted when the tag exists."}),isRequired:t.Boolean({description:"Whether the tag must be present. If false, `allowedTagValues` is still enforced when the tag exists. Reserved policies cannot be set to false."}),teamScope:t.Optional(I5),configuration:O5,creator:t.Optional(pe),updater:t.Optional(pe),owner:t.Optional(t.String({description:"Team ID that owns and manages the policy."})),createdAt:S({description:"Timestamp when Tsuga created the tag policy."}),updatedAt:S({description:"Timestamp when Tsuga last updated the tag policy."}),assetUpdatedAt:S({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})});var Cc=t.Object({name:p({description:"Human-readable tag policy name."}),description:Se(p(),{description:"Optional policy description."}),isActive:t.Boolean({description:"Set to true for Tsuga to evaluate this policy. Reserved policies (for example the built-in `env` policy on ingestion API keys) reject a false value."}),tagKey:p({allowEmpty:!1,description:"Tag key enforced by this policy. Tsuga trims surrounding whitespace before storing the policy."}),allowedTagValues:t.Array(p({allowEmpty:!1}),{maxItems:1e3,description:"Allowed values for `tagKey`. Leave empty to allow any value when the tag exists. Tsuga trims each submitted value before storing the policy."}),isRequired:t.Boolean({description:"Set to true to require the tag. If false, allowed values still apply when the tag exists. Reserved policies reject a false value."}),teamScope:t.Optional(t.Object({teamIds:t.Array(p(),{minItems:1,maxItems:100,description:"Team IDs used by this policy scope."}),mode:t.Enum(["include","exclude"],{description:"`include` applies the policy only to listed teams. `exclude` applies it to all teams except the listed teams."})},{description:"Team scope to store for this policy. Omit this field to apply the policy to all teams."})),configuration:A5,owner:p({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),Pst=d({tags:["tag-policies"],url:Ho,method:"GET",query:t.Object({teamIds:t.Optional(t.Array(p(),{maxItems:100})),assetTypes:t.Optional(_5),searchQuery:t.Optional(p())}),response:t.Array(Es)}),Ust=d({tags:["tag-policies"],url:`${Ho}/:id`,method:"GET",params:t.Object({id:p()}),response:Es}),Nst=d({tags:["tag-policies"],url:Ho,method:"POST",body:Cc,response:Es}),wst=d({tags:["tag-policies"],url:`${Ho}/:id`,method:"PUT",params:t.Object({id:p()}),body:Cc,response:Es}),vst=d({tags:["tag-policies"],url:`${Ho}/:id`,method:"DELETE",params:t.Object({id:p()}),response:w}),Lst=d({tags:["tag-policies"],url:`${Sc}/applicable-tag-rules`,method:"GET",query:t.Object({assetType:t.Enum(ca),teamId:p()}),response:t.Array(t.Object({tagKey:t.String(),allowedTagValues:t.Array(t.String()),isRequired:t.Boolean(),tagPolicyId:t.String()}))}),Wk=t.Object({total:t.Number(),totalNonCompliant:t.Number(),idsNonCompliant:t.Array(t.String())}),Zk=t.Union([t.Literal("ingestion-api-key"),t.Literal("operation-api-key"),t.Literal("rum-public-token"),t.Literal("dashboard"),t.Literal("log-route"),t.Literal("metric-route"),t.Literal("monitor"),t.Literal("notification-rule"),t.Literal("notification-silence"),t.Literal("slo")]),x5=t.Object({total:t.Number(),totalNonCompliant:t.Number(),byAssetType:t.Record(Zk,Wk)}),R5=t.Omit(Wk,["total"]),C5=t.Object({totalNonCompliant:t.Number(),byAssetType:t.Record(Zk,R5)}),Xk=t.Object({totals:x5,byTeam:t.Record(t.String(),C5)}),kst=d({tags:["tag-policies"],url:`${Ho}/:id/stats`,method:"GET",params:t.Object({id:p()}),response:Xk}),Mst=d({tags:["tag-policies"],url:`${Ho}/new-policy-stats`,method:"POST",body:Cc,response:Xk});var Pc=`/${"v1"}/tag-policies`,Jk={name:"Required Environment Tag",description:"Requires dashboards and monitors to declare an environment.",isActive:!0,tagKey:"environment",allowedTagValues:["production","staging"],isRequired:!0,teamScope:{teamIds:["team-123-abc"],mode:"include"},configuration:{type:"tsuga_asset",assetTypes:["dashboard","monitor"]},owner:"team-123-abc"},eM={name:"Telemetry Environment Policy",description:"Warns when telemetry is missing a known deployment environment.",isActive:!0,tagKey:"deployment.environment.name",allowedTagValues:["production","staging","development"],isRequired:!0,configuration:{type:"telemetry",assetTypes:[],shouldInsertWarning:!0,dropSample:25},owner:"team-123-abc"},P5={id:"123-456-abc",...Jk},U5={id:"456-789-def",...eM},Uc=t.Pick(Es,["id","name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"],{$id:"TagPolicy",description:"Policy that enforces tag requirements on Tsuga-managed assets or telemetry data. See [Tag policies](/documentation/account-and-settings/tag-policies)."}),N5=P5,w5=U5;Object.assign(Uc,{examples:[N5,w5]});var $h=t.Pick(Cc,["name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"],{description:"Tag policy create or update request. Provide policy identity, owner, enforced tag key, allowed values, team scope, active state, and asset or telemetry configuration."}),v5=Jk,L5=eM;Object.assign($h,{examples:[v5,L5]});var tM=d({description:"Lists tag policies visible to the authenticated operation key. Use this to audit required tags, allowed values, team scope, and whether each policy applies to assets or telemetry.",operationId:"listTagPolicies",tags:["tag-policies"],url:Pc,method:"GET",response:t.Array(Uc)}),rM=d({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${Pc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to retrieve. Use the `id` returned by tag policy list or create responses."})}),response:Uc}),nM=d({description:"Creates a tag policy for Tsuga-managed assets or telemetry data. Use the configuration type to choose the policy surface.",operationId:"createTagPolicy",tags:["tag-policies"],url:Pc,method:"POST",body:$h,response:Uc}),oM=d({description:"Replaces an existing tag policy by ID, including scope, requiredness, allowed values, owner, active state, and configuration. Reserved policies (for example the built-in `env` policy on ingestion API keys) reject changes to `tagKey` and reject `isActive: false` or `isRequired: false`.",operationId:"updateTagPolicy",tags:["tag-policies"],url:`${Pc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to update. Use the `id` returned by tag policy list, get, or create responses."})}),body:$h,response:Uc}),iM=d({description:"Deletes a tag policy by ID. Tsuga stops evaluating the policy after deletion. Reserved policies (for example the built-in `env` policy on ingestion API keys) cannot be deleted.",operationId:"deleteTagPolicy",tags:["tag-policies"],url:`${Pc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to delete. Use the `id` returned by tag policy list, create, or update responses."})}),response:w});var Nc=`/${"v1"}/teams`,wc=t.Pick(Cn,["id","name","description","visibility","tags"],{$id:"Team",description:"Collection of users used to manage ownership, visibility, and access to team-owned Tsuga resources. See [Teams](/documentation/account-and-settings/teams)."}),k5={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(wc,{examples:[k5]});var sM=d({description:"Lists teams visible to the authenticated operation key. Use this endpoint to inventory owners for resources, dashboards, monitors, routes, and policies. Pagination fields limit the returned page.",operationId:"listTeams",tags:["teams"],url:Nc,method:"GET",paginated:!0,query:t.Object(qe),response:t.Array(wc)}),aM=d({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${Nc}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to retrieve. Use the `id` returned by team list or create responses."})}),response:wc}),Fh=t.Pick(Tu,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),M5={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Fh,{examples:[M5]});var cM=d({description:"Creates a team for ownership and access control. Use this before assigning resources to a new owner team. A new team sits outside every existing team, so the operation key must be scoped to all teams: a key scoped to its owning team cannot create teams, even with write access to teams.",operationId:"createTeam",tags:["teams"],url:Nc,method:"POST",body:Fh,response:wc}),pM=d({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${Nc}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to update. Use the `id` returned by team list, get, or create responses."})}),body:Fh,response:wc}),uM=d({description:"Deletes a team. Fails while the team still owns resources (dashboards, monitors, routes, API keys, etc.); reassign or delete those first. Team memberships are removed automatically as part of the deletion.",operationId:"deleteTeam",tags:["teams"],url:`${Nc}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to delete. Use the `id` returned by team list, create, or update responses."})}),response:w});function D5(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function lM(e,r){let n=Number(r);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${r})`);return n}function mM(e){let r={};return e.limit!==void 0&&(r.limit=lM("limit",e.limit)),e.offset!==void 0&&(r.offset=lM("offset",e.offset)),r}function jh(e){let r=e.params;if(r?.properties){let n=Object.keys(r.properties);if(n.length===1&&n[0])return n[0]}return"id"}function dM(e,r,n){let o=e.command(r.commandName).description(r.description),i=r.singularOverride??jR(r.commandName).replace(/-/g," "),s=r.pluralOverride??r.commandName.replace(/-/g," "),c=D5(i),l=o.command("list").description(r.listDescription??`List all ${s}`);if(r.listOptions)for(let m of r.listOptions)l.option(m.flag,m.description);if(r.endpoints.list.paginated===!0&&l.option("--limit <n>",`Maximum number of items to return, up to ${Si} (default: ${su})`).option("--offset <n>","Number of items to skip, to request a later page"),r.enableListBody?l.option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async m=>{if(m.generateSkeleton){W(Ki(r.endpoints.list));return}let f=m.data?wi({data:m.data}):{},h=await n()(r.endpoints.list,{body:{...f,...mM(m)}});W(h)}):l.action(async m=>{let f=mM(m);if(r.listOptions)for(let E of r.listOptions){let I=m[E.queryParam];I!==void 0&&(f[E.queryParam]=I)}let h=await n()(r.endpoints.list,Object.keys(f).length>0?{query:f}:void 0);W(h)}),r.endpoints.get){let m=r.endpoints.get,f=jh(m);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});W(E)})}if(r.endpoints.create){let m=r.endpoints.create;o.command("create").description(`Create a new ${i}`).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async f=>{if(f.generateSkeleton){W(Ki(m));return}let h=wi(f),E=await n()(m,{body:h});W(E)})}if(r.endpoints.update){let m=r.endpoints.update,f=jh(m);o.command("update <ID>").description(`Update ${c} ${i} by ID`).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async(h,E)=>{if(E.generateSkeleton){W(Ki(m));return}let I=wi(E),g=await n()(m,{params:{[f]:h},body:I});W(g)})}if(r.endpoints.delete){let m=r.endpoints.delete,f=jh(m);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});W(E)})}}var G5=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:cL},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:fv,get:gv,create:hv,update:yv,delete:Tv},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:Fv,get:jv,create:qv,update:Bv,delete:Hv},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:Zv,create:Xv,update:Jv,delete:eL}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:uL,get:lL,create:mL,update:dL,delete:fL}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:$L,get:FL,create:VL,update:QL,delete:WL},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:ik,get:sk,create:ak,update:ck,delete:pk}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:hk,get:yk,create:Tk,update:Ek,delete:_k}},{commandName:"notification-integrations",description:"Manage notification integrations",endpoints:{list:ZL,get:XL,create:ek,update:rk,delete:nk}},{commandName:"quality-reports",description:"Get the latest quality report rows for a cluster",listDescription:"Get the latest quality report rows for a cluster (pass --cluster <CLUSTER_ID> when the org has more than one cluster)",endpoints:{list:Ck},listOptions:[{flag:"--team <TEAM_NAME>",description:"Only return rows for this team by name (omits cluster-wide global rows)",queryParam:"team"}]},{commandName:"retention-policies",description:"Manage retention policies",endpoints:{list:vk,get:Lk,create:kk,update:Mk,delete:Dk}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:CL,get:PL,create:UL,update:NL,delete:wL}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:hw,get:yw}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:Fk,get:jk,create:zk,update:Yk,delete:Vk},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:tM,get:rM,create:nM,update:oM,delete:iM}},{commandName:"teams",description:"Manage teams",endpoints:{list:sM,get:aM,create:cM,update:pM,delete:uM}}];function fM(e,r){for(let n of G5)dM(e,n,r)}var gM=require("node:child_process");var Vl="@tsuga/cli@latest";function $5(){Y(`Updating ${Vl}`),Y(` $ npm install -g ${Vl}`);try{(0,gM.execFileSync)("npm",["install","-g",Vl],{stdio:["ignore","inherit","inherit"]})}catch(e){let r=e.status??1;throw new Error(`npm install -g ${Vl} exited ${r}`,{cause:e})}Y("Updated. Run `tsuga --version` to confirm the new version.")}function hM(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{$5()})}var Vh=require("node:fs"),Yh=require("node:os"),Is=require("node:path");var F5=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,vc=class e extends Date{#t=!1;#r=!1;#e=null;constructor(r){let n=!0,o=!0,i="Z";if(typeof r=="string"){let s=r.match(F5);s?(s[1]||(n=!1,r=`0000-01-01T${r}`),o=!!s[2],o&&r[10]===" "&&(r=r.replace(" ","T")),s[2]&&+s[2]>23?r="":(i=s[3]||null,r=r.toUpperCase(),!i&&o&&(r+="Z"))):r=""}super(r),isNaN(this.getTime())||(this.#t=n,this.#r=o,this.#e=i)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let r=super.toISOString();if(this.isDate())return r.slice(0,10);if(this.isTime())return r.slice(11,23);if(this.#e===null)return r.slice(0,-1);if(this.#e==="Z")return r;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(r,n="Z"){let o=new e(r);return o.#e=n,o}static wrapAsLocalDateTime(r){let n=new e(r);return n.#e=null,n}static wrapAsLocalDate(r){let n=new e(r);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(r){let n=new e(r);return n.#t=!1,n.#e=null,n}};function j5(e,r){let n=e.slice(0,r).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function q5(e,r,n){let o=e.split(/\r\n|\n|\r/g),i="",s=(Math.log10(r+1)|0)+1;for(let c=r-1;c<=r+1;c++){let l=o[c-1];l&&(i+=c.toString().padEnd(s," "),i+=": ",i+=l,i+=`
147
+ `,c===r&&(i+=" ".repeat(s+n+2),i+=`^
148
+ `))}return i}var te=class extends Error{line;column;codeblock;constructor(r,n){let[o,i]=j5(n.toml,n.ptr),s=q5(n.toml,o,i);super(`Invalid TOML document: ${r}
148
149
 
149
- ${a}`,n),this.line=o,this.column=i,this.codeblock=a}};var R5=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,C5=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,P5=/^[+-]?0[0-9_]/;function Ql(e,r){let n=e[r++],o=n,i=n==="'",a=n===e[r]&&n===e[r+1];a&&(e[r+=2]===`
150
+ ${s}`,n),this.line=o,this.column=i,this.codeblock=s}};var B5=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,H5=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,K5=/^[+-]?0[0-9_]/;function Ql(e,r){let n=e[r++],o=n,i=n==="'",s=n===e[r]&&n===e[r+1];s&&(e[r+=2]===`
150
151
  `?r++:e[r]==="\r"&&e[r+1]===`
151
- `&&(r+=2));let c="",l=r,m=0;for(let f=r;f<e.length;f++)if(n=e[f],a&&(n===`
152
+ `&&(r+=2));let c="",l=r,m=0;for(let f=r;f<e.length;f++)if(n=e[f],s&&(n===`
152
153
  `||n==="\r"&&e[f+1]===`
153
- `))m=m&&3;else{if(n<" "&&n!==" "||n==="\x7F")throw new ee("control characters are not allowed in strings",{toml:e,ptr:f});if((!m||m===3)&&n===o&&(!a||e[f+1]===o&&e[f+2]===o))return a&&(e[f+3]===o&&f++,e[f+3]===o&&f++),[m?c:c+e.slice(l,f),f+(a?3:1)];if(!m)!i&&n==="\\"&&(c+=e.slice(l,l=f),m=1);else if(m===1)if(n==="x"||n==="u"||n==="U"){let h=0,E=n==="x"?2:n==="u"?4:8;for(let I=0;I<E;I++,f++){let g=e.charCodeAt(f+1),T=g>=48&&g<=57?g-48:g>=65&&g<=70?g-65+10:g>=97&&g<=102?g-97+10:-1;if(T<0)throw new ee("invalid non-hex character in unicode escape",{toml:e,ptr:f+1});h=h<<4|T}if(h<0||h>1114111||h>=55296&&h<=57343)throw new ee("invalid unicode escape",{toml:e,ptr:f});c+=String.fromCodePoint(h),l=f+1,m=0}else if(n===" "||n===" ")m=2;else{if(n==="b")c+="\b";else if(n==="t")c+=" ";else if(n==="n")c+=`
154
- `;else if(n==="f")c+="\f";else if(n==="r")c+="\r";else if(n==="e")c+="\x1B";else if(n==='"')c+='"';else if(n==="\\")c+="\\";else throw new ee("unrecognized escape sequence",{toml:e,ptr:f});l=f+1,m=0}else if(n!==" "&&n!==" "){if(m===2)throw new ee("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:l});m=!i&&n==="\\"?1:0,l=f}}throw new ee("unfinished string",{toml:e,ptr:r})}function uM(e,r,n,o){if(e==="true")return!0;if(e==="false")return!1;if(e==="-inf")return-1/0;if(e==="inf"||e==="+inf")return 1/0;if(e==="nan"||e==="+nan"||e==="-nan")return NaN;if(e==="-0")return o?0n:0;let i=R5.test(e);if(i||C5.test(e)){if(P5.test(e))throw new ee("leading zeroes are not allowed",{toml:r,ptr:n});e=e.replace(/_/g,"");let c=+e;if(isNaN(c))throw new ee("invalid number",{toml:r,ptr:n});if(i){if((i=!Number.isSafeInteger(c))&&!o)throw new ee("integer value cannot be represented losslessly",{toml:r,ptr:n});(i||o===!0)&&(c=BigInt(e))}return c}let a=new vc(e);if(!a.isValid())throw new ee("invalid value",{toml:r,ptr:n});return a}function Wl(e,r=0,n=e.length){let o=e.indexOf(`
155
- `,r);return e[o-1]==="\r"&&o--,o<=n?o:-1}function Ea(e,r){for(let n=r;n<e.length;n++){let o=e[n];if(o===`
154
+ `))m=m&&3;else{if(n<" "&&n!==" "||n==="\x7F")throw new te("control characters are not allowed in strings",{toml:e,ptr:f});if((!m||m===3)&&n===o&&(!s||e[f+1]===o&&e[f+2]===o))return s&&(e[f+3]===o&&f++,e[f+3]===o&&f++),[m?c:c+e.slice(l,f),f+(s?3:1)];if(!m)!i&&n==="\\"&&(c+=e.slice(l,l=f),m=1);else if(m===1)if(n==="x"||n==="u"||n==="U"){let h=0,E=n==="x"?2:n==="u"?4:8;for(let I=0;I<E;I++,f++){let g=e.charCodeAt(f+1),T=g>=48&&g<=57?g-48:g>=65&&g<=70?g-65+10:g>=97&&g<=102?g-97+10:-1;if(T<0)throw new te("invalid non-hex character in unicode escape",{toml:e,ptr:f+1});h=h<<4|T}if(h<0||h>1114111||h>=55296&&h<=57343)throw new te("invalid unicode escape",{toml:e,ptr:f});c+=String.fromCodePoint(h),l=f+1,m=0}else if(n===" "||n===" ")m=2;else{if(n==="b")c+="\b";else if(n==="t")c+=" ";else if(n==="n")c+=`
155
+ `;else if(n==="f")c+="\f";else if(n==="r")c+="\r";else if(n==="e")c+="\x1B";else if(n==='"')c+='"';else if(n==="\\")c+="\\";else throw new te("unrecognized escape sequence",{toml:e,ptr:f});l=f+1,m=0}else if(n!==" "&&n!==" "){if(m===2)throw new te("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:l});m=!i&&n==="\\"?1:0,l=f}}throw new te("unfinished string",{toml:e,ptr:r})}function yM(e,r,n,o){if(e==="true")return!0;if(e==="false")return!1;if(e==="-inf")return-1/0;if(e==="inf"||e==="+inf")return 1/0;if(e==="nan"||e==="+nan"||e==="-nan")return NaN;if(e==="-0")return o?0n:0;let i=B5.test(e);if(i||H5.test(e)){if(K5.test(e))throw new te("leading zeroes are not allowed",{toml:r,ptr:n});e=e.replace(/_/g,"");let c=+e;if(isNaN(c))throw new te("invalid number",{toml:r,ptr:n});if(i){if((i=!Number.isSafeInteger(c))&&!o)throw new te("integer value cannot be represented losslessly",{toml:r,ptr:n});(i||o===!0)&&(c=BigInt(e))}return c}let s=new vc(e);if(!s.isValid())throw new te("invalid value",{toml:r,ptr:n});return s}function Wl(e,r=0,n=e.length){let o=e.indexOf(`
156
+ `,r);return e[o-1]==="\r"&&o--,o<=n?o:-1}function _s(e,r){for(let n=r;n<e.length;n++){let o=e[n];if(o===`
156
157
  `)return n;if(o==="\r"&&e[n+1]===`
157
- `)return n+1;if(o<" "&&o!==" "||o==="\x7F")throw new ee("control characters are not allowed in comments",{toml:e,ptr:r})}return e.length}function Hr(e,r,n,o){let i;for(;;){for(;(i=e[r])===" "||i===" "||!n&&(i===`
158
+ `)return n+1;if(o<" "&&o!==" "||o==="\x7F")throw new te("control characters are not allowed in comments",{toml:e,ptr:r})}return e.length}function Kr(e,r,n,o){let i;for(;;){for(;(i=e[r])===" "||i===" "||!n&&(i===`
158
159
  `||i==="\r"&&e[r+1]===`
159
- `);)r++;if(o||i!=="#")break;r=Ea(e,r)}return r}function lM(e,r,n,o,i=!1){if(!o)return r=Wl(e,r),r<0?e.length:r;for(let a=r;a<e.length;a++){let c=e[a];if(c==="#"){if(a=Wl(e,a),a<0)break}else{if(c===n)return a+1;if(c===o||i&&(c===`
160
- `||c==="\r"&&e[a+1]===`
161
- `))return a}}throw new ee("cannot find end of structure",{toml:e,ptr:r})}function U5(e,r,n){let o=e.slice(r,n),i=o.indexOf("#");return i>-1&&(Ea(e,i),o=o.slice(0,i)),[o.trimEnd(),i]}function Nc(e,r,n,o,i){if(o===0)throw new ee("document contains excessively nested structures. aborting.",{toml:e,ptr:r});let a=e[r];if(a==="["||a==="{"){let[m,f]=a==="["?dM(e,r,o,i):mM(e,r,o,i);if(n){if(f=Hr(e,f),e[f]===",")f++;else if(e[f]!==n)throw new ee("expected comma or end of structure",{toml:e,ptr:f})}return[m,f]}if(a==='"'||a==="'"){let[m,f]=Ql(e,r);if(n){if(f=Hr(e,f),e[f]&&e[f]!==","&&e[f]!==n&&e[f]!==`
162
- `&&e[f]!=="\r")throw new ee("unexpected character encountered",{toml:e,ptr:f});e[f]===","&&f++}return[m,f]}let c=lM(e,r,",",n),l=U5(e,r,c-(e[c-1]===","?1:0));if(!l[0])throw new ee("incomplete key-value declaration: no value specified",{toml:e,ptr:r});return n&&l[1]>-1&&(c=Hr(e,r+l[1]),e[c]===","&&c++),[uM(l[0],e,r,i),c]}var w5=/^[a-zA-Z0-9-_]+[ \t]*$/;function Zl(e,r,n="="){let o=r-1,i=[],a=e.indexOf(n,r);if(a<0)throw new ee("incomplete key-value: cannot find end of key",{toml:e,ptr:r});do{let c=e[r=++o];if(c!==" "&&c!==" ")if(c==='"'||c==="'"){if(c===e[r+1]&&c===e[r+2])throw new ee("multiline strings are not allowed in keys",{toml:e,ptr:r});let[l,m]=Ql(e,r);o=e.indexOf(".",m);let f=e.slice(m,o<0||o>a?a:o),h=Wl(f);if(h>-1)throw new ee("newlines are not allowed in keys",{toml:e,ptr:r+o+h});if(f.trimStart())throw new ee("found extra tokens after the string part",{toml:e,ptr:m});if(a<m&&(a=e.indexOf(n,m),a<0))throw new ee("incomplete key-value: cannot find end of key",{toml:e,ptr:r});i.push(l)}else{o=e.indexOf(".",r);let l=e.slice(r,o<0||o>a?a:o);if(!w5.test(l))throw new ee("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:r});i.push(l.trimEnd())}}while(o+1&&o<a);return[i,Hr(e,a+1,!0,!0)]}function mM(e,r,n,o){let i={},a=new Set,c;for(r++;(c=e[r++])!=="}"&&c;){if(c===",")throw new ee("expected value, found comma",{toml:e,ptr:r-1});if(c==="#")r=Ea(e,r);else if(c!==" "&&c!==" "&&c!==`
163
- `&&c!=="\r"){let l,m=i,f=!1,[h,E]=Zl(e,r-1);for(let T=0;T<h.length;T++){if(T&&(m=f?m[l]:m[l]={}),l=h[T],(f=Object.hasOwn(m,l))&&(typeof m[l]!="object"||a.has(m[l])))throw new ee("trying to redefine an already defined value",{toml:e,ptr:r});!f&&l==="__proto__"&&Object.defineProperty(m,l,{enumerable:!0,configurable:!0,writable:!0})}if(f)throw new ee("trying to redefine an already defined value",{toml:e,ptr:r});let[I,g]=Nc(e,E,"}",n-1,o);a.add(I),m[l]=I,r=g}}if(!c)throw new ee("unfinished table encountered",{toml:e,ptr:r});return[i,r]}function dM(e,r,n,o){let i=[],a;for(r++;(a=e[r++])!=="]"&&a;){if(a===",")throw new ee("expected value, found comma",{toml:e,ptr:r-1});if(a==="#")r=Ea(e,r);else if(a!==" "&&a!==" "&&a!==`
164
- `&&a!=="\r"){let c=Nc(e,r-1,"]",n-1,o);i.push(c[0]),r=c[1]}}if(!a)throw new ee("unfinished array encountered",{toml:e,ptr:r});return[i,r]}function fM(e,r,n,o){let i=r,a=n,c,l=!1,m;for(let f=0;f<e.length;f++){if(f){if(i=l?i[c]:i[c]={},a=(m=a[c]).c,o===0&&(m.t===1||m.t===2))return null;if(m.t===2){let h=i.length-1;i=i[h],a=a[h].c}}if(c=e[f],(l=Object.hasOwn(i,c))&&a[c]?.t===0&&a[c]?.d)return null;l||(c==="__proto__"&&(Object.defineProperty(i,c,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,c,{enumerable:!0,configurable:!0,writable:!0})),a[c]={t:f<e.length-1&&o===2?3:o,d:!1,i:0,c:{}})}if(m=a[c],m.t!==o&&!(o===1&&m.t===3)||(o===2&&(m.d||(m.d=!0,i[c]=[]),i[c].push(i={}),m.c[m.i++]=m={t:1,d:!1,i:0,c:{}}),m.d))return null;if(m.d=!0,o===1)i=l?i[c]:i[c]={};else if(o===0&&l)return null;return[c,i,m.c]}function $h(e,{maxDepth:r=1e3,integersAsBigInt:n}={}){let o={},i={},a=o,c=i;for(let l=Hr(e,0);l<e.length;){if(e[l]==="["){let m=e[++l]==="[",f=Zl(e,l+=+m,"]");if(m){if(e[f[1]-1]!=="]")throw new ee("expected end of table declaration",{toml:e,ptr:f[1]-1});f[1]++}let h=fM(f[0],o,i,m?2:1);if(!h)throw new ee("trying to redefine an already defined table or value",{toml:e,ptr:l});c=h[2],a=h[1],l=f[1]}else{let m=Zl(e,l),f=fM(m[0],a,c,0);if(!f)throw new ee("trying to redefine an already defined table or value",{toml:e,ptr:l});let h=Nc(e,m[1],void 0,r,n);f[1][f[0]]=h[0],l=h[1]}if(l=Hr(e,l,!0),e[l]&&e[l]!==`
165
- `&&e[l]!=="\r")throw new ee("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=Hr(e,l)}return o}var gM=/^[a-z0-9-_]+$/i;function Lc(e){let r=typeof e;if(r==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return r}function v5(e){for(let r=0;r<e.length;r++)if(Lc(e[r])!=="object")return!1;return e.length!=0}function Fh(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function jh(e,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(r==="number")return isNaN(e)?"nan":e===1/0?"inf":e===-1/0?"-inf":Number.isInteger(e)&&(o||!Number.isSafeInteger(e))?e.toFixed(1):e.toString();if(r==="bigint"||r==="boolean")return e.toString();if(r==="string")return Fh(e);if(r==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(r==="object")return N5(e,n,o);if(r==="array")return L5(e,n,o)}function N5(e,r,n){let o=Object.keys(e);if(o.length===0)return"{}";let i="{ ";for(let a=0;a<o.length;a++){let c=o[a];a&&(i+=", "),i+=gM.test(c)?c:Fh(c),i+=" = ",i+=jh(e[c],Lc(e[c]),r-1,n)}return i+" }"}function L5(e,r,n){if(e.length===0)return"[]";let o="[ ";for(let i=0;i<e.length;i++){if(i&&(o+=", "),e[i]===null||e[i]===void 0)throw new TypeError("arrays cannot contain null or undefined values");o+=jh(e[i],Lc(e[i]),r-1,n)}return o+" ]"}function k5(e,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let i="";for(let a=0;a<e.length;a++)i+=`${i&&`
160
+ `);)r++;if(o||i!=="#")break;r=_s(e,r)}return r}function TM(e,r,n,o,i=!1){if(!o)return r=Wl(e,r),r<0?e.length:r;for(let s=r;s<e.length;s++){let c=e[s];if(c==="#"){if(s=Wl(e,s),s<0)break}else{if(c===n)return s+1;if(c===o||i&&(c===`
161
+ `||c==="\r"&&e[s+1]===`
162
+ `))return s}}throw new te("cannot find end of structure",{toml:e,ptr:r})}function z5(e,r,n){let o=e.slice(r,n),i=o.indexOf("#");return i>-1&&(_s(e,i),o=o.slice(0,i)),[o.trimEnd(),i]}function Lc(e,r,n,o,i){if(o===0)throw new te("document contains excessively nested structures. aborting.",{toml:e,ptr:r});let s=e[r];if(s==="["||s==="{"){let[m,f]=s==="["?_M(e,r,o,i):EM(e,r,o,i);if(n){if(f=Kr(e,f),e[f]===",")f++;else if(e[f]!==n)throw new te("expected comma or end of structure",{toml:e,ptr:f})}return[m,f]}if(s==='"'||s==="'"){let[m,f]=Ql(e,r);if(n){if(f=Kr(e,f),e[f]&&e[f]!==","&&e[f]!==n&&e[f]!==`
163
+ `&&e[f]!=="\r")throw new te("unexpected character encountered",{toml:e,ptr:f});e[f]===","&&f++}return[m,f]}let c=TM(e,r,",",n),l=z5(e,r,c-(e[c-1]===","?1:0));if(!l[0])throw new te("incomplete key-value declaration: no value specified",{toml:e,ptr:r});return n&&l[1]>-1&&(c=Kr(e,r+l[1]),e[c]===","&&c++),[yM(l[0],e,r,i),c]}var Y5=/^[a-zA-Z0-9-_]+[ \t]*$/;function Zl(e,r,n="="){let o=r-1,i=[],s=e.indexOf(n,r);if(s<0)throw new te("incomplete key-value: cannot find end of key",{toml:e,ptr:r});do{let c=e[r=++o];if(c!==" "&&c!==" ")if(c==='"'||c==="'"){if(c===e[r+1]&&c===e[r+2])throw new te("multiline strings are not allowed in keys",{toml:e,ptr:r});let[l,m]=Ql(e,r);o=e.indexOf(".",m);let f=e.slice(m,o<0||o>s?s:o),h=Wl(f);if(h>-1)throw new te("newlines are not allowed in keys",{toml:e,ptr:r+o+h});if(f.trimStart())throw new te("found extra tokens after the string part",{toml:e,ptr:m});if(s<m&&(s=e.indexOf(n,m),s<0))throw new te("incomplete key-value: cannot find end of key",{toml:e,ptr:r});i.push(l)}else{o=e.indexOf(".",r);let l=e.slice(r,o<0||o>s?s:o);if(!Y5.test(l))throw new te("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:r});i.push(l.trimEnd())}}while(o+1&&o<s);return[i,Kr(e,s+1,!0,!0)]}function EM(e,r,n,o){let i={},s=new Set,c;for(r++;(c=e[r++])!=="}"&&c;){if(c===",")throw new te("expected value, found comma",{toml:e,ptr:r-1});if(c==="#")r=_s(e,r);else if(c!==" "&&c!==" "&&c!==`
164
+ `&&c!=="\r"){let l,m=i,f=!1,[h,E]=Zl(e,r-1);for(let T=0;T<h.length;T++){if(T&&(m=f?m[l]:m[l]={}),l=h[T],(f=Object.hasOwn(m,l))&&(typeof m[l]!="object"||s.has(m[l])))throw new te("trying to redefine an already defined value",{toml:e,ptr:r});!f&&l==="__proto__"&&Object.defineProperty(m,l,{enumerable:!0,configurable:!0,writable:!0})}if(f)throw new te("trying to redefine an already defined value",{toml:e,ptr:r});let[I,g]=Lc(e,E,"}",n-1,o);s.add(I),m[l]=I,r=g}}if(!c)throw new te("unfinished table encountered",{toml:e,ptr:r});return[i,r]}function _M(e,r,n,o){let i=[],s;for(r++;(s=e[r++])!=="]"&&s;){if(s===",")throw new te("expected value, found comma",{toml:e,ptr:r-1});if(s==="#")r=_s(e,r);else if(s!==" "&&s!==" "&&s!==`
165
+ `&&s!=="\r"){let c=Lc(e,r-1,"]",n-1,o);i.push(c[0]),r=c[1]}}if(!s)throw new te("unfinished array encountered",{toml:e,ptr:r});return[i,r]}function IM(e,r,n,o){let i=r,s=n,c,l=!1,m;for(let f=0;f<e.length;f++){if(f){if(i=l?i[c]:i[c]={},s=(m=s[c]).c,o===0&&(m.t===1||m.t===2))return null;if(m.t===2){let h=i.length-1;i=i[h],s=s[h].c}}if(c=e[f],(l=Object.hasOwn(i,c))&&s[c]?.t===0&&s[c]?.d)return null;l||(c==="__proto__"&&(Object.defineProperty(i,c,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(s,c,{enumerable:!0,configurable:!0,writable:!0})),s[c]={t:f<e.length-1&&o===2?3:o,d:!1,i:0,c:{}})}if(m=s[c],m.t!==o&&!(o===1&&m.t===3)||(o===2&&(m.d||(m.d=!0,i[c]=[]),i[c].push(i={}),m.c[m.i++]=m={t:1,d:!1,i:0,c:{}}),m.d))return null;if(m.d=!0,o===1)i=l?i[c]:i[c]={};else if(o===0&&l)return null;return[c,i,m.c]}function qh(e,{maxDepth:r=1e3,integersAsBigInt:n}={}){let o={},i={},s=o,c=i;for(let l=Kr(e,0);l<e.length;){if(e[l]==="["){let m=e[++l]==="[",f=Zl(e,l+=+m,"]");if(m){if(e[f[1]-1]!=="]")throw new te("expected end of table declaration",{toml:e,ptr:f[1]-1});f[1]++}let h=IM(f[0],o,i,m?2:1);if(!h)throw new te("trying to redefine an already defined table or value",{toml:e,ptr:l});c=h[2],s=h[1],l=f[1]}else{let m=Zl(e,l),f=IM(m[0],s,c,0);if(!f)throw new te("trying to redefine an already defined table or value",{toml:e,ptr:l});let h=Lc(e,m[1],void 0,r,n);f[1][f[0]]=h[0],l=h[1]}if(l=Kr(e,l,!0),e[l]&&e[l]!==`
166
+ `&&e[l]!=="\r")throw new te("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=Kr(e,l)}return o}var SM=/^[a-z0-9-_]+$/i;function kc(e){let r=typeof e;if(r==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return r}function V5(e){for(let r=0;r<e.length;r++)if(kc(e[r])!=="object")return!1;return e.length!=0}function Bh(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function Hh(e,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(r==="number")return isNaN(e)?"nan":e===1/0?"inf":e===-1/0?"-inf":Number.isInteger(e)&&(o||!Number.isSafeInteger(e))?e.toFixed(1):e.toString();if(r==="bigint"||r==="boolean")return e.toString();if(r==="string")return Bh(e);if(r==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(r==="object")return Q5(e,n,o);if(r==="array")return W5(e,n,o)}function Q5(e,r,n){let o=Object.keys(e);if(o.length===0)return"{}";let i="{ ";for(let s=0;s<o.length;s++){let c=o[s];s&&(i+=", "),i+=SM.test(c)?c:Bh(c),i+=" = ",i+=Hh(e[c],kc(e[c]),r-1,n)}return i+" }"}function W5(e,r,n){if(e.length===0)return"[]";let o="[ ";for(let i=0;i<e.length;i++){if(i&&(o+=", "),e[i]===null||e[i]===void 0)throw new TypeError("arrays cannot contain null or undefined values");o+=Hh(e[i],kc(e[i]),r-1,n)}return o+" ]"}function Z5(e,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let i="";for(let s=0;s<e.length;s++)i+=`${i&&`
166
167
  `}[[${r}]]
167
- `,i+=qh(0,e[a],r,n,o);return i}function qh(e,r,n,o,i){if(o===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let a="",c="",l=Object.keys(r);for(let m=0;m<l.length;m++){let f=l[m];if(r[f]!==null&&r[f]!==void 0){let h=Lc(r[f]);if(h==="symbol"||h==="function")throw new TypeError(`cannot serialize values of type '${h}'`);let E=gM.test(f)?f:Fh(f);if(h==="array"&&v5(r[f]))c+=(c&&`
168
- `)+k5(r[f],n?`${n}.${E}`:E,o-1,i);else if(h==="object"){let I=n?`${n}.${E}`:E;c+=(c&&`
169
- `)+qh(I,r[f],I,o-1,i)}else a+=E,a+=" = ",a+=jh(r[f],h,o,i),a+=`
170
- `}}return e&&(a||!c)&&(a=a?`[${e}]
171
- ${a}`:`[${e}]`),a&&c?`${a}
172
- ${c}`:a||c}function Bh(e,{maxDepth:r=1e3,numbersAsFloat:n=!1}={}){if(Lc(e)!=="object")throw new TypeError("stringify can only be called with an object");let o=qh(0,e,"",r,n);return o[o.length-1]!==`
168
+ `,i+=Kh(0,e[s],r,n,o);return i}function Kh(e,r,n,o,i){if(o===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let s="",c="",l=Object.keys(r);for(let m=0;m<l.length;m++){let f=l[m];if(r[f]!==null&&r[f]!==void 0){let h=kc(r[f]);if(h==="symbol"||h==="function")throw new TypeError(`cannot serialize values of type '${h}'`);let E=SM.test(f)?f:Bh(f);if(h==="array"&&V5(r[f]))c+=(c&&`
169
+ `)+Z5(r[f],n?`${n}.${E}`:E,o-1,i);else if(h==="object"){let I=n?`${n}.${E}`:E;c+=(c&&`
170
+ `)+Kh(I,r[f],I,o-1,i)}else s+=E,s+=" = ",s+=Hh(r[f],h,o,i),s+=`
171
+ `}}return e&&(s||!c)&&(s=s?`[${e}]
172
+ ${s}`:`[${e}]`),s&&c?`${s}
173
+ ${c}`:s||c}function zh(e,{maxDepth:r=1e3,numbersAsFloat:n=!1}={}){if(kc(e)!=="object")throw new TypeError("stringify can only be called with an object");let o=Kh(0,e,"",r,n);return o[o.length-1]!==`
173
174
  `?o+`
174
- `:o}var M5={CLAUDE_CODE_ENABLE_TELEMETRY:"1",CLAUDE_CODE_ENHANCED_TELEMETRY_BETA:"1",OTEL_METRICS_EXPORTER:"otlp",OTEL_LOGS_EXPORTER:"otlp",OTEL_TRACES_EXPORTER:"otlp",OTEL_EXPORTER_OTLP_PROTOCOL:"http/json",OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:"delta"};function D5(e,r,n,o){let i=(0,_a.join)(e,".claude","settings.json");z(`Claude Code \u2192 ${i}`),(0,Kh.mkdirSync)((0,_a.dirname)(i),{recursive:!0});let a=Vs(i),c;try{c=JSON.parse(a??"{}")}catch{throw new Error(`${i} is not valid JSON. Fix or remove it before re-running.`)}if(!Do(c))throw new Error(`${i} must contain a JSON object at the top level.`);let l=c.env??{};if(!Do(l))throw new Error(`${i} "env" must be a JSON object.`);let m=o?"1":"0";c.env={...l,...M5,OTEL_EXPORTER_OTLP_ENDPOINT:r,OTEL_LOG_USER_PROMPTS:m,OTEL_LOG_TOOL_DETAILS:m,OTEL_LOG_TOOL_CONTENT:m,OTEL_EXPORTER_OTLP_HEADERS:`Authorization=Bearer ${n}`};let f=Qs(i,a);Ys(i,`${JSON.stringify(c,null,2)}
175
- `),z(f===void 0?" created":` patched (backup: ${f})`)}function G5(e,r,n){return{environment:"dev",log_user_prompt:n,exporter:{"otlp-http":{endpoint:`${e}/v1/logs`,protocol:"binary",headers:{Authorization:`Bearer ${r}`}}},trace_exporter:{"otlp-http":{endpoint:`${e}/v1/traces`,protocol:"binary",headers:{Authorization:`Bearer ${r}`}}}}}function $5(e,r,n,o){let i=(0,_a.join)(e,".codex"),a=(0,_a.join)(i,"config.toml");z(`Codex \u2192 ${a}`),(0,Kh.mkdirSync)(i,{recursive:!0});let c=Vs(a),l=c===void 0?{}:$h(c),m="otel"in l;delete l.otel,l.otel=G5(r,n,o);let f=Qs(a,c);Ys(a,Bh(l)),z(f===void 0?" created":m?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function hM(){return new ur("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function yM(){return new ur("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var TM="Restart your claude / codex session to load the new config.";function EM(e){let r=e.command("setup").description("Configure local LLM CLIs to ship OTEL telemetry to Tsuga");r.command("claude-code").description("Patch ~/.claude/settings.json with Tsuga OTEL env").addOption(hM()).addOption(yM()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{D5((0,Hh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),z(TM)}),r.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(hM()).addOption(yM()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{$5((0,Hh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),z(TM)})}var Bo="/v0/logs";var zh=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var kc=0,Yh=t.Object({__tsuga_metadata__:t.Object({id:t.String(),source:t.Optional(t.String())},{additionalProperties:!0}),context:t.Optional(t.Object({team:t.Optional(t.String({description:"Team name associated with this log."})),tag_policy_warnings:t.Optional(t.Record(t.String(),t.String()))},{additionalProperties:!0,description:"Context attributes attached to the log after ingestion and route processing. `team` comes from telemetry or route-enriched context when present."})),message:t.Optional(t.Unknown({description:"Log message after ingestion and route processing. It can be any JSON value because processors may map arbitrary data into `message`."})),timestamp:t.Number({description:"Log timestamp as a Unix timestamp in milliseconds."}),level:t.Enum(zh,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[mR]:t.Optional(t.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),IM=100,F5="timestamp",j5=t.Union([t.Literal(F5)]),Yn=t.Partial(t.Object({...it.properties,query:p({type:"tsuga-query",description:"Tsuga query used to filter logs in the selected time range."}),maxResults:t.Integer({minimum:1,maximum:1e3,description:"Maximum number of logs to return. Valid values are 1 through 1000."}),shouldRecommendAttributes:t.Boolean({description:"Whether Tsuga should return suggested attributes to highlight in results."}),triggeredBy:t.Literal("refresh",{description:"Indicates the query was triggered by a refresh action."}),startOffset:t.Number({minimum:kc,description:"Result offset used when fetching additional log rows."}),startOffsets:t.Array(t.Number({minimum:kc}),{description:`Result offsets used when fetching additional log rows, one per entry of \`clusterIds\` and in the same order. Echo back each cluster's \`nextStartOffset\` from the previous response. Must have the same length as \`clusterIds\`. Defaults to ${kc} for every cluster.`}),clusterId:p({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:bs,sortBy:j5,sortDirection:Q,useCanopy:t.Boolean()})),Nst=d({tags:["logs"],url:`${Bo}/count`,method:"GET",query:t.Pick(Yn,["from","to","query","clusterId","clusterIds","useCanopy"]),response:t.Object({count:t.Number(),clusterResponses:t.Optional(Ri())})}),Mc=t.Object({value:t.String(),priority:t.Number()}),Lst=d({tags:["logs"],url:`${Bo}/search`,method:"GET",query:Yn,response:t.Object({logs:t.Optional(t.Array(Yh)),attributesToHighlight:t.Optional(t.Array(Mc)),clusterResponses:t.Optional(Ri(t.Object({nextStartOffset:t.Number({description:"Number of logs consumed on this cluster so far. Echo it back at this cluster's position in `startOffsets` to fetch the next page."})})))},{additionalProperties:!0})}),q5=t.Cyclic({TokenOutput:t.Union([t.Object({type:t.Literal("top"),values:t.Array(t.String())}),t.Object({type:t.Literal("ip"),value:t.String()}),t.Object({type:t.Literal("range"),min:t.Number(),max:t.Number()}),t.Object({type:t.Literal("variable"),value:t.String()}),t.Object({type:t.Literal("text"),value:t.String()}),t.Object({type:t.Literal("date"),value:t.String()}),t.Object({type:t.Literal("url"),value:t.String()}),t.Object({type:t.Literal("structure"),key:t.Array(t.String()),value:t.Array(t.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),B5=t.Object({id:t.String(),pattern:t.Array(q5),size:t.Integer({description:"Number of logs that matched the pattern"}),examples:t.Array(t.Object({id:t.String(),timestampUnix:t.Number()})),timeDistribution:t.Array(t.Number()),staticFeatures:t.Array(t.Object({key:t.String(),value:t.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),kst=d({tags:["logs"],url:`${Bo}/patterns`,method:"GET",query:t.Object({...it.properties,query:p({type:"tsuga-query"}),clusteringThreshold:t.Optional(t.Number()),clusterId:t.Optional(p({allowEmpty:!1})),useCanopy:t.Optional(t.Boolean())}),response:t.Object({patterns:t.Array(B5),sampleSize:t.Number()})}),Mst=d({tags:["logs"],url:`${Bo}/attributes`,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),clusterIds:t.Optional(bs),useCanopy:t.Optional(t.Boolean())}),response:t.Object({attributes:t.Array(t.String()),clusterResponses:t.Optional(Ri())})});var SM="timestamp";var _M=`${SM}_iso`;var H5=["pending","running","completed","incomplete","failed"],bM=t.Object({id:t.String({description:"ID of the export."}),status:t.Enum(H5,{description:"Lifecycle of the export. `pending` until the download is claimed, `running` while the CSV streams, then `completed`, `incomplete` when the file is usable but some matched logs could not be reached, or `failed` if the export was interrupted."}),rowsWritten:t.Number({description:"Logs written to the CSV so far. Updated periodically while the download streams, so it lags slightly behind the bytes on the wire."}),totalRows:t.Number({description:"Logs this export will write, already clamped to the export maximum. Use it as the denominator for progress."}),isTruncated:t.Boolean({description:"Whether the query matched more logs than the export maximum, so the CSV holds only the first logs in the requested sort order."}),errorMessage:t.Optional(t.String({description:"Why the export is incomplete or failed."}))}),Dst=d({tags:["logs"],url:`${Bo}/exports`,method:"POST",body:t.Object({...t.Pick(Yn,["from","to","query","clusterId","clusterIds","sortBy","sortDirection"]).properties,columns:t.Array(p({allowEmpty:!1}),{minItems:1,description:`Log attributes to write as CSV columns, in order. Each becomes one column, resolved against the log with dotted-path lookup. Including \`${SM}\` also writes a \`${_M}\` column next to it, holding the same instant in ISO 8601.`}),timezone:t.Optional(t.String({format:go,description:`IANA timezone the \`${_M}\` column is offset to (e.g. \`Europe/Paris\`). Defaults to UTC.`}))}),response:t.Object({...bM.properties,downloadUrl:t.String({description:"Relative URL to fetch the CSV from. It carries a single-use token that expires shortly after creation, so the caller must start the download immediately."})})}),Gst=d({tags:["logs"],url:`${Bo}/exports/:exportId`,method:"GET",params:t.Object({exportId:t.String()}),response:bM}),$st=d({tags:["logs"],url:`${Bo}/exports/:exportId/download`,method:"GET",params:t.Object({exportId:t.String()}),query:t.Object({token:p({allowEmpty:!1,description:"Single-use token minted when the export was created."})}),response:t.String({description:"CSV file, streamed as it is produced."})});var Dc=`/${"v1"}/logs`,Vh=t.Object({context:t.Optional(t.Object({team:t.Optional(t.String({description:"Team name associated with this log."}))},{additionalProperties:!0,$id:"LogContext",description:"Context attributes attached to the log after ingestion and route processing. `team` comes from telemetry or route-enriched context when present."})),...t.Pick(Yh,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),K5={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(Vh,{examples:[K5]});var OM=t.Object({query:t.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting logs to return. Omit to search all logs with `*`."})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e3,default:IM,description:"Maximum number of logs to return. Defaults to 100. Valid values are 1 through 1000."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),...Tt.properties},{description:"Log search query. Provide a time range, optional Tsuga query, and optional limit."}),z5={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(OM,{examples:[z5]});var AM=d({description:"Searches logs in a required time range using Tsuga query syntax. Use this endpoint to retrieve raw log events for investigations or automation. See [Logs](/documentation/explore/logs) and [Query syntax](/documentation/explore/query-syntax).",operationId:"searchLogs",tags:["public","logs"],url:`${Dc}/search`,method:"GET",query:OM,response:t.Object({logs:t.Array(Vh,{description:"Log events matching the query and time range."})})}),Y5=t.Object({pattern:t.String({description:"Clustered log pattern formatted as a readable string."}),size:t.Integer({description:"Number of logs that matched the pattern"}),groups:t.Array(t.Object({key:t.String({description:"Attribute dot-path shared by all logs in the pattern."}),value:t.String({description:"Value of the attribute identified by `key`, common to all logs in the pattern."})},{description:"Attribute key-value pair that is constant across every log matching this pattern, e.g. a shared `level` or `context.team`."}))}),xM=t.Object({patterns:t.Array(Y5,{description:"Log patterns clustered from logs matching the query."}),sampleSize:t.Number({description:"Number of logs sampled while computing patterns."})},{}),V5={patterns:[{pattern:"Resolved segment SegmentId([0:1]) from cache",size:37004,groups:[{key:"level",value:"DEBUG"},{key:"context.team",value:"infra"}]}],sampleSize:100};Object.assign(xM,{examples:[V5]});var RM=d({description:"Clusters matching logs into readable patterns for the requested time range. Use this to summarize common log shapes before drilling into raw events. See [Logs](/documentation/explore/logs).",operationId:"getLogPatterns",tags:["public","logs"],url:`${Dc}/patterns`,method:"GET",query:t.Object({...Tt.properties,query:p({type:"tsuga-query",description:"Tsuga query selecting logs to cluster into patterns."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:xM}),Q5=t.Object({exampleLog:t.Optional(Vh),team:t.String({description:"Team associated with the new error pattern."}),env:t.String({description:"Environment associated with the new error pattern."}),service:t.String({description:"Service associated with the new error pattern."}),firstSeen:t.Number({description:"Unix timestamp in seconds when this pattern was first seen."}),lastSeen:t.Number({description:"Unix timestamp in seconds when this pattern was last seen."})}),CM=t.Object({newErrorPatterns:t.Array(Q5,{description:"Error patterns first seen in the requested time range."})},{}),W5={newErrorPatterns:[{team:"platform",env:"production",service:"api-gateway",firstSeen:1704067200,lastSeen:1704153600,exampleLog:{message:"ConnectionError: Failed to connect to database",timestamp:17041536e5,level:"ERROR"}}]};Object.assign(CM,{examples:[W5]});var PM=d({description:"Finds error patterns first seen in the requested time range, optionally filtered by team, environment, or service. Use this to detect newly appearing failures. See [Logs](/documentation/explore/logs).",operationId:"getNewErrorPatterns",tags:["public","logs"],url:`${Dc}/patterns/new`,method:"GET",query:t.Object({...Tt.properties,team:t.Optional(p({description:"Team name to restrict pattern detection to."})),env:t.Optional(p({description:"Environment to restrict pattern detection to."})),service:t.Optional(p({description:"Service name to restrict pattern detection to."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:CM}),Z5=t.Object({team:t.String({description:"Team associated with the error pattern. Set from the log context used during pattern analysis. Returned for every pattern increase."}),env:t.String({description:"Environment associated with the error pattern. Set from the log context used during pattern analysis. Returned for every pattern increase."}),pattern:t.String({description:"Readable representation of the grouped error log pattern. Generated by Tsuga from matching log messages and returned for every pattern increase."}),increaseTimestamps:t.Array(t.Number({description:"Unix timestamp in milliseconds of a detected spike in this pattern. Tsuga computes these timestamps during pattern-increase analysis; one entry is returned for each spike in the requested time range."}))}),UM=t.Object({errorPatternIncreases:t.Array(Z5,{description:"Error patterns with increased occurrence in the requested time range."})},{}),X5={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(UM,{examples:[X5]});var wM=d({description:"Finds error patterns whose occurrence increased for a team in the requested time range. Use this to identify growing failure modes without retrieving raw log events. See [Logs](/documentation/explore/logs).",operationId:"getErrorPatternIncrease",tags:["public","logs"],url:`${Dc}/patterns/increase`,method:"GET",query:t.Object({...Tt.properties,team:p({allowEmpty:!1,description:"Team name to analyze for pattern increases. Required; match it to the `context.team` value on the logs you want Tsuga to inspect."}),env:t.Optional(p({allowEmpty:!1,description:"Environment to restrict the analysis to. Optional; match it to the `context.env` value on the logs, or omit it to analyze all environments for the team."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:UM}),vM=t.Object({attributes:t.Array(t.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),J5={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(vM,{examples:[J5]});var e8=t.Object({...Tt.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Log attribute discovery query. Provide a time range and optional cluster ID."}),NM=d({description:"Lists log attribute dot-paths observed in the requested time range. This endpoint requires a public API credential that can read all relevant teams because attribute discovery is not team-filtered. Use this to discover fields for Tsuga queries, filters, and grouping. See [Logs](/documentation/explore/logs).",operationId:"getLogAttributes",tags:["public","logs"],url:`${Dc}/attributes`,method:"GET",query:e8,response:vM});var ln="/v0/metrics",t8=t.Object({__tsuga_metadata__:t.Object({},{additionalProperties:!0}),context:t.Optional(t.Object({},{additionalProperties:!0})),message:t.Optional(t.String()),timestamp:t.Number(),level:t.Enum(zh)},{additionalProperties:!0}),Jst=d({tags:["metrics"],url:`${ln}/count`,method:"GET",query:t.Pick(Yn,["from","to","query","clusterId"]),response:t.Object({count:t.Number()})}),ect=d({tags:["metrics"],url:`${ln}/search`,method:"GET",query:Yn,response:t.Object({logs:t.Optional(t.Array(t8)),totalHits:t.Optional(t.Number()),attributesToHighlight:t.Optional(t.Array(Mc))},{additionalProperties:!0})}),Xl=t.Enum(["counter","gauge","histogram","summary","composite_histogram"],{description:"Metric instrument type, set by the reporting instrumentation. `counter` accumulates a monotonically increasing total (aggregate with `sum` or `increase`); `gauge` reports a point-in-time value that can go up or down (aggregate with `average`, `max`, `min`, or `last`); `histogram`, `composite_histogram`, and `summary` report a distribution of values, from which percentiles can be computed. Tsuga displays `composite_histogram` metrics as Histogram in the app."}),Qh=t.Enum(["delta","cumulative","none"],{description:"Metric temporality. `delta` reports changes per collection interval, `cumulative` reports running totals, and `none` means temporality is not applicable or unknown."}),LM=t.Number({description:"Timestamp of the most recent data point recorded for this metric, in milliseconds since the Unix epoch. Omitted when Tsuga has no record of it. Computed from a periodically refreshed metadata snapshot, so it can lag ingestion by a few minutes and should not be used to detect sub-minute gaps."}),kM=t.Array(t.String(),{description:"Team values observed on this metric across the most recent data generations kept by the metric catalog. Omitted when the catalog has no team statistics for the metric yet."}),r8=t.Number({description:"Estimated number of distinct series for this metric across the most recent data generations kept by the metric catalog. Omitted when the catalog has no statistics for the metric yet."}),n8=t.Record(t.String(),t.Number(),{description:"Estimated number of distinct values per attribute over the same window as `seriesCardinality`, keyed like `tags`."}),o8=t.Object({capabilities:t.Optional(t.Array(t.String(),{description:"Aggregate function types (such as `max`, `min`, `sum`) supported when querying or graphing this metric. If this field is omitted or empty, all aggregate types are supported."})),description:t.Optional(t.String({description:"Human-readable description of the metric"})),tags:t.Optional(t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping this metric. Exposed publicly as `attributes`."})),temporality:t.Optional(Qh),type:t.Optional(Xl),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:t.Optional(LM),teams:t.Optional(kM),seriesCardinality:t.Optional(r8),attributeCardinalities:t.Optional(n8)}),tct=d({url:`${ln}/metadata`,method:"GET",query:t.Object({...it.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:o8}),rct=d({tags:["metrics"],url:ln,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Array(t.String())}),Jl=t.Array(t.Object({name:t.String({description:"Metric name observed by Tsuga."}),type:Xl,lastSeen:t.Optional(LM),teams:t.Optional(kM)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),i8=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Jl,{examples:[i8]});var nct=d({tags:["metrics"],url:`${ln}/names-and-types`,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Jl}),Gc=t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),a8=["service","env","host","method","status_code"];Object.assign(Gc,{examples:[a8]});var oct=d({tags:["metrics"],url:`${ln}/attributes`,method:"GET",query:t.Object({...it.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Gc}),ict=d({tags:["metrics"],url:`${ln}/attributes/batch`,method:"GET",query:t.Object({...it.properties,metricNames:t.Array(p({allowEmpty:!1}),{minItems:1,description:"Metric names to fetch attributes for"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Gc}),Wh=t.Object({assets:t.Array(t.Object({type:t.Enum(["dashboard","monitor"],{description:"Kind of asset referencing the metric."}),id:t.String({description:"Dashboard or monitor ID for the asset that queries this metric."}),name:t.String({description:"Display name of the referencing dashboard or monitor."}),owner:t.String({description:"Team ID that owns the referencing dashboard or monitor."})},{description:"A dashboard or monitor that queries this metric."}),{description:"Dashboards and monitors that currently query this metric."})}),act=d({tags:["metrics"],url:`${ln}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1})}),response:Wh}),sct=d({url:`${ln}/per-attribute`,method:"GET",query:t.Object({from:t.Optional(t.Number()),to:t.Optional(t.Number()),attribute:p(),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Array(t.String())});var Zh=`/${"v1"}/metrics`,s8=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Jl,{examples:[s8]});var Xh=t.Object({name:t.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:Xl,description:t.Optional(t.String({description:"Human-readable description of what the metric measures, set by the reporting instrumentation. Omitted when the instrumentation did not provide one."})),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."})),temporality:t.Optional(Qh),capabilities:t.Optional(t.Array(t.String(),{description:"Aggregate function types (such as `max`, `min`, `sum`) supported when querying or graphing this metric. An empty or omitted array means all aggregate types are supported."})),attributes:t.Optional(t.Array(t.String(),{description:"Metric attribute names available as dimensions for filtering or grouping."}))}),c8={name:"http.server.request.duration",type:"histogram",description:"Duration of HTTP server requests",unit:"ms",temporality:"delta",capabilities:["max","min","sum"],attributes:["context.team","context.environment","context.region"]};Object.assign(Xh,{examples:[c8]});var MM=t.Object({...Tt.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Metric metadata query. Provide the time range to inspect and optionally a cluster ID."}),DM=d({description:"Lists metrics observed in the requested time range with metadata such as type, unit, temporality, capabilities, and attributes. Use this to discover metric names before querying or graphing them. See [Metrics](/documentation/explore/metrics/index).",operationId:"listMetrics",tags:["public","metrics"],url:Zh,method:"GET",query:MM,response:t.Array(Xh)}),GM=d({description:"Retrieves metadata for one metric name in the requested time range. Use this to inspect available dimensions and supported query behavior for a metric. See [Metric details](/documentation/explore/metrics/metric-details).",operationId:"getMetric",tags:["public","metrics"],url:`${Zh}/:name`,method:"GET",params:t.Object({name:p({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:MM,response:Xh}),p8=["service","env","host","method","status_code"];Object.assign(Gc,{examples:[p8]});var $M=t.Pick(Wh,["assets"]),u8={assets:[{type:"dashboard",id:"dash-123-abc",name:"API Performance Overview",owner:"team-123-abc"},{type:"monitor",id:"mon-789-ghi",name:"High Latency Alert",owner:"team-123-abc"}]};Object.assign($M,{examples:[u8]});var FM=d({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${Zh}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:$M});var Vn="/v0/traces",Ict=d({tags:["traces"],url:`${Vn}/count`,method:"GET",query:t.Pick(Yn,["from","to","query","clusterId","useCanopy"]),response:t.Object({count:t.Number()})}),l8=["unset","ok","error"],m8=t.Enum(l8),d8=["unspecified","internal","server","client","producer","consumer"],f8=t.Enum(d8),qM=t.Object({__tsuga_metadata__:t.Optional(t.Object({},{additionalProperties:!0})),context:t.Optional(t.Object({telemetry:t.Optional(t.Object({sdk:t.Optional(t.Object({language:t.Optional(t.String())},{additionalProperties:!0}))},{additionalProperties:!0})),tag_policy_warnings:t.Optional(t.Record(t.String(),t.String())),service:t.Optional(t.Object({name:t.Optional(t.String()),version:t.Optional(t.String())},{additionalProperties:!0})),env:t.Optional(t.String())},{additionalProperties:!0})),parent_span_id:t.Optional(t.String()),resource_attributes:t.Object({},{additionalProperties:!0}),span_attributes:t.Object({},{additionalProperties:!0}),duration:t.Number({description:"In milliseconds."}),duration_ns:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),start_time:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),end_time:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:t.Optional(t.Object({message:t.String()})),events:t.Optional(t.Array(t.Object({event_attributes:t.Object({},{additionalProperties:!0}),event_name:t.String(),event_timestamp_nanos:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."})}))),links:t.Optional(t.Array(t.Object({},{additionalProperties:!0}))),span_id:t.String(),span:t.Object({kind:f8,name:t.String()}),status_code:t.Optional(m8),trace_id:t.String()}),BM=100,g8="start_time",h8="duration_ns",y8=t.Union([t.Literal(g8),t.Literal(h8)]),T8={...it.properties,query:t.Optional(p({type:"tsuga-query"})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4})),shouldRecommendAttributes:t.Optional(t.Boolean()),startOffset:t.Optional(t.Number({minimum:kc})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),sortBy:t.Optional(y8),sortDirection:t.Optional(Q),useCanopy:t.Optional(t.Boolean())},Sct=d({tags:["traces"],url:`${Vn}/search`,method:"GET",query:t.Object(T8),response:t.Object({spans:t.Optional(t.Array(qM)),attributesToHighlight:t.Optional(t.Array(Mc))})});var E8=t.Object({groupByAttributes:t.Array(p({allowEmpty:!1}),{description:'Glob patterns of span_attributes keys to use as additional grouping dimensions (e.g. "db.*"). Matches against flattened dotted keys of span_attributes only.'}),minLeafSpansToAggregate:t.Integer({minimum:2,description:"Minimum leaf-group size before aggregation occurs. Default 5."}),maxParentDepth:t.Integer({minimum:-1,description:"Max depth of recursive parent aggregation. 0 = leaves only, -1 = unlimited (default)."}),aggregationHistogramBucketsSeconds:t.Array(t.Number({minimum:0}),{description:"Upper bounds for the latency histogram in seconds. Empty array disables the histogram attributes."}),sortSpans:t.Boolean({description:"Whether to sort the returned spans by start_time (span_id tie-breaker). Set false when the caller reconstructs the trace tree and does not need ordering. Default true."})}),_8=t.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),...t.Partial(E8).properties}),bct=d({tags:["traces"],url:`${Vn}/summarize`,method:"GET",query:_8,response:t.Object({spans:t.Array(qM)})}),Oct=d({tags:["traces"],url:`${Vn}/attributes`,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),useCanopy:t.Optional(t.Boolean())}),response:t.Object({attributes:t.Array(t.String())})}),I8=t.Object({key:t.String({description:"Opaque stable key identifying this contributing service within the response. Tsuga assigns it while building the summary; `ranges[].contributions[].serviceKey` and `serviceTotals[].serviceKey` reference this value."}),name:t.String({description:"Observed service name that contributed leaf-span time to the trace. Comes from trace service context and is returned for every contributing service."}),env:t.Optional(t.String({description:"Observed service environment for this contributing service. Comes from trace service context and is absent when the spans do not carry an environment."})),id:t.Optional(t.String({description:"Service catalog ID for this contributing service. Tsuga sets it when exactly one catalog entry matches the observed service and environment; absent when the service is not cataloged or matches ambiguously."})),namespace:t.Optional(t.String({description:"Service namespace from the matched service catalog entry. Returned only when Tsuga can resolve the contributing service to one catalog entry with a namespace."}))}),S8=t.Object({fromNs:t.String({description:"Range start time in nanoseconds since Unix epoch. Tsuga sets it from the trace timeline split where active leaf spans change. Transmitted as a string to avoid losing precision."}),toNs:t.String({description:"Range end time in nanoseconds since Unix epoch. Tsuga sets it from the trace timeline split where active leaf spans change. Transmitted as a string to avoid losing precision."}),durationNs:t.String({description:"Range duration in nanoseconds, computed as `toNs - fromNs`. Transmitted as a string to avoid losing precision."}),contributions:t.Array(t.Object({serviceKey:t.String({description:"Contributing service key for this range. References `services[].key` in the same response."}),weight:t.Number({description:"Share of this range attributed to the service, from `0` through `1`. Tsuga computes the weight from active leaf spans in the range; weights inside one range sum to `1`."}),durationNs:t.String({description:"Estimated duration attributed to this service in the range, computed as `weight` times the range's own `durationNs` and rounded to whole nanoseconds. Use `serviceTotals` as authoritative when rounded range values do not add up exactly."})}),{description:"Services contributing active leaf-span time to this range, with weighted shares for the range duration."}),spanIds:t.Array(t.String(),{description:"Leaf span IDs that produced this range. Tsuga returns IDs from the leaf-only attribution set, including merged sub-ranges after short-range collapsing."})}),b8=t.Object({serviceKey:t.String({description:"Contributing service key for this aggregate total. References `services[].key` in the same response."}),durationNs:t.String({description:"Total wall-clock contribution of this service across the trace, in nanoseconds. Sum of `weight * durationNs` over every range the service contributes to; authoritative when it disagrees with rounded per-range values. Transmitted as a string to avoid losing precision."}),share:t.Number({description:"Share of total trace duration attributed to this service, from `0` through `1`. Computed as `durationNs / totalDurationNs`; multiply by 100 for a percentage."})}),ey=t.Optional(t.Number({minimum:0,description:"Minimum range duration in milliseconds. Shorter ranges are collapsed (absorbed into a neighbor or blended with adjacent shorts) to keep the timeline readable. When omitted, the default depends on the trace: max(1ms, 1% of the total trace duration), so e.g. a 10s trace collapses ranges shorter than 100ms. Pass 0 to disable collapsing."})),ty=t.Optional(t.Boolean({default:!0,description:"When false, omits the per-range timeline (returns `ranges: []`) and returns only `services` and `serviceTotals`. Cuts payload size for callers that only need the headline. Defaults to true."})),em=t.Object({traceId:t.String({description:"Trace ID summarized by the response. Echoes the required `traceId` query parameter."}),startTimeNs:t.String({description:"Earliest `start_time` across fetched spans, in nanoseconds since Unix epoch. If the request window does not cover the full trace, this reflects the fetched subset, not necessarily the trace's true start. Transmitted as a string to avoid losing precision."}),endTimeNs:t.String({description:"Latest `end_time` across fetched spans, in nanoseconds since Unix epoch. If the request window does not cover the full trace, this reflects the fetched subset, not necessarily the trace's true end. Transmitted as a string to avoid losing precision."}),totalDurationNs:t.String({description:"Total fetched trace duration in nanoseconds, computed as `endTimeNs - startTimeNs`. Transmitted as a string to avoid losing precision."}),truncated:t.Boolean({description:"Whether the underlying span fetch hit its result cap. When true, the latency summary may be incomplete because not every span in the trace was available."}),services:t.Array(I8,{description:"Unique services that contributed leaf-span time to the trace, enriched with catalog IDs when Tsuga can resolve them. Referenced by `serviceKey` from `ranges` and `serviceTotals`."}),ranges:t.Array(S8,{description:"Sequential trace timeline split into ranges wherever the active leaf-span set changes. Empty when the request sets `includeRanges` to false."}),serviceTotals:t.Array(b8,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),O8={traceId:"78c99c5bb1e4a30297fa134b9dbec64f",startTimeNs:"1704067200000000000",endTimeNs:"1704067202400000000",totalDurationNs:"2400000000",truncated:!1,services:[{key:"checkout|prod",name:"checkout",env:"prod",id:"123-456-abc",namespace:"default"},{key:"payments|prod",name:"payments",env:"prod",id:"456-789-def",namespace:"default"}],ranges:[{fromNs:"1704067200000000000",toNs:"1704067201200000000",durationNs:"1200000000",contributions:[{serviceKey:"checkout|prod",weight:1,durationNs:"1200000000"}],spanIds:["3df8cc3449378f66"]},{fromNs:"1704067201200000000",toNs:"1704067202400000000",durationNs:"1200000000",contributions:[{serviceKey:"checkout|prod",weight:.5,durationNs:"600000000"},{serviceKey:"payments|prod",weight:.5,durationNs:"600000000"}],spanIds:["187a47da1b2560f8","3df8cc3449378f66"]}],serviceTotals:[{serviceKey:"checkout|prod",durationNs:"1800000000",share:.75},{serviceKey:"payments|prod",durationNs:"600000000",share:.25}]};Object.assign(em,{examples:[O8]});var Act=d({tags:["traces"],url:`${Vn}/latency-summary`,method:"GET",query:t.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),minRangeDurationMs:ey,includeRanges:ty}),response:em}),A8=t.Object({traceId:t.String(),spanId:t.String()}),xct=d({tags:["traces"],url:`${Vn}/span-backlinks`,method:"GET",query:t.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID referenced by span links"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Object({backlinks:t.Array(t.Object({spanId:t.String(),references:t.Array(A8)})),truncated:t.Boolean()})}),jM=t.Object({filter:p({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:kn}),x8=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number()}),R8=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number(),lift:t.Union([t.Number(),t.Null()]),pValue:t.Number()}),C8=t.Object({attr:t.String(),values:t.Array(R8),otherValues:t.Array(x8)}),Jh=t.Object({contrastSets:t.Array(C8),groupACount:t.Number(),groupBCount:t.Number(),failedAttributeCount:t.Number()}),HM=t.Object({groupA:jM,groupB:jM,candidateAttrs:t.Optional(t.Array(p({allowEmpty:!1}))),topK:t.Optional(t.Integer({minimum:1,maximum:100})),minLift:t.Optional(t.Number({minimum:1})),minSupport:t.Optional(t.Number({minimum:0,maximum:100})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),Rct=d({tags:["traces"],url:`${Vn}/contrast-sets`,method:"POST",body:HM,response:Jh}),P8=x("type",[t.Object({type:t.Literal("snapshot"),response:Jh}),t.Object({type:t.Literal("done"),response:Jh}),t.Object({type:t.Literal("error"),message:t.String()})]),Cct=d({tags:["traces"],url:`${Vn}/contrast-sets/stream`,method:"POST",body:HM,response:P8});var ry=`/${"v1"}/traces`,ny=t.Object({context:t.Optional(t.Object({service:t.Optional(t.Object({name:t.Optional(t.String({description:"Service name associated with the span."})),version:t.Optional(t.String({description:"Service version associated with the span."}))},{additionalProperties:!0,description:"Service identity associated with the span, from OpenTelemetry service resource attributes."}))},{additionalProperties:!0,description:"OpenTelemetry resource context resolved for the span, holding the identity of the emitting service."})),parentSpanId:t.Optional(t.String({description:"`spanId` of this span's parent within the same trace. Absent for the root span."})),resourceAttributes:t.Object({},{additionalProperties:!0,description:"OpenTelemetry resource attributes describing the process/host that emitted the span (e.g. `host.name`, `k8s.pod.name`), as a flat key-value map set by the instrumented service or its SDK."}),spanAttributes:t.Object({},{additionalProperties:!0,description:"OpenTelemetry span attributes describing this operation (e.g. HTTP method, DB statement), as a flat key-value map set by the instrumented code or auto-instrumentation."}),duration:t.Number({description:"Span duration in milliseconds, derived from the nanosecond `startTime` and `endTime` values."}),startTime:t.String({description:"Span start time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),endTime:t.String({description:"Span end time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),error:t.Optional(t.Object({message:t.String({description:"Error message associated with the span."})},{description:"Error details associated with the span, separate from the OpenTelemetry `statusCode` field."})),events:t.Optional(t.Array(t.Object({event_attributes:t.Object({},{additionalProperties:!0,description:"Key-value attributes recorded with this event, set by the instrumented code when the event was added to the span (e.g. exception details)."}),event_name:t.String({description:"Name of the span event."}),event_timestamp_nanos:t.String({description:"Event timestamp in nanoseconds, transmitted as a string for precision."})},{description:"A single timestamped event recorded on the span, with its name and attributes."}),{description:"Events recorded on the span."})),spanId:t.String({description:"Unique span ID within the trace."}),span:t.Object({kind:t.String({description:"OpenTelemetry span kind describing the relationship to remote calls: `unspecified`, `internal`, `server`, `client`, `producer`, or `consumer`."}),name:t.String({description:"Operation name recorded on the span."})},{description:"Operation identity for the span, combining the recorded operation name and the OpenTelemetry span kind."}),statusCode:t.Optional(t.String({description:"OpenTelemetry span status set by the instrumented code: `unset` (default, no explicit status), `ok`, or `error`. Absent if the source span never set a status."})),traceId:t.String({description:"Trace ID shared by all spans in the trace."})},{additionalProperties:!0,$id:"SpanEvent",description:"Distributed tracing span including timing, identifiers, OpenTelemetry attributes, events, and status metadata."}),U8={context:{service:{name:"my-service",version:"1.0.0"}},parentSpanId:"187a47da1b2560f8",resourceAttributes:{},spanAttributes:{busyNs:374640,code:{file:{path:"src/queue/sqs.rs"},line:{number:162},module:{name:"queue::sqs"}},idleNs:23621445,maxMessages:"1",target:"queue::sqs",thread:{id:2,name:"tokio-runtime-worker"}},duration:23,startTime:"1770923469995353600",endTime:"1770923470019349500",spanId:"3df8cc3449378f66",span:{kind:"internal",name:"receive_messages"},statusCode:"ok",traceId:"78c99c5bb1e4a30297fa134b9dbec64f"};Object.assign(ny,{examples:[U8]});var w8={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},KM=t.Object({...Tt.properties,query:t.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting spans to return. Omit to search all spans in the range with `*`."})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4,default:BM,description:"Maximum number of spans to return. Defaults to 100. Valid values are 1 through 10000."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Span search query. Provide a time range, optional Tsuga query, and optional limit."});Object.assign(KM,{examples:[w8]});var zM=d({description:"Searches spans in a required time range using Tsuga query syntax. Use this endpoint to retrieve trace spans for investigations or automation. See [Traces](/documentation/explore/traces) and [Query syntax](/documentation/explore/query-syntax).",operationId:"searchSpans",tags:["public","traces"],url:`${ry}/search`,method:"GET",query:KM,response:t.Object({spans:t.Array(ny,{description:"Spans matching the query and time range."})})}),v8={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},YM=t.Object({...Tt.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize. Use the `traceId` returned by span search, the trace details page, or your tracing instrumentation. Required; the requested time range must include the trace."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),groupByAttributes:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Glob patterns of span attribute keys to use as additional grouping dimensions. Use this when spans should be summarized separately for matching attributes, such as `db.*`. Matches flattened dotted span attribute keys; omitted by default."})),minLeafSpansToAggregate:t.Optional(t.Integer({minimum:2,default:5,description:"Minimum number of similar leaf spans in a group before Tsuga replaces them with one synthetic summary span. Use higher values for less aggressive summarization. Optional; defaults to 5 and must be at least 2."})),maxParentDepth:t.Optional(t.Integer({minimum:-1,default:-1,description:"Maximum depth of recursive parent aggregation after leaf spans are summarized. Use this to limit parent-level aggregation. Use `0` to aggregate leaf spans only or `-1` for unlimited depth; defaults to `-1`."})),aggregationHistogramBucketsSeconds:t.Optional(t.Array(t.Number({minimum:0}),{description:"Upper-bound bucket values, in seconds, for the latency histogram recorded on synthetic summary spans. Provide custom buckets when the default latency buckets are not suitable. Pass an empty array to omit histogram attributes; omitted values use Tsuga defaults from 5 ms through 10 s."})),sortSpans:t.Optional(t.Boolean({default:!0,description:"Whether Tsuga sorts returned spans by start time, using span ID as the tie-breaker for identical start times. Defaults to `true`; set to `false` only when reconstructing the trace tree yourself, in which case summary spans are appended after surviving spans."}))},{description:"Trace summarization query. Provide a trace ID, a time range covering the trace, and optional aggregation tuning."});Object.assign(YM,{examples:[v8]});var VM=d({description:"Summarizes a trace by aggregating groups of similar spans into synthetic summary spans, producing a compact view of large traces. Summary spans are marked with `spanAttributes.aggregation.is_summary` and carry span counts, duration statistics, and an optional latency histogram. See [Traces](/documentation/explore/traces).",operationId:"summarizeTrace",tags:["public","traces"],url:`${ry}/summarize`,method:"GET",query:YM,response:t.Object({spans:t.Array(ny,{description:"Summarized trace spans, sorted by start time unless `sortSpans` is false. Aggregated groups are replaced by synthetic summary spans marked with `spanAttributes.aggregation.is_summary`."})})}),N8={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},QM=t.Object({...Tt.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize. Use the `traceId` returned by span search, the trace details page, or your tracing instrumentation. Required; the requested time range must include the trace."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),minRangeDurationMs:ey,includeRanges:ty},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(QM,{examples:[N8]});var WM=d({description:"Summarizes where wall-clock time is spent in a trace, attributing each slice of the trace timeline to the services with active leaf spans. Returns per-service totals and an optional sequential range timeline. See [Traces](/documentation/explore/traces).",operationId:"getTraceLatencySummary",tags:["public","traces"],url:`${ry}/latency-summary`,method:"GET",query:QM,response:em});var JM=["timestamp","level","message"],e0=["count","ratio","team","level","pattern"];function Et(e,r){let n=r??nr(e);if(!n)throw new Error(`--${e} is required`);return Qo(n)}function ZM(e){let r={from:Et("from",e.from),to:Et("to",e.to)},n=e.query??nr("query");n!==void 0&&(r.query=n);let o=e.maxResults??nr("max-results");if(o!==void 0){let i=Number(o);if(Number.isNaN(i))throw new Error(`--max-results must be a number (got: ${o})`);r.maxResults=i}return r}function Ge(e){let r=nr(e);return r===void 0?"":` (default: ${r})`}function L8(e){let r=ds(e.output),n=e.fields===void 0?void 0:fs(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??JM}}function k8(e){let r=ds(e.output),n=e.fields===void 0?void 0:fs(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??e0}}function XM(e,r){let n={count:e.size,ratio:r>0?e.size/r:0,pattern:e.pattern};for(let{key:o,value:i}of e.groups)o==="context.team"?n.team=i:n[o]=i;return n}function M8(e,r){if(r.format==="json"){if(r.fields===void 0){W(e);return}let{fields:i}=r;W({patterns:e.patterns.map(a=>XM(a,e.sampleSize)).map(a=>gs(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>XM(i,e.sampleSize)),o=hs(r.format,n,r.fields);o.length>0&&z(o)}function D8(e,r){if(r.format==="json"){if(r.fields===void 0){W(e);return}let{fields:o}=r;W({logs:e.logs.map(i=>gs(i,o))});return}let n=hs(r.format,e.logs,r.fields);n.length>0&&z(n)}function t0(e,r){let n=e.command("logs").description("Search and analyze logs");n.command("search").description("Search logs").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs${Ge("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-1000${Ge("max-results")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each log (default for --output=tsv|csv: ${JM.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=L8(c),m=await r()(AM,{query:ZM(c)});D8(m,l)}),n.command("attributes").description("List log attribute dot-paths observed in the time range").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await r()(NM,{query:{from:Et("from",c.from),to:Et("to",c.to)}});W(l)}),n.command("patterns").description("List log patterns").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs before clustering into patterns${Ge("query")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each pattern (default for --output=tsv|csv: ${e0.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=k8(c),m={from:Et("from",c.from),to:Et("to",c.to)},f=c.query??nr("query");f!==void 0&&(m.query=f);let h=await r()(RM,{query:m});M8(h,l)}),n.command("new-error-patterns").description("List error patterns first seen in this time range").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--team <TEAM_NAME>","Filter by team").option("--env <ENV_NAME>","Filter by environment").option("--service <SERVICE_NAME>","Filter by service").action(async c=>{let l={from:Et("from",c.from),to:Et("to",c.to)};c.team!==void 0&&(l.team=c.team),c.env!==void 0&&(l.env=c.env),c.service!==void 0&&(l.service=c.service);let m=await r()(PM,{query:l});W(m)}),n.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).requiredOption("--team <TEAM_NAME>","Team to query").option("--env <ENV_NAME>","Filter by environment").action(async c=>{let l={from:Et("from",c.from),to:Et("to",c.to),team:c.team};c.env!==void 0&&(l.env=c.env);let m=await r()(wM,{query:l});W(m)});let o=e.command("metrics").description("List and inspect metrics");o.command("list").description("List all metrics with their metadata").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await r()(DM,{query:{from:Et("from",c.from),to:Et("to",c.to)}});W(l)}),o.command("get <METRIC_NAME>").description("Retrieve a metric by name with its metadata").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async(c,l)=>{let m=await r()(GM,{params:{name:c},query:{from:Et("from",l.from),to:Et("to",l.to)}});W(m)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await r()(FM,{query:{metricName:c}});W(l)});let i=e.command("traces").description("Search and summarize traces");i.command("search").description("Search spans").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter spans${Ge("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-10000${Ge("max-results")}`).action(async c=>{let l=await r()(zM,{query:ZM(c)});W(l)}),i.command("summarize").description("Summarize a trace by aggregating groups of similar spans into summary spans").requiredOption("--trace-id <TRACE_ID>","Trace ID to summarize").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await r()(VM,{query:{traceId:c.traceId,from:Et("from",c.from),to:Et("to",c.to)}});W(l)}),i.command("latency-summary").description("Summarize where wall-clock time is spent in a trace, attributed per service").requiredOption("--trace-id <TRACE_ID>","Trace ID to summarize").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--min-range-duration-ms <MILLISECONDS>","Collapse timeline ranges shorter than this (default: max(1ms, 1% of trace duration); 0 disables collapsing)").option("--no-ranges","Omit the per-range timeline; return only services and serviceTotals").action(async c=>{let l={traceId:c.traceId,from:Et("from",c.from),to:Et("to",c.to)};if(c.minRangeDurationMs!==void 0){let f=Number(c.minRangeDurationMs);if(Number.isNaN(f))throw new Error(`--min-range-duration-ms must be a number (got: ${c.minRangeDurationMs})`);l.minRangeDurationMs=f}c.ranges||(l.includeRanges=!1);let m=await r()(WM,{query:l});W(m)});let a=e.command("aggregation").description("Run aggregation queries");yr(a,"scalar","Run aggregation queries and return scalar results",aC,r),yr(a,"timeseries","Run aggregation queries and return timeseries results",cC,r)}var G8="x-tsuga-session-id",oy="x-tsuga-source",iy="x-tsuga-source-version",ay="x-tsuga-source-commit",sy="x-tsuga-source-date",cy="x-tsuga-rationale",$8="x-tsuga-dashboard-id",F8="x-tsuga-widget-id",j8="x-request-id",Yct={[G8]:"Session identifier for request correlation",[oy]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[iy]:"SDK version",[ay]:"SDK commit hash",[sy]:"SDK commit date",[cy]:"Optional caller-supplied rationale for this request, recorded for telemetry",[$8]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[F8]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[j8]:"Unique identifier for this API request, useful for debugging and support"};function q8(e){return e.replace(/\s+/g," ").replace(/[^\x20-\x7e\x80-\xff]/g,"").trim()}function r0(e,r,n,o){return async function(a,c={}){let{body:l,params:m,query:f}=c,h;if(a.url!==void 0)h=a.url;else if(a.buildUrl){if(!m)throw new or("Internal error: params required for this endpoint");h=a.buildUrl(m)}else throw new or("Internal error: endpoint has neither url nor buildUrl");let E=n===void 0?f:{clusterId:n,...f},I=LA(`${e}${h}`,E),g={Accept:"application/json",Authorization:`Bearer ${r}`,[oy]:"cli",[iy]:"1.32.0",[ay]:"cc6955d5b4",[sy]:"2026-09-21T14:57:42.876Z"};l&&(g["Content-Type"]="application/json");let T=o?.(),O=T?q8(T):"";O&&(g[cy]=O);let b=await fetch(I,{method:a.method,headers:g,body:l?JSON.stringify(l):null}),R;try{R=await b.json()}catch{throw new or(b.status===504?"The server timed out (504). Try a smaller time range.":`Server returned a non-JSON response (HTTP ${b.status}).`,b.status)}if(R.error)throw or.fromErrorResponse(R.error,R.requestId);return H8(R,B8(c)),R.data}}function B8({body:e,query:r}){let n=r?.offset??e?.offset;return typeof n=="number"?n:0}function H8(e,r){let n=e.metadata?.pagination;if(n===void 0||!Array.isArray(e.data))return;let o=r+e.data.length;o>=n.totalCount||Ix(`Showing ${e.data.length} of ${n.totalCount} (offset ${r}). Use --limit (max ${_i}) and --offset ${o} for the next page.`)}function py(e,r=n=>{process.exit(n)}){e.on("error",n=>{if(n.code==="EPIPE"){r(process.exitCode);return}throw n})}var K8=3e3,z8="https://registry.npmjs.org/@tsuga/cli/latest";function Y8(e,r){let n=e.split(".").map(Number),o=r.split(".").map(Number);for(let i=0;i<Math.max(n.length,o.length);i++){let a=n[i]??0,c=o[i]??0;if(a>c)return!0;if(a<c)return!1}return!1}async function n0(e){try{let r=oR();if(r&&Date.now()-new Date(r).getTime()<Kc)return;let n=await fetch(z8,{signal:AbortSignal.timeout(K8)});if(!n.ok)return;let i=(await n.json()).version;Y8(i,e)&&(process.stderr.write(`
175
+ `:o}var X5={CLAUDE_CODE_ENABLE_TELEMETRY:"1",CLAUDE_CODE_ENHANCED_TELEMETRY_BETA:"1",OTEL_METRICS_EXPORTER:"otlp",OTEL_LOGS_EXPORTER:"otlp",OTEL_TRACES_EXPORTER:"otlp",OTEL_EXPORTER_OTLP_PROTOCOL:"http/json",OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:"delta"};function J5(e,r,n,o){let i=(0,Is.join)(e,".claude","settings.json");Y(`Claude Code \u2192 ${i}`),(0,Vh.mkdirSync)((0,Is.dirname)(i),{recursive:!0});let s=Qa(i),c;try{c=JSON.parse(s??"{}")}catch{throw new Error(`${i} is not valid JSON. Fix or remove it before re-running.`)}if(!Go(c))throw new Error(`${i} must contain a JSON object at the top level.`);let l=c.env??{};if(!Go(l))throw new Error(`${i} "env" must be a JSON object.`);let m=o?"1":"0";c.env={...l,...X5,OTEL_EXPORTER_OTLP_ENDPOINT:r,OTEL_LOG_USER_PROMPTS:m,OTEL_LOG_TOOL_DETAILS:m,OTEL_LOG_TOOL_CONTENT:m,OTEL_EXPORTER_OTLP_HEADERS:`Authorization=Bearer ${n}`};let f=Wa(i,s);Va(i,`${JSON.stringify(c,null,2)}
176
+ `),Y(f===void 0?" created":` patched (backup: ${f})`)}function e8(e,r,n){return{environment:"dev",log_user_prompt:n,exporter:{"otlp-http":{endpoint:`${e}/v1/logs`,protocol:"binary",headers:{Authorization:`Bearer ${r}`}}},trace_exporter:{"otlp-http":{endpoint:`${e}/v1/traces`,protocol:"binary",headers:{Authorization:`Bearer ${r}`}}}}}function t8(e,r,n,o){let i=(0,Is.join)(e,".codex"),s=(0,Is.join)(i,"config.toml");Y(`Codex \u2192 ${s}`),(0,Vh.mkdirSync)(i,{recursive:!0});let c=Qa(s),l=c===void 0?{}:qh(c),m="otel"in l;delete l.otel,l.otel=e8(r,n,o);let f=Wa(s,c);Va(s,zh(l)),Y(f===void 0?" created":m?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function bM(){return new ur("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function OM(){return new ur("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var AM="Restart your claude / codex session to load the new config.";function xM(e){let r=e.command("setup").description("Configure local LLM CLIs to ship OTEL telemetry to Tsuga");r.command("claude-code").description("Patch ~/.claude/settings.json with Tsuga OTEL env").addOption(bM()).addOption(OM()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{J5((0,Yh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),Y(AM)}),r.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(bM()).addOption(OM()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{t8((0,Yh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),Y(AM)})}var Ko="/v0/logs";var Qh=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var Mc=0,Wh=t.Object({__tsuga_metadata__:t.Object({id:t.String(),source:t.Optional(t.String())},{additionalProperties:!0}),context:t.Optional(t.Object({team:t.Optional(t.String({description:"Team name associated with this log."})),tag_policy_warnings:t.Optional(t.Record(t.String(),t.String()))},{additionalProperties:!0,description:"Context attributes attached to the log after ingestion and route processing. `team` comes from telemetry or route-enriched context when present."})),message:t.Optional(t.Unknown({description:"Log message after ingestion and route processing. It can be any JSON value because processors may map arbitrary data into `message`."})),timestamp:t.Number({description:"Log timestamp as a Unix timestamp in milliseconds."}),level:t.Enum(Qh,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[gR]:t.Optional(t.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),CM=100,r8="timestamp",n8=t.Union([t.Literal(r8)]),Vn=t.Partial(t.Object({...it.properties,query:p({type:"tsuga-query",description:"Tsuga query used to filter logs in the selected time range."}),maxResults:t.Integer({minimum:1,maximum:1e3,description:"Maximum number of logs to return. Valid values are 1 through 1000."}),shouldRecommendAttributes:t.Boolean({description:"Whether Tsuga should return suggested attributes to highlight in results."}),triggeredBy:t.Literal("refresh",{description:"Indicates the query was triggered by a refresh action."}),startOffset:t.Number({minimum:Mc,description:"Result offset used when fetching additional log rows."}),startOffsets:t.Array(t.Number({minimum:Mc}),{description:`Result offsets used when fetching additional log rows, one per entry of \`clusterIds\` and in the same order. Echo back each cluster's \`nextStartOffset\` from the previous response. Must have the same length as \`clusterIds\`. Defaults to ${Mc} for every cluster.`}),clusterId:p({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:Oa,sortBy:n8,sortDirection:K,useCanopy:t.Boolean()})),pct=d({tags:["logs"],url:`${Ko}/count`,method:"GET",query:t.Pick(Vn,["from","to","query","clusterId","clusterIds","useCanopy"]),response:t.Object({count:t.Number(),clusterResponses:t.Optional(Pi())})}),Dc=t.Object({value:t.String(),priority:t.Number()}),uct=d({tags:["logs"],url:`${Ko}/search`,method:"GET",query:Vn,response:t.Object({logs:t.Optional(t.Array(Wh)),attributesToHighlight:t.Optional(t.Array(Dc)),clusterResponses:t.Optional(Pi(t.Object({nextStartOffset:t.Number({description:"Number of logs consumed on this cluster so far. Echo it back at this cluster's position in `startOffsets` to fetch the next page."})})))},{additionalProperties:!0})}),o8=t.Cyclic({TokenOutput:t.Union([t.Object({type:t.Literal("top"),values:t.Array(t.String())}),t.Object({type:t.Literal("ip"),value:t.String()}),t.Object({type:t.Literal("range"),min:t.Number(),max:t.Number()}),t.Object({type:t.Literal("variable"),value:t.String()}),t.Object({type:t.Literal("text"),value:t.String()}),t.Object({type:t.Literal("date"),value:t.String()}),t.Object({type:t.Literal("url"),value:t.String()}),t.Object({type:t.Literal("structure"),key:t.Array(t.String()),value:t.Array(t.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),i8=t.Object({id:t.String(),pattern:t.Array(o8),size:t.Integer({description:"Number of logs that matched the pattern"}),examples:t.Array(t.Object({id:t.String(),timestampUnix:t.Number()})),timeDistribution:t.Array(t.Number()),staticFeatures:t.Array(t.Object({key:t.String(),value:t.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),lct=d({tags:["logs"],url:`${Ko}/patterns`,method:"GET",query:t.Object({...it.properties,query:p({type:"tsuga-query"}),clusteringThreshold:t.Optional(t.Number()),clusterId:t.Optional(p({allowEmpty:!1})),useCanopy:t.Optional(t.Boolean())}),response:t.Object({patterns:t.Array(i8),sampleSize:t.Number()})}),mct=d({tags:["logs"],url:`${Ko}/attributes`,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),clusterIds:t.Optional(Oa),useCanopy:t.Optional(t.Boolean())}),response:t.Object({attributes:t.Array(t.String()),clusterResponses:t.Optional(Pi())})});var PM="timestamp";var RM=`${PM}_iso`;var s8=["pending","running","completed","incomplete","failed"],UM=t.Object({id:t.String({description:"ID of the export."}),status:t.Enum(s8,{description:"Lifecycle of the export. `pending` until the download is claimed, `running` while the CSV streams, then `completed`, `incomplete` when the file is usable but some matched logs could not be reached, or `failed` if the export was interrupted."}),rowsWritten:t.Number({description:"Logs written to the CSV so far. Updated periodically while the download streams, so it lags slightly behind the bytes on the wire."}),totalRows:t.Number({description:"Logs this export will write, already clamped to the export maximum. Use it as the denominator for progress."}),isTruncated:t.Boolean({description:"Whether the query matched more logs than the export maximum, so the CSV holds only the first logs in the requested sort order."}),errorMessage:t.Optional(t.String({description:"Why the export is incomplete or failed."}))}),dct=d({tags:["logs"],url:`${Ko}/exports`,method:"POST",body:t.Object({...t.Pick(Vn,["from","to","query","clusterId","clusterIds","sortBy","sortDirection"]).properties,columns:t.Array(p({allowEmpty:!1}),{minItems:1,description:`Log attributes to write as CSV columns, in order. Each becomes one column, resolved against the log with dotted-path lookup. Including \`${PM}\` also writes a \`${RM}\` column next to it, holding the same instant in ISO 8601.`}),timezone:t.Optional(t.String({format:ho,description:`IANA timezone the \`${RM}\` column is offset to (e.g. \`Europe/Paris\`). Defaults to UTC.`}))}),response:t.Object({...UM.properties,downloadUrl:t.String({description:"Relative URL to fetch the CSV from. It carries a single-use token that expires shortly after creation, so the caller must start the download immediately."})})}),fct=d({tags:["logs"],url:`${Ko}/exports/:exportId`,method:"GET",params:t.Object({exportId:t.String()}),response:UM}),gct=d({tags:["logs"],url:`${Ko}/exports/:exportId/download`,method:"GET",params:t.Object({exportId:t.String()}),query:t.Object({token:p({allowEmpty:!1,description:"Single-use token minted when the export was created."})}),response:t.String({description:"CSV file, streamed as it is produced."})});var Gc=`/${"v1"}/logs`,Zh=t.Object({context:t.Optional(t.Object({team:t.Optional(t.String({description:"Team name associated with this log."}))},{additionalProperties:!0,$id:"LogContext",description:"Context attributes attached to the log after ingestion and route processing. `team` comes from telemetry or route-enriched context when present."})),...t.Pick(Wh,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),a8={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(Zh,{examples:[a8]});var NM=t.Object({query:t.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting logs to return. Omit to search all logs with `*`."})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e3,default:CM,description:"Maximum number of logs to return. Defaults to 100. Valid values are 1 through 1000."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),...Tt.properties},{description:"Log search query. Provide a time range, optional Tsuga query, and optional limit."}),c8={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(NM,{examples:[c8]});var wM=d({description:"Searches logs in a required time range using Tsuga query syntax. Use this endpoint to retrieve raw log events for investigations or automation. See [Logs](/documentation/explore/logs) and [Query syntax](/documentation/explore/query-syntax).",operationId:"searchLogs",tags:["public","logs"],url:`${Gc}/search`,method:"GET",query:NM,response:t.Object({logs:t.Array(Zh,{description:"Log events matching the query and time range."})})}),p8=t.Object({pattern:t.String({description:"Clustered log pattern formatted as a readable string."}),size:t.Integer({description:"Number of logs that matched the pattern"}),groups:t.Array(t.Object({key:t.String({description:"Attribute dot-path shared by all logs in the pattern."}),value:t.String({description:"Value of the attribute identified by `key`, common to all logs in the pattern."})},{description:"Attribute key-value pair that is constant across every log matching this pattern, e.g. a shared `level` or `context.team`."}))}),vM=t.Object({patterns:t.Array(p8,{description:"Log patterns clustered from logs matching the query."}),sampleSize:t.Number({description:"Number of logs sampled while computing patterns."})},{}),u8={patterns:[{pattern:"Resolved segment SegmentId([0:1]) from cache",size:37004,groups:[{key:"level",value:"DEBUG"},{key:"context.team",value:"infra"}]}],sampleSize:100};Object.assign(vM,{examples:[u8]});var LM=d({description:"Clusters matching logs into readable patterns for the requested time range. Use this to summarize common log shapes before drilling into raw events. See [Logs](/documentation/explore/logs).",operationId:"getLogPatterns",tags:["public","logs"],url:`${Gc}/patterns`,method:"GET",query:t.Object({...Tt.properties,query:p({type:"tsuga-query",description:"Tsuga query selecting logs to cluster into patterns."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:vM}),l8=t.Object({exampleLog:t.Optional(Zh),team:t.String({description:"Team associated with the new error pattern."}),env:t.String({description:"Environment associated with the new error pattern."}),service:t.String({description:"Service associated with the new error pattern."}),firstSeen:t.Number({description:"Unix timestamp in seconds when this pattern was first seen."}),lastSeen:t.Number({description:"Unix timestamp in seconds when this pattern was last seen."})}),kM=t.Object({newErrorPatterns:t.Array(l8,{description:"Error patterns first seen in the requested time range."})},{}),m8={newErrorPatterns:[{team:"platform",env:"production",service:"api-gateway",firstSeen:1704067200,lastSeen:1704153600,exampleLog:{message:"ConnectionError: Failed to connect to database",timestamp:17041536e5,level:"ERROR"}}]};Object.assign(kM,{examples:[m8]});var MM=d({description:"Finds error patterns first seen in the requested time range, optionally filtered by team, environment, or service. Use this to detect newly appearing failures. See [Logs](/documentation/explore/logs).",operationId:"getNewErrorPatterns",tags:["public","logs"],url:`${Gc}/patterns/new`,method:"GET",query:t.Object({...Tt.properties,team:t.Optional(p({description:"Team name to restrict pattern detection to."})),env:t.Optional(p({description:"Environment to restrict pattern detection to."})),service:t.Optional(p({description:"Service name to restrict pattern detection to."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:kM}),d8=t.Object({team:t.String({description:"Team associated with the error pattern. Set from the log context used during pattern analysis. Returned for every pattern increase."}),env:t.String({description:"Environment associated with the error pattern. Set from the log context used during pattern analysis. Returned for every pattern increase."}),pattern:t.String({description:"Readable representation of the grouped error log pattern. Generated by Tsuga from matching log messages and returned for every pattern increase."}),increaseTimestamps:t.Array(t.Number({description:"Unix timestamp in milliseconds of a detected spike in this pattern. Tsuga computes these timestamps during pattern-increase analysis; one entry is returned for each spike in the requested time range."}))}),DM=t.Object({errorPatternIncreases:t.Array(d8,{description:"Error patterns with increased occurrence in the requested time range."})},{}),f8={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(DM,{examples:[f8]});var GM=d({description:"Finds error patterns whose occurrence increased for a team in the requested time range. Use this to identify growing failure modes without retrieving raw log events. See [Logs](/documentation/explore/logs).",operationId:"getErrorPatternIncrease",tags:["public","logs"],url:`${Gc}/patterns/increase`,method:"GET",query:t.Object({...Tt.properties,team:p({allowEmpty:!1,description:"Team name to analyze for pattern increases. Required; match it to the `context.team` value on the logs you want Tsuga to inspect."}),env:t.Optional(p({allowEmpty:!1,description:"Environment to restrict the analysis to. Optional; match it to the `context.env` value on the logs, or omit it to analyze all environments for the team."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:DM}),$M=t.Object({attributes:t.Array(t.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),g8={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign($M,{examples:[g8]});var h8=t.Object({...Tt.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Log attribute discovery query. Provide a time range and optional cluster ID."}),FM=d({description:"Lists log attribute dot-paths observed in the requested time range. This endpoint requires a public API credential that can read all relevant teams because attribute discovery is not team-filtered. Use this to discover fields for Tsuga queries, filters, and grouping. See [Logs](/documentation/explore/logs).",operationId:"getLogAttributes",tags:["public","logs"],url:`${Gc}/attributes`,method:"GET",query:h8,response:$M});var mn="/v0/metrics",y8=t.Object({__tsuga_metadata__:t.Object({},{additionalProperties:!0}),context:t.Optional(t.Object({},{additionalProperties:!0})),message:t.Optional(t.String()),timestamp:t.Number(),level:t.Enum(Qh)},{additionalProperties:!0}),Pct=d({tags:["metrics"],url:`${mn}/count`,method:"GET",query:t.Pick(Vn,["from","to","query","clusterId"]),response:t.Object({count:t.Number()})}),Uct=d({tags:["metrics"],url:`${mn}/search`,method:"GET",query:Vn,response:t.Object({logs:t.Optional(t.Array(y8)),totalHits:t.Optional(t.Number()),attributesToHighlight:t.Optional(t.Array(Dc))},{additionalProperties:!0})}),Xl=t.Enum(["counter","gauge","histogram","summary","composite_histogram"],{description:"Metric instrument type, set by the reporting instrumentation. `counter` accumulates a monotonically increasing total (aggregate with `sum` or `increase`); `gauge` reports a point-in-time value that can go up or down (aggregate with `average`, `max`, `min`, or `last`); `histogram`, `composite_histogram`, and `summary` report a distribution of values, from which percentiles can be computed. Tsuga displays `composite_histogram` metrics as Histogram in the app."}),Xh=t.Enum(["delta","cumulative","none"],{description:"Metric temporality. `delta` reports changes per collection interval, `cumulative` reports running totals, and `none` means temporality is not applicable or unknown."}),jM=t.Number({description:"Timestamp of the most recent data point recorded for this metric, in milliseconds since the Unix epoch. Omitted when Tsuga has no record of it. Computed from a periodically refreshed metadata snapshot, so it can lag ingestion by a few minutes and should not be used to detect sub-minute gaps."}),qM=t.Array(t.String(),{description:"Team values observed on this metric across the most recent data generations kept by the metric catalog. Omitted when the catalog has no team statistics for the metric yet."}),T8=t.Number({description:"Estimated number of distinct series for this metric across the most recent data generations kept by the metric catalog. Omitted when the catalog has no statistics for the metric yet."}),E8=t.Record(t.String(),t.Number(),{description:"Estimated number of distinct values per attribute over the same window as `seriesCardinality`, keyed like `tags`."}),_8=t.Object({capabilities:t.Optional(t.Array(t.String(),{description:"Aggregate function types (such as `max`, `min`, `sum`) supported when querying or graphing this metric. If this field is omitted or empty, all aggregate types are supported."})),description:t.Optional(t.String({description:"Human-readable description of the metric"})),tags:t.Optional(t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping this metric. Exposed publicly as `attributes`."})),temporality:t.Optional(Xh),type:t.Optional(Xl),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:t.Optional(jM),teams:t.Optional(qM),seriesCardinality:t.Optional(T8),attributeCardinalities:t.Optional(E8)}),Nct=d({url:`${mn}/metadata`,method:"GET",query:t.Object({...it.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:_8}),wct=d({tags:["metrics"],url:mn,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Array(t.String())}),Jl=t.Array(t.Object({name:t.String({description:"Metric name observed by Tsuga."}),type:Xl,lastSeen:t.Optional(jM),teams:t.Optional(qM)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),I8=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Jl,{examples:[I8]});var vct=d({tags:["metrics"],url:`${mn}/names-and-types`,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Jl}),$c=t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),S8=["service","env","host","method","status_code"];Object.assign($c,{examples:[S8]});var Lct=d({tags:["metrics"],url:`${mn}/attributes`,method:"GET",query:t.Object({...it.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:$c}),kct=d({tags:["metrics"],url:`${mn}/attributes/batch`,method:"GET",query:t.Object({...it.properties,metricNames:t.Array(p({allowEmpty:!1}),{minItems:1,description:"Metric names to fetch attributes for"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:$c}),Jh=t.Object({assets:t.Array(t.Object({type:t.Enum(["dashboard","monitor"],{description:"Kind of asset referencing the metric."}),id:t.String({description:"Dashboard or monitor ID for the asset that queries this metric."}),name:t.String({description:"Display name of the referencing dashboard or monitor."}),owner:t.String({description:"Team ID that owns the referencing dashboard or monitor."})},{description:"A dashboard or monitor that queries this metric."}),{description:"Dashboards and monitors that currently query this metric."})}),Mct=d({tags:["metrics"],url:`${mn}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1})}),response:Jh}),Dct=d({url:`${mn}/per-attribute`,method:"GET",query:t.Object({from:t.Optional(t.Number()),to:t.Optional(t.Number()),attribute:p(),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Array(t.String())});var ey=`/${"v1"}/metrics`,b8=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Jl,{examples:[b8]});var ty=t.Object({name:t.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:Xl,description:t.Optional(t.String({description:"Human-readable description of what the metric measures, set by the reporting instrumentation. Omitted when the instrumentation did not provide one."})),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."})),temporality:t.Optional(Xh),capabilities:t.Optional(t.Array(t.String(),{description:"Aggregate function types (such as `max`, `min`, `sum`) supported when querying or graphing this metric. An empty or omitted array means all aggregate types are supported."})),attributes:t.Optional(t.Array(t.String(),{description:"Metric attribute names available as dimensions for filtering or grouping."}))}),O8={name:"http.server.request.duration",type:"histogram",description:"Duration of HTTP server requests",unit:"ms",temporality:"delta",capabilities:["max","min","sum"],attributes:["context.team","context.environment","context.region"]};Object.assign(ty,{examples:[O8]});var BM=t.Object({...Tt.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Metric metadata query. Provide the time range to inspect and optionally a cluster ID."}),HM=d({description:"Lists metrics observed in the requested time range with metadata such as type, unit, temporality, capabilities, and attributes. Use this to discover metric names before querying or graphing them. See [Metrics](/documentation/explore/metrics/index).",operationId:"listMetrics",tags:["public","metrics"],url:ey,method:"GET",query:BM,response:t.Array(ty)}),KM=d({description:"Retrieves metadata for one metric name in the requested time range. Use this to inspect available dimensions and supported query behavior for a metric. See [Metric details](/documentation/explore/metrics/metric-details).",operationId:"getMetric",tags:["public","metrics"],url:`${ey}/:name`,method:"GET",params:t.Object({name:p({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:BM,response:ty}),A8=["service","env","host","method","status_code"];Object.assign($c,{examples:[A8]});var zM=t.Pick(Jh,["assets"]),x8={assets:[{type:"dashboard",id:"dash-123-abc",name:"API Performance Overview",owner:"team-123-abc"},{type:"monitor",id:"mon-789-ghi",name:"High Latency Alert",owner:"team-123-abc"}]};Object.assign(zM,{examples:[x8]});var YM=d({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${ey}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:zM});var Qn="/v0/traces",Zct=d({tags:["traces"],url:`${Qn}/count`,method:"GET",query:t.Pick(Vn,["from","to","query","clusterId","useCanopy"]),response:t.Object({count:t.Number()})}),R8=["unset","ok","error"],C8=t.Enum(R8),P8=["unspecified","internal","server","client","producer","consumer"],U8=t.Enum(P8),QM=t.Object({__tsuga_metadata__:t.Optional(t.Object({},{additionalProperties:!0})),context:t.Optional(t.Object({telemetry:t.Optional(t.Object({sdk:t.Optional(t.Object({language:t.Optional(t.String())},{additionalProperties:!0}))},{additionalProperties:!0})),tag_policy_warnings:t.Optional(t.Record(t.String(),t.String())),service:t.Optional(t.Object({name:t.Optional(t.String()),version:t.Optional(t.String())},{additionalProperties:!0})),env:t.Optional(t.String())},{additionalProperties:!0})),parent_span_id:t.Optional(t.String()),resource_attributes:t.Object({},{additionalProperties:!0}),span_attributes:t.Object({},{additionalProperties:!0}),duration:t.Number({description:"In milliseconds."}),duration_ns:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),start_time:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),end_time:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:t.Optional(t.Object({message:t.String()})),events:t.Optional(t.Array(t.Object({event_attributes:t.Object({},{additionalProperties:!0}),event_name:t.String(),event_timestamp_nanos:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."})}))),links:t.Optional(t.Array(t.Object({},{additionalProperties:!0}))),span_id:t.String(),span:t.Object({kind:U8,name:t.String()}),status_code:t.Optional(C8),trace_id:t.String()}),WM=100,N8="start_time",w8="duration_ns",v8=t.Union([t.Literal(N8),t.Literal(w8)]),L8={...it.properties,query:t.Optional(p({type:"tsuga-query"})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4})),shouldRecommendAttributes:t.Optional(t.Boolean()),startOffset:t.Optional(t.Number({minimum:Mc})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),sortBy:t.Optional(v8),sortDirection:t.Optional(K),useCanopy:t.Optional(t.Boolean())},Xct=d({tags:["traces"],url:`${Qn}/search`,method:"GET",query:t.Object(L8),response:t.Object({spans:t.Optional(t.Array(QM)),attributesToHighlight:t.Optional(t.Array(Dc))})});var k8=t.Object({groupByAttributes:t.Array(p({allowEmpty:!1}),{description:'Glob patterns of span_attributes keys to use as additional grouping dimensions (e.g. "db.*"). Matches against flattened dotted keys of span_attributes only.'}),minLeafSpansToAggregate:t.Integer({minimum:2,description:"Minimum leaf-group size before aggregation occurs. Default 5."}),maxParentDepth:t.Integer({minimum:-1,description:"Max depth of recursive parent aggregation. 0 = leaves only, -1 = unlimited (default)."}),aggregationHistogramBucketsSeconds:t.Array(t.Number({minimum:0}),{description:"Upper bounds for the latency histogram in seconds. Empty array disables the histogram attributes."}),sortSpans:t.Boolean({description:"Whether to sort the returned spans by start_time (span_id tie-breaker). Set false when the caller reconstructs the trace tree and does not need ordering. Default true."})}),M8=t.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),...t.Partial(k8).properties}),Jct=d({tags:["traces"],url:`${Qn}/summarize`,method:"GET",query:M8,response:t.Object({spans:t.Array(QM)})}),ept=d({tags:["traces"],url:`${Qn}/attributes`,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),useCanopy:t.Optional(t.Boolean())}),response:t.Object({attributes:t.Array(t.String())})}),D8=t.Object({key:t.String({description:"Opaque stable key identifying this contributing service within the response. Tsuga assigns it while building the summary; `ranges[].contributions[].serviceKey` and `serviceTotals[].serviceKey` reference this value."}),name:t.String({description:"Observed service name that contributed leaf-span time to the trace. Comes from trace service context and is returned for every contributing service."}),env:t.Optional(t.String({description:"Observed service environment for this contributing service. Comes from trace service context and is absent when the spans do not carry an environment."})),id:t.Optional(t.String({description:"Service catalog ID for this contributing service. Tsuga sets it when exactly one catalog entry matches the observed service and environment; absent when the service is not cataloged or matches ambiguously."})),namespace:t.Optional(t.String({description:"Service namespace from the matched service catalog entry. Returned only when Tsuga can resolve the contributing service to one catalog entry with a namespace."}))}),G8=t.Object({fromNs:t.String({description:"Range start time in nanoseconds since Unix epoch. Tsuga sets it from the trace timeline split where active leaf spans change. Transmitted as a string to avoid losing precision."}),toNs:t.String({description:"Range end time in nanoseconds since Unix epoch. Tsuga sets it from the trace timeline split where active leaf spans change. Transmitted as a string to avoid losing precision."}),durationNs:t.String({description:"Range duration in nanoseconds, computed as `toNs - fromNs`. Transmitted as a string to avoid losing precision."}),contributions:t.Array(t.Object({serviceKey:t.String({description:"Contributing service key for this range. References `services[].key` in the same response."}),weight:t.Number({description:"Share of this range attributed to the service, from `0` through `1`. Tsuga computes the weight from active leaf spans in the range; weights inside one range sum to `1`."}),durationNs:t.String({description:"Estimated duration attributed to this service in the range, computed as `weight` times the range's own `durationNs` and rounded to whole nanoseconds. Use `serviceTotals` as authoritative when rounded range values do not add up exactly."})}),{description:"Services contributing active leaf-span time to this range, with weighted shares for the range duration."}),spanIds:t.Array(t.String(),{description:"Leaf span IDs that produced this range. Tsuga returns IDs from the leaf-only attribution set, including merged sub-ranges after short-range collapsing."})}),$8=t.Object({serviceKey:t.String({description:"Contributing service key for this aggregate total. References `services[].key` in the same response."}),durationNs:t.String({description:"Total wall-clock contribution of this service across the trace, in nanoseconds. Sum of `weight * durationNs` over every range the service contributes to; authoritative when it disagrees with rounded per-range values. Transmitted as a string to avoid losing precision."}),share:t.Number({description:"Share of total trace duration attributed to this service, from `0` through `1`. Computed as `durationNs / totalDurationNs`; multiply by 100 for a percentage."})}),ny=t.Optional(t.Number({minimum:0,description:"Minimum range duration in milliseconds. Shorter ranges are collapsed (absorbed into a neighbor or blended with adjacent shorts) to keep the timeline readable. When omitted, the default depends on the trace: max(1ms, 1% of the total trace duration), so e.g. a 10s trace collapses ranges shorter than 100ms. Pass 0 to disable collapsing."})),oy=t.Optional(t.Boolean({default:!0,description:"When false, omits the per-range timeline (returns `ranges: []`) and returns only `services` and `serviceTotals`. Cuts payload size for callers that only need the headline. Defaults to true."})),em=t.Object({traceId:t.String({description:"Trace ID summarized by the response. Echoes the required `traceId` query parameter."}),startTimeNs:t.String({description:"Earliest `start_time` across fetched spans, in nanoseconds since Unix epoch. If the request window does not cover the full trace, this reflects the fetched subset, not necessarily the trace's true start. Transmitted as a string to avoid losing precision."}),endTimeNs:t.String({description:"Latest `end_time` across fetched spans, in nanoseconds since Unix epoch. If the request window does not cover the full trace, this reflects the fetched subset, not necessarily the trace's true end. Transmitted as a string to avoid losing precision."}),totalDurationNs:t.String({description:"Total fetched trace duration in nanoseconds, computed as `endTimeNs - startTimeNs`. Transmitted as a string to avoid losing precision."}),truncated:t.Boolean({description:"Whether the underlying span fetch hit its result cap. When true, the latency summary may be incomplete because not every span in the trace was available."}),services:t.Array(D8,{description:"Unique services that contributed leaf-span time to the trace, enriched with catalog IDs when Tsuga can resolve them. Referenced by `serviceKey` from `ranges` and `serviceTotals`."}),ranges:t.Array(G8,{description:"Sequential trace timeline split into ranges wherever the active leaf-span set changes. Empty when the request sets `includeRanges` to false."}),serviceTotals:t.Array($8,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),F8={traceId:"78c99c5bb1e4a30297fa134b9dbec64f",startTimeNs:"1704067200000000000",endTimeNs:"1704067202400000000",totalDurationNs:"2400000000",truncated:!1,services:[{key:"checkout|prod",name:"checkout",env:"prod",id:"123-456-abc",namespace:"default"},{key:"payments|prod",name:"payments",env:"prod",id:"456-789-def",namespace:"default"}],ranges:[{fromNs:"1704067200000000000",toNs:"1704067201200000000",durationNs:"1200000000",contributions:[{serviceKey:"checkout|prod",weight:1,durationNs:"1200000000"}],spanIds:["3df8cc3449378f66"]},{fromNs:"1704067201200000000",toNs:"1704067202400000000",durationNs:"1200000000",contributions:[{serviceKey:"checkout|prod",weight:.5,durationNs:"600000000"},{serviceKey:"payments|prod",weight:.5,durationNs:"600000000"}],spanIds:["187a47da1b2560f8","3df8cc3449378f66"]}],serviceTotals:[{serviceKey:"checkout|prod",durationNs:"1800000000",share:.75},{serviceKey:"payments|prod",durationNs:"600000000",share:.25}]};Object.assign(em,{examples:[F8]});var tpt=d({tags:["traces"],url:`${Qn}/latency-summary`,method:"GET",query:t.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),minRangeDurationMs:ny,includeRanges:oy}),response:em}),j8=t.Object({traceId:t.String(),spanId:t.String()}),rpt=d({tags:["traces"],url:`${Qn}/span-backlinks`,method:"GET",query:t.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID referenced by span links"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Object({backlinks:t.Array(t.Object({spanId:t.String(),references:t.Array(j8)})),truncated:t.Boolean()})}),VM=t.Object({filter:p({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:kn}),q8=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number()}),B8=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number(),lift:t.Union([t.Number(),t.Null()]),pValue:t.Number()}),H8=t.Object({attr:t.String(),values:t.Array(B8),otherValues:t.Array(q8)}),ry=t.Object({contrastSets:t.Array(H8),groupACount:t.Number(),groupBCount:t.Number(),failedAttributeCount:t.Number()}),ZM=t.Object({groupA:VM,groupB:VM,candidateAttrs:t.Optional(t.Array(p({allowEmpty:!1}))),topK:t.Optional(t.Integer({minimum:1,maximum:100})),minLift:t.Optional(t.Number({minimum:1})),minSupport:t.Optional(t.Number({minimum:0,maximum:100})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),npt=d({tags:["traces"],url:`${Qn}/contrast-sets`,method:"POST",body:ZM,response:ry}),K8=x("type",[t.Object({type:t.Literal("snapshot"),response:ry}),t.Object({type:t.Literal("done"),response:ry}),t.Object({type:t.Literal("error"),message:t.String()})]),opt=d({tags:["traces"],url:`${Qn}/contrast-sets/stream`,method:"POST",body:ZM,response:K8});var iy=`/${"v1"}/traces`,sy=t.Object({context:t.Optional(t.Object({service:t.Optional(t.Object({name:t.Optional(t.String({description:"Service name associated with the span."})),version:t.Optional(t.String({description:"Service version associated with the span."}))},{additionalProperties:!0,description:"Service identity associated with the span, from OpenTelemetry service resource attributes."}))},{additionalProperties:!0,description:"OpenTelemetry resource context resolved for the span, holding the identity of the emitting service."})),parentSpanId:t.Optional(t.String({description:"`spanId` of this span's parent within the same trace. Absent for the root span."})),resourceAttributes:t.Object({},{additionalProperties:!0,description:"OpenTelemetry resource attributes describing the process/host that emitted the span (e.g. `host.name`, `k8s.pod.name`), as a flat key-value map set by the instrumented service or its SDK."}),spanAttributes:t.Object({},{additionalProperties:!0,description:"OpenTelemetry span attributes describing this operation (e.g. HTTP method, DB statement), as a flat key-value map set by the instrumented code or auto-instrumentation."}),duration:t.Number({description:"Span duration in milliseconds, derived from the nanosecond `startTime` and `endTime` values."}),startTime:t.String({description:"Span start time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),endTime:t.String({description:"Span end time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),error:t.Optional(t.Object({message:t.String({description:"Error message associated with the span."})},{description:"Error details associated with the span, separate from the OpenTelemetry `statusCode` field."})),events:t.Optional(t.Array(t.Object({event_attributes:t.Object({},{additionalProperties:!0,description:"Key-value attributes recorded with this event, set by the instrumented code when the event was added to the span (e.g. exception details)."}),event_name:t.String({description:"Name of the span event."}),event_timestamp_nanos:t.String({description:"Event timestamp in nanoseconds, transmitted as a string for precision."})},{description:"A single timestamped event recorded on the span, with its name and attributes."}),{description:"Events recorded on the span."})),spanId:t.String({description:"Unique span ID within the trace."}),span:t.Object({kind:t.String({description:"OpenTelemetry span kind describing the relationship to remote calls: `unspecified`, `internal`, `server`, `client`, `producer`, or `consumer`."}),name:t.String({description:"Operation name recorded on the span."})},{description:"Operation identity for the span, combining the recorded operation name and the OpenTelemetry span kind."}),statusCode:t.Optional(t.String({description:"OpenTelemetry span status set by the instrumented code: `unset` (default, no explicit status), `ok`, or `error`. Absent if the source span never set a status."})),traceId:t.String({description:"Trace ID shared by all spans in the trace."})},{additionalProperties:!0,$id:"SpanEvent",description:"Distributed tracing span including timing, identifiers, OpenTelemetry attributes, events, and status metadata."}),z8={context:{service:{name:"my-service",version:"1.0.0"}},parentSpanId:"187a47da1b2560f8",resourceAttributes:{},spanAttributes:{busyNs:374640,code:{file:{path:"src/queue/sqs.rs"},line:{number:162},module:{name:"queue::sqs"}},idleNs:23621445,maxMessages:"1",target:"queue::sqs",thread:{id:2,name:"tokio-runtime-worker"}},duration:23,startTime:"1770923469995353600",endTime:"1770923470019349500",spanId:"3df8cc3449378f66",span:{kind:"internal",name:"receive_messages"},statusCode:"ok",traceId:"78c99c5bb1e4a30297fa134b9dbec64f"};Object.assign(sy,{examples:[z8]});var Y8={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},XM=t.Object({...Tt.properties,query:t.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting spans to return. Omit to search all spans in the range with `*`."})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4,default:WM,description:"Maximum number of spans to return. Defaults to 100. Valid values are 1 through 10000."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Span search query. Provide a time range, optional Tsuga query, and optional limit."});Object.assign(XM,{examples:[Y8]});var JM=d({description:"Searches spans in a required time range using Tsuga query syntax. Use this endpoint to retrieve trace spans for investigations or automation. See [Traces](/documentation/explore/traces) and [Query syntax](/documentation/explore/query-syntax).",operationId:"searchSpans",tags:["public","traces"],url:`${iy}/search`,method:"GET",query:XM,response:t.Object({spans:t.Array(sy,{description:"Spans matching the query and time range."})})}),V8={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},e0=t.Object({...Tt.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize. Use the `traceId` returned by span search, the trace details page, or your tracing instrumentation. Required; the requested time range must include the trace."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),groupByAttributes:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Glob patterns of span attribute keys to use as additional grouping dimensions. Use this when spans should be summarized separately for matching attributes, such as `db.*`. Matches flattened dotted span attribute keys; omitted by default."})),minLeafSpansToAggregate:t.Optional(t.Integer({minimum:2,default:5,description:"Minimum number of similar leaf spans in a group before Tsuga replaces them with one synthetic summary span. Use higher values for less aggressive summarization. Optional; defaults to 5 and must be at least 2."})),maxParentDepth:t.Optional(t.Integer({minimum:-1,default:-1,description:"Maximum depth of recursive parent aggregation after leaf spans are summarized. Use this to limit parent-level aggregation. Use `0` to aggregate leaf spans only or `-1` for unlimited depth; defaults to `-1`."})),aggregationHistogramBucketsSeconds:t.Optional(t.Array(t.Number({minimum:0}),{description:"Upper-bound bucket values, in seconds, for the latency histogram recorded on synthetic summary spans. Provide custom buckets when the default latency buckets are not suitable. Pass an empty array to omit histogram attributes; omitted values use Tsuga defaults from 5 ms through 10 s."})),sortSpans:t.Optional(t.Boolean({default:!0,description:"Whether Tsuga sorts returned spans by start time, using span ID as the tie-breaker for identical start times. Defaults to `true`; set to `false` only when reconstructing the trace tree yourself, in which case summary spans are appended after surviving spans."}))},{description:"Trace summarization query. Provide a trace ID, a time range covering the trace, and optional aggregation tuning."});Object.assign(e0,{examples:[V8]});var t0=d({description:"Summarizes a trace by aggregating groups of similar spans into synthetic summary spans, producing a compact view of large traces. Summary spans are marked with `spanAttributes.aggregation.is_summary` and carry span counts, duration statistics, and an optional latency histogram. See [Traces](/documentation/explore/traces).",operationId:"summarizeTrace",tags:["public","traces"],url:`${iy}/summarize`,method:"GET",query:e0,response:t.Object({spans:t.Array(sy,{description:"Summarized trace spans, sorted by start time unless `sortSpans` is false. Aggregated groups are replaced by synthetic summary spans marked with `spanAttributes.aggregation.is_summary`."})})}),Q8={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},r0=t.Object({...Tt.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize. Use the `traceId` returned by span search, the trace details page, or your tracing instrumentation. Required; the requested time range must include the trace."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),minRangeDurationMs:ny,includeRanges:oy},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(r0,{examples:[Q8]});var n0=d({description:"Summarizes where wall-clock time is spent in a trace, attributing each slice of the trace timeline to the services with active leaf spans. Returns per-service totals and an optional sequential range timeline. See [Traces](/documentation/explore/traces).",operationId:"getTraceLatencySummary",tags:["public","traces"],url:`${iy}/latency-summary`,method:"GET",query:r0,response:em});var s0=["timestamp","level","message"],a0=["count","ratio","team","level","pattern"];function Et(e,r){let n=r??ar(e);if(!n)throw new Error(`--${e} is required`);return Zo(n)}function o0(e){let r={from:Et("from",e.from),to:Et("to",e.to)},n=e.query??ar("query");n!==void 0&&(r.query=n);let o=e.maxResults??ar("max-results");if(o!==void 0){let i=Number(o);if(Number.isNaN(i))throw new Error(`--max-results must be a number (got: ${o})`);r.maxResults=i}return r}function Ge(e){let r=ar(e);return r===void 0?"":` (default: ${r})`}function W8(e){let r=fa(e.output),n=e.fields===void 0?void 0:ga(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??s0}}function Z8(e){let r=fa(e.output),n=e.fields===void 0?void 0:ga(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??a0}}function i0(e,r){let n={count:e.size,ratio:r>0?e.size/r:0,pattern:e.pattern};for(let{key:o,value:i}of e.groups)o==="context.team"?n.team=i:n[o]=i;return n}function X8(e,r){if(r.format==="json"){if(r.fields===void 0){W(e);return}let{fields:i}=r;W({patterns:e.patterns.map(s=>i0(s,e.sampleSize)).map(s=>ha(s,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>i0(i,e.sampleSize)),o=ya(r.format,n,r.fields);o.length>0&&Y(o)}function J8(e,r){if(r.format==="json"){if(r.fields===void 0){W(e);return}let{fields:o}=r;W({logs:e.logs.map(i=>ha(i,o))});return}let n=ya(r.format,e.logs,r.fields);n.length>0&&Y(n)}function c0(e,r){let n=e.command("logs").description("Search and analyze logs");n.command("search").description("Search logs").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs${Ge("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-1000${Ge("max-results")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each log (default for --output=tsv|csv: ${s0.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=W8(c),m=await r()(wM,{query:o0(c)});J8(m,l)}),n.command("attributes").description("List log attribute dot-paths observed in the time range").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await r()(FM,{query:{from:Et("from",c.from),to:Et("to",c.to)}});W(l)}),n.command("patterns").description("List log patterns").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs before clustering into patterns${Ge("query")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each pattern (default for --output=tsv|csv: ${a0.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=Z8(c),m={from:Et("from",c.from),to:Et("to",c.to)},f=c.query??ar("query");f!==void 0&&(m.query=f);let h=await r()(LM,{query:m});X8(h,l)}),n.command("new-error-patterns").description("List error patterns first seen in this time range").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--team <TEAM_NAME>","Filter by team").option("--env <ENV_NAME>","Filter by environment").option("--service <SERVICE_NAME>","Filter by service").action(async c=>{let l={from:Et("from",c.from),to:Et("to",c.to)};c.team!==void 0&&(l.team=c.team),c.env!==void 0&&(l.env=c.env),c.service!==void 0&&(l.service=c.service);let m=await r()(MM,{query:l});W(m)}),n.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).requiredOption("--team <TEAM_NAME>","Team to query").option("--env <ENV_NAME>","Filter by environment").action(async c=>{let l={from:Et("from",c.from),to:Et("to",c.to),team:c.team};c.env!==void 0&&(l.env=c.env);let m=await r()(GM,{query:l});W(m)});let o=e.command("metrics").description("List and inspect metrics");o.command("list").description("List all metrics with their metadata").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await r()(HM,{query:{from:Et("from",c.from),to:Et("to",c.to)}});W(l)}),o.command("get <METRIC_NAME>").description("Retrieve a metric by name with its metadata").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async(c,l)=>{let m=await r()(KM,{params:{name:c},query:{from:Et("from",l.from),to:Et("to",l.to)}});W(m)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await r()(YM,{query:{metricName:c}});W(l)});let i=e.command("traces").description("Search and summarize traces");i.command("search").description("Search spans").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter spans${Ge("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-10000${Ge("max-results")}`).action(async c=>{let l=await r()(JM,{query:o0(c)});W(l)}),i.command("summarize").description("Summarize a trace by aggregating groups of similar spans into summary spans").requiredOption("--trace-id <TRACE_ID>","Trace ID to summarize").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).action(async c=>{let l=await r()(t0,{query:{traceId:c.traceId,from:Et("from",c.from),to:Et("to",c.to)}});W(l)}),i.command("latency-summary").description("Summarize where wall-clock time is spent in a trace, attributed per service").requiredOption("--trace-id <TRACE_ID>","Trace ID to summarize").option("--from <TIMESTAMP>",`Start of time range${Ue}${Ge("from")}`).option("--to <TIMESTAMP>",`End of time range${Ue}${Ge("to")}`).option("--min-range-duration-ms <MILLISECONDS>","Collapse timeline ranges shorter than this (default: max(1ms, 1% of trace duration); 0 disables collapsing)").option("--no-ranges","Omit the per-range timeline; return only services and serviceTotals").action(async c=>{let l={traceId:c.traceId,from:Et("from",c.from),to:Et("to",c.to)};if(c.minRangeDurationMs!==void 0){let f=Number(c.minRangeDurationMs);if(Number.isNaN(f))throw new Error(`--min-range-duration-ms must be a number (got: ${c.minRangeDurationMs})`);l.minRangeDurationMs=f}c.ranges||(l.includeRanges=!1);let m=await r()(n0,{query:l});W(m)});let s=e.command("aggregation").description("Run aggregation queries");Tr(s,"scalar","Run aggregation queries and return scalar results",mC,r),Tr(s,"timeseries","Run aggregation queries and return timeseries results",fC,r)}var eW="x-tsuga-session-id",ay="x-tsuga-source",cy="x-tsuga-source-version",py="x-tsuga-source-commit",uy="x-tsuga-source-date",ly="x-tsuga-rationale",tW="x-tsuga-dashboard-id",rW="x-tsuga-widget-id",nW="x-request-id",bpt={[eW]:"Session identifier for request correlation",[ay]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[cy]:"SDK version",[py]:"SDK commit hash",[uy]:"SDK commit date",[ly]:"Optional caller-supplied rationale for this request, recorded for telemetry",[tW]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[rW]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[nW]:"Unique identifier for this API request, useful for debugging and support"};function oW(e){return e.replace(/\s+/g," ").replace(/[^\x20-\x7e\x80-\xff]/g,"").trim()}function p0(e,r,n,o){return async function(s,c={}){let{body:l,params:m,query:f}=c,h;if(s.url!==void 0)h=s.url;else if(s.buildUrl){if(!m)throw new qt("Internal error: params required for this endpoint");h=s.buildUrl(m)}else throw new qt("Internal error: endpoint has neither url nor buildUrl");let E=n===void 0?f:{clusterId:n,...f},I=DA(`${e}${h}`,E),g={Accept:"application/json",Authorization:`Bearer ${r}`,[ay]:"cli",[cy]:"1.34.0",[py]:"d78348708c",[uy]:"2026-09-23T09:39:15.555Z"};l&&(g["Content-Type"]="application/json");let T=o?.(),O=T?oW(T):"";O&&(g[ly]=O);let b=await fetch(I,{method:s.method,headers:g,body:l?JSON.stringify(l):null}),R;try{R=await b.json()}catch{throw new qt(b.status===504?"The server timed out (504). Try a smaller time range.":`Server returned a non-JSON response (HTTP ${b.status}).`,b.status)}if(R.error)throw qt.fromErrorResponse(R.error,R.requestId);return sW(R,iW(c)),R.data}}function iW({body:e,query:r}){let n=r?.offset??e?.offset;return typeof n=="number"?n:0}function sW(e,r){let n=e.metadata?.pagination;if(n===void 0||!Array.isArray(e.data))return;let o=r+e.data.length;o>=n.totalCount||Ox(`Showing ${e.data.length} of ${n.totalCount} (offset ${r}). Use --limit (max ${Si}) and --offset ${o} for the next page.`)}function my(e,r=n=>{process.exit(n)}){e.on("error",n=>{if(n.code==="EPIPE"){r(process.exitCode);return}throw n})}var aW=3e3,cW="https://registry.npmjs.org/@tsuga/cli/latest";function pW(e,r){let n=e.split(".").map(Number),o=r.split(".").map(Number);for(let i=0;i<Math.max(n.length,o.length);i++){let s=n[i]??0,c=o[i]??0;if(s>c)return!0;if(s<c)return!1}return!1}async function u0(e){try{let r=aR();if(r&&Date.now()-new Date(r).getTime()<zc)return;let n=await fetch(cW,{signal:AbortSignal.timeout(aW)});if(!n.ok)return;let i=(await n.json()).version;pW(i,e)&&(process.stderr.write(`
176
177
  Update available: ${e} \u2192 ${i}
177
- `),process.stderr.write("Run `tsuga self-update` to update\n")),iR(new Date().toISOString())}catch{}}py(process.stdout);py(process.stderr);var Ae=new Ho().name("tsuga").description("Manage Tsuga resources, telemetry, and configuration from the command line").version("1.32.0").addHelpText("before",()=>`${BA()}
178
- `).configureHelp({sortSubcommands:!0}).helpOption("-h, --help","Display help for command").helpCommand("help [command]","Display help for command").option("--cluster <CLUSTER_ID>","Target cluster (overrides config and TSUGA_CLUSTER_ID)"),Ia,o0;function pr(){if(Ia)return Ia;let e=Ae.opts(),r=Ai({clusterId:e.cluster}),n=Qx(r);n||(console.error("Error: no credentials. Authenticate with one of:"),console.error(" tsuga auth login # log in as a user (OAuth)"),console.error(" tsuga auth operation-key <OPERATION_API_KEY> # save an operation API key"),console.error(" export TSUGA_OPERATION_API_KEY=<OPERATION_API_KEY>"),process.exit(1));let o=l=>r0(r.apiUrl,l,r.clusterId,()=>o0),{credential:i}=r;if(i?.kind!=="user-session")return Ia=o(n),Ia;let a=i.userAuth,c=o(a.accessToken);return Ia=async(l,m)=>{let f=await lu({userAuth:a,now:new Date,reload:Is,refresh:h=>pu(r.apiUrl,h),persist:xu});return f!==a&&(a=f,c=o(a.accessToken)),c(l,m)},Ia}var i0="Setup & config:",a0="Documentation, help & feedback:";Ae.commandsGroup(i0);cR(Ae,pr);VR(Ae);var V8=new Set(Ae.commands);Ae.commandsGroup("Resources:");sM(Ae,pr);Ae.commandsGroup("Query & explore:");t0(Ae,pr);fv(Ae,pr);Tv(Ae,pr);Ov(Ae,pr);nN(Ae,pr);iN(Ae,pr);bw(Ae,pr);Ae.commandsGroup(a0);eC(Ae,pr);Rw(Ae,pr);Ae.commandsGroup(i0);HR(Ae,pr);EM(Ae);Sv(Ae);pM(Ae);YR(Ae);Ae.commandsGroup(a0).helpCommand("help [command]");function s0(e){if(e.commands.length===0){e.option("--rationale <RATIONALE>",'Why you are making this call, e.g. "confirming the deploy caused the error spike". Recorded to explain intent; does not affect the result.');return}for(let r of e.commands)s0(r)}var Q8=new Set(["completion","self-update","install","setup","feedback"]);for(let e of Ae.commands)!V8.has(e)&&!Q8.has(e.name())&&s0(e);Ae.hook("preAction",(e,r)=>{let{rationale:n}=r.opts();o0=n});Ae.parseAsync().then(()=>n0("1.32.0")).catch(e=>{console.error(mC(e)),process.exitCode=1});
178
+ `),process.stderr.write("Run `tsuga self-update` to update\n")),cR(new Date().toISOString())}catch{}}my(process.stdout);my(process.stderr);var Ae=new zo().name("tsuga").description("Manage Tsuga resources, telemetry, and configuration from the command line").version("1.34.0").addHelpText("before",()=>`${zA()}
179
+ `).configureHelp({sortSubcommands:!0,showGlobalOptions:!0}).helpOption("-h, --help","Display help for command").helpCommand("help [command]","Display help for command").option("--cluster <CLUSTER_ID>","Target cluster (overrides config and TSUGA_CLUSTER_ID)"),Ss,l0;function tr(){if(Ss)return Ss;let e=Ae.opts(),r=Ri({clusterId:e.cluster}),n=Xx(r);n||(console.error("Error: no credentials. Authenticate with one of:"),console.error(" tsuga auth login # log in as a user (OAuth)"),console.error(" tsuga auth operation-key <OPERATION_API_KEY> # save an operation API key"),console.error(" export TSUGA_OPERATION_API_KEY=<OPERATION_API_KEY>"),process.exit(1));let o=l=>p0(r.apiUrl,l,r.clusterId,()=>l0),{credential:i}=r;if(i?.kind!=="user-session")return Ss=o(n),Ss;let s=i.userAuth,c=o(s.accessToken);return Ss=async(l,m)=>{let f=await mu({userAuth:s,now:new Date,reload:Sa,refresh:h=>uu(r.apiUrl,h),persist:Ru});return f!==s&&(s=f,c=o(s.accessToken)),c(l,m)},Ss}var m0="Setup & config:",d0="Documentation, help & feedback:";Ae.commandsGroup(m0);lR(Ae,tr);eC(Ae);var uW=new Set(Ae.commands);Ae.commandsGroup("Resources:");fM(Ae,tr);Ae.commandsGroup("Query & explore:");c0(Ae,tr);_w(Ae,tr);Ow(Ae,tr);Uw(Ae,tr);cv(Ae,tr);uv(Ae,tr);CN(Ae,tr);Ae.commandsGroup(d0);sC(Ae,tr);wN(Ae,tr);Ae.commandsGroup(m0);VR(Ae,tr);xM(Ae);Cw(Ae);hM(Ae);JR(Ae);Ae.commandsGroup(d0).helpCommand("help [command]");function f0(e){if(e.commands.length===0){e.option("--rationale <RATIONALE>",'Why you are making this call, e.g. "confirming the deploy caused the error spike". Recorded to explain intent; does not affect the result.');return}for(let r of e.commands)f0(r)}var lW=new Set(["completion","self-update","install","setup","feedback"]);for(let e of Ae.commands)!uW.has(e)&&!lW.has(e.name())&&f0(e);Ae.hook("preAction",(e,r)=>{let{rationale:n}=r.opts();l0=n});Ae.parseAsync().then(()=>u0("1.34.0")).catch(async e=>{console.error(YR(e)),QR(e)&&console.error(await WR(tr())),process.exitCode=1});
179
180
  /**
180
181
  * The following is a list of HTTP status codes and their meanings.
181
182
  *