@tsuga/cli 1.25.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/cli.js +58 -57
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,57 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var kk=Object.create;var bl=Object.defineProperty;var Mk=Object.getOwnPropertyDescriptor;var Dk=Object.getOwnPropertyNames;var Gk=Object.getPrototypeOf,$k=Object.prototype.hasOwnProperty;var jk=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yt=(e,t)=>{for(var n in t)bl(e,n,{get:t[n],enumerable:!0})},qk=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Dk(t))!$k.call(e,i)&&i!==n&&bl(e,i,{get:()=>t[i],enumerable:!(o=Mk(t,i))||o.enumerable});return e};var rn=(e,t,n)=>(n=e!=null?kk(Gk(e)):{},qk(t||!e||!e.__esModule?bl(n,"default",{value:e,enumerable:!0}):n,e));var VA=jk((YA,Lp)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"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(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function m(g,T){if(g.indexOf("::")!==g.lastIndexOf("::"))return null;let S=0,b=-1,x=(g.match(l.zoneIndex)||[])[0],P,ue;for(x&&(x=x.substring(1),g=g.replace(/%.+$/,""));(b=g.indexOf(":",b+1))>=0;)S++;if(g.substr(0,2)==="::"&&S--,g.substr(-2,2)==="::"&&S--,S>=T)return null;for(ue=T-S,P=":";ue--;)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 tn=g.split(":"),Lr=[];for(let kr=0;kr<tn.length;kr++)Lr.push(tn[kr].length>4?NaN:parseInt(tn[kr],16));return Lr})(),{parts:T,zoneId:x}}function f(g,T,S,b){if(g.length!==T.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,P;for(;b>0;){if(P=S-b,P<0&&(P=0),g[x]>>P!==T[x]>>P)return!1;b-=S,x+=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 S,b;for(S=0;S<T.length;S++)if(b=T[S],!(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,S){let b;if(S===void 0&&(b=T,T=b[0],S=b[1]),T.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,T.octets,8,S)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,S=!1,b={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},x,P,ue;for(x=3;x>=0;x-=1)if(P=this.octets[x],P in b){if(ue=b[P],S&&ue!==0)return null;ue!==8&&(S=!0),T+=ue}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),S=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],P=0;for(;P<4;)x.push(parseInt(S[P],10)|parseInt(b[P],10)^255),P++;return new this(x)}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,S,b,x,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],S=0;S<4;)x.push(parseInt(b[S],10)&parseInt(P[S],10)),S++;return new this(x)}catch(ue){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:ue})}},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 S=parseInt(T[2]);if(S>=0&&S<=32){let b=[this.parse(T[1]),S];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,S,b;if(T=g.match(n.fourOctet))return(function(){let x=T.slice(1,6),P=[];for(let ue=0;ue<x.length;ue++)S=x[ue],P.push(h(S));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 x=[],P;for(P=0;P<=24;P+=8)x.push(b>>P&255);return x})().reverse()}else return(T=g.match(n.twoOctet))?(function(){let x=T.slice(1,4),P=[];if(b=h(x[1]),b>16777215||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(x[0])),P.push(b>>16&255),P.push(b>>8&255),P.push(b&255),P})():(T=g.match(n.threeOctet))?(function(){let x=T.slice(1,5),P=[];if(b=h(x[2]),b>65535||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(x[0])),P.push(h(x[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],S=0,b=Math.floor(g/8);for(;S<b;)T[S]=255,S++;return b<4&&(T[b]=Math.pow(2,g%8)-1<<8-g%8),new this(T)},I.IPv6=(function(){function g(T,S){let b,x;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(x=this.parts[b],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");S&&(this.zoneId=S)}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,S){let b;if(S===void 0&&(b=T,T=b[0],S=b[1]),T.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,T.parts,16,S)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,S=!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},x,P;for(let ue=7;ue>=0;ue-=1)if(x=this.parts[ue],x in b){if(P=b[x],S&&P!==0)return null;P!==16&&(S=!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,S=[],b=this.parts;for(let x=0;x<b.length;x++)T=b[x],S.push(T>>8),S.push(T&255);return S},g.prototype.toFixedLengthString=function(){let T=(function(){let b=[];for(let x=0;x<this.parts.length;x++)b.push(E(this.parts[x].toString(16),4));return b}).call(this).join(":"),S="";return this.zoneId&&(S=`%${this.zoneId}`),T+S},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),S=T[0],b=T[1];return new I.IPv4([S>>8,S&255,b>>8,b&255])},g.prototype.toNormalizedString=function(){let T=(function(){let b=[];for(let x=0;x<this.parts.length;x++)b.push(this.parts[x].toString(16));return b}).call(this).join(":"),S="";return this.zoneId&&(S=`%${this.zoneId}`),T+S},g.prototype.toRFC5952String=function(){let T=/((^|:)(0(:|$)){2,})/g,S="";this.zoneId&&(S=`%${this.zoneId}`);let b=this.toNormalizedString(),x=b.slice(0,b.length-S.length),P=0,ue=-1,tn=-1,Lr;for(;Lr=T.exec(x);){let kr=(Lr[0].match(/0/g)||[]).length;kr>tn&&(tn=kr,P=Lr.index,ue=Lr[0].length)}return ue<0?x+S:`${x.substring(0,P)}::${x.substring(P+ue)}${S}`},g.prototype.toString=function(){return this.toRFC5952String()},g})(),I.IPv6.broadcastAddressFromCIDR=function(g){try{let T=this.parseCIDR(g),S=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],P=0;for(;P<16;)x.push(parseInt(S[P],10)|parseInt(b[P],10)^255),P++;return new this(x)}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,S,b,x,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],S=0;S<16;)x.push(parseInt(b[S],10)&parseInt(P[S],10)),S++;return new this(x)}catch(ue){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:ue})}},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,S,b;if((S=g.match(/^(.+)\/(\d+)$/))&&(T=parseInt(S[2]),T>=0&&T<=128))return b=[this.parse(S[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,S,b,x,P,ue;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))&&(ue=b[6]||"",T=b[1],b[1].endsWith("::")||(T=T.slice(0,-1)),T=m(T+ue,6),T&&T.parts)){for(P=[parseInt(b[2]),parseInt(b[3]),parseInt(b[4]),parseInt(b[5])],S=0;S<P.length;S++)if(x=P[S],!(0<=x&&x<=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],S=0,b=Math.floor(g/8);for(;S<b;)T[S]=255,S++;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,S){let b,x,P,ue;S==null&&(S="unicast");for(x in T)if(Object.prototype.hasOwnProperty.call(T,x)){for(P=T[x],P[0]&&!(P[0]instanceof Array)&&(P=[P]),b=0;b<P.length;b++)if(ue=P[b],g.kind()===ue[0].kind()&&g.match.apply(g,ue))return x}return S},typeof Lp<"u"&&Lp.exports?Lp.exports=I:e.ipaddr=I})(YA)});var nn=class extends Error{constructor(t,n,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=t,this.nestedError=void 0}},Mn=class extends nn{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var ia=class{constructor(t,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,n){return n===this.defaultValue||!Array.isArray(n)?[t]:(n.push(t),n)}default(t,n){return this.defaultValue=t,this.defaultValueDescription=n,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Mn(`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 t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}var Mh=require("node:events"),hc=rn(require("node:child_process"),1),pr=rn(require("node:path"),1),sa=rn(require("node:fs"),1),le=rn(require("node:process"),1),Dh=require("node:util");var vh=require("node:util"),aa=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let n=t.commands.filter(i=>!i._hidden),o=t._getHelpCommand();return o&&!o._hidden&&n.push(o),this.sortSubcommands&&n.sort((i,a)=>i.name().localeCompare(a.name())),n}compareOptions(t,n){let o=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return o(t).localeCompare(o(n))}visibleOptions(t){let n=t.options.filter(i=>!i.hidden),o=t._getHelpOption();if(o&&!o.hidden){let i=o.short&&t._findOption(o.short),a=o.long&&t._findOption(o.long);!i&&!a?n.push(o):o.long&&!a?n.push(t.createOption(o.long,o.description)):o.short&&!i&&n.push(t.createOption(o.short,o.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let n=[];for(let o=t.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(t){return t._argsDescription&&t.registeredArguments.forEach(n=>{n.description=n.description||t._argsDescription[n.name()]||""}),t.registeredArguments.find(n=>n.description)?t.registeredArguments:[]}subcommandTerm(t){let n=t.registeredArguments.map(o=>fc(o)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,n){return n.visibleCommands(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(i)))),0)}longestOptionTermLength(t,n){return n.visibleOptions(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestGlobalOptionTermLength(t,n){return n.visibleGlobalOptions(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestArgumentTermLength(t,n){return n.visibleArguments(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(i)))),0)}commandUsage(t){let n=t._name;t._aliases[0]&&(n=n+"|"+t._aliases[0]);let o="";for(let i=t.parent;i;i=i.parent)o=i.name()+" "+o;return o+n+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&n.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&n.push(`env: ${t.envVar}`),n.length>0){let o=`(${n.join(", ")})`;return t.description?`${t.description} ${o}`:o}return t.description}argumentDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),t.defaultValue!==void 0&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),n.length>0){let o=`(${n.join(", ")})`;return t.description?`${t.description} ${o}`:o}return t.description}formatItemList(t,n,o){return n.length===0?[]:[o.styleTitle(t),...n,""]}groupItems(t,n,o){let i=new Map;return t.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(t,n){let o=n.padWidth(t,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(t))}`,""],l=n.commandDescription(t);l.length>0&&(c=c.concat([n.boxWrap(n.styleCommandDescription(l),i),""]));let m=n.visibleArguments(t).map(E=>a(n.styleArgumentTerm(n.argumentTerm(E)),n.styleArgumentDescription(n.argumentDescription(E))));if(c=c.concat(this.formatItemList("Arguments:",m,n)),this.groupItems(t.options,n.visibleOptions(t),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(t).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(t.commands,n.visibleCommands(t),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(t){return(0,
|
|
2
|
+
"use strict";var Yk=Object.create;var Al=Object.defineProperty;var Vk=Object.getOwnPropertyDescriptor;var Qk=Object.getOwnPropertyNames;var Wk=Object.getPrototypeOf,Zk=Object.prototype.hasOwnProperty;var Xk=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yt=(e,t)=>{for(var n in t)Al(e,n,{get:t[n],enumerable:!0})},Jk=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qk(t))!Zk.call(e,i)&&i!==n&&Al(e,i,{get:()=>t[i],enumerable:!(o=Vk(t,i))||o.enumerable});return e};var rn=(e,t,n)=>(n=e!=null?Yk(Wk(e)):{},Jk(t||!e||!e.__esModule?Al(n,"default",{value:e,enumerable:!0}):n,e));var WA=Xk((QA,Lp)=>{(function(e){"use strict";let t="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"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(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${t}\\.${t}\\.${t}\\.${t}(${a})?$`,"i")};function m(g,T){if(g.indexOf("::")!==g.lastIndexOf("::"))return null;let S=0,b=-1,x=(g.match(l.zoneIndex)||[])[0],P,ue;for(x&&(x=x.substring(1),g=g.replace(/%.+$/,""));(b=g.indexOf(":",b+1))>=0;)S++;if(g.substr(0,2)==="::"&&S--,g.substr(-2,2)==="::"&&S--,S>=T)return null;for(ue=T-S,P=":";ue--;)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 tn=g.split(":"),Lr=[];for(let kr=0;kr<tn.length;kr++)Lr.push(tn[kr].length>4?NaN:parseInt(tn[kr],16));return Lr})(),{parts:T,zoneId:x}}function f(g,T,S,b){if(g.length!==T.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,P;for(;b>0;){if(P=S-b,P<0&&(P=0),g[x]>>P!==T[x]>>P)return!1;b-=S,x+=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 S,b;for(S=0;S<T.length;S++)if(b=T[S],!(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,S){let b;if(S===void 0&&(b=T,T=b[0],S=b[1]),T.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,T.octets,8,S)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,S=!1,b={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},x,P,ue;for(x=3;x>=0;x-=1)if(P=this.octets[x],P in b){if(ue=b[P],S&&ue!==0)return null;ue!==8&&(S=!0),T+=ue}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),S=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],P=0;for(;P<4;)x.push(parseInt(S[P],10)|parseInt(b[P],10)^255),P++;return new this(x)}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,S,b,x,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],S=0;S<4;)x.push(parseInt(b[S],10)&parseInt(P[S],10)),S++;return new this(x)}catch(ue){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:ue})}},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 S=parseInt(T[2]);if(S>=0&&S<=32){let b=[this.parse(T[1]),S];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,S,b;if(T=g.match(n.fourOctet))return(function(){let x=T.slice(1,6),P=[];for(let ue=0;ue<x.length;ue++)S=x[ue],P.push(h(S));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 x=[],P;for(P=0;P<=24;P+=8)x.push(b>>P&255);return x})().reverse()}else return(T=g.match(n.twoOctet))?(function(){let x=T.slice(1,4),P=[];if(b=h(x[1]),b>16777215||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(x[0])),P.push(b>>16&255),P.push(b>>8&255),P.push(b&255),P})():(T=g.match(n.threeOctet))?(function(){let x=T.slice(1,5),P=[];if(b=h(x[2]),b>65535||b<0)throw new Error("ipaddr: address outside defined range");return P.push(h(x[0])),P.push(h(x[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],S=0,b=Math.floor(g/8);for(;S<b;)T[S]=255,S++;return b<4&&(T[b]=Math.pow(2,g%8)-1<<8-g%8),new this(T)},I.IPv6=(function(){function g(T,S){let b,x;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(x=this.parts[b],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");S&&(this.zoneId=S)}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,S){let b;if(S===void 0&&(b=T,T=b[0],S=b[1]),T.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,T.parts,16,S)},g.prototype.prefixLengthFromSubnetMask=function(){let T=0,S=!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},x,P;for(let ue=7;ue>=0;ue-=1)if(x=this.parts[ue],x in b){if(P=b[x],S&&P!==0)return null;P!==16&&(S=!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,S=[],b=this.parts;for(let x=0;x<b.length;x++)T=b[x],S.push(T>>8),S.push(T&255);return S},g.prototype.toFixedLengthString=function(){let T=(function(){let b=[];for(let x=0;x<this.parts.length;x++)b.push(E(this.parts[x].toString(16),4));return b}).call(this).join(":"),S="";return this.zoneId&&(S=`%${this.zoneId}`),T+S},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),S=T[0],b=T[1];return new I.IPv4([S>>8,S&255,b>>8,b&255])},g.prototype.toNormalizedString=function(){let T=(function(){let b=[];for(let x=0;x<this.parts.length;x++)b.push(this.parts[x].toString(16));return b}).call(this).join(":"),S="";return this.zoneId&&(S=`%${this.zoneId}`),T+S},g.prototype.toRFC5952String=function(){let T=/((^|:)(0(:|$)){2,})/g,S="";this.zoneId&&(S=`%${this.zoneId}`);let b=this.toNormalizedString(),x=b.slice(0,b.length-S.length),P=0,ue=-1,tn=-1,Lr;for(;Lr=T.exec(x);){let kr=(Lr[0].match(/0/g)||[]).length;kr>tn&&(tn=kr,P=Lr.index,ue=Lr[0].length)}return ue<0?x+S:`${x.substring(0,P)}::${x.substring(P+ue)}${S}`},g.prototype.toString=function(){return this.toRFC5952String()},g})(),I.IPv6.broadcastAddressFromCIDR=function(g){try{let T=this.parseCIDR(g),S=T[0].toByteArray(),b=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],P=0;for(;P<16;)x.push(parseInt(S[P],10)|parseInt(b[P],10)^255),P++;return new this(x)}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,S,b,x,P;try{for(T=this.parseCIDR(g),b=T[0].toByteArray(),P=this.subnetMaskFromPrefixLength(T[1]).toByteArray(),x=[],S=0;S<16;)x.push(parseInt(b[S],10)&parseInt(P[S],10)),S++;return new this(x)}catch(ue){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:ue})}},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,S,b;if((S=g.match(/^(.+)\/(\d+)$/))&&(T=parseInt(S[2]),T>=0&&T<=128))return b=[this.parse(S[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,S,b,x,P,ue;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))&&(ue=b[6]||"",T=b[1],b[1].endsWith("::")||(T=T.slice(0,-1)),T=m(T+ue,6),T&&T.parts)){for(P=[parseInt(b[2]),parseInt(b[3]),parseInt(b[4]),parseInt(b[5])],S=0;S<P.length;S++)if(x=P[S],!(0<=x&&x<=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],S=0,b=Math.floor(g/8);for(;S<b;)T[S]=255,S++;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,S){let b,x,P,ue;S==null&&(S="unicast");for(x in T)if(Object.prototype.hasOwnProperty.call(T,x)){for(P=T[x],P[0]&&!(P[0]instanceof Array)&&(P=[P]),b=0;b<P.length;b++)if(ue=P[b],g.kind()===ue[0].kind()&&g.match.apply(g,ue))return x}return S},typeof Lp<"u"&&Lp.exports?Lp.exports=I:e.ipaddr=I})(QA)});var nn=class extends Error{constructor(t,n,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=t,this.nestedError=void 0}},Dn=class extends nn{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var aa=class{constructor(t,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,n){return n===this.defaultValue||!Array.isArray(n)?[t]:(n.push(t),n)}default(t,n){return this.defaultValue=t,this.defaultValueDescription=n,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Dn(`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 t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}var Gh=require("node:events"),hc=rn(require("node:child_process"),1),pr=rn(require("node:path"),1),ca=rn(require("node:fs"),1),le=rn(require("node:process"),1),$h=require("node:util");var Lh=require("node:util"),sa=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let n=t.commands.filter(i=>!i._hidden),o=t._getHelpCommand();return o&&!o._hidden&&n.push(o),this.sortSubcommands&&n.sort((i,a)=>i.name().localeCompare(a.name())),n}compareOptions(t,n){let o=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return o(t).localeCompare(o(n))}visibleOptions(t){let n=t.options.filter(i=>!i.hidden),o=t._getHelpOption();if(o&&!o.hidden){let i=o.short&&t._findOption(o.short),a=o.long&&t._findOption(o.long);!i&&!a?n.push(o):o.long&&!a?n.push(t.createOption(o.long,o.description)):o.short&&!i&&n.push(t.createOption(o.short,o.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let n=[];for(let o=t.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(t){return t._argsDescription&&t.registeredArguments.forEach(n=>{n.description=n.description||t._argsDescription[n.name()]||""}),t.registeredArguments.find(n=>n.description)?t.registeredArguments:[]}subcommandTerm(t){let n=t.registeredArguments.map(o=>fc(o)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,n){return n.visibleCommands(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(i)))),0)}longestOptionTermLength(t,n){return n.visibleOptions(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestGlobalOptionTermLength(t,n){return n.visibleGlobalOptions(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestArgumentTermLength(t,n){return n.visibleArguments(t).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(i)))),0)}commandUsage(t){let n=t._name;t._aliases[0]&&(n=n+"|"+t._aliases[0]);let o="";for(let i=t.parent;i;i=i.parent)o=i.name()+" "+o;return o+n+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&n.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&n.push(`env: ${t.envVar}`),n.length>0){let o=`(${n.join(", ")})`;return t.description?`${t.description} ${o}`:o}return t.description}argumentDescription(t){let n=[];if(t.argChoices&&n.push(`choices: ${t.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),t.defaultValue!==void 0&&n.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),n.length>0){let o=`(${n.join(", ")})`;return t.description?`${t.description} ${o}`:o}return t.description}formatItemList(t,n,o){return n.length===0?[]:[o.styleTitle(t),...n,""]}groupItems(t,n,o){let i=new Map;return t.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(t,n){let o=n.padWidth(t,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(t))}`,""],l=n.commandDescription(t);l.length>0&&(c=c.concat([n.boxWrap(n.styleCommandDescription(l),i),""]));let m=n.visibleArguments(t).map(E=>a(n.styleArgumentTerm(n.argumentTerm(E)),n.styleArgumentDescription(n.argumentDescription(E))));if(c=c.concat(this.formatItemList("Arguments:",m,n)),this.groupItems(t.options,n.visibleOptions(t),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(t).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(t.commands,n.visibleCommands(t),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(t){return(0,Lh.stripVTControlCharacters)(t).length}styleTitle(t){return t}styleUsage(t){return t.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(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,n){return Math.max(n.longestOptionTermLength(t,n),n.longestGlobalOptionTermLength(t,n),n.longestSubcommandTermLength(t,n),n.longestArgumentTermLength(t,n))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,n,o,i){let c=" ".repeat(2);if(!o)return c+t;let l=t.padEnd(n+t.length-i.displayWidth(t)),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
5
|
${c}`)}boxWrap(t,n){if(n<this.minWidthToWrap)return t;let o=t.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 Mr=class{constructor(t,n){this.flags=t,this.description=n||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let o=
|
|
6
|
+
`)}};var Mr=class{constructor(t,n){this.flags=t,this.description=n||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let o=eM(t);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(t,n){return this.defaultValue=t,this.defaultValueDescription=n,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let n=t;return typeof t=="string"&&(n={[t]:!0}),this.implied=Object.assign(this.implied||{},n),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,n){return n===this.defaultValue||!Array.isArray(n)?[t]:(n.push(t),n)}choices(t){return this.argChoices=t.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new Dn(`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?kh(this.name().replace(/^no-/,"")):kh(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},gc=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.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(t,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===t)}};function kh(e){return e.split("-").reduce((t,n)=>t+n[0].toUpperCase()+n.slice(1))}function eM(e){let t,n,o=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat("guard");if(o.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&o.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=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}
|
|
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(t===void 0&&n===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}function
|
|
12
|
+
- unrecognised flag format`)}if(t===void 0&&n===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}function tM(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let o=0;o<=e.length;o++)n[o]=[o];for(let o=0;o<=t.length;o++)n[0][o]=o;for(let o=1;o<=t.length;o++)for(let i=1;i<=e.length;i++){let a;e[i-1]===t[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]===t[o-2]&&e[i-2]===t[o-1]&&(n[i][o]=Math.min(n[i][o],n[i-2][o-2]+1))}return n[e.length][t.length]}function Ol(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let n=e.startsWith("--");n&&(e=e.slice(2),t=t.map(c=>c.slice(2)));let o=[],i=3,a=.4;return t.forEach(c=>{if(c.length<=1)return;let l=tM(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?`
|
|
13
13
|
(Did you mean one of ${o.join(", ")}?)`:o.length===1?`
|
|
14
|
-
(Did you mean ${o[0]}?)`:""}var
|
|
15
|
-
- specify the name in Command constructor or using .name()`);return n=n||{},n.isDefault&&(this._defaultCommandName=t._name),(n.noHelp||n.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,n){return new
|
|
14
|
+
(Did you mean ${o[0]}?)`:""}var Po=class e extends Gh.EventEmitter{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:n=>le.default.stdout.write(n),writeErr:n=>le.default.stderr.write(n),outputError:(n,o)=>o(n),getOutHelpWidth:()=>le.default.stdout.isTTY?le.default.stdout.columns:void 0,getErrHelpWidth:()=>le.default.stderr.isTTY?le.default.stderr.columns:void 0,getOutHasColors:()=>Dh()??(le.default.stdout.isTTY&&le.default.stdout.hasColors?.()),getErrHasColors:()=>Dh()??(le.default.stderr.isTTY&&le.default.stderr.hasColors?.()),stripColor:n=>(0,$h.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(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let n=this;n;n=n.parent)t.push(n);return t}command(t,n,o){let i=n,a=o;typeof i=="object"&&i!==null&&(a=i,i=null),a=a||{};let[,c,l]=t.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(t){return new e(t)}createHelp(){return Object.assign(new sa,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,n){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
15
|
+
- specify the name in Command constructor or using .name()`);return n=n||{},n.isDefault&&(this._defaultCommandName=t._name),(n.noHelp||n.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,n){return new aa(t,n)}argument(t,n,o,i){let a=this.createArgument(t,n);return typeof o=="function"?a.default(i).argParser(o):a.default(o),this.addArgument(a),this}arguments(t){return t.trim().split(/ +/).forEach(n=>{this.argument(n)}),this}addArgument(t){let n=this.registeredArguments.slice(-1)[0];if(n?.variadic)throw new Error(`only the last argument can be variadic '${n.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,n){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let o=t??"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,(t||n)&&this._initCommandGroup(l),this}addHelpCommand(t,n){return typeof t!="object"?(this.helpCommand(t,n),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,n){let o=["preSubcommand","preAction","postAction"];if(!o.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
|
|
16
16
|
Expecting one of '${o.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(n):this._lifeCycleHooks[t]=[n],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=n=>{if(n.code!=="commander.executeSubCommandAsync")throw n},this}_exit(t,n,o){this._exitCallback&&this._exitCallback(new nn(t,n,o)),le.default.exit(t)}action(t){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),t.apply(this,a)};return this._actionHandler=n,this}createOption(t,n){return new Mr(t,n)}_callParseArg(t,n,o,i){try{return t.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(t){let n=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(n){let o=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${o}'
|
|
17
17
|
- already used by option '${n.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let n=i=>[i.name()].concat(i.aliases()),o=n(t).find(i=>this._findCommand(i));if(o){let i=n(this._findCommand(o)).join("|"),a=n(t).join("|");throw new Error(`cannot add command '${a}' as already have command '${i}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let n=t.name(),o=t.attributeName();t.defaultValue!==void 0&&this.setOptionValueWithSource(o,t.defaultValue,"default");let i=(a,c,l)=>{a==null&&t.presetArg!==void 0&&(a=t.presetArg);let m=this.getOptionValue(o);a!==null&&t.parseArg?a=this._callParseArg(t,a,m,c):a!==null&&t.variadic&&(a=t._collectValue(a,m)),a==null&&(t.negate?a=!1:t.isBoolean()||t.optional?a=!0:a=""),this.setOptionValueWithSource(o,a,l)};return this.on("option:"+n,a=>{let c=`error: option '${t.flags}' argument '${a}' is invalid.`;i(a,c,"cli")}),t.envVar&&this.on("optionEnv:"+n,a=>{let c=`error: option '${t.flags}' value '${a}' from env '${t.envVar}' is invalid.`;i(a,c,"env")}),this}_optionEx(t,n,o,i,a){if(typeof n=="object"&&n instanceof Mr)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let c=this.createOption(n,o);if(c.makeOptionMandatory(!!t.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(t,n,o,i){return this._optionEx({},t,n,o,i)}requiredOption(t,n,o,i){return this._optionEx({mandatory:!0},t,n,o,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,n){return this.setOptionValueWithSource(t,n,void 0)}setOptionValueWithSource(t,n,o){return this._storeOptionsAsProperties?this[t]=n:this._optionValues[t]=n,this._optionValueSources[t]=o,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let n;return this._getCommandAndAncestors().forEach(o=>{o.getOptionValueSource(t)!==void 0&&(n=o.getOptionValueSource(t))}),n}_prepareUserArgs(t,n){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(n=n||{},t===void 0&&n.from===void 0){le.default.versions?.electron&&(n.from="electron");let i=le.default.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(n.from="eval")}t===void 0&&(t=le.default.argv),this.rawArgs=t.slice();let o;switch(n.from){case void 0:case"node":this._scriptPath=t[1],o=t.slice(2);break;case"electron":le.default.defaultApp?(this._scriptPath=t[1],o=t.slice(2)):o=t.slice(1);break;case"user":o=t.slice(0);break;case"eval":o=t.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(t,n){this._prepareForParse();let o=this._prepareUserArgs(t,n);return this._parseCommand([],o),this}async parseAsync(t,n){this._prepareForParse();let o=this._prepareUserArgs(t,n);return await this._parseCommand([],o),this}_prepareForParse(){this._savedState===null?(this.options.filter(t=>t.negate&&t.defaultValue===void 0&&this.getOptionValue(t.attributeName())===void 0).forEach(t=>{let n=t.long.replace(/^--no-/,"--");this._findOption(n)||this.setOptionValueWithSource(t.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(t,n,o){if(
|
|
18
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,n,o){if(ca.default.existsSync(t))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=`'${t}' 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(t,n){n=n.slice();let o=[".js",".ts",".tsx",".mjs",".cjs"];function i(h,E){let I=pr.default.resolve(h,E);if(
|
|
21
|
+
- ${i}`;throw new Error(a)}_executeSubCommand(t,n){n=n.slice();let o=[".js",".ts",".tsx",".mjs",".cjs"];function i(h,E){let I=pr.default.resolve(h,E);if(ca.default.existsSync(I))return I;if(o.includes(pr.default.extname(E)))return;let g=o.find(T=>ca.default.existsSync(`${I}${T}`));if(g)return`${I}${g}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=t._executableFile||`${this._name}-${t._name}`,c=this._executableDir||"";if(this._scriptPath){let h;try{h=ca.default.realpathSync(this._scriptPath)}catch{h=this._scriptPath}c=pr.default.resolve(pr.default.dirname(h),c)}if(c){let h=i(c,a);if(!h&&!t._executableFile&&this._scriptPath){let E=pr.default.basename(this._scriptPath,pr.default.extname(this._scriptPath));E!==this._name&&(h=i(c,`${E}-${t._name}`))}a=h||a}let l=o.includes(pr.default.extname(a)),m;le.default.platform!=="win32"?l?(n.unshift(a),n=Mh(le.default.execArgv).concat(n),m=hc.default.spawn(le.default.argv[0],n,{stdio:"inherit"})):m=hc.default.spawn(a,n,{stdio:"inherit"}):(this._checkForMissingExecutable(a,c,t._name),n.unshift(a),n=Mh(le.default.execArgv).concat(n),m=hc.default.spawn(le.default.execPath,n,{stdio:"inherit"})),m.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(E=>{le.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 nn(h,"commander.executeSubCommandAsync","(close)")):le.default.exit(h)}),m.on("error",h=>{if(h.code==="ENOENT")this._checkForMissingExecutable(a,c,t._name);else if(h.code==="EACCES")throw new Error(`'${a}' not executable`);if(!f)le.default.exit(1);else{let E=new nn(1,"commander.executeSubCommandAsync","(error)");E.nestedError=h,f(E)}}),this.runningCommand=m}_dispatchSubcommand(t,n,o){let i=this._findCommand(t);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(t){t||this.help();let n=this._findCommand(t);return n&&!n._executableHandler&&n.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,n)=>{t.required&&this.args[n]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(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)=>t(o,l,c),o.defaultValue))):a===void 0&&(a=[]):i<this.args.length&&(a=this.args[i],o.parseArg&&(a=t(o,a,o.defaultValue))),n[i]=a}),this.processedArgs=n}_chainOrCall(t,n){return t?.then&&typeof t.then=="function"?t.then(()=>n()):n()}_chainOrCallHooks(t,n){let o=t,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(t,n,o){let i=t;return this._lifeCycleHooks[o]!==void 0&&this._lifeCycleHooks[o].forEach(a=>{i=this._chainOrCall(i,()=>a(this,n))}),i}_parseCommand(t,n){let o=this.parseOptions(n);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(o.operands),n=o.unknown,this.args=t.concat(n),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),n);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(n),this._dispatchSubcommand(this._defaultCommandName,t,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,t,n)})),c=this._chainOrCallHooks(c,"postAction"),c}if(this.parent?.listenerCount(a))i(),this._processArguments(),this.parent.emit(a,t,n);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,n);this.listenerCount("command:*")?this.emit("command:*",t,n):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(n=>n._name===t||n._aliases.includes(t))}_findOption(t){return this.options.find(n=>n.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(n=>{n.mandatory&&t.getOptionValue(n.attributeName())===void 0&&t.missingMandatoryOptionValue(n)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(o=>{let i=o.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});t.filter(o=>o.conflictsWith.length>0).forEach(o=>{let i=t.find(a=>o.conflictsWith.includes(a.attributeName()));i&&this._conflictingOption(o,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){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<t.length||m;){let h=m??t[f++];if(m=null,h==="--"){i===o&&i.push(h),i.push(...t.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=t[f++];I===void 0&&this.optionMissingArgument(E),this.emit(`option:${E.name()}`,I)}else if(E.optional){let I=null;f<t.length&&(!a(t[f])||c(t[f]))&&(I=t[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(...t.slice(f));break}else if(this._getHelpCommand()&&h===this._getHelpCommand().name()){n.push(h,...t.slice(f));break}else if(this._defaultCommandName){o.push(h,...t.slice(f));break}}if(this._passThroughOptions){i.push(h,...t.slice(f));break}i.push(h)}return{operands:n,unknown:o}}opts(){if(this._storeOptionsAsProperties){let t={},n=this.options.length;for(let o=0;o<n;o++){let i=this.options[o].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,n)=>Object.assign(t,n.opts()),{})}error(t,n){this._outputConfiguration.outputError(`${t}
|
|
22
22
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
23
23
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
24
|
-
`),this.outputHelp({error:!0}));let o=n||{},i=o.exitCode||1,a=o.code||"commander.error";this._exit(i,a,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in le.default.env){let n=t.attributeName();(this.getOptionValue(n)===void 0||["default","config","env"].includes(this.getOptionValueSource(n)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,le.default.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new gc(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())&&t.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(t){let n=`error: missing required argument '${t}'`;this.error(n,{code:"commander.missingArgument"})}optionMissingArgument(t){let n=`error: option '${t.flags}' argument missing`;this.error(n,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let n=`error: required option '${t.flags}' not specified`;this.error(n,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,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(t)} cannot be used with ${i(n)}`;this.error(a,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let n="";if(t.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=
|
|
24
|
+
`),this.outputHelp({error:!0}));let o=n||{},i=o.exitCode||1,a=o.code||"commander.error";this._exit(i,a,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in le.default.env){let n=t.attributeName();(this.getOptionValue(n)===void 0||["default","config","env"].includes(this.getOptionValueSource(n)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,le.default.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new gc(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())&&t.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(t){let n=`error: missing required argument '${t}'`;this.error(n,{code:"commander.missingArgument"})}optionMissingArgument(t){let n=`error: option '${t.flags}' argument missing`;this.error(n,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let n=`error: required option '${t.flags}' not specified`;this.error(n,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,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(t)} cannot be used with ${i(n)}`;this.error(a,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let n="";if(t.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=Ol(t,i)}let o=`error: unknown option '${t}'${n}`;this.error(o,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let n=this.registeredArguments.length,o=n===1?"":"s",i=t.length,a=this.parent?` for '${this.name()}'`:"",c=t.join(", "),l=`error: too many arguments${a}. Expected ${n} argument${o} but got ${i}: ${c}.`;this.error(l,{code:"commander.excessArguments"})}unknownCommand(){let t=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=Ol(t,i)}let o=`error: unknown command '${t}'${n}`;this.error(o,{code:"commander.unknownCommand"})}version(t,n,o){if(t===void 0)return this._version;this._version=t,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(`${t}
|
|
25
25
|
`),this._exit(0,"commander.version",t)}),this}description(t,n){return t===void 0&&n===void 0?this._description:(this._description=t,n&&(this._argsDescription=n),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===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]),t===n._name)throw new Error("Command alias can't be the same as its name");let o=this.parent?._findCommand(t);if(o){let i=[o.name()].concat(o.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${i}'`)}return n._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(n=>this.alias(n)),this)}usage(t){if(t===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=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=pr.default.basename(t,pr.default.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let n=this.createHelp(),o=this._getOutputContext(t);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(t){t=t||{};let n=!!t.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(t){let n;typeof t=="function"&&(n=t,t=void 0);let o=this._getOutputContext(t),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(t,n){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",n??"display help for command"),(t||n)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let n=Number(le.default.exitCode??0);n===0&&t&&typeof t!="function"&&t.error&&(n=1),this._exit(n,"commander.help","(outputHelp)")}addHelpText(t,n){let o=["beforeAll","before","after","afterAll"];if(!o.includes(t))throw new Error(`Unexpected value for position to addHelpText.
|
|
26
26
|
Expecting one of '${o.join("', '")}'`);let i=`${t}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(t){let n=this._getHelpOption();n&&t.find(i=>n.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Lh(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let n,o="127.0.0.1",i="9229",a;return(a=t.match(/^(--inspect(-brk)?)$/))!==null?n=a[1]:(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(n=a[1],/^\d+$/.test(a[3])?i=a[3]:o=a[3]):(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(n=a[1],o=a[3],i=a[4]),n&&i!=="0"?`${n}=${o}:${parseInt(i)+1}`:t})}function kh(){if(le.default.env.NO_COLOR||le.default.env.FORCE_COLOR==="0"||le.default.env.FORCE_COLOR==="false")return!1;if(le.default.env.FORCE_COLOR||le.default.env.CLICOLOR_FORCE!==void 0)return!0}var T5=new Co;function Je(e){throw new Error(`assertUnreachable: ${JSON.stringify(e,null,2)}`)}var Hk=Math.pow(10,8)*24*60*60*1e3,I5=-Hk;var Gh=864e5,$h=6e4,jh=36e5;var Kk=3600;var qh=Kk*24,b5=qh*7,zk=qh*365.2425,Yk=zk/12,S5=Yk*3,Al=Symbol.for("constructDateFrom");function er(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Al in e?e[Al](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ye(e,t){return er(t||e,e)}function Fh(e,t,n){let o=Ye(e,n?.in);return isNaN(t)?er(n?.in||e,NaN):(t&&o.setDate(o.getDate()+t),o)}function Bh(e,t,n){let o=Ye(e,n?.in);if(isNaN(t))return er(n?.in||e,NaN);if(!t)return o;let i=o.getDate(),a=er(n?.in||e,o.getTime());a.setMonth(o.getMonth()+t+1,0);let c=a.getDate();return i>=c?a:(o.setFullYear(a.getFullYear(),a.getMonth(),i),o)}function Po(e,t,n){let{years:o=0,months:i=0,weeks:a=0,days:c=0,hours:l=0,minutes:m=0,seconds:f=0}=t,h=Ye(e,n?.in),E=i||o?Bh(h,i+o*12):h,I=c||a?Fh(E,c+a*7):E,g=m+l*60,S=(f+g*60)*1e3;return er(n?.in||e,+I+S)}var Vk={};function Hh(){return Vk}function Ol(e){let t=Ye(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function yt(e,...t){let n=er.bind(null,e||t.find(o=>typeof o=="object"));return t.map(n)}function xl(e,t){let n=Ye(e,t?.in);return n.setHours(0,0,0,0),n}function Kh(e,t,n){let[o,i]=yt(n?.in,e,t),a=xl(o),c=xl(i),l=+a-Ol(a),m=+c-Ol(c);return Math.round((l-m)/Gh)}function Dn(e,t){let n=+Ye(e)-+Ye(t);return n<0?-1:n>0?1:n}function zh(e,t,n){let[o,i]=yt(n?.in,e,t),a=o.getFullYear()-i.getFullYear(),c=o.getMonth()-i.getMonth();return a*12+c}function Yh(e,t,n){let[o,i]=yt(n?.in,e,t);return o.getFullYear()-i.getFullYear()}function Qh(e,t,n){let[o,i]=yt(n?.in,e,t),a=Vh(o,i),c=Math.abs(Kh(o,i));o.setDate(o.getDate()-a*c);let l=+(Vh(o,i)===-a),m=a*(c-l);return m===0?0:m}function Vh(e,t){let n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function Uo(e){return t=>{let o=(e?Math[e]:Math.trunc)(t);return o===0?0:o}}function Wh(e,t,n){let[o,i]=yt(n?.in,e,t),a=(+o-+i)/jh;return Uo(n?.roundingMethod)(a)}function yc(e,t){return+Ye(e)-+Ye(t)}function Zh(e,t,n){let o=yc(e,t)/$h;return Uo(n?.roundingMethod)(o)}function Xh(e,t){let n=Ye(e,t?.in);return n.setHours(23,59,59,999),n}function Jh(e,t){let n=Ye(e,t?.in),o=n.getMonth();return n.setFullYear(n.getFullYear(),o+1,0),n.setHours(23,59,59,999),n}function ey(e,t){let n=Ye(e,t?.in);return+Xh(n,t)==+Jh(n,t)}function ty(e,t,n){let[o,i,a]=yt(n?.in,e,e,t),c=Dn(i,a),l=Math.abs(zh(i,a));if(l<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-c*l);let m=Dn(i,a)===-c;ey(o)&&l===1&&Dn(o,a)===1&&(m=!1);let f=c*(l-+m);return f===0?0:f}function ry(e,t,n){let o=yc(e,t)/1e3;return Uo(n?.roundingMethod)(o)}function ny(e,t,n){let[o,i]=yt(n?.in,e,t),a=Dn(o,i),c=Math.abs(Yh(o,i));o.setFullYear(1584),i.setFullYear(1584);let l=Dn(o,i)===-a,m=a*(c-+l);return m===0?0:m}function oy(e,t){let[n,o]=yt(e,t.start,t.end);return{start:n,end:o}}var Qk={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"}},iy=(e,t,n)=>{let o,i=Qk[e];return typeof i=="string"?o=i:t===1?o=i.one:o=i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function Tc(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Wk={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Zk={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Xk={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ay={date:Tc({formats:Wk,defaultWidth:"full"}),time:Tc({formats:Zk,defaultWidth:"full"}),dateTime:Tc({formats:Xk,defaultWidth:"full"})};var Jk={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},sy=(e,t,n,o)=>Jk[e];function wo(e){return(t,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(t):t;return i[a]}}var eM={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},tM={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},rM={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"]},nM={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"]},oM={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"}},iM={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"}},aM=(e,t)=>{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"},cy={ordinalNumber:aM,era:wo({values:eM,defaultWidth:"wide"}),quarter:wo({values:tM,defaultWidth:"wide",argumentCallback:e=>e-1}),month:wo({values:rM,defaultWidth:"wide"}),day:wo({values:nM,defaultWidth:"wide"}),dayPeriod:wo({values:oM,defaultWidth:"wide",formattingValues:iM,defaultFormattingWidth:"wide"})};function vo(e){return(t,n={})=>{let o=n.width,i=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let c=a[0],l=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],m=Array.isArray(l)?cM(l,E=>E.test(c)):sM(l,E=>E.test(c)),f;f=e.valueCallback?e.valueCallback(m):m,f=n.valueCallback?n.valueCallback(f):f;let h=t.slice(c.length);return{value:f,rest:h}}}function sM(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function cM(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function py(e){return(t,n={})=>{let o=t.match(e.matchPattern);if(!o)return null;let i=o[0],a=t.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=t.slice(i.length);return{value:c,rest:l}}}var pM=/^(\d+)(th|st|nd|rd)?/i,uM=/\d+/i,lM={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},mM={any:[/^b/i,/^(a|c)/i]},dM={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},fM={any:[/1/i,/2/i,/3/i,/4/i]},gM={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},hM={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]},yM={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},TM={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]},EM={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},_M={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}},uy={ordinalNumber:py({matchPattern:pM,parsePattern:uM,valueCallback:e=>parseInt(e,10)}),era:vo({matchPatterns:lM,defaultMatchWidth:"wide",parsePatterns:mM,defaultParseWidth:"any"}),quarter:vo({matchPatterns:dM,defaultMatchWidth:"wide",parsePatterns:fM,defaultParseWidth:"any",valueCallback:e=>e+1}),month:vo({matchPatterns:gM,defaultMatchWidth:"wide",parsePatterns:hM,defaultParseWidth:"any"}),day:vo({matchPatterns:yM,defaultMatchWidth:"wide",parsePatterns:TM,defaultParseWidth:"any"}),dayPeriod:vo({matchPatterns:EM,defaultMatchWidth:"any",parsePatterns:_M,defaultParseWidth:"any"})};var Rl={code:"en-US",formatDistance:iy,formatLong:ay,formatRelative:sy,localize:cy,match:uy,options:{weekStartsOn:0,firstWeekContainsDate:1}};var IM=["years","months","weeks","days","hours","minutes","seconds"];function ly(e,t){let n=Hh(),o=t?.locale??n.locale??Rl,i=t?.format??IM,a=t?.zero??!1,c=t?.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 my(e,t){let{start:n,end:o}=oy(t?.in,e),i={},a=ny(o,n);a&&(i.years=a);let c=Po(n,{years:i.years}),l=ty(o,c);l&&(i.months=l);let m=Po(c,{months:i.months}),f=Qh(o,m);f&&(i.days=f);let h=Po(m,{days:i.days}),E=Wh(o,h);E&&(i.hours=E);let I=Po(h,{hours:i.hours}),g=Zh(o,I);g&&(i.minutes=g);let T=Po(I,{minutes:i.minutes}),S=ry(o,T);return S&&(i.seconds=S),i}var _8=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 U8=60*1e3;var mW=1/1e6,Pl=1e3,ca=60*Pl,RM=60*ca,_c=24*RM,dW=7*_c,fW=30*_c;var Ul=["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-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 CM={s:1,m:60,h:3600,d:86400};function fy(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return!0}function gy(){return Math.floor(Date.now()/1e3)}function Ic(e){if(typeof e=="number")return e;if(e==="now")return gy();if(e.startsWith("-")&&e.length>=3){let n=e.at(-1),o=n?CM[n]:void 0;if(o){let i=e.slice(1,-1);if(i.length>0&&fy(i))return gy()-parseInt(i,10)*o}}if(fy(e)&&e.length>0)return parseInt(e,10);let t=Date.parse(e);if(!Number.isNaN(t))return Math.floor(t/1e3);throw new Error(`Invalid time value: ${e}. Use unix seconds, relative (-30m, -1h), 'now', or ISO 8601.`)}var y={};Yt(y,{Assign:()=>PM,Clone:()=>jn,Create:()=>M0,Discard:()=>D0,Metrics:()=>tr,Update:()=>G0});var tr={assign:0,create:0,clone:0,discard:0,update:0};function PM(e,t){return tr.assign+=1,{...e,...t}}var s={};Yt(s,{Counted:()=>QM,Entries:()=>XM,EntriesRegExp:()=>ZM,Every:()=>KM,EveryAll:()=>zM,GraphemeCount:()=>FM,HasPropertyKey:()=>WM,IsArray:()=>ua,IsBigInt:()=>pa,IsBoolean:()=>Ay,IsClassInstance:()=>qM,IsConstructor:()=>kM,IsDeepEqual:()=>Ll,IsEqual:()=>te,IsFunction:()=>Oy,IsGreaterEqualThan:()=>Ry,IsGreaterThan:()=>GM,IsInteger:()=>vl,IsLessEqualThan:()=>xy,IsLessThan:()=>$M,IsMaxLength:()=>BM,IsMinLength:()=>HM,IsMultipleOf:()=>jM,IsNull:()=>Ac,IsNumber:()=>Oc,IsObject:()=>la,IsObjectNotArray:()=>MM,IsString:()=>xc,IsSymbol:()=>DM,IsUndefined:()=>Nl,IsUnsafePropertyKey:()=>Py,IsValueLike:()=>Cy,Keys:()=>Sc,ShiftLeft:()=>Rc,Some:()=>YM,SomeAll:()=>VM,Symbols:()=>JM,Values:()=>e0});function Gn(e,t,n){return e>=t&&e<=n}function UM(e){return e===8205}function wM(e){return Gn(e,55296,56319)}function hy(e){return Gn(e,127462,127487)}function Ty(e){return Gn(e,65024,65039)}function Ey(e){return Gn(e,768,879)||Gn(e,6832,6911)||Gn(e,7616,7679)||Gn(e,65056,65071)}function bc(e){return e>65535?2:1}function yy(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Ey(n)||Ty(n))t+=bc(n);else break}return t}function wl(e,t){let n=e.codePointAt(t),o=t+bc(n);for(o=yy(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+bc(i),o=yy(e,o)}return hy(n)&&o<e.length&&hy(e.codePointAt(o))&&(o+=bc(e.codePointAt(o))),o}function _y(e){return wM(e)||Ey(e)||Ty(e)||UM(e)}function Iy(e){let t=0,n=0;for(;n<e.length;)n=wl(e,n),t++;return t}function vM(e,t){if(t===0)return!0;let n=0,o=0;for(;o<e.length;)if(o=wl(e,o),n++,n>=t)return!0;return!1}function NM(e,t){let n=0,o=0;for(;o<e.length;)if(o=wl(e,o),n++,n>t)return!1;return!0}function by(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(_y(e.charCodeAt(n)))return vM(e,t);if(n++,n>=t)return!0}return!1}function Sy(e,t){let n=0;for(;n<e.length;){if(_y(e.charCodeAt(n)))return NM(e,t);if(n++,n>t)return!1}return!0}function ua(e){return Array.isArray(e)}function pa(e){return te(typeof e,"bigint")}function Ay(e){return te(typeof e,"boolean")}function kM(e){if(Nl(e)||!Oy(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Oy(e){return te(typeof e,"function")}function vl(e){return Number.isInteger(e)}function Ac(e){return te(e,null)}function Oc(e){return Number.isFinite(e)}function MM(e){return la(e)&&!ua(e)}function la(e){return te(typeof e,"object")&&!Ac(e)}function xc(e){return te(typeof e,"string")}function DM(e){return te(typeof e,"symbol")}function Nl(e){return te(e,void 0)}function te(e,t){return e===t}function GM(e,t){return e>t}function $M(e,t){return e<t}function xy(e,t){return e<=t}function Ry(e,t){return e>=t}function jM(e,t){if(pa(e)||pa(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!Oc(e)||vl(e)&&1/t%1===0)return!0;let o=e%t;return Math.min(Math.abs(o),Math.abs(o-t),Math.abs(o+t))<n}function qM(e){if(!la(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Ac(t)?!1:te(typeof t.constructor,"function")&&!(te(t.constructor,globalThis.Object)||te(t.constructor.name,"Object"))}function Cy(e){return pa(e)||Ay(e)||Ac(e)||Oc(e)||xc(e)||Nl(e)}function FM(e){return Iy(e)}function BM(e,t){return Sy(e,t)}function HM(e,t){return by(e,t)}function KM(e,t,n){for(let o=t;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function zM(e,t,n){let o=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(o=!1);return o}function YM(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function VM(e,t){let n=!1;for(let o=0;o<e.length;o++)t(e[o],o)&&(n=!0);return n}function QM(e,t){return e.reduce((n,o,i)=>t(o,i)?++n:n,0)}function Rc(e,t,n){return te(e.length,0)?n():t(e[0],e.slice(1))}function Py(e){return te(e,"__proto__")||te(e,"constructor")||te(e,"prototype")}function WM(e,t){return Py(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ZM(e){return Sc(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function XM(e){return Object.entries(e)}function Sc(e){return Object.getOwnPropertyNames(e)}function JM(e){return Object.getOwnPropertySymbols(e)}function e0(e){return Object.values(e)}function t0(e,t){if(!la(t))return!1;let n=Sc(e);return te(n.length,Sc(t).length)&&n.every(o=>Ll(e[o],t[o]))}function r0(e,t){return ua(t)&&te(e.length,t.length)&&e.every((n,o)=>Ll(e[o],t[o]))}function Ll(e,t){return ua(e)?r0(e,t):la(e)?t0(e,t):te(e,t)}var Tt={};Yt(Tt,{IsBigInt64Array:()=>h0,IsBigUint64Array:()=>y0,IsBoolean:()=>n0,IsDate:()=>E0,IsFloat32Array:()=>f0,IsFloat64Array:()=>g0,IsInt16Array:()=>u0,IsInt32Array:()=>m0,IsInt8Array:()=>s0,IsMap:()=>I0,IsNumber:()=>o0,IsRegExp:()=>T0,IsSet:()=>_0,IsString:()=>i0,IsTypeArray:()=>a0,IsUint16Array:()=>l0,IsUint32Array:()=>d0,IsUint8Array:()=>c0,IsUint8ClampedArray:()=>p0});function n0(e){return e instanceof Boolean}function o0(e){return e instanceof Number}function i0(e){return e instanceof String}function a0(e){return globalThis.ArrayBuffer.isView(e)}function s0(e){return e instanceof globalThis.Int8Array}function c0(e){return e instanceof globalThis.Uint8Array}function p0(e){return e instanceof globalThis.Uint8ClampedArray}function u0(e){return e instanceof globalThis.Int16Array}function l0(e){return e instanceof globalThis.Uint16Array}function m0(e){return e instanceof globalThis.Int32Array}function d0(e){return e instanceof globalThis.Uint32Array}function f0(e){return e instanceof globalThis.Float32Array}function g0(e){return e instanceof globalThis.Float64Array}function h0(e){return e instanceof globalThis.BigInt64Array}function y0(e){return e instanceof globalThis.BigUint64Array}function T0(e){return e instanceof globalThis.RegExp}function E0(e){return e instanceof globalThis.Date}function _0(e){return e instanceof globalThis.Set}function I0(e){return e instanceof globalThis.Map}var Cc=s;function S0(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function A0(e){let t={};for(let n of Object.getOwnPropertyNames(e)){if(s.IsUnsafePropertyKey(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=$n(o.value),s.IsEqual(o.enumerable,!0)?t[n]=o.value:Object.defineProperty(t,n,o)}return t}function O0(e){let t={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(t[n]=$n(e[n]));for(let n of s.Symbols(e))t[n]=$n(e[n]);return t}function x0(e){return s.IsClassInstance(e)?e:S0(e)?A0(e):O0(e)}function R0(e){return e.map(t=>$n(t))}function C0(e){return e.slice()}function P0(e){return new RegExp(e.source,e.flags)}function U0(e){return new Map($n([...e.entries()]))}function w0(e){return new Set($n([...e.values()]))}function $n(e){return Tt.IsTypeArray(e)?C0(e):Tt.IsRegExp(e)?P0(e):Tt.IsMap(e)?U0(e):Tt.IsSet(e)?w0(e):s.IsArray(e)?R0(e):s.IsObject(e)?x0(e):e}function jn(e){return tr.clone+=1,$n(e)}var rt={};Yt(rt,{Get:()=>L0,Reset:()=>v0,Set:()=>N0});var ur={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function v0(){ur.immutableTypes=!1,ur.maxErrors=8,ur.maxInstantiationCount=128,ur.useAcceleration=!0,ur.exactOptionalPropertyTypes=!1,ur.enumerableKind=!1,ur.correctiveParse=!1,ur.unionPrioritySort=!0}function N0(e){for(let t of s.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(ur,t,{value:n})}}function L0(){return ur}function k0(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Uy(e,t){return{...e,...t}}function M0(e,t,n={}){tr.create+=1;let o=rt.Get(),i=Uy(t,n),a=o.enumerableKind?Uy(i,e):k0(i,e);return o.immutableTypes?Object.freeze(a):a}function D0(e,t){tr.discard+=1;let n={};for(let o of Object.getOwnPropertyNames(e)){if(t.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);i.value=jn(i.value),Object.defineProperty(n,o,i)}return n}function G0(e,t,n){tr.update+=1;let o=rt.Get(),i=jn(e);for(let a of Object.keys(t))Object.defineProperty(i,a,{configurable:!0,writable:!0,enumerable:o.enumerableKind,value:t[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,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function Ue(e){return s.IsObject(e)}function v(e,t,n){return y.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function on(e){return w(e,"Deferred")}function $0(e){return y.Update(e,{"~readonly":!0},{})}function ma(e,t){return y.Update($0(e),{},t)}function wy(e,t,n,o){let i=O(e,t,n);return ma(i,o)}function j0(e){return y.Update(e,{"~optional":!0},{})}function da(e,t){return y.Update(j0(e),{},t)}function vy(e,t,n,o){let i=O(e,t,n);return da(i,o)}function Pt(e,t){return y.Create({"~kind":"Array"},{type:"array",items:e},t)}function Z(e){return w(e,"Array")}function No(e){return y.Discard(e,["~kind","type","items"])}function lr(e,t,n={}){return y.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function Be(e){return w(e,"Constructor")}function Ny(e){return y.Discard(e,["~kind","type","parameters","instanceType"])}function mr(e,t,n={}){return y.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function He(e){return w(e,"Function")}function Ly(e){return y.Discard(e,["~kind","type","parameters","returnType"])}function nt(e,t){return y.Create({"~kind":"Ref"},{$ref:e},t)}function ce(e){return w(e,"Ref")}function an(e,t){return y.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Lo(e){return w(e,"Generic")}function ko(e){return y.Create({"~kind":"Any"},{},e)}function Ve(e){return w(e,"Any")}var ky="(?!)";function me(e){return y.Create({"~kind":"Never"},{not:{}},e)}function rr(e){return w(e,"Never")}function dr(e,t={}){return v("AddOptional",[e],t)}function qn(e,t={}){return da(e,t)}function My(e){return qn(e)}function et(e){return Ue(e)&&s.HasPropertyKey(e,"~optional")}function Dy(e){return s.Keys(e).filter(t=>!et(e[t]))}function Pc(e){return s.Keys(e)}function Uc(e){return s.Values(e)}function k(e,t={}){let n=Dy(e),o=n.length>0?{required:n}:{};return y.Create({"~kind":"Object"},{type:"object",...o,properties:e},t)}function D(e){return w(e,"Object")}function Gy(e){return y.Discard(e,["~kind","type","properties","required"])}function Qe(e){return y.Create({"~kind":"Unknown"},{},e)}function tt(e){return w(e,"Unknown")}function fr(e,t,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:t},n)}function Te(e){return w(e,"Cyclic")}function $y(e){return y.Update(e,{"~unsafe":null},{})}function wc(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var oe={};Yt(oe,{Match:()=>q0});function q0(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function fa(...e){let[t,n]=oe.Match(e,{2:(o,i)=>[o,i,i],1:o=>[o,Qe(),Qe()]});return y.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Ke(e){return w(e,"Infer")}function Fn(e,t,n,o={}){return y.Create({"~kind":"Dependent"},{if:e,then:t,else:n},o)}function Le(e){return w(e,"Dependent")}function jy(e){return y.Discard(e,["~kind","if","then","else"])}function qy(e){return s.IsObjectNotArray(e)}function Fy(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function By(e){return s.IsString(e)||s.IsNumber(e)}function Hy(e,t){let n=qy(e)?Fy(e):e;return y.Create({"~kind":"Enum"},{enum:n},t)}function ze(e){return w(e,"Enum")}function ut(e,t={}){return y.Create({"~kind":"Intersect"},{allOf:e},t)}function M(e){return w(e,"Intersect")}function Ky(e){return y.Discard(e,["~kind","allOf"])}var Bn={};Yt(Bn,{Hash:()=>iD,HashCode:()=>Xy});function ge(){throw new Error("Unreachable")}function F0(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let o of Reflect.ownKeys(n))o!=="constructor"&&typeof o!="symbol"&&t.add(o);n=Object.getPrototypeOf(n)}return[...t]}function B0(e){return typeof e=="number"}var Et;(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"})(Et||(Et={}));var Mo=BigInt("14695981039346656037"),[H0,K0]=[BigInt("1099511628211"),BigInt("18446744073709551616")],z0=Array.from({length:256}).map((e,t)=>BigInt(t)),Qy=new Float64Array(1),Wy=new DataView(Qy.buffer),Zy=new Uint8Array(Qy.buffer);function lt(e){Mo=Mo^z0[e],Mo=Mo*H0%K0}function Y0(e){lt(Et.Array);for(let t of e)sn(t)}function V0(e){lt(Et.BigInt),Wy.setBigInt64(0,e);for(let t of Zy)lt(t)}function Yy(e){lt(Et.Boolean),lt(e?1:0)}function Q0(e){lt(Et.Constructor),sn(e.toString())}function W0(e){lt(Et.Date),sn(e.getTime())}function Z0(e){lt(Et.Function),sn(e.toString())}function X0(e){lt(Et.Null)}function Vy(e){lt(Et.Number),Wy.setFloat64(0,e,!0);for(let t of Zy)lt(t)}function J0(e){lt(Et.Object);for(let t of F0(e).sort())sn(t),sn(e[t])}function eD(e){lt(Et.RegExp),kl(e.toString())}var tD=new TextEncoder;function kl(e){lt(Et.String);for(let t of tD.encode(e))lt(t)}function rD(e){lt(Et.Symbol),sn(e.toString())}function nD(e){lt(Et.TypeArray);let t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)lt(t[n])}function oD(e){return lt(Et.Undefined)}function sn(e){return Tt.IsTypeArray(e)?nD(e):Tt.IsDate(e)?W0(e):Tt.IsRegExp(e)?eD(e):Tt.IsBoolean(e)?Yy(e.valueOf()):Tt.IsString(e)?kl(e.valueOf()):Tt.IsNumber(e)?Vy(e.valueOf()):B0(e)?Vy(e):s.IsArray(e)?Y0(e):s.IsBoolean(e)?Yy(e):s.IsBigInt(e)?V0(e):s.IsConstructor(e)?Q0(e):s.IsNull(e)?X0(e):s.IsObject(e)?J0(e):s.IsString(e)?kl(e):s.IsSymbol(e)?rD(e):s.IsUndefined(e)?oD(e):s.IsFunction(e)?Z0(e):ge()}function Xy(e){return Mo=BigInt("14695981039346656037"),sn(e),Mo}function iD(e){return Xy(e).toString(16).padStart(16,"0")}function Jy(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 aD=Jy;function eT(){return aD}var ga=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,o=Hn(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=Hn(n)?c=>n["~codec"].encode(t(c)):t,a={decode:o,encode:i};return y.Update(this.type,{"~codec":a},{})}},ha=class{constructor(t){this.type=t}Decode(t){return new ga(this.type,t)}};function vc(e){return new ha(e)}function rT(e,t){return vc(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function nT(e,t){return vc(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function Hn(e){return Ue(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function oT(e){return Do(e)}function Kn(e){return Ue(e)&&s.HasPropertyKey(e,"~immutable")}function gr(e,t={}){return v("AddReadonly",[e],t)}function zn(e,t={}){return ma(e,t)}function iT(e){return zn(e)}function Yn(e){return Ue(e)&&s.HasPropertyKey(e,"~readonly")}function cD(e,t){let n=Nc(e)?[...e["~refine"],t]:[t];return y.Update(e,{"~refine":n},{})}function aT(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,()=>"Refine Error"]});return cD(t,{check:n,error:o})}function pD(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function Nc(e){return Ue(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>pD(t))}var sT="-?(?:0|[1-9][0-9]*)n";function ya(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function vt(e){return w(e,"BigInt")}function Lc(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function _t(e){return w(e,"Boolean")}function Ta(e){return y.Create({"~kind":"Identifier"},{name:e})}function cT(e){return w(e,"Identifier")}var kc="-?(?:0|[1-9][0-9]*)";function Vn(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function ot(e){return w(e,"Integer")}var Ml=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function uD(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new Ml(e)})()}function z(e,t){return y.Create({"~kind":"Literal"},{type:uD(e),const:e},t)}function Mc(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function pT(e){return Q(e)&&s.IsBigInt(e.const)}function uT(e){return Q(e)&&s.IsBoolean(e.const)}function Dc(e){return Q(e)&&s.IsNumber(e.const)}function Gc(e){return Q(e)&&s.IsString(e.const)}function Q(e){return w(e,"Literal")}function Go(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function hr(e){return w(e,"Null")}var $c="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Nt(e){return y.Create({"~kind":"Number"},{type:"number"},e)}function Ce(e){return w(e,"Number")}function $o(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function yr(e){return w(e,"Symbol")}function Qn(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,a],1:i=>[i,Qe(),Qe()]});return y.Create({"~kind":"Parameter"},{name:t,extends:n,equals:o},{})}function lT(e){return w(e,"Parameter")}var jc=".*";function It(e){return y.Create({"~kind":"String"},{type:"string"},e)}function We(e){return w(e,"String")}function F(e,t={}){return y.Create({"~kind":"Union"},{anyOf:e},t)}function R(e){return w(e,"Union")}function mT(e){return y.Discard(e,["~kind","anyOf"])}function Ea(e){let t=dT(e);return s.IsEqual(t.length,2)?t[0]:[]}function lD(e){return!0}function fT(e){return s.ShiftLeft(e,(t,n)=>mD(t)?fT(n):!1,()=>!0)}function gT(e){return s.IsEqual(e.length,0)?!1:fT(e)}function mD(e){return R(e)?gT(e.anyOf):Q(e)?lD(e.const):!1}function qc(e){return gT(e)}function Fc(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function hT(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>hT(i,t,[...n,`${o}${t}`]),()=>n)}function dD(e,t){return s.IsEqual(e.length,0)?[`${t}`]:hT(e,t)}function yT(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>yT(e,i,[...n,...TT(e,o)]),()=>n)}function TT(e,t){return R(t)?yT(e,t.anyOf):Q(t)?dD(e,t.const):ge()}function ET(e,t){return s.ShiftLeft(t,(n,o)=>ET(TT(e,n),o),()=>e)}function fD(e){return e.map(t=>z(t))}function gD(e){let t=ET([],e),n=fD(t);return F(n)}function hD(e){return s.IsEqual(e.length,0)?ge():s.IsEqual(e.length,1)&&Q(e[0])?e[0]:gD(e)}function Dl(e){let t=Ea(e);return s.IsEqual(t.length,0)?It():qc(t)?hD(t):Fc(e)}function _a(e){let t=Dl(e);return Ee(t)?It():t}function Ut(e,t){let n="object",o={[e]:t};return y.Create({"~kind":"Record"},{type:n,patternProperties:o})}function _T(e){return Ut($t,e)}function IT(e){return k({true:e,false:e})}function ke(e,t={}){let[n,o,i]=[e,e.length,!1];return y.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:o},t)}function Y(e){return w(e,"Tuple")}function bT(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function yD(e){return y.Discard(e,["~readonly"])}function Gl(e,t){return y.Update(yD(e),{},t)}function ST(e,t,n,o){let i=O(e,t,n);return Gl(i,o)}function AT(e,t={}){return v("RemoveReadonly",[e],t)}function OT(e,t={}){return Gl(e,t)}function TD(e){return y.Discard(e,["~optional"])}function $l(e,t){return y.Update(TD(e),{},t)}function xT(e,t,n,o){let i=O(e,t,n);return $l(i,o)}function RT(e,t={}){return v("RemoveOptional",[e],t)}function Bc(e,t={}){return $l(e,t)}function jl(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function CT(e){let t=jl(e.items);return k(t)}function ED(e,t){return Yn(e)?!!Yn(t):!1}function _D(e,t){return et(e)?!!et(t):!1}function ID(e,t){let n=ED(e,t),o=_D(e,t),i=we([e,t]),a=OT(Bc(i));return n&&o?zn(qn(a)):n&&!o?zn(a):!n&&o?qn(a):a}function bD(e,t,n){return n in e?n in t?ID(e[n],t[n]):e[n]:n in t?t[n]:me()}function SD(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:bD(e,t,i)}),{})}function PT(e){return D(e)?e.properties:Y(e)?jl(e.items):ge()}function UT(e,t){let n=PT(e),o=PT(t),i=SD(n,o);return k(i)}function wT(e,t){let n=Wn(e,t);return s.IsEqual(n,ba)?e:s.IsEqual(n,Sa)||s.IsEqual(n,Ia)?t:me()}function vT(e){return D(e)||Y(e)}function AD(e,t){let n=R(e),o=R(t);return n||o}function OD(e,t){let n=Vt(e),o=Vt(t),i=AD(n,o),a=vT(n),c=vT(o);return i?we([n,o]):a&&c?UT(n,o):a&&!c?n:!a&&c?o:wT(n,o)}function NT(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>NT(e,i,[...n,OD(e,o)]),()=>s.IsEqual(n.length,0)?[e]:n)}function LT(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>LT(i,t,[...n,...Aa([o],t)]),()=>n)}function Aa(e,t=[]){return s.ShiftLeft(e,(n,o)=>R(n)?Aa(o,LT(n.anyOf,t)):Aa(o,NT(n,t)),()=>t)}function xD(e,t){let n=dt({},e,t);return G.IsExtendsTrueLike(n)?[]:[e]}function RD(e,t){return e.reduce((n,o)=>[...n,...xD(o,t)],[])}function Hc(e,t){let n=Vt(e),o=R(n)?n.anyOf:[n],i=RD(o,t);return Lt(i)}function nr(e,t,n){let o=ut([e,t]),i=Hc(n,e);return Lt([o,i])}function wt(e){let t=e.map(n=>z(n));return Lt(t)}function we(e){let t=Aa(e),n=ql(t);return Dr(n)}function ht(e){let t=_a(e);return Vt(t)}function Lt(e){let t=ql(e);return Dr(t)}function Vt(e){return Le(e)?nr(e.if,e.then,e.else):ze(e)?wt(e.enum):M(e)?we(e.allOf):Ee(e)?ht(e.pattern):R(e)?Lt(e.anyOf):e}function Dr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?me():F(e)}function kT(e,t){let n=wt(e);return cn(n,t)}function MT(e,t){return Ut(pn,t)}function DT(e,t){let n=we(e);return cn(n,t)}function GT(e,t){return s.IsString(e)||s.IsNumber(e)?k({[e]:t}):s.IsEqual(e,!1)?k({false:t}):s.IsEqual(e,!0)?k({true:t}):k({})}function $T(e,t){return Ut(jo,t)}function jT(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?Ut(e.pattern.toString(),t):Ut($t,t)}function qT(e,t){let n=Ea(e);return qc(n)?cn(ht(e),t):Ut(e,t)}function CD(e){return R(e)?qo(e.anyOf):[e]}function qo(e){return e.reduce((t,n)=>[...t,...CD(n)],[])}function PD(e){return e.some(t=>We(t)||Ce(t)||ot(t))}function UD(e,t){return s.IsEqual(PD(e),!0)?Ut($t,t):void 0}function wD(e,t){return e.reduce((n,o)=>Q(o)&&(s.IsString(o.const)||s.IsNumber(o.const))?{...n,[o.const]:t}:n,{})}function vD(e,t){let n=wD(e,t);return k(n)}function FT(e,t){let n=qo(e),o=UD(n,t);return Ue(o)?o:vD(n,t)}function cn(e,t){return Ve(e)?_T(t):_t(e)?IT(t):ze(e)?kT(e.enum,t):ot(e)?MT(e,t):M(e)?DT(e.allOf,t):Q(e)?GT(e.const,t):Ce(e)?$T(e,t):R(e)?FT(e.anyOf,t):We(e)?jT(e,t):Ee(e)?qT(e.pattern,t):k({})}function Fl(e,t,n){return K([e])?y.Update(cn(e,t),{},n):Kc(e,t,n)}function BT(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Fl(a,c,i)}var pn=`^${kc}$`,jo=`^${$c}$`,$t=`^${jc}$`;function Kc(e,t,n={}){return v("Record",[e,t],n)}function Fo(e,t,n={}){return Fl(e,t,n)}function zc(e,t){return Ut(e,t)}function Yc(e){return s.IsEqual(e,$t)?It():s.IsEqual(e,pn)?Vn():s.IsEqual(e,jo)?Nt():Dl(e)}function it(e){return s.Keys(e.patternProperties)[0]}function un(e){let t=it(e);return Yc(t)}function Se(e){return e.patternProperties[it(e)]}function de(e){return w(e,"Record")}function Zn(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function ln(e){return w(e,"Rest")}function Vc(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function Qc(e){return w(e,"This")}function Bo(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function or(e){return w(e,"Undefined")}function Wc(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function kt(e){return w(e,"Void")}function LD(e,t){return s.IsEqual(e,"Array")?Pt(t[0]):s.IsEqual(e,"Capitalize")?Xc(t[0]):s.IsEqual(e,"ConstructorParameters")?np(t[0]):s.IsEqual(e,"Evaluate")?H_(t[0]):s.IsEqual(e,"Exclude")?op(t[0],t[1]):s.IsEqual(e,"Extract")?ip(t[0],t[1]):s.IsEqual(e,"Index")?Ca(t[0],t[1]):s.IsEqual(e,"InstanceType")?ap(t[0]):s.IsEqual(e,"Lowercase")?Jc(t[0]):s.IsEqual(e,"NonNullable")?sp(t[0]):s.IsEqual(e,"Omit")?cp(t[0],t[1]):s.IsEqual(e,"Parameters")?pp(t[0]):s.IsEqual(e,"Partial")?up(t[0]):s.IsEqual(e,"Pick")?lp(t[0],t[1]):s.IsEqual(e,"Readonly")?mp(t[0]):s.IsEqual(e,"KeyOf")?Pa(t[0]):s.IsEqual(e,"Record")?Kc(t[0],t[1]):s.IsEqual(e,"Required")?dp(t[0]):s.IsEqual(e,"ReturnType")?fp(t[0]):s.IsEqual(e,"Uncapitalize")?ep(t[0]):s.IsEqual(e,"Uppercase")?tp(t[0]):Ra(nt(e),t)}function Xn(){throw Error("Unreachable")}function VT(e,t=[]){return s.ShiftLeft(e,(n,o)=>VT(o,[...t,n[1]]),()=>t)}function Gr(e){return s.IsEqual(e.length,3)?[e[0],...VT(e[1])]:[]}function QT(e){return Qn(e[0],e[2],e[4])}function WT(e){return Qn(e[0],e[2],e[2])}function ZT(e){return Qn(e[0],Qe(),e[2])}function XT(e){return Qn(e,Qe(),Qe())}function JT(e){return Gr(e)}function eE(e){return e[1]}function tE(e){return Gr(e)}function rE(e){return e[1]}function nE(e){return LD(e[0],e[1])}function oE(e){return null}function iE(e){return It()}function aE(e){return Nt()}function sE(e){return Lc()}function cE(e){return Bo()}function pE(e){return Go()}function uE(e){return Vn()}function lE(e){return ya()}function mE(e){return Qe()}function dE(e){return ko()}function fE(e){return k({})}function gE(e){return me()}function hE(e){return $o()}function yE(e){return Wc()}function TE(e){return Vc()}function EE(e){return z(BigInt(e))}function _E(e){return z(s.IsEqual(e,"true"))}function IE(e){return z(parseFloat(e))}function bE(e){return z(e)}function SE(e){return e[1]}function AE(e){return z(e)}function OE(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function xE(e){return e[1]}function RE(e){return Zc(e)}function CE(e){return s.IsEqual(e.length,6)?Fn(e[1],e[3],e[5]):Fn(e[1],e[3],Qe())}function PE(e){return e.length>0}function UE(e){return e.reduce((t,n)=>s.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function wE(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function vE(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function NE(e){return s.IsEqual(e.length,2)?e[1]:[]}function HT(e,t){return t.reduce((n,o)=>{let i=o;return s.IsEqual(i.length,1)?Ca(n,i[0]):s.IsEqual(i.length,0)?Pt(n):Xn()},e)}function KT(e,t){return s.IsEqual(t.length,3)?rp(e,t[0],t[1],t[2]):e}function kD(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:gp(e,t)}function LE(e){let[t,n,o,i,a]=e;return kD(KT(t?Pa(HT(n,o)):HT(n,o),i),a)}function Bl(e,t){return s.IsEqual(t.length,3)?(()=>{let[n,o,i]=t,a=Bl(o,i);if(s.IsEqual(n,"&"))return M(a)?ut([e,...a.allOf]):ut([e,a]);if(s.IsEqual(n,"|"))return R(a)?F([e,...a.anyOf]):F([e,a]);Xn()})():e}function kE(e){let[t,n]=e;return Bl(t,n)}function ME(e){let[t,n]=e;return Bl(t,n)}function DE(e){return B_(e[1])}function GE(e){return e[1]}function $E(e){return an(e[0],e[2])}function jE(e){return s.IsEqual(e.length,4)?fa(e[1],e[3]):s.IsEqual(e.length,2)?fa(e[1],Qe()):Xn()}function qE(e){return`${e}`}function FE(e){return ot(e[3])?pn:Ce(e[3])?jo:yr(e[3])?$t:We(e[3])?$t:Xn()}function BE(e){return e.length>0}function HE(e){return e.length>0}function KE(e){let[t,n,o,i,a]=e;return{[n]:t&&o?gr(dr(a)):t&&!o?gr(a):!t&&o?dr(a):a}}function zE(e){return Gr(e)}function YE(e){return e.reduce((t,n)=>s.HasPropertyKey(n,pn)||s.HasPropertyKey(n,jo)||s.HasPropertyKey(n,$t)?[t[0],y.Assign(t[1],n)]:[y.Assign(t[0],n),t[1]],[{},{}])}function VE(e){return YE(e[1])}function QE(e){let[t,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return k(t,o)}function WE(e){return s.IsEqual(e.length,5)?gr(dr(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?gr(e[3]):dr(e[3]):Xn()}function ZE(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[t,n,o]=e;return t&&o?gr(dr(n)):t&&!o?gr(n):!t&&o?dr(n):n}function XE(e){return s.IsEqual(e.length,2)?Zn(e[1]):s.IsEqual(e.length,1)?e[0]:Xn()}function JE(e){return Gr(e)}function e_(e){return ke(e[1])}function t_(e){return gr(dr(e[4]))}function r_(e){return gr(e[3])}function n_(e){return dr(e[3])}function o_(e){return e[2]}function i_(e){return s.IsEqual(e.length,2)?Zn(e[1]):s.IsEqual(e.length,1)?e[0]:Xn()}function a_(e){return Gr(e)}function s_(e){return mr(e[1],e[4])}function c_(e){return lr(e[2],e[5])}function zT(e,t){return s.IsEqual(e,"remove")?AT(t):s.IsEqual(e,"add")?gr(t):t}function p_(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 YT(e,t){return s.IsEqual(e,"remove")?RT(t):s.IsEqual(e,"add")?dr(t):t}function u_(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 l_(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function m_(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?Oa(Ta(e[3]),e[5],e[6][0],zT(e[1],YT(e[8],e[10]))):Oa(Ta(e[3]),e[5],nt(e[3]),zT(e[1],YT(e[8],e[10])))}function d_(e){return nt(e)}function f_(e){return BigInt(e)}function g_(e){return parseFloat(e)}function h_(e){return s.IsEqual(e,"true")}function y_(e){return null}function T_(e){return{[e[0]]:e[2]}}function E_(e){return Gr(e)}function MD(e){return e.reduce((t,n)=>y.Assign(t,n),{})}function __(e){return MD(e[1])}function I_(e){return Gr(e)}function b_(e){return e[1]}function S_(e){return ya()}function A_(e){return It()}function O_(e){return Nt()}function x_(e){return Vn()}function R_(e){return me()}function C_(e){return z(e)}function P_(e){return F(e[1])}function U_(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function w_(e){return[e[0],...e[1]]}function v_(e){return e[1]}function N_(e){return Gr(e)}function L_(e){return s.IsEqual(e.length,2)?e[1]:[]}function k_(e){let t=e[2],n=e[3],[o,i]=e[4],a=s.IsEqual(s.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:an(t,xa(n,o,a))}}function M_(e){let t=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:xa(t,n,i)}}function D_(e){return{[e[1]]:an(e[2],e[4])}}function G_(e){return{[e[1]]:e[3]}}function $_(e){return null}function j_(e){return Gr(e)}function q_(e){return e[1]}function F_(e){let[t,n]=[e[0],e[1]];return K_(y.Assign(t,YE(n)[0]))}function Ua(e){return te(e.length,2)}function W(e,t,n){return Ua(e)?t(e[0],e[1]):n()}function $D(e,t){return te(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function ve(e,t){for(let n=0;n<e.length;n++){let o=$D(e[n],t);if(Ua(o))return o}return[]}function Hl(e,t){return Array.from({length:t-e+1},(n,o)=>String.fromCharCode(e+o))}var z_=[...Hl(97,122),...Hl(65,90)],Kl="0",zl=Hl(49,57),Ho=[Kl,...zl],Y_=" ",Ko=`
|
|
28
|
-
`;var mn="_",hp=".",
|
|
27
|
+
`)}),this}_outputHelpIfRequested(t){let n=this._getHelpOption();n&&t.find(i=>n.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Mh(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let n,o="127.0.0.1",i="9229",a;return(a=t.match(/^(--inspect(-brk)?)$/))!==null?n=a[1]:(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(n=a[1],/^\d+$/.test(a[3])?i=a[3]:o=a[3]):(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(n=a[1],o=a[3],i=a[4]),n&&i!=="0"?`${n}=${o}:${parseInt(i)+1}`:t})}function Dh(){if(le.default.env.NO_COLOR||le.default.env.FORCE_COLOR==="0"||le.default.env.FORCE_COLOR==="false")return!1;if(le.default.env.FORCE_COLOR||le.default.env.CLICOLOR_FORCE!==void 0)return!0}var k5=new Po;function Je(e){throw new Error(`assertUnreachable: ${JSON.stringify(e,null,2)}`)}var rM=Math.pow(10,8)*24*60*60*1e3,G5=-rM;var jh=864e5,Fh=6e4,qh=36e5;var nM=3600;var Bh=nM*24,$5=Bh*7,oM=Bh*365.2425,iM=oM/12,j5=iM*3,xl=Symbol.for("constructDateFrom");function er(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&xl in e?e[xl](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ye(e,t){return er(t||e,e)}function Hh(e,t,n){let o=Ye(e,n?.in);return isNaN(t)?er(n?.in||e,NaN):(t&&o.setDate(o.getDate()+t),o)}function Kh(e,t,n){let o=Ye(e,n?.in);if(isNaN(t))return er(n?.in||e,NaN);if(!t)return o;let i=o.getDate(),a=er(n?.in||e,o.getTime());a.setMonth(o.getMonth()+t+1,0);let c=a.getDate();return i>=c?a:(o.setFullYear(a.getFullYear(),a.getMonth(),i),o)}function Uo(e,t,n){let{years:o=0,months:i=0,weeks:a=0,days:c=0,hours:l=0,minutes:m=0,seconds:f=0}=t,h=Ye(e,n?.in),E=i||o?Kh(h,i+o*12):h,I=c||a?Hh(E,c+a*7):E,g=m+l*60,S=(f+g*60)*1e3;return er(n?.in||e,+I+S)}var aM={};function zh(){return aM}function Rl(e){let t=Ye(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function yt(e,...t){let n=er.bind(null,e||t.find(o=>typeof o=="object"));return t.map(n)}function Cl(e,t){let n=Ye(e,t?.in);return n.setHours(0,0,0,0),n}function Yh(e,t,n){let[o,i]=yt(n?.in,e,t),a=Cl(o),c=Cl(i),l=+a-Rl(a),m=+c-Rl(c);return Math.round((l-m)/jh)}function Gn(e,t){let n=+Ye(e)-+Ye(t);return n<0?-1:n>0?1:n}function Vh(e,t,n){let[o,i]=yt(n?.in,e,t),a=o.getFullYear()-i.getFullYear(),c=o.getMonth()-i.getMonth();return a*12+c}function Qh(e,t,n){let[o,i]=yt(n?.in,e,t);return o.getFullYear()-i.getFullYear()}function Zh(e,t,n){let[o,i]=yt(n?.in,e,t),a=Wh(o,i),c=Math.abs(Yh(o,i));o.setDate(o.getDate()-a*c);let l=+(Wh(o,i)===-a),m=a*(c-l);return m===0?0:m}function Wh(e,t){let n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function wo(e){return t=>{let o=(e?Math[e]:Math.trunc)(t);return o===0?0:o}}function Xh(e,t,n){let[o,i]=yt(n?.in,e,t),a=(+o-+i)/qh;return wo(n?.roundingMethod)(a)}function yc(e,t){return+Ye(e)-+Ye(t)}function Jh(e,t,n){let o=yc(e,t)/Fh;return wo(n?.roundingMethod)(o)}function ey(e,t){let n=Ye(e,t?.in);return n.setHours(23,59,59,999),n}function ty(e,t){let n=Ye(e,t?.in),o=n.getMonth();return n.setFullYear(n.getFullYear(),o+1,0),n.setHours(23,59,59,999),n}function ry(e,t){let n=Ye(e,t?.in);return+ey(n,t)==+ty(n,t)}function ny(e,t,n){let[o,i,a]=yt(n?.in,e,e,t),c=Gn(i,a),l=Math.abs(Vh(i,a));if(l<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-c*l);let m=Gn(i,a)===-c;ry(o)&&l===1&&Gn(o,a)===1&&(m=!1);let f=c*(l-+m);return f===0?0:f}function oy(e,t,n){let o=yc(e,t)/1e3;return wo(n?.roundingMethod)(o)}function iy(e,t,n){let[o,i]=yt(n?.in,e,t),a=Gn(o,i),c=Math.abs(Qh(o,i));o.setFullYear(1584),i.setFullYear(1584);let l=Gn(o,i)===-a,m=a*(c-+l);return m===0?0:m}function ay(e,t){let[n,o]=yt(e,t.start,t.end);return{start:n,end:o}}var sM={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"}},sy=(e,t,n)=>{let o,i=sM[e];return typeof i=="string"?o=i:t===1?o=i.one:o=i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function Tc(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var cM={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},pM={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},uM={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},cy={date:Tc({formats:cM,defaultWidth:"full"}),time:Tc({formats:pM,defaultWidth:"full"}),dateTime:Tc({formats:uM,defaultWidth:"full"})};var lM={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},py=(e,t,n,o)=>lM[e];function vo(e){return(t,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(t):t;return i[a]}}var mM={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},dM={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},fM={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"]},gM={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"]},hM={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"}},yM={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"}},TM=(e,t)=>{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"},uy={ordinalNumber:TM,era:vo({values:mM,defaultWidth:"wide"}),quarter:vo({values:dM,defaultWidth:"wide",argumentCallback:e=>e-1}),month:vo({values:fM,defaultWidth:"wide"}),day:vo({values:gM,defaultWidth:"wide"}),dayPeriod:vo({values:hM,defaultWidth:"wide",formattingValues:yM,defaultFormattingWidth:"wide"})};function No(e){return(t,n={})=>{let o=n.width,i=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let c=a[0],l=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],m=Array.isArray(l)?_M(l,E=>E.test(c)):EM(l,E=>E.test(c)),f;f=e.valueCallback?e.valueCallback(m):m,f=n.valueCallback?n.valueCallback(f):f;let h=t.slice(c.length);return{value:f,rest:h}}}function EM(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function _M(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function ly(e){return(t,n={})=>{let o=t.match(e.matchPattern);if(!o)return null;let i=o[0],a=t.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=t.slice(i.length);return{value:c,rest:l}}}var IM=/^(\d+)(th|st|nd|rd)?/i,bM=/\d+/i,SM={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},AM={any:[/^b/i,/^(a|c)/i]},OM={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},xM={any:[/1/i,/2/i,/3/i,/4/i]},RM={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},CM={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]},PM={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},UM={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]},wM={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},vM={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}},my={ordinalNumber:ly({matchPattern:IM,parsePattern:bM,valueCallback:e=>parseInt(e,10)}),era:No({matchPatterns:SM,defaultMatchWidth:"wide",parsePatterns:AM,defaultParseWidth:"any"}),quarter:No({matchPatterns:OM,defaultMatchWidth:"wide",parsePatterns:xM,defaultParseWidth:"any",valueCallback:e=>e+1}),month:No({matchPatterns:RM,defaultMatchWidth:"wide",parsePatterns:CM,defaultParseWidth:"any"}),day:No({matchPatterns:PM,defaultMatchWidth:"wide",parsePatterns:UM,defaultParseWidth:"any"}),dayPeriod:No({matchPatterns:wM,defaultMatchWidth:"any",parsePatterns:vM,defaultParseWidth:"any"})};var Pl={code:"en-US",formatDistance:sy,formatLong:cy,formatRelative:py,localize:uy,match:my,options:{weekStartsOn:0,firstWeekContainsDate:1}};var NM=["years","months","weeks","days","hours","minutes","seconds"];function dy(e,t){let n=zh(),o=t?.locale??n.locale??Pl,i=t?.format??NM,a=t?.zero??!1,c=t?.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 fy(e,t){let{start:n,end:o}=ay(t?.in,e),i={},a=iy(o,n);a&&(i.years=a);let c=Uo(n,{years:i.years}),l=ny(o,c);l&&(i.months=l);let m=Uo(c,{months:i.months}),f=Zh(o,m);f&&(i.days=f);let h=Uo(m,{days:i.days}),E=Xh(o,h);E&&(i.hours=E);let I=Uo(h,{hours:i.hours}),g=Jh(o,I);g&&(i.minutes=g);let T=Uo(I,{minutes:i.minutes}),S=oy(o,T);return S&&(i.seconds=S),i}var D8=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 Y8=60*1e3;var PW=1/1e6,wl=1e3,pa=60*wl,$M=60*pa,_c=24*$M,UW=7*_c,wW=30*_c;var vl=["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-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 jM={s:1,m:60,h:3600,d:86400};function hy(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return!0}function yy(){return Math.floor(Date.now()/1e3)}function Ic(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?jM[n]:void 0;if(o){let i=e.slice(1,-1);if(i.length>0&&hy(i))return yy()-parseInt(i,10)*o}}if(hy(e)&&e.length>0)return parseInt(e,10);let t=Date.parse(e);if(!Number.isNaN(t))return Math.floor(t/1e3);throw new Error(`Invalid time value: ${e}. Use unix seconds, relative (-30m, -1h), 'now', or ISO 8601.`)}var y={};Yt(y,{Assign:()=>FM,Clone:()=>Fn,Create:()=>V0,Discard:()=>Q0,Metrics:()=>tr,Update:()=>W0});var tr={assign:0,create:0,clone:0,discard:0,update:0};function FM(e,t){return tr.assign+=1,{...e,...t}}var s={};Yt(s,{Counted:()=>s0,Entries:()=>u0,EntriesRegExp:()=>p0,Every:()=>n0,EveryAll:()=>o0,GraphemeCount:()=>e0,HasPropertyKey:()=>c0,IsArray:()=>la,IsBigInt:()=>ua,IsBoolean:()=>xy,IsClassInstance:()=>JM,IsConstructor:()=>YM,IsDeepEqual:()=>Ml,IsEqual:()=>te,IsFunction:()=>Ry,IsGreaterEqualThan:()=>Py,IsGreaterThan:()=>WM,IsInteger:()=>Ll,IsLessEqualThan:()=>Cy,IsLessThan:()=>ZM,IsMaxLength:()=>t0,IsMinLength:()=>r0,IsMultipleOf:()=>XM,IsNull:()=>Ac,IsNumber:()=>Oc,IsObject:()=>ma,IsObjectNotArray:()=>VM,IsString:()=>xc,IsSymbol:()=>QM,IsUndefined:()=>kl,IsUnsafePropertyKey:()=>wy,IsValueLike:()=>Uy,Keys:()=>Sc,ShiftLeft:()=>Rc,Some:()=>i0,SomeAll:()=>a0,Symbols:()=>l0,Values:()=>m0});function $n(e,t,n){return e>=t&&e<=n}function qM(e){return e===8205}function BM(e){return $n(e,55296,56319)}function Ty(e){return $n(e,127462,127487)}function _y(e){return $n(e,65024,65039)}function Iy(e){return $n(e,768,879)||$n(e,6832,6911)||$n(e,7616,7679)||$n(e,65056,65071)}function bc(e){return e>65535?2:1}function Ey(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Iy(n)||_y(n))t+=bc(n);else break}return t}function Nl(e,t){let n=e.codePointAt(t),o=t+bc(n);for(o=Ey(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+bc(i),o=Ey(e,o)}return Ty(n)&&o<e.length&&Ty(e.codePointAt(o))&&(o+=bc(e.codePointAt(o))),o}function by(e){return BM(e)||Iy(e)||_y(e)||qM(e)}function Sy(e){let t=0,n=0;for(;n<e.length;)n=Nl(e,n),t++;return t}function HM(e,t){if(t===0)return!0;let n=0,o=0;for(;o<e.length;)if(o=Nl(e,o),n++,n>=t)return!0;return!1}function KM(e,t){let n=0,o=0;for(;o<e.length;)if(o=Nl(e,o),n++,n>t)return!1;return!0}function Ay(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(by(e.charCodeAt(n)))return HM(e,t);if(n++,n>=t)return!0}return!1}function Oy(e,t){let n=0;for(;n<e.length;){if(by(e.charCodeAt(n)))return KM(e,t);if(n++,n>t)return!1}return!0}function la(e){return Array.isArray(e)}function ua(e){return te(typeof e,"bigint")}function xy(e){return te(typeof e,"boolean")}function YM(e){if(kl(e)||!Ry(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Ry(e){return te(typeof e,"function")}function Ll(e){return Number.isInteger(e)}function Ac(e){return te(e,null)}function Oc(e){return Number.isFinite(e)}function VM(e){return ma(e)&&!la(e)}function ma(e){return te(typeof e,"object")&&!Ac(e)}function xc(e){return te(typeof e,"string")}function QM(e){return te(typeof e,"symbol")}function kl(e){return te(e,void 0)}function te(e,t){return e===t}function WM(e,t){return e>t}function ZM(e,t){return e<t}function Cy(e,t){return e<=t}function Py(e,t){return e>=t}function XM(e,t){if(ua(e)||ua(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!Oc(e)||Ll(e)&&1/t%1===0)return!0;let o=e%t;return Math.min(Math.abs(o),Math.abs(o-t),Math.abs(o+t))<n}function JM(e){if(!ma(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Ac(t)?!1:te(typeof t.constructor,"function")&&!(te(t.constructor,globalThis.Object)||te(t.constructor.name,"Object"))}function Uy(e){return ua(e)||xy(e)||Ac(e)||Oc(e)||xc(e)||kl(e)}function e0(e){return Sy(e)}function t0(e,t){return Oy(e,t)}function r0(e,t){return Ay(e,t)}function n0(e,t,n){for(let o=t;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function o0(e,t,n){let o=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(o=!1);return o}function i0(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function a0(e,t){let n=!1;for(let o=0;o<e.length;o++)t(e[o],o)&&(n=!0);return n}function s0(e,t){return e.reduce((n,o,i)=>t(o,i)?++n:n,0)}function Rc(e,t,n){return te(e.length,0)?n():t(e[0],e.slice(1))}function wy(e){return te(e,"__proto__")||te(e,"constructor")||te(e,"prototype")}function c0(e,t){return wy(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function p0(e){return Sc(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function u0(e){return Object.entries(e)}function Sc(e){return Object.getOwnPropertyNames(e)}function l0(e){return Object.getOwnPropertySymbols(e)}function m0(e){return Object.values(e)}function d0(e,t){if(!ma(t))return!1;let n=Sc(e);return te(n.length,Sc(t).length)&&n.every(o=>Ml(e[o],t[o]))}function f0(e,t){return la(t)&&te(e.length,t.length)&&e.every((n,o)=>Ml(e[o],t[o]))}function Ml(e,t){return la(e)?f0(e,t):ma(e)?d0(e,t):te(e,t)}var Tt={};Yt(Tt,{IsBigInt64Array:()=>C0,IsBigUint64Array:()=>P0,IsBoolean:()=>g0,IsDate:()=>w0,IsFloat32Array:()=>x0,IsFloat64Array:()=>R0,IsInt16Array:()=>b0,IsInt32Array:()=>A0,IsInt8Array:()=>E0,IsMap:()=>N0,IsNumber:()=>h0,IsRegExp:()=>U0,IsSet:()=>v0,IsString:()=>y0,IsTypeArray:()=>T0,IsUint16Array:()=>S0,IsUint32Array:()=>O0,IsUint8Array:()=>_0,IsUint8ClampedArray:()=>I0});function g0(e){return e instanceof Boolean}function h0(e){return e instanceof Number}function y0(e){return e instanceof String}function T0(e){return globalThis.ArrayBuffer.isView(e)}function E0(e){return e instanceof globalThis.Int8Array}function _0(e){return e instanceof globalThis.Uint8Array}function I0(e){return e instanceof globalThis.Uint8ClampedArray}function b0(e){return e instanceof globalThis.Int16Array}function S0(e){return e instanceof globalThis.Uint16Array}function A0(e){return e instanceof globalThis.Int32Array}function O0(e){return e instanceof globalThis.Uint32Array}function x0(e){return e instanceof globalThis.Float32Array}function R0(e){return e instanceof globalThis.Float64Array}function C0(e){return e instanceof globalThis.BigInt64Array}function P0(e){return e instanceof globalThis.BigUint64Array}function U0(e){return e instanceof globalThis.RegExp}function w0(e){return e instanceof globalThis.Date}function v0(e){return e instanceof globalThis.Set}function N0(e){return e instanceof globalThis.Map}var Cc=s;function k0(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function M0(e){let t={};for(let n of Object.getOwnPropertyNames(e)){if(s.IsUnsafePropertyKey(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=jn(o.value),s.IsEqual(o.enumerable,!0)?t[n]=o.value:Object.defineProperty(t,n,o)}return t}function D0(e){let t={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(t[n]=jn(e[n]));for(let n of s.Symbols(e))t[n]=jn(e[n]);return t}function G0(e){return s.IsClassInstance(e)?e:k0(e)?M0(e):D0(e)}function $0(e){return e.map(t=>jn(t))}function j0(e){return e.slice()}function F0(e){return new RegExp(e.source,e.flags)}function q0(e){return new Map(jn([...e.entries()]))}function B0(e){return new Set(jn([...e.values()]))}function jn(e){return Tt.IsTypeArray(e)?j0(e):Tt.IsRegExp(e)?F0(e):Tt.IsMap(e)?q0(e):Tt.IsSet(e)?B0(e):s.IsArray(e)?$0(e):s.IsObject(e)?G0(e):e}function Fn(e){return tr.clone+=1,jn(e)}var rt={};Yt(rt,{Get:()=>z0,Reset:()=>H0,Set:()=>K0});var ur={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function H0(){ur.immutableTypes=!1,ur.maxErrors=8,ur.maxInstantiationCount=128,ur.useAcceleration=!0,ur.exactOptionalPropertyTypes=!1,ur.enumerableKind=!1,ur.correctiveParse=!1,ur.unionPrioritySort=!0}function K0(e){for(let t of s.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(ur,t,{value:n})}}function z0(){return ur}function Y0(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function vy(e,t){return{...e,...t}}function V0(e,t,n={}){tr.create+=1;let o=rt.Get(),i=vy(t,n),a=o.enumerableKind?vy(i,e):Y0(i,e);return o.immutableTypes?Object.freeze(a):a}function Q0(e,t){tr.discard+=1;let n={};for(let o of Object.getOwnPropertyNames(e)){if(t.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);i.value=Fn(i.value),Object.defineProperty(n,o,i)}return n}function W0(e,t,n){tr.update+=1;let o=rt.Get(),i=Fn(e);for(let a of Object.keys(t))Object.defineProperty(i,a,{configurable:!0,writable:!0,enumerable:o.enumerableKind,value:t[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,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function Ue(e){return s.IsObject(e)}function v(e,t,n){return y.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function on(e){return w(e,"Deferred")}function Z0(e){return y.Update(e,{"~readonly":!0},{})}function da(e,t){return y.Update(Z0(e),{},t)}function Ny(e,t,n,o){let i=O(e,t,n);return da(i,o)}function X0(e){return y.Update(e,{"~optional":!0},{})}function fa(e,t){return y.Update(X0(e),{},t)}function Ly(e,t,n,o){let i=O(e,t,n);return fa(i,o)}function Pt(e,t){return y.Create({"~kind":"Array"},{type:"array",items:e},t)}function Z(e){return w(e,"Array")}function Lo(e){return y.Discard(e,["~kind","type","items"])}function lr(e,t,n={}){return y.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function Be(e){return w(e,"Constructor")}function ky(e){return y.Discard(e,["~kind","type","parameters","instanceType"])}function mr(e,t,n={}){return y.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function He(e){return w(e,"Function")}function My(e){return y.Discard(e,["~kind","type","parameters","returnType"])}function nt(e,t){return y.Create({"~kind":"Ref"},{$ref:e},t)}function ce(e){return w(e,"Ref")}function an(e,t){return y.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function ko(e){return w(e,"Generic")}function Mo(e){return y.Create({"~kind":"Any"},{},e)}function Ve(e){return w(e,"Any")}var Dy="(?!)";function me(e){return y.Create({"~kind":"Never"},{not:{}},e)}function rr(e){return w(e,"Never")}function dr(e,t={}){return v("AddOptional",[e],t)}function qn(e,t={}){return fa(e,t)}function Gy(e){return qn(e)}function et(e){return Ue(e)&&s.HasPropertyKey(e,"~optional")}function $y(e){return s.Keys(e).filter(t=>!et(e[t]))}function Pc(e){return s.Keys(e)}function Uc(e){return s.Values(e)}function k(e,t={}){let n=$y(e),o=n.length>0?{required:n}:{};return y.Create({"~kind":"Object"},{type:"object",...o,properties:e},t)}function D(e){return w(e,"Object")}function jy(e){return y.Discard(e,["~kind","type","properties","required"])}function Qe(e){return y.Create({"~kind":"Unknown"},{},e)}function tt(e){return w(e,"Unknown")}function fr(e,t,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:t},n)}function Te(e){return w(e,"Cyclic")}function Fy(e){return y.Update(e,{"~unsafe":null},{})}function wc(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var oe={};Yt(oe,{Match:()=>J0});function J0(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function ga(...e){let[t,n]=oe.Match(e,{2:(o,i)=>[o,i,i],1:o=>[o,Qe(),Qe()]});return y.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Ke(e){return w(e,"Infer")}function Bn(e,t,n,o={}){return y.Create({"~kind":"Dependent"},{if:e,then:t,else:n},o)}function Le(e){return w(e,"Dependent")}function qy(e){return y.Discard(e,["~kind","if","then","else"])}function By(e){return s.IsObjectNotArray(e)}function Hy(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function Ky(e){return s.IsString(e)||s.IsNumber(e)}function zy(e,t){let n=By(e)?Hy(e):e;return y.Create({"~kind":"Enum"},{enum:n},t)}function ze(e){return w(e,"Enum")}function ut(e,t={}){return y.Create({"~kind":"Intersect"},{allOf:e},t)}function M(e){return w(e,"Intersect")}function Yy(e){return y.Discard(e,["~kind","allOf"])}var Hn={};Yt(Hn,{Hash:()=>yD,HashCode:()=>eT});function ge(){throw new Error("Unreachable")}function eD(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let o of Reflect.ownKeys(n))o!=="constructor"&&typeof o!="symbol"&&t.add(o);n=Object.getPrototypeOf(n)}return[...t]}function tD(e){return typeof e=="number"}var Et;(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"})(Et||(Et={}));var Do=BigInt("14695981039346656037"),[rD,nD]=[BigInt("1099511628211"),BigInt("18446744073709551616")],oD=Array.from({length:256}).map((e,t)=>BigInt(t)),Zy=new Float64Array(1),Xy=new DataView(Zy.buffer),Jy=new Uint8Array(Zy.buffer);function lt(e){Do=Do^oD[e],Do=Do*rD%nD}function iD(e){lt(Et.Array);for(let t of e)sn(t)}function aD(e){lt(Et.BigInt),Xy.setBigInt64(0,e);for(let t of Jy)lt(t)}function Qy(e){lt(Et.Boolean),lt(e?1:0)}function sD(e){lt(Et.Constructor),sn(e.toString())}function cD(e){lt(Et.Date),sn(e.getTime())}function pD(e){lt(Et.Function),sn(e.toString())}function uD(e){lt(Et.Null)}function Wy(e){lt(Et.Number),Xy.setFloat64(0,e,!0);for(let t of Jy)lt(t)}function lD(e){lt(Et.Object);for(let t of eD(e).sort())sn(t),sn(e[t])}function mD(e){lt(Et.RegExp),Dl(e.toString())}var dD=new TextEncoder;function Dl(e){lt(Et.String);for(let t of dD.encode(e))lt(t)}function fD(e){lt(Et.Symbol),sn(e.toString())}function gD(e){lt(Et.TypeArray);let t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)lt(t[n])}function hD(e){return lt(Et.Undefined)}function sn(e){return Tt.IsTypeArray(e)?gD(e):Tt.IsDate(e)?cD(e):Tt.IsRegExp(e)?mD(e):Tt.IsBoolean(e)?Qy(e.valueOf()):Tt.IsString(e)?Dl(e.valueOf()):Tt.IsNumber(e)?Wy(e.valueOf()):tD(e)?Wy(e):s.IsArray(e)?iD(e):s.IsBoolean(e)?Qy(e):s.IsBigInt(e)?aD(e):s.IsConstructor(e)?sD(e):s.IsNull(e)?uD(e):s.IsObject(e)?lD(e):s.IsString(e)?Dl(e):s.IsSymbol(e)?fD(e):s.IsUndefined(e)?hD(e):s.IsFunction(e)?pD(e):ge()}function eT(e){return Do=BigInt("14695981039346656037"),sn(e),Do}function yD(e){return eT(e).toString(16).padStart(16,"0")}function tT(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 TD=tT;function rT(){return TD}var ha=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,o=Kn(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=Kn(n)?c=>n["~codec"].encode(t(c)):t,a={decode:o,encode:i};return y.Update(this.type,{"~codec":a},{})}},ya=class{constructor(t){this.type=t}Decode(t){return new ha(this.type,t)}};function vc(e){return new ya(e)}function oT(e,t){return vc(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function iT(e,t){return vc(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function Kn(e){return Ue(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function aT(e){return Go(e)}function zn(e){return Ue(e)&&s.HasPropertyKey(e,"~immutable")}function gr(e,t={}){return v("AddReadonly",[e],t)}function Yn(e,t={}){return da(e,t)}function sT(e){return Yn(e)}function Vn(e){return Ue(e)&&s.HasPropertyKey(e,"~readonly")}function _D(e,t){let n=Nc(e)?[...e["~refine"],t]:[t];return y.Update(e,{"~refine":n},{})}function cT(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,()=>"Refine Error"]});return _D(t,{check:n,error:o})}function ID(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function Nc(e){return Ue(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>ID(t))}var pT="-?(?:0|[1-9][0-9]*)n";function Ta(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function vt(e){return w(e,"BigInt")}function Lc(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function _t(e){return w(e,"Boolean")}function Ea(e){return y.Create({"~kind":"Identifier"},{name:e})}function uT(e){return w(e,"Identifier")}var kc="-?(?:0|[1-9][0-9]*)";function Qn(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function ot(e){return w(e,"Integer")}var Gl=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function bD(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new Gl(e)})()}function z(e,t){return y.Create({"~kind":"Literal"},{type:bD(e),const:e},t)}function Mc(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function lT(e){return Q(e)&&s.IsBigInt(e.const)}function mT(e){return Q(e)&&s.IsBoolean(e.const)}function Dc(e){return Q(e)&&s.IsNumber(e.const)}function Gc(e){return Q(e)&&s.IsString(e.const)}function Q(e){return w(e,"Literal")}function $o(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function hr(e){return w(e,"Null")}var $c="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Nt(e){return y.Create({"~kind":"Number"},{type:"number"},e)}function Ce(e){return w(e,"Number")}function jo(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function yr(e){return w(e,"Symbol")}function Wn(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,a],1:i=>[i,Qe(),Qe()]});return y.Create({"~kind":"Parameter"},{name:t,extends:n,equals:o},{})}function dT(e){return w(e,"Parameter")}var jc=".*";function It(e){return y.Create({"~kind":"String"},{type:"string"},e)}function We(e){return w(e,"String")}function q(e,t={}){return y.Create({"~kind":"Union"},{anyOf:e},t)}function R(e){return w(e,"Union")}function fT(e){return y.Discard(e,["~kind","anyOf"])}function _a(e){let t=gT(e);return s.IsEqual(t.length,2)?t[0]:[]}function SD(e){return!0}function hT(e){return s.ShiftLeft(e,(t,n)=>AD(t)?hT(n):!1,()=>!0)}function yT(e){return s.IsEqual(e.length,0)?!1:hT(e)}function AD(e){return R(e)?yT(e.anyOf):Q(e)?SD(e.const):!1}function Fc(e){return yT(e)}function qc(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function TT(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>TT(i,t,[...n,`${o}${t}`]),()=>n)}function OD(e,t){return s.IsEqual(e.length,0)?[`${t}`]:TT(e,t)}function ET(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>ET(e,i,[...n,..._T(e,o)]),()=>n)}function _T(e,t){return R(t)?ET(e,t.anyOf):Q(t)?OD(e,t.const):ge()}function IT(e,t){return s.ShiftLeft(t,(n,o)=>IT(_T(e,n),o),()=>e)}function xD(e){return e.map(t=>z(t))}function RD(e){let t=IT([],e),n=xD(t);return q(n)}function CD(e){return s.IsEqual(e.length,0)?ge():s.IsEqual(e.length,1)&&Q(e[0])?e[0]:RD(e)}function $l(e){let t=_a(e);return s.IsEqual(t.length,0)?It():Fc(t)?CD(t):qc(e)}function Ia(e){let t=$l(e);return Ee(t)?It():t}function Ut(e,t){let n="object",o={[e]:t};return y.Create({"~kind":"Record"},{type:n,patternProperties:o})}function bT(e){return Ut($t,e)}function ST(e){return k({true:e,false:e})}function ke(e,t={}){let[n,o,i]=[e,e.length,!1];return y.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:o},t)}function Y(e){return w(e,"Tuple")}function AT(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function PD(e){return y.Discard(e,["~readonly"])}function jl(e,t){return y.Update(PD(e),{},t)}function OT(e,t,n,o){let i=O(e,t,n);return jl(i,o)}function xT(e,t={}){return v("RemoveReadonly",[e],t)}function RT(e,t={}){return jl(e,t)}function UD(e){return y.Discard(e,["~optional"])}function Fl(e,t){return y.Update(UD(e),{},t)}function CT(e,t,n,o){let i=O(e,t,n);return Fl(i,o)}function PT(e,t={}){return v("RemoveOptional",[e],t)}function Bc(e,t={}){return Fl(e,t)}function ql(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function UT(e){let t=ql(e.items);return k(t)}function wD(e,t){return Vn(e)?!!Vn(t):!1}function vD(e,t){return et(e)?!!et(t):!1}function ND(e,t){let n=wD(e,t),o=vD(e,t),i=we([e,t]),a=RT(Bc(i));return n&&o?Yn(qn(a)):n&&!o?Yn(a):!n&&o?qn(a):a}function LD(e,t,n){return n in e?n in t?ND(e[n],t[n]):e[n]:n in t?t[n]:me()}function kD(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:LD(e,t,i)}),{})}function wT(e){return D(e)?e.properties:Y(e)?ql(e.items):ge()}function vT(e,t){let n=wT(e),o=wT(t),i=kD(n,o);return k(i)}function NT(e,t){let n=Zn(e,t);return s.IsEqual(n,Sa)?e:s.IsEqual(n,Aa)||s.IsEqual(n,ba)?t:me()}function LT(e){return D(e)||Y(e)}function MD(e,t){let n=R(e),o=R(t);return n||o}function DD(e,t){let n=Vt(e),o=Vt(t),i=MD(n,o),a=LT(n),c=LT(o);return i?we([n,o]):a&&c?vT(n,o):a&&!c?n:!a&&c?o:NT(n,o)}function kT(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>kT(e,i,[...n,DD(e,o)]),()=>s.IsEqual(n.length,0)?[e]:n)}function MT(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>MT(i,t,[...n,...Oa([o],t)]),()=>n)}function Oa(e,t=[]){return s.ShiftLeft(e,(n,o)=>R(n)?Oa(o,MT(n.anyOf,t)):Oa(o,kT(n,t)),()=>t)}function GD(e,t){let n=dt({},e,t);return G.IsExtendsTrueLike(n)?[]:[e]}function $D(e,t){return e.reduce((n,o)=>[...n,...GD(o,t)],[])}function Hc(e,t){let n=Vt(e),o=R(n)?n.anyOf:[n],i=$D(o,t);return Lt(i)}function nr(e,t,n){let o=ut([e,t]),i=Hc(n,e);return Lt([o,i])}function wt(e){let t=e.map(n=>z(n));return Lt(t)}function we(e){let t=Oa(e),n=Bl(t);return Dr(n)}function ht(e){let t=Ia(e);return Vt(t)}function Lt(e){let t=Bl(e);return Dr(t)}function Vt(e){return Le(e)?nr(e.if,e.then,e.else):ze(e)?wt(e.enum):M(e)?we(e.allOf):Ee(e)?ht(e.pattern):R(e)?Lt(e.anyOf):e}function Dr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?me():q(e)}function DT(e,t){let n=wt(e);return cn(n,t)}function GT(e,t){return Ut(pn,t)}function $T(e,t){let n=we(e);return cn(n,t)}function jT(e,t){return s.IsString(e)||s.IsNumber(e)?k({[e]:t}):s.IsEqual(e,!1)?k({false:t}):s.IsEqual(e,!0)?k({true:t}):k({})}function FT(e,t){return Ut(Fo,t)}function qT(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?Ut(e.pattern.toString(),t):Ut($t,t)}function BT(e,t){let n=_a(e);return Fc(n)?cn(ht(e),t):Ut(e,t)}function jD(e){return R(e)?qo(e.anyOf):[e]}function qo(e){return e.reduce((t,n)=>[...t,...jD(n)],[])}function FD(e){return e.some(t=>We(t)||Ce(t)||ot(t))}function qD(e,t){return s.IsEqual(FD(e),!0)?Ut($t,t):void 0}function BD(e,t){return e.reduce((n,o)=>Q(o)&&(s.IsString(o.const)||s.IsNumber(o.const))?{...n,[o.const]:t}:n,{})}function HD(e,t){let n=BD(e,t);return k(n)}function HT(e,t){let n=qo(e),o=qD(n,t);return Ue(o)?o:HD(n,t)}function cn(e,t){return Ve(e)?bT(t):_t(e)?ST(t):ze(e)?DT(e.enum,t):ot(e)?GT(e,t):M(e)?$T(e.allOf,t):Q(e)?jT(e.const,t):Ce(e)?FT(e,t):R(e)?HT(e.anyOf,t):We(e)?qT(e,t):Ee(e)?BT(e.pattern,t):k({})}function Hl(e,t,n){return K([e])?y.Update(cn(e,t),{},n):Kc(e,t,n)}function KT(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Hl(a,c,i)}var pn=`^${kc}$`,Fo=`^${$c}$`,$t=`^${jc}$`;function Kc(e,t,n={}){return v("Record",[e,t],n)}function Bo(e,t,n={}){return Hl(e,t,n)}function zc(e,t){return Ut(e,t)}function Yc(e){return s.IsEqual(e,$t)?It():s.IsEqual(e,pn)?Qn():s.IsEqual(e,Fo)?Nt():$l(e)}function it(e){return s.Keys(e.patternProperties)[0]}function un(e){let t=it(e);return Yc(t)}function Se(e){return e.patternProperties[it(e)]}function de(e){return w(e,"Record")}function Xn(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function ln(e){return w(e,"Rest")}function Vc(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function Qc(e){return w(e,"This")}function Ho(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function or(e){return w(e,"Undefined")}function Wc(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function kt(e){return w(e,"Void")}function zD(e,t){return s.IsEqual(e,"Array")?Pt(t[0]):s.IsEqual(e,"Capitalize")?Xc(t[0]):s.IsEqual(e,"ConstructorParameters")?np(t[0]):s.IsEqual(e,"Evaluate")?z_(t[0]):s.IsEqual(e,"Exclude")?op(t[0],t[1]):s.IsEqual(e,"Extract")?ip(t[0],t[1]):s.IsEqual(e,"Index")?Pa(t[0],t[1]):s.IsEqual(e,"InstanceType")?ap(t[0]):s.IsEqual(e,"Lowercase")?Jc(t[0]):s.IsEqual(e,"NonNullable")?sp(t[0]):s.IsEqual(e,"Omit")?cp(t[0],t[1]):s.IsEqual(e,"Parameters")?pp(t[0]):s.IsEqual(e,"Partial")?up(t[0]):s.IsEqual(e,"Pick")?lp(t[0],t[1]):s.IsEqual(e,"Readonly")?mp(t[0]):s.IsEqual(e,"KeyOf")?Ua(t[0]):s.IsEqual(e,"Record")?Kc(t[0],t[1]):s.IsEqual(e,"Required")?dp(t[0]):s.IsEqual(e,"ReturnType")?fp(t[0]):s.IsEqual(e,"Uncapitalize")?ep(t[0]):s.IsEqual(e,"Uppercase")?tp(t[0]):Ca(nt(e),t)}function Jn(){throw Error("Unreachable")}function WT(e,t=[]){return s.ShiftLeft(e,(n,o)=>WT(o,[...t,n[1]]),()=>t)}function Gr(e){return s.IsEqual(e.length,3)?[e[0],...WT(e[1])]:[]}function ZT(e){return Wn(e[0],e[2],e[4])}function XT(e){return Wn(e[0],e[2],e[2])}function JT(e){return Wn(e[0],Qe(),e[2])}function eE(e){return Wn(e,Qe(),Qe())}function tE(e){return Gr(e)}function rE(e){return e[1]}function nE(e){return Gr(e)}function oE(e){return e[1]}function iE(e){return zD(e[0],e[1])}function aE(e){return null}function sE(e){return It()}function cE(e){return Nt()}function pE(e){return Lc()}function uE(e){return Ho()}function lE(e){return $o()}function mE(e){return Qn()}function dE(e){return Ta()}function fE(e){return Qe()}function gE(e){return Mo()}function hE(e){return k({})}function yE(e){return me()}function TE(e){return jo()}function EE(e){return Wc()}function _E(e){return Vc()}function IE(e){return z(BigInt(e))}function bE(e){return z(s.IsEqual(e,"true"))}function SE(e){return z(parseFloat(e))}function AE(e){return z(e)}function OE(e){return e[1]}function xE(e){return z(e)}function RE(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function CE(e){return e[1]}function PE(e){return Zc(e)}function UE(e){return s.IsEqual(e.length,6)?Bn(e[1],e[3],e[5]):Bn(e[1],e[3],Qe())}function wE(e){return e.length>0}function vE(e){return e.reduce((t,n)=>s.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function NE(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function LE(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function kE(e){return s.IsEqual(e.length,2)?e[1]:[]}function zT(e,t){return t.reduce((n,o)=>{let i=o;return s.IsEqual(i.length,1)?Pa(n,i[0]):s.IsEqual(i.length,0)?Pt(n):Jn()},e)}function YT(e,t){return s.IsEqual(t.length,3)?rp(e,t[0],t[1],t[2]):e}function YD(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:gp(e,t)}function ME(e){let[t,n,o,i,a]=e;return YD(YT(t?Ua(zT(n,o)):zT(n,o),i),a)}function Kl(e,t){return s.IsEqual(t.length,3)?(()=>{let[n,o,i]=t,a=Kl(o,i);if(s.IsEqual(n,"&"))return M(a)?ut([e,...a.allOf]):ut([e,a]);if(s.IsEqual(n,"|"))return R(a)?q([e,...a.anyOf]):q([e,a]);Jn()})():e}function DE(e){let[t,n]=e;return Kl(t,n)}function GE(e){let[t,n]=e;return Kl(t,n)}function $E(e){return K_(e[1])}function jE(e){return e[1]}function FE(e){return an(e[0],e[2])}function qE(e){return s.IsEqual(e.length,4)?ga(e[1],e[3]):s.IsEqual(e.length,2)?ga(e[1],Qe()):Jn()}function BE(e){return`${e}`}function HE(e){return ot(e[3])?pn:Ce(e[3])?Fo:yr(e[3])?$t:We(e[3])?$t:Jn()}function KE(e){return e.length>0}function zE(e){return e.length>0}function YE(e){let[t,n,o,i,a]=e;return{[n]:t&&o?gr(dr(a)):t&&!o?gr(a):!t&&o?dr(a):a}}function VE(e){return Gr(e)}function QE(e){return e.reduce((t,n)=>s.HasPropertyKey(n,pn)||s.HasPropertyKey(n,Fo)||s.HasPropertyKey(n,$t)?[t[0],y.Assign(t[1],n)]:[y.Assign(t[0],n),t[1]],[{},{}])}function WE(e){return QE(e[1])}function ZE(e){let[t,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return k(t,o)}function XE(e){return s.IsEqual(e.length,5)?gr(dr(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?gr(e[3]):dr(e[3]):Jn()}function JE(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[t,n,o]=e;return t&&o?gr(dr(n)):t&&!o?gr(n):!t&&o?dr(n):n}function e_(e){return s.IsEqual(e.length,2)?Xn(e[1]):s.IsEqual(e.length,1)?e[0]:Jn()}function t_(e){return Gr(e)}function r_(e){return ke(e[1])}function n_(e){return gr(dr(e[4]))}function o_(e){return gr(e[3])}function i_(e){return dr(e[3])}function a_(e){return e[2]}function s_(e){return s.IsEqual(e.length,2)?Xn(e[1]):s.IsEqual(e.length,1)?e[0]:Jn()}function c_(e){return Gr(e)}function p_(e){return mr(e[1],e[4])}function u_(e){return lr(e[2],e[5])}function VT(e,t){return s.IsEqual(e,"remove")?xT(t):s.IsEqual(e,"add")?gr(t):t}function l_(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 QT(e,t){return s.IsEqual(e,"remove")?PT(t):s.IsEqual(e,"add")?dr(t):t}function m_(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 d_(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function f_(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?xa(Ea(e[3]),e[5],e[6][0],VT(e[1],QT(e[8],e[10]))):xa(Ea(e[3]),e[5],nt(e[3]),VT(e[1],QT(e[8],e[10])))}function g_(e){return nt(e)}function h_(e){return BigInt(e)}function y_(e){return parseFloat(e)}function T_(e){return s.IsEqual(e,"true")}function E_(e){return null}function __(e){return{[e[0]]:e[2]}}function I_(e){return Gr(e)}function VD(e){return e.reduce((t,n)=>y.Assign(t,n),{})}function b_(e){return VD(e[1])}function S_(e){return Gr(e)}function A_(e){return e[1]}function O_(e){return Ta()}function x_(e){return It()}function R_(e){return Nt()}function C_(e){return Qn()}function P_(e){return me()}function U_(e){return z(e)}function w_(e){return q(e[1])}function v_(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function N_(e){return[e[0],...e[1]]}function L_(e){return e[1]}function k_(e){return Gr(e)}function M_(e){return s.IsEqual(e.length,2)?e[1]:[]}function D_(e){let t=e[2],n=e[3],[o,i]=e[4],a=s.IsEqual(s.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:an(t,Ra(n,o,a))}}function G_(e){let t=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Ra(t,n,i)}}function $_(e){return{[e[1]]:an(e[2],e[4])}}function j_(e){return{[e[1]]:e[3]}}function F_(e){return null}function q_(e){return Gr(e)}function B_(e){return e[1]}function H_(e){let[t,n]=[e[0],e[1]];return Y_(y.Assign(t,QE(n)[0]))}function wa(e){return te(e.length,2)}function W(e,t,n){return wa(e)?t(e[0],e[1]):n()}function ZD(e,t){return te(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function ve(e,t){for(let n=0;n<e.length;n++){let o=ZD(e[n],t);if(wa(o))return o}return[]}function zl(e,t){return Array.from({length:t-e+1},(n,o)=>String.fromCharCode(e+o))}var V_=[...zl(97,122),...zl(65,90)],Yl="0",Vl=zl(49,57),Ko=[Yl,...Vl],Q_=" ",zo=`
|
|
28
|
+
`;var mn="_",hp=".",W_="$",yp="-";var Z_="//",X_="/*",JD="*/";function J_(e){let t=e.indexOf(JD);return te(t,-1)?"":e.slice(t+2)}function eI(e){let t=e.indexOf(zo);return te(t,-1)?"":e.slice(t)}function eG(e){return e.replace(/^[ \t\r\f\v]+/,"")}function Tp(e){let t=eG(e);return t.startsWith(X_)?Tp(J_(t.slice(2))):t.startsWith(Z_)?Tp(eI(t.slice(2))):t}function mt(e){let t=e.trimStart();return t.startsWith(X_)?mt(J_(t.slice(2))):t.startsWith(Z_)?mt(eI(t.slice(2))):t}function Ep(e,t){return W(ve([e],t),(n,o)=>[n,o],()=>["",t])}function tG(e,t){return e.includes(t)}function Yo(e,t,n,o=""){return W(ve(e,n),(i,a)=>tG(t,i)?Yo(e,t,a,o):Yo(e,t,a,`${o}${i}`),()=>[o,n])}function rG(e){return ve(Vl,e)}var nG=[...Ko,mn];function oG(e){return Yo(nG,[mn],e)}function iG(e){return W(ve([Yl],e),(t,n)=>[t,n],()=>W(rG(e),(t,n)=>W(oG(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[]))}function _p(e){return iG(mt(e))}function aG(e){return Ep(yp,e)}function sG(e){return W(aG(e),(t,n)=>W(_p(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function tI(e){return sG(mt(e))}function cG(e){return W(tI(e),(t,n)=>W(ve(["n"],n),(o,i)=>[`${t}`,i],()=>[]),()=>[])}function Ql(e){return cG(e)}function Wl(e,t){return ve([e],t)}function _(e,t){return te(e,"")?["",t]:e.startsWith(zo)?Wl(e,Tp(t)):e.startsWith(Q_)?Wl(e,t):Wl(e,mt(t))}var rI=[...V_,mn,W_];function pG(e){return ve(rI,e)}var uG=[...rI,...Ko];function nI(e,t=""){return W(ve(uG,e),(n,o)=>nI(o,`${t}${n}`),()=>[t,e])}function lG(e){return W(pG(e),(t,n)=>W(nI(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function Me(e){return lG(mt(e))}var mG=[...Ko,mn];function dG(e){return wa(ve([hp],e))}function oI(e){return W(Yo(mG,[mn],e),(t,n)=>te(t,"")?[]:[t,n],()=>[])}function fG(e){return W(ve([hp],e),(t,n)=>W(oI(n),(o,i)=>[`0${t}${o}`,i],()=>[]),()=>[])}function gG(e){return W(_p(e),(t,n)=>W(ve([hp],n),(o,i)=>W(oI(i),(a,c)=>[`${t}${o}${a}`,c],()=>[`${t}`,i]),()=>[`${t}`,n]),()=>[])}function hG(e){return dG(e)?fG(e):gG(e)}function iI(e){return hG(mt(e))}function yG(e){return Ep(yp,e)}function TG(e){return W(yG(e),(t,n)=>W(iI(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function Ip(e){return TG(mt(e))}function EG(e){return te(e,"")?[]:[e.slice(0,1),e.slice(1)]}function aI(e,t){return Rc(e,(n,o)=>t.startsWith(n)?!0:aI(o,t),()=>!1)}function dn(e,t,n=""){return W(EG(t),(o,i)=>aI(e,t)?[n,t]:dn(e,i,`${n}${o}`),()=>[])}function _G(e,t,n){return W(ve([e],n),(o,i)=>W(dn([t],i),(a,c)=>W(ve([t],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function IG(e,t,n){return W(ve([e],n),(o,i)=>W(dn([zo,t],i),(a,c)=>W(ve([t],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function sI(e,t,n,o){return n?_G(e,t,mt(o)):IG(e,t,mt(o))}function bG(e,t){return ve(e,t)}function SG(e,t){return sI(e,e,!1,t)}function AG(e,t){return W(bG(e,t),(n,o)=>SG(n,`${n}${o}`),()=>[])}function bp(e,t){return AG(e,mt(t))}function cI(e,t){return W(dn(e,t),(n,o)=>te(n,"")?[]:[n,o],()=>[])}var p=(e,t,n=()=>[])=>e.length===2?t(e):n(),xG=e=>p(p(Me(e),([t,n])=>p(_("extends",n),([o,i])=>p(re(i),([a,c])=>p(_("=",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[ZT(t),n]),RG=e=>p(p(Me(e),([t,n])=>p(_("extends",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[XT(t),n]),CG=e=>p(p(Me(e),([t,n])=>p(_("=",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[JT(t),n]),PG=e=>p(Me(e),([t,n])=>[eE(t),n]),lI=e=>p(p(xG(e),([t,n])=>[t,n],()=>p(RG(e),([t,n])=>[t,n],()=>p(CG(e),([t,n])=>[t,n],()=>p(PG(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),mI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(lI(o),([i,a])=>[[n,i],a])),([n,o])=>mI(o,[...t,n]),()=>[t,e]),UG=e=>p(p(p(lI(e),([t,n])=>p(mI(n),([o,i])=>p(p(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[tE(t),n]),Jl=e=>p(p(_("<",e),([t,n])=>p(UG(n),([o,i])=>p(_(">",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[rE(t),n]),dI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(re(o),([i,a])=>[[n,i],a])),([n,o])=>dI(o,[...t,n]),()=>[t,e]),wG=e=>p(p(p(re(e),([t,n])=>p(dI(n),([o,i])=>p(p(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[nE(t),n]),vG=e=>p(p(_("<",e),([t,n])=>p(wG(n),([o,i])=>p(_(">",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[oE(t),n]),NG=e=>p(p(Me(e),([t,n])=>p(vG(n),([o,i])=>[[t,o],i])),([t,n])=>[iE(t),n]),fI=e=>p(p(p(_(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[aE(t),n]),gI=e=>p(_("string",e),([t,n])=>[sE(t),n]),hI=e=>p(_("number",e),([t,n])=>[cE(t),n]),LG=e=>p(_("boolean",e),([t,n])=>[pE(t),n]),kG=e=>p(_("undefined",e),([t,n])=>[uE(t),n]),MG=e=>p(_("null",e),([t,n])=>[lE(t),n]),yI=e=>p(_("integer",e),([t,n])=>[mE(t),n]),DG=e=>p(_("bigint",e),([t,n])=>[dE(t),n]),GG=e=>p(_("unknown",e),([t,n])=>[fE(t),n]),$G=e=>p(_("any",e),([t,n])=>[gE(t),n]),jG=e=>p(_("object",e),([t,n])=>[hE(t),n]),FG=e=>p(_("never",e),([t,n])=>[yE(t),n]),TI=e=>p(_("symbol",e),([t,n])=>[TE(t),n]),qG=e=>p(_("void",e),([t,n])=>[EE(t),n]),BG=e=>p(_("this",e),([t,n])=>[_E(t),n]),HG=e=>p(p(_("${",e),([t,n])=>p(re(n),([o,i])=>p(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[OE(t),n]),Zl=e=>p(dn(["${","`"],e),([t,n])=>[xE(t),n]),EI=e=>p(p(p(Zl(e),([t,n])=>p(HG(n),([o,i])=>p(EI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p(p(Zl(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p(p(Zl(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[RE(t),n]),em=e=>p(p(_("`",e),([t,n])=>p(EI(n),([o,i])=>p(_("`",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[CE(t),n]),KG=e=>p(em(e),([t,n])=>[PE(t),n]),zG=e=>p(p(p(_("if",e),([t,n])=>p(re(n),([o,i])=>p(_("then",i),([a,c])=>p(re(c),([l,m])=>p(_("else",m),([f,h])=>p(re(h),([E,I])=>[[t,o,a,l,f,E],I])))))),([t,n])=>[t,n],()=>p(p(_("if",e),([t,n])=>p(re(n),([o,i])=>p(_("then",i),([a,c])=>p(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>[])),([t,n])=>[UE(t),n]),YG=e=>p(Ql(e),([t,n])=>[IE(t),n]),VG=e=>p(p(_("true",e),([t,n])=>[t,n],()=>p(_("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[bE(t),n]),QG=e=>p(Ip(e),([t,n])=>[SE(t),n]),WG=e=>p(bp(["'",'"'],e),([t,n])=>[AE(t),n]),ZG=e=>p(p(p(_("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[wE(t),n]),_I=(e,t=[])=>p(p(p(_("[",e),([n,o])=>p(re(o),([i,a])=>p(_("]",a),([c,l])=>[[n,i,c],l]))),([n,o])=>[n,o],()=>p(p(_("[",e),([n,o])=>p(_("]",o),([i,a])=>[[n,i],a])),([n,o])=>[n,o],()=>[])),([n,o])=>_I(o,[...t,n]),()=>[t,e]),XG=e=>p(_I(e),([t,n])=>[vE(t),n]),JG=e=>p(p(p(_("extends",e),([t,n])=>p(re(n),([o,i])=>p(_("?",i),([a,c])=>p(re(c),([l,m])=>p(_(":",m),([f,h])=>p(re(h),([E,I])=>[[t,o,a,l,f,E],I])))))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[NE(t),n]),e$=e=>p(p(p(_("(",e),([t,n])=>p(re(n),([o,i])=>p(_(")",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p(gI(e),([t,n])=>[t,n],()=>p(hI(e),([t,n])=>[t,n],()=>p(LG(e),([t,n])=>[t,n],()=>p(kG(e),([t,n])=>[t,n],()=>p(MG(e),([t,n])=>[t,n],()=>p(yI(e),([t,n])=>[t,n],()=>p(DG(e),([t,n])=>[t,n],()=>p(GG(e),([t,n])=>[t,n],()=>p($G(e),([t,n])=>[t,n],()=>p(jG(e),([t,n])=>[t,n],()=>p(FG(e),([t,n])=>[t,n],()=>p(TI(e),([t,n])=>[t,n],()=>p(qG(e),([t,n])=>[t,n],()=>p(BG(e),([t,n])=>[t,n],()=>p(YG(e),([t,n])=>[t,n],()=>p(VG(e),([t,n])=>[t,n],()=>p(QG(e),([t,n])=>[t,n],()=>p(WG(e),([t,n])=>[t,n],()=>p(KG(e),([t,n])=>[t,n],()=>p(zG(e),([t,n])=>[t,n],()=>p(l$(e),([t,n])=>[t,n],()=>p(f$(e),([t,n])=>[t,n],()=>p(_$(e),([t,n])=>[t,n],()=>p(E$(e),([t,n])=>[t,n],()=>p(A$(e),([t,n])=>[t,n],()=>p(NG(e),([t,n])=>[t,n],()=>p(O$(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[LE(t),n]),t$=e=>p(p(p(_("with",e),([t,n])=>p(DI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[kE(t),n]),II=e=>p(p(ZG(e),([t,n])=>p(e$(n),([o,i])=>p(XG(i),([a,c])=>p(JG(c),([l,m])=>p(t$(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[ME(t),n]),bI=e=>p(p(p(_("&",e),([t,n])=>p(II(n),([o,i])=>p(bI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),SI=e=>p(p(II(e),([t,n])=>p(bI(n),([o,i])=>[[t,o],i])),([t,n])=>[DE(t),n]),AI=e=>p(p(p(_("|",e),([t,n])=>p(SI(n),([o,i])=>p(AI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Sp=e=>p(p(SI(e),([t,n])=>p(AI(n),([o,i])=>[[t,o],i])),([t,n])=>[GE(t),n]),r$=e=>p(p(_("readonly",e),([t,n])=>p(Sp(n),([o,i])=>[[t,o],i])),([t,n])=>[$E(t),n]),n$=e=>p(p(_("|",e),([t,n])=>p(Sp(n),([o,i])=>[[t,o],i])),([t,n])=>[jE(t),n]),o$=e=>p(p(Jl(e),([t,n])=>p(_("=",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[FE(t),n]),i$=e=>p(p(p(_("infer",e),([t,n])=>p(Me(n),([o,i])=>p(_("extends",i),([a,c])=>p(Sp(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>p(p(_("infer",e),([t,n])=>p(Me(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>[])),([t,n])=>[qE(t),n]),re=e=>p(p(i$(e),([t,n])=>[t,n],()=>p(n$(e),([t,n])=>[t,n],()=>p(r$(e),([t,n])=>[t,n],()=>p(Sp(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),a$=e=>p(Ip(e),([t,n])=>[BE(t),n]),s$=e=>p(Me(e),([t,n])=>[t,n]),c$=e=>p(bp(["'",'"'],e),([t,n])=>[t,n]),p$=e=>p(p(_("[",e),([t,n])=>p(Me(n),([o,i])=>p(_(":",i),([a,c])=>p(p(yI(c),([l,m])=>[l,m],()=>p(hI(c),([l,m])=>[l,m],()=>p(gI(c),([l,m])=>[l,m],()=>p(TI(c),([l,m])=>[l,m],()=>[])))),([l,m])=>p(_("]",m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[HE(t),n]),OI=e=>p(p(a$(e),([t,n])=>[t,n],()=>p(s$(e),([t,n])=>[t,n],()=>p(c$(e),([t,n])=>[t,n],()=>p(p$(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),xI=e=>p(p(p(_("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[KE(t),n]),RI=e=>p(p(p(_("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[zE(t),n]),CI=e=>p(p(xI(e),([t,n])=>p(OI(n),([o,i])=>p(RI(i),([a,c])=>p(_(":",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[YE(t),n]),Ap=e=>p(p(p(_(",",e),([t,n])=>p(_(`
|
|
29
29
|
`,n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(_(";",e),([t,n])=>p(_(`
|
|
30
30
|
`,n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(_(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p(p(_(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p(p(_(`
|
|
31
|
-
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),
|
|
31
|
+
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),PI=(e,t=[])=>p(p(Ap(e),([n,o])=>p(CI(o),([i,a])=>[[n,i],a])),([n,o])=>PI(o,[...t,n]),()=>[t,e]),u$=e=>p(p(p(CI(e),([t,n])=>p(PI(n),([o,i])=>p(p(Ap(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[VE(t),n]),tm=e=>p(p(_("{",e),([t,n])=>p(u$(n),([o,i])=>p(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[WE(t),n]),l$=e=>p(tm(e),([t,n])=>[ZE(t),n]),m$=e=>p(p(p(Me(e),([t,n])=>p(_("?",n),([o,i])=>p(_(":",i),([a,c])=>p(_("readonly",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[t,n],()=>p(p(Me(e),([t,n])=>p(_(":",n),([o,i])=>p(_("readonly",i),([a,c])=>p(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>p(p(Me(e),([t,n])=>p(_("?",n),([o,i])=>p(_(":",i),([a,c])=>p(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[t,n],()=>p(p(Me(e),([t,n])=>p(_(":",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[XE(t),n]),pI=e=>p(p(m$(e),([t,n])=>[t,n],()=>p(p(xI(e),([t,n])=>p(re(n),([o,i])=>p(RI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>[])),([t,n])=>[JE(t),n]),UI=e=>p(p(p(_("...",e),([t,n])=>p(pI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(pI(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[e_(t),n]),wI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(UI(o),([i,a])=>[[n,i],a])),([n,o])=>wI(o,[...t,n]),()=>[t,e]),d$=e=>p(p(p(UI(e),([t,n])=>p(wI(n),([o,i])=>p(p(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t_(t),n]),f$=e=>p(p(_("[",e),([t,n])=>p(d$(n),([o,i])=>p(_("]",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[r_(t),n]),g$=e=>p(p(Me(e),([t,n])=>p(_("?",n),([o,i])=>p(_(":",i),([a,c])=>p(_("readonly",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[n_(t),n]),h$=e=>p(p(Me(e),([t,n])=>p(_(":",n),([o,i])=>p(_("readonly",i),([a,c])=>p(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[o_(t),n]),y$=e=>p(p(Me(e),([t,n])=>p(_("?",n),([o,i])=>p(_(":",i),([a,c])=>p(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[i_(t),n]),T$=e=>p(p(Me(e),([t,n])=>p(_(":",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[a_(t),n]),uI=e=>p(p(g$(e),([t,n])=>[t,n],()=>p(h$(e),([t,n])=>[t,n],()=>p(y$(e),([t,n])=>[t,n],()=>p(T$(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),vI=e=>p(p(p(_("...",e),([t,n])=>p(uI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(uI(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[s_(t),n]),NI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(vI(o),([i,a])=>[[n,i],a])),([n,o])=>NI(o,[...t,n]),()=>[t,e]),LI=e=>p(p(p(vI(e),([t,n])=>p(NI(n),([o,i])=>p(p(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[c_(t),n]),E$=e=>p(p(_("(",e),([t,n])=>p(LI(n),([o,i])=>p(_(")",i),([a,c])=>p(_("=>",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[p_(t),n]),_$=e=>p(p(_("new",e),([t,n])=>p(_("(",n),([o,i])=>p(LI(i),([a,c])=>p(_(")",c),([l,m])=>p(_("=>",m),([f,h])=>p(re(h),([E,I])=>[[t,o,a,l,f,E],I])))))),([t,n])=>[u_(t),n]),I$=e=>p(p(p(_("+",e),([t,n])=>p(_("readonly",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(_("-",e),([t,n])=>p(_("readonly",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(_("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[l_(t),n]),b$=e=>p(p(p(_("+",e),([t,n])=>p(_("?",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(_("-",e),([t,n])=>p(_("?",n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(_("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[m_(t),n]),S$=e=>p(p(p(_("as",e),([t,n])=>p(re(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[d_(t),n]),A$=e=>p(p(_("{",e),([t,n])=>p(I$(n),([o,i])=>p(_("[",i),([a,c])=>p(Me(c),([l,m])=>p(_("in",m),([f,h])=>p(re(h),([E,I])=>p(S$(I),([g,T])=>p(_("]",T),([S,b])=>p(b$(b),([x,P])=>p(_(":",P),([ue,tn])=>p(re(tn),([Lr,kr])=>p(fI(kr),([Bk,Hk])=>p(_("}",Hk),([Kk,zk])=>[[t,o,a,l,f,E,g,S,x,ue,Lr,Bk,Kk],zk]))))))))))))),([t,n])=>[f_(t),n]),O$=e=>p(Me(e),([t,n])=>[g_(t),n]),x$=e=>p(Ql(e),([t,n])=>[h_(t),n]),R$=e=>p(Ip(e),([t,n])=>[y_(t),n]),C$=e=>p(p(_("true",e),([t,n])=>[t,n],()=>p(_("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[T_(t),n]),P$=e=>p(bp(['"',"'"],e),([t,n])=>[t,n]),U$=e=>p(_("null",e),([t,n])=>[E_(t),n]),w$=e=>p(_("undefined",e),([t,n])=>[void 0,n]),kI=e=>p(p(OI(e),([t,n])=>p(_(":",n),([o,i])=>p(rm(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[__(t),n]),MI=(e,t=[])=>p(p(Ap(e),([n,o])=>p(kI(o),([i,a])=>[[n,i],a])),([n,o])=>MI(o,[...t,n]),()=>[t,e]),v$=e=>p(p(p(kI(e),([t,n])=>p(MI(n),([o,i])=>p(p(Ap(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[I_(t),n]),DI=e=>p(p(_("{",e),([t,n])=>p(v$(n),([o,i])=>p(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[b_(t),n]),GI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(rm(o),([i,a])=>[[n,i],a])),([n,o])=>GI(o,[...t,n]),()=>[t,e]),N$=e=>p(p(p(rm(e),([t,n])=>p(GI(n),([o,i])=>p(p(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[S_(t),n]),L$=e=>p(p(_("[",e),([t,n])=>p(N$(n),([o,i])=>p(_("]",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[A_(t),n]),rm=e=>p(p(x$(e),([t,n])=>[t,n],()=>p(R$(e),([t,n])=>[t,n],()=>p(C$(e),([t,n])=>[t,n],()=>p(P$(e),([t,n])=>[t,n],()=>p(U$(e),([t,n])=>[t,n],()=>p(w$(e),([t,n])=>[t,n],()=>p(DI(e),([t,n])=>[t,n],()=>p(L$(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),k$=e=>p(_("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[O_(t),n]),M$=e=>p(_(".*",e),([t,n])=>[x_(t),n]),D$=e=>p(_("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[R_(t),n]),G$=e=>p(_("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[C_(t),n]),$$=e=>p(_("(?!)",e),([t,n])=>[P_(t),n]),j$=e=>p(cI(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[U_(t),n]),F$=e=>p(p(k$(e),([t,n])=>[t,n],()=>p(M$(e),([t,n])=>[t,n],()=>p(D$(e),([t,n])=>[t,n],()=>p(G$(e),([t,n])=>[t,n],()=>p($$(e),([t,n])=>[t,n],()=>p(q$(e),([t,n])=>[t,n],()=>p(j$(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),q$=e=>p(p(_("(",e),([t,n])=>p(nm(n),([o,i])=>p(_(")",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[w_(t),n]),$I=e=>p(p(p(Xl(e),([t,n])=>p(_("|",n),([o,i])=>p($I(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p(p(Xl(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[v_(t),n]),Xl=e=>p(p(F$(e),([t,n])=>p(nm(n),([o,i])=>[[t,o],i])),([t,n])=>[N_(t),n]),nm=e=>p(p($I(e),([t,n])=>[t,n],()=>p(Xl(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),gT=e=>p(p(_("^",e),([t,n])=>p(nm(n),([o,i])=>p(_("$",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[L_(t),n]),jI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(re(o),([i,a])=>[[n,i],a])),([n,o])=>jI(o,[...t,n]),()=>[t,e]),B$=e=>p(p(p(re(e),([t,n])=>p(jI(n),([o,i])=>p(p(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[k_(t),n]),FI=e=>p(p(p(_("extends",e),([t,n])=>p(B$(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[M_(t),n]),H$=e=>p(p(_("interface",e),([t,n])=>p(Me(n),([o,i])=>p(Jl(i),([a,c])=>p(FI(c),([l,m])=>p(tm(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[D_(t),n]),K$=e=>p(p(_("interface",e),([t,n])=>p(Me(n),([o,i])=>p(FI(i),([a,c])=>p(tm(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[G_(t),n]),z$=e=>p(p(_("type",e),([t,n])=>p(Me(n),([o,i])=>p(Jl(i),([a,c])=>p(_("=",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[$_(t),n]),Y$=e=>p(p(_("type",e),([t,n])=>p(Me(n),([o,i])=>p(_("=",i),([a,c])=>p(re(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[j_(t),n]),V$=e=>p(p(p(_("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[F_(t),n]),qI=e=>p(p(p(_(";",e),([t,n])=>p(_(`
|
|
32
32
|
`,n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(_(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p(p(_(`
|
|
33
|
-
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),qI=(e,t=[])=>p(p(jI(e),([n,o])=>p(rm(o),([i,a])=>[[n,i],a])),([n,o])=>qI(o,[...t,n]),()=>[t,e]),D$=e=>p(p(p(rm(e),([t,n])=>p(qI(n),([o,i])=>p(p(jI(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[j_(t),n]),rm=e=>p(p(M$(e),([t,n])=>p(p(v$(n),([o,i])=>[o,i],()=>p(N$(n),([o,i])=>[o,i],()=>p(L$(n),([o,i])=>[o,i],()=>p(k$(n),([o,i])=>[o,i],()=>[])))),([o,i])=>p(mI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[q_(t),n]),G$=e=>p(p(rm(e),([t,n])=>p(D$(n),([o,i])=>[[t,o],i])),([t,n])=>[F_(t),n]),FI=e=>p(p(G$(e),([t,n])=>[t,n],()=>p(zG(e),([t,n])=>[t,n],()=>p(re(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function BI(e){let t=Xl(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:ge()}function j$(e){return e.join("|")}function q$(e){return e.slice(1,e.length-1)}function F$(e,t,n){return fn(t,`${n}${e}`)}function B$(e,t){return fn(e,`${t}${sT}`)}function H$(e,t){return fn(e,`${t}${kc}`)}function K$(e,t){return fn(e,`${t}${$c}`)}function z$(e,t){return wa(F([z("false"),z("true")]),e,t)}function Y$(e,t){return fn(e,`${t}${jc}`)}function V$(e,t,n){return fn(t,`${n}${q$(e)}`)}function Q$(e,t,n){let o=va(e,{});return wa(o,t,n)}function W$(e,t,n){let o=wt(e);return wa(o,t,n)}function HI(e,t,n,o=[]){return s.ShiftLeft(e,(i,a)=>HI(a,t,n,[...o,wa(i,[],"")]),()=>fn(t,`${n}(${j$(o)})`))}function wa(e,t,n){return ze(e)?W$(e.enum,t,n):ot(e)?H$(t,n):Q(e)?F$(e.const,t,n):vt(e)?B$(t,n):_t(e)?z$(t,n):Ce(e)?K$(t,n):We(e)?Y$(t,n):Ee(e)?V$(e.pattern,t,n):zI(e)?Q$(e.parameters[0],t,n):R(e)?HI(e.anyOf,t,n):ky}function fn(e,t){return s.ShiftLeft(e,(n,o)=>wa(n,o,t),()=>t)}function Z$(e){return`^${fn(e,"")}$`}function KI(e){let t=Z$(e);return Fc(t)}function va(e,t){return K(e)?y.Update(KI(e),{},t):Zc(e,t)}function YI(e,t,n,o){let i=jt(e,t,n);return va(i,o)}function Zc(e,t={}){return v("TemplateLiteral",[e],t)}function zI(e){return Ue(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function VI(e){return va(e,{})}function X$(e){let t=BI(e);return VI(t)}function QI(e,t={}){let n=s.IsString(e)?X$(e):VI(e);return y.Update(n,{},t)}function Ee(e){return w(e,"TemplateLiteral")}var G={};Yt(G,{ExtendsFalse:()=>B,ExtendsTrue:()=>U,ExtendsUnion:()=>nm,IsExtendsFalse:()=>J$,IsExtendsTrue:()=>ZI,IsExtendsTrueLike:()=>Yo,IsExtendsUnion:()=>WI,Match:()=>Ae});function nm(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function WI(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 ZI(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 J$(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function Yo(e){return WI(e)||ZI(e)}function Ae(e,t,n){return Yo(e)?t(e.inferred):n()}function e1(e,t,n,o){return Ae(J(e,n,o),i=>U(y.Assign(y.Assign(e,i),{[t]:n})),()=>B())}function t1(e,t){return U(e)}function r1(e,t,n,o,i){return Ae(J(e,t,n),a=>Ae(J(a,t,o),c=>U(c),()=>B()),()=>Ae(J(e,t,i),a=>U(a),()=>B()))}function n1(e,t,n){let o=wt(n);return J(e,t,o)}function XI(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(J(e,t,o),a=>XI(a,t,i),()=>B()),()=>U(e))}function o1(e,t,n){let o=ht(n);return J(e,t,o)}function JI(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(J(e,t,o),a=>U(a),()=>JI(e,t,i)),()=>B())}function ae(e,t,n){return Ve(n)?t1(e,t):Le(n)?r1(e,t,n.if,n.then,n.else):ze(n)?n1(e,t,n.enum):Ke(n)?e1(e,n.name,t,n.extends):M(n)?XI(e,t,n.allOf):Ee(n)?o1(e,t,n.pattern):R(n)?JI(e,t,n.anyOf):tt(n)?U(e):B()}function eb(e,t,n){return Ke(n)?ae(e,t,n):Ve(n)?U(e):tt(n)?U(e):nm(e)}function i1(e,t){let n=Kn(e),o=Kn(t);return n&&o||!n&&o?!0:!(n&&!o)}function tb(e,t,n,o){return Z(o)?i1(t,o)?J(e,n,o.items):B():ae(e,t,o)}function rb(e,t,n){return vt(n)?U(e):ae(e,t,n)}function nb(e,t,n){return _t(n)?U(e):ae(e,t,n)}function a1(e,t,n,o,i){let a=Ke(o)?t:o,c=Ke(o)?o:t,l=et(t),m=et(o);return!l&&m?B():Ae(J(e,a,c),f=>Na(f,n,i),()=>B())}function s1(e,t,n,o){return s.ShiftLeft(o,(i,a)=>a1(e,t,n,i,a),()=>et(t)?U(e):B())}function c1(e,t,n){return s.ShiftLeft(t,(o,i)=>s1(e,o,i,n),()=>U(e))}function Na(e,t,n){return c1(e,t,n)}function Op(e,t,n){return kt(n)?U(e):J(e,t,n)}function ob(e,t,n,o){return Ve(o)?U(e):tt(o)?U(e):Be(o)?Ae(Na(e,t,o.parameters),i=>Op(i,n,o.instanceType),()=>B()):B()}function ib(e,t,n,o,i){return Ae(J(e,t,i),()=>J(e,n,i),()=>J(e,o,i))}function ab(e,t,n){let o=wt(t);return J(e,o,n)}function sb(e,t,n,o){return Ve(o)?U(e):tt(o)?U(e):He(o)?Ae(Na(e,t,o.parameters),i=>Op(i,n,o.returnType),()=>B()):B()}function cb(e,t,n){return ot(n)?U(e):Ce(n)?U(e):ae(e,t,n)}function pb(e,t,n){let o=we(t);return J(e,o,n)}function xp(e,t,n){return t===n?U(e):B()}function p1(e,t,n){return Q(n)?xp(e,t,n.const):vt(n)?U(e):ae(e,z(t),n)}function u1(e,t,n){return Q(n)?xp(e,t,n.const):_t(n)?U(e):ae(e,z(t),n)}function l1(e,t,n){return Q(n)?xp(e,t,n.const):Ce(n)?U(e):ae(e,z(t),n)}function m1(e,t,n){return Q(n)?xp(e,t,n.const):We(n)?U(e):ae(e,z(t),n)}function ub(e,t,n){return s.IsBigInt(t.const)?p1(e,t.const,n):s.IsBoolean(t.const)?u1(e,t.const,n):s.IsNumber(t.const)?l1(e,t.const,n):s.IsString(t.const)?m1(e,t.const,n):ge()}function lb(e,t,n){return Ke(n)?ae(e,t,n):U(e)}function mb(e,t,n){return hr(n)?U(e):ae(e,t,n)}function db(e,t,n){return Ce(n)?U(e):ae(e,t,n)}function d1(e,t,n){return et(t)?et(n)?U(e):B():U(e)}function f1(e,t,n){return Ke(n)&&rr(n.extends)?B():Ae(J(e,t,n),o=>d1(o,t,n),()=>B())}function g1(e,t){return e.reduce((n,o)=>o in t?Yo(t[o])?{...n,...t[o].inferred}:ge():ge(),{})}function h1(e,t,n){let o={};for(let c of s.Keys(n))o[c]=c in t?f1({},t[c],n[c]):et(n[c])?Ke(n[c])?U(y.Assign(e,{[n[c].name]:n[c].extends})):U(e):B();let i=s.Values(o).every(c=>Yo(c)),a=i?g1(s.Keys(o),o):{};return i?U(a):B()}function y1(e,t,n){let o=h1(e,t,n);return Yo(o)?U(y.Assign(e,o.inferred)):B()}function T1(e,t,n){return y1(e,t,n)}function E1(e,t){return s.Keys(t).reduce((n,o)=>({...n,[o]:s.HasPropertyKey(e,o)?R(n[o])?F([...n[o].anyOf,t[o]]):F([e[o],t[o]]):t[o]}),e)}function fb(e,t,n,o){return s.ShiftLeft(t,(i,a)=>Ae(J({},e[i],n),c=>fb(e,a,n,E1(o,c)),()=>B()),()=>U(o))}function _1(e,t,n,o){let i=s.Keys(t);return fb(t,i,o,e)}function gb(e,t,n){return de(n)?_1(e,t,it(n),Se(n)):D(n)?T1(e,t,n.properties):ae(e,k(t),n)}function I1(e,t){return s.IsEqual(s.Keys(t).length,0)?U(e):B()}function b1(e,t,n,o,i){return J(e,n,i)}function hb(e,t,n,o){return de(o)?b1(e,Yc(t),n,Yc(it(o)),Se(o)):D(o)?I1(e,o.properties):Ve(o)?U(e):tt(o)?U(e):B()}function yb(e,t,n){return We(n)?U(e):ae(e,t,n)}function Tb(e,t,n){return yr(n)?U(e):ae(e,t,n)}function Eb(e,t,n){let o=ht(t);return J(e,o,n)}function om(e,t){return y.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function La(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 im(e){return ln(e)?Ke(e.items)?Z(e.items.extends)?om(e.items.name,e.items.extends.items):tt(e.items.extends)?om(e.items.name,e.items.extends):void 0:ge():void 0}function Rp(e){return Ke(e)?om(e.name,e.extends):void 0}function am(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>Ae(J({},o,t),()=>am(i,t,[...n,o]),()=>{}),()=>n)}function _b(e,t,n,o){let i=am(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:ke(i)})):B()}function Cp(e,t,n,o){let i=am(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:F(i)})):B()}function S1(e){return[...e].reverse()}function sm(e,t){return t?S1(e):e}function A1(e){let t=e.length>0?e[0]:void 0,n=Ue(t)?im(t):void 0;return Ue(n)}function O1(e,t,n,o,i,a){return Ae(J(e,n,i),c=>Ib(c,t,o,a),()=>B())}function x1(e,t,n,o,i){let a=im(o);return La(a)?_b(e,a.name,sm(n,t),a.type):s.ShiftLeft(n,(c,l)=>O1(e,t,c,l,o,i),()=>B())}function R1(e,t,n,o){return s.ShiftLeft(o,(i,a)=>x1(e,t,n,i,a),()=>s.IsEqual(n.length,0)?U(e):B())}function Ib(e,t,n,o){return R1(e,t,n,o)}function C1(e,t,n){let o=gn(e,be([],[]),n),i=A1(o);return Ib(e,i,sm(t,i),sm(o,i))}function bb(e,t,n){let o=Rp(n);return La(o)?Cp(e,o.name,t,o.type):s.ShiftLeft(t,(i,a)=>Ae(J(e,i,n),c=>bb(c,a,n),()=>B()),()=>U(e))}function Sb(e,t,n){let o=gn(e,be([],[]),t);return Y(n)?C1(e,o,n.items):Z(n)?bb(e,o,n.items):ae(e,ke(o),n)}function Ab(e,t,n){return kt(n)?U(e):or(n)?U(e):ae(e,t,n)}function Ob(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(J(e,t,o),a=>U(a),()=>Ob(e,t,i)),()=>B())}function cm(e,t,n){return s.ShiftLeft(t,(o,i)=>Ae(Ob(e,o,n),a=>cm(a,i,n),()=>B()),()=>U(e))}function xb(e,t,n){let o=Rp(n);return La(o)?Cp(e,o.name,t,o.type):R(n)?cm(e,t,n.anyOf):cm(e,t,[n])}function Rb(e,t,n){return Ke(n)?ae(e,t,n):Ve(n)?U(e):tt(n)?U(e):B()}function Cb(e,t,n){return kt(n)?U(e):ae(e,t,n)}function J(e,t,n){return Ve(t)?eb(e,t,n):Z(t)?tb(e,t,t.items,n):vt(t)?rb(e,t,n):_t(t)?nb(e,t,n):Be(t)?ob(e,t.parameters,t.instanceType,n):Le(t)?ib(e,t.if,t.then,t.else,n):ze(t)?ab(e,t.enum,n):He(t)?sb(e,t.parameters,t.returnType,n):ot(t)?cb(e,t,n):M(t)?pb(e,t.allOf,n):Q(t)?ub(e,t,n):rr(t)?lb(e,t,n):hr(t)?mb(e,t,n):Ce(t)?db(e,t,n):D(t)?gb(e,t.properties,n):de(t)?hb(e,it(t),Se(t),n):We(t)?yb(e,t,n):yr(t)?Tb(e,t,n):Ee(t)?Eb(e,t.pattern,n):Y(t)?Sb(e,t.items,n):or(t)?Ab(e,t,n):R(t)?xb(e,t.anyOf,n):tt(t)?Rb(e,t,n):kt(t)?Cb(e,t,n):B()}function P1(e,t){return we([...e,k(t)])}function pm(e,t,n){return K(e)?y.Update(P1(e,t),{},n):xa(e,t,n)}function Pb(e,t,n,o,i){let a=jt(e,t,n),c=ka(e,t,o);return pm(a,c,i)}function xa(e,t,n={}){return v("Interface",[e,t],n)}function Vo(e){return Ue(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function Ub(e,t,n={}){return pm(e,t,n)}function U1(e,t,n){return e.includes(n)?!0:Ma([...e,n],t,t[n])}function wb(e,t,n){let o=Uc(n);return Jn(e,t,o)}function Jn(e,t,n){return s.ShiftLeft(n,(o,i)=>Ma(e,t,o)?!0:Jn(e,t,i),()=>!1)}function Ma(e,t,n){return ce(n)?U1(e,t,n.$ref):Z(n)?Ma(e,t,n.items):Be(n)?Jn(e,t,[...n.parameters,n.instanceType]):He(n)?Jn(e,t,[...n.parameters,n.returnType]):Vo(n)?wb(e,t,n.parameters[1]):M(n)?Jn(e,t,n.allOf):D(n)?wb(e,t,n.properties):R(n)?Jn(e,t,n.anyOf):Y(n)?Jn(e,t,n.items):de(n)?Ma(e,t,Se(n)):!1}function vb(e,t,n){return Ma(e,t,n)}function w1(e,t){return t.reduce((n,o)=>vb([o],e,e[o])?[...n,o]:n,[])}function Nb(e){let t=Pc(e);return w1(e,t)}function v1(e,t,n){return n.includes(t)?n:t in e?Da(e,e[t],[...n,t]):ge()}function Lb(e,t,n){let o=Uc(t);return Qo(e,o,n)}function Qo(e,t,n){return t.reduce((o,i)=>Da(e,i,o),n)}function Da(e,t,n){return ce(t)?v1(e,t.$ref,n):Z(t)?Da(e,t.items,n):Be(t)?Qo(e,[...t.parameters,t.instanceType],n):He(t)?Qo(e,[...t.parameters,t.returnType],n):Vo(t)?Lb(e,t.parameters[1],n):M(t)?Qo(e,t.allOf,n):D(t)?Lb(e,t.properties,n):R(t)?Qo(e,t.anyOf,n):Y(t)?Qo(e,t.items,n):de(t)?Da(e,Se(t),n):n}function kb(e,t,n){return Da(e,n,[t])}function N1(e){return ko()}function L1(e){return s.Keys(e).reduce((t,n)=>({...t,[n]:eo(e[n])}),{})}function Ga(e){return e.reduce((t,n)=>[...t,eo(n)],[])}function eo(e){return ce(e)?N1(e.$ref):Z(e)?Pt(eo(e.items),No(e)):Be(e)?lr(Ga(e.parameters),eo(e.instanceType)):He(e)?mr(Ga(e.parameters),eo(e.returnType)):M(e)?ut(Ga(e.allOf)):D(e)?k(L1(e.properties)):de(e)?Fo(un(e),eo(Se(e))):R(e)?F(Ga(e.anyOf)):Y(e)?ke(Ga(e.items)):e}function k1(e,t){return t in e?eo(e[t]):Qe()}function Mb(e){return k1(e.$defs,e.$ref)}function M1(e,t,n){let o=jt(e,be([],[]),t),i=ka({},be([],[]),n);return we([...o,k(i)])}function D1(e,t){return s.Keys(e).filter(o=>t.includes(o)).reduce((o,i)=>{let a=e[i],c=Vo(a)?M1(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function Db(e,t,n){let o=kb(e,t,n),i=D1(e,o);return fr(i,t)}function Gb(e,t){return t in e?ce(e[t])?Gb(e,e[t].$ref):e[t]:me()}function Tr(e,t){return Gb(e,t)}function $b(e){return Te(e)?Mb(e):wc(e)?Qe():e}function dt(e,t,n){let o=$b(t),i=$b(n);return J(e,o,i)}var Ia="equal",G1="disjoint",ba="left-inside",Sa="right-inside";function Wn(e,t){let n=[tt(e)?G.ExtendsFalse():dt({},e,t),tt(e)?G.ExtendsTrue({}):dt({},t,e)];return G.IsExtendsTrueLike(n[0])&&G.IsExtendsTrueLike(n[1])?Ia:G.IsExtendsTrueLike(n[0])&&G.IsExtendsFalse(n[1])?ba:G.IsExtendsFalse(n[0])&&G.IsExtendsTrueLike(n[1])?Sa:G1}function $1(e,t){return t.filter(n=>Wn(e,n)!==Sa)}function j1(e,t){let n=t.some(o=>{let i=Wn(e,o);return s.IsEqual(i,ba)||s.IsEqual(i,Ia)});return s.IsEqual(n,!1)}function q1(e,t){let n=Vt(e);return Ve(n)?[n]:j1(n,t)?[...$1(n,t),n]:t}function F1(e){return e.reduce((t,n)=>D(n)?[...t,n]:rr(n)?t:q1(n,t),[])}function ql(e){let t=F1(e);return qo(t)}function um(e,t){return y.Update(Vt(e),{},t)}function jb(e,t,n,o){let i=O(e,t,n);return um(i,o)}function $a(e,t=[]){return on(e)&&s.IsEqual(e.action,"Conditional")?ce(e.parameters[0])?$a(e.parameters[2],$a(e.parameters[3],[...t,e.parameters[0].$ref])):$a(e.parameters[2],$a(e.parameters[3],t)):on(e)&&s.IsEqual(e.action,"Mapped")&&on(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&ce(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function B1(e,t){return e.reduce((n,o)=>[...n,t.includes(o.name)],[])}function Bb(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>s.ShiftLeft(t,(a,c)=>Bb(i,c,[...n,[a,o]]),()=>n),()=>n)}function H1(e){return Ee(e)?ht(e.pattern):ze(e)?wt(e.enum):e}function K1(e){let t=H1(e);return R(t)?[...t.anyOf]:[t]}function z1(e,t){return e.reduce((n,o)=>[...n,[...o,t]],[])}function qb(e,t){return t.reduce((n,o)=>[...n,...z1(e,o)],[])}function Fb(e){return e.reduce((t,n)=>s.IsEqual(n[0],!0)?qb(t,K1(n[1])):qb(t,[n[1]]),[[]])}function Hb(e,t,n){let o=$a(n),i=B1(e,o),a=Bb(t,i);return on(n)&&s.IsEqual(n.action,"Conditional")||on(n)&&s.IsEqual(n.action,"Mapped")?Fb(a):[t]}function Y1(){return["(not-resolvable)",me()]}function V1(){return["(not-generic)",me()]}function Q1(e,t,n){return[e,an(t,n)]}function W1(e,t,n){return t in e?Kb(e,t,e[t],n):Y1()}function Kb(e,t,n,o){return Lo(n)?Q1(t,n.parameters,n.expression):ce(n)?W1(e,n.$ref,o):V1()}function zb(e,t,n){return Kb(e,"(anonymous)",t,n)}function Z1(e,t,n){if(Ke(t)||Wo(t)||G.IsExtendsTrueLike(dt({},t,n)))return;let o={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:o})}function Yb(e,t,n,o,i){let a=O(e,t,i);return Z1(n,a,o),y.Assign(e,{[n]:a})}function X1(e,t,n,o,i){let a=O(e,t,n.extends),c=O(e,t,n.equals);return s.ShiftLeft(i,(l,m)=>lm(Yb(e,t,n.name,a,l),t,o,m),()=>lm(Yb(e,t,n.name,a,c),t,o,[]))}function lm(e,t,n,o){return s.ShiftLeft(n,(i,a)=>X1(e,t,i,a,o),()=>e)}function Vb(e,t,n,o){return lm(e,t,n,o)}var mm=0,dm=0;function J1(){if(!s.IsLessThan(dm,rt.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function ej(){J1(),dm++,mm++}function tj(){mm--,s.IsEqual(mm,0)&&(dm=0)}function rj(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function nj(e,t){return s.IsEqual(rj(e),t)}function oj(e,t,n,o,i,a){ej();try{let c=Vb(e,t,o,a),l=O(c,be([...t.callstack,n.$ref],t.visited),i);return O(c,be([],[]),l)}finally{tj()}}function ij(e,t,n,o,i,a){return a.reduce((c,l)=>{let m=oj(e,t,n,o,i,l);return[...c,m]},[])}function aj(e,t,n,o,i,a){let c=Hb(o,a,i),l=ij(e,t,n,o,i,c);return s.IsEqual(l.length,1)?l[0]:Lt(l)}function Pp(e,t,n,o){let i=jt(e,t,o),a=zb(e,n,o),c=a[0],l=a[1];return Lo(l)?nj(t,c)?Ra(nt(c),i):aj(e,t,nt(c),l.parameters,l.expression,i):Ra(n,i)}function Ra(e,t){return y.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Qb(e,t){return Pp({},be([],[]),e,t)}function Wo(e){return w(e,"Call")}function sj(e){return y.Discard(e,["~immutable"])}function Wb(e,t){return y.Update(sj(e),{},t)}function Zb(e,t,n,o){let i=O(e,t,n);return Wb(i,o)}function Xb(e,t){return e(t)}function Jb(e,t){return s.IsString(t)?z(Xb(e,t)):z(t)}function eS(e,t){let n=ht(t);return $r(e,n)}function tS(e,t){let n=t.map(o=>$r(e,o));return F(n)}function $r(e,t){return Q(t)?Jb(e,t.const):Ee(t)?eS(e,t.pattern):R(t)?tS(e,t.anyOf):t}function Xc(e,t={}){return v("Capitalize",[e],t)}function rS(e,t={}){return fm(e,t)}function Jc(e,t={}){return v("Lowercase",[e],t)}function nS(e,t={}){return gm(e,t)}function ep(e,t={}){return v("Uncapitalize",[e],t)}function oS(e,t={}){return hm(e,t)}function tp(e,t={}){return v("Uppercase",[e],t)}function iS(e,t={}){return ym(e,t)}var cj=e=>e[0].toUpperCase()+e.slice(1),pj=e=>e.toLowerCase(),uj=e=>e[0].toLowerCase()+e.slice(1),lj=e=>e.toUpperCase();function fm(e,t){return K([e])?y.Update($r(cj,e),{},t):Xc(e,t)}function gm(e,t){return K([e])?y.Update($r(pj,e),{},t):Jc(e,t)}function hm(e,t){return K([e])?y.Update($r(uj,e),{},t):ep(e,t)}function ym(e,t){return K([e])?y.Update($r(lj,e),{},t):tp(e,t)}function aS(e,t,n,o){let i=O(e,t,n);return fm(i,o)}function sS(e,t,n,o){let i=O(e,t,n);return gm(i,o)}function cS(e,t,n,o){let i=O(e,t,n);return hm(i,o)}function pS(e,t,n,o){let i=O(e,t,n);return ym(i,o)}function rp(e,t,n,o,i={}){return v("Conditional",[e,t,n,o],i)}function uS(e,t,n,o,i={}){return Tm({},be([],[]),e,t,n,o,i)}function mj(e,t,n,o,i,a){let c=dt(e,n,o);return G.IsExtendsUnion(c)?F([O(c.inferred,t,i),O(e,t,a)]):G.IsExtendsTrue(c)?O(c.inferred,t,i):O(e,t,a)}function Tm(e,t,n,o,i,a,c){return K([n,o])?y.Update(mj(e,t,n,o,i,a),{},c):rp(n,o,i,a,c)}function lS(e,t,n,o,i,a,c){let l=O(e,t,n),m=O(e,t,o);return Tm(e,t,l,m,i,a,c)}function np(e,t={}){return v("ConstructorParameters",[e],t)}function mS(e,t={}){return Em(e,t)}function dj(e){let t=Be(e)?e.parameters:[],n=gn({},be([],[]),t);return ke(n)}function Em(e,t){return K([e])?y.Update(dj(e),{},t):np(e,t)}function dS(e,t,n,o){let i=O(e,t,n);return Em(i,o)}function op(e,t,n={}){return v("Exclude",[e,t],n)}function fS(e,t,n={}){return ja(e,t,n)}function ja(e,t,n){return K([e,t])?y.Update(Hc(e,t),{},n):op(e,t,n)}function gS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return ja(a,c,i)}function ip(e,t,n={}){return v("Extract",[e,t],n)}function hS(e,t,n={}){return _m(e,t,n)}function fj(e,t){let n=dt({},e,t);return G.IsExtendsTrueLike(n)?[e]:[]}function gj(e,t){return e.reduce((n,o)=>[...n,...fj(o,t)],[])}function yS(e,t){let n=Vt(e),o=R(n)?n.anyOf:[n],i=gj(o,t);return Lt(i)}function _m(e,t,n){return K([e,t])?y.Update(yS(e,t),{},n):ip(e,t,n)}function TS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return _m(a,c,i)}function hj(e){return e.reduce((t,n)=>Mc(n)?[...t,z(n)]:t,[])}function Zo(e){let t=hj(e);return F(t)}function Ca(e,t,n={}){return v("Index",[e,t],n)}function ES(e,t,n={}){let o=s.IsArray(t)?Zo(t):t;return Im(e,o,n)}function _S(e,t){let n=Tr(e,t);return qt(n)}function IS(e,t,n){let o=nr(e,t,n);return qt(o)}function yj(e,t){let n=s.Keys(e).filter(h=>!s.HasPropertyKey(t,h)),o=s.Keys(t).filter(h=>!s.HasPropertyKey(e,h)),i=s.Keys(e).filter(h=>s.HasPropertyKey(t,h)),a=n.reduce((h,E)=>({...h,[E]:e[E]}),{}),c=o.reduce((h,E)=>({...h,[E]:t[E]}),{}),l=i.reduce((h,E)=>({...h,[E]:we([e[E],t[E]])}),{}),m=y.Assign(a,c);return y.Assign(m,l)}function bS(e){return e.reduce((t,n)=>yj(t,qt(n)),{})}function SS(e){let t=CT(ke(e));return qt(t)}function Tj(e,t){return s.Keys(e).filter(i=>i in t).reduce((i,a)=>({...i,[a]:Lt([e[a],t[a]])}),{})}function AS(e,t){return s.ShiftLeft(e,(n,o)=>AS(o,Tj(t,qt(n))),()=>t)}function OS(e){return s.ShiftLeft(e,(t,n)=>AS(n,qt(t)),()=>ge())}function qt(e){return Te(e)?_S(e.$defs,e.$ref):Le(e)?IS(e.if,e.then,e.else):M(e)?bS(e.allOf):R(e)?OS(e.anyOf):Y(e)?SS(e.items):D(e)?e.properties:{}}function Xo(e){let t=qt(e);return k(t)}var Ej=new RegExp("^(?:0|[1-9][0-9]*)$");function Jo(e){let t=`${e}`;return Ej.test(t)?parseInt(t):e}function _j(e){return z(Jo(e))}function xS(e){return e.map(t=>RS(t))}function RS(e){return M(e)?ut(xS(e.allOf)):R(e)?F(xS(e.anyOf)):Q(e)?_j(e.const):e}function CS(e,t){let n=RS(t),o=dt({},n,Nt());return G.IsExtendsTrueLike(o)?e:Q(t)&&s.IsEqual(t.const,"length")?Nt():me()}function PS(e,t){let n=Tr(e,t);return Mt(n)}function US(e,t,n){let o=nr(e,t,n);return Mt(o)}function wS(e){let t=wt(e);return Mt(t)}function vS(e){let t=we(e);return Mt(t)}function NS(e){return[`${e}`]}function LS(e){let t=ht(e);return Mt(t)}function kS(e){return e.reduce((t,n)=>[...t,...Mt(n)],[])}function Mt(e){return Te(e)?PS(e.$defs,e.$ref):Le(e)?US(e.if,e.then,e.else):ze(e)?wS(e.enum):M(e)?vS(e.allOf):Q(e)?NS(e.const):Ee(e)?LS(e.pattern):R(e)?kS(e.anyOf):[]}function ei(e){return Mt(e)}function qa(e,t){return t.map(n=>Fa(e,n))}function Fa(e,t){return Z(t)?Pt(Fa(e,t.items)):Be(t)?lr(qa(e,t.parameters),Fa(e,t.instanceType)):He(t)?mr(qa(e,t.parameters),Fa(e,t.returnType)):Y(t)?ke(qa(e,t.items)):R(t)?F(qa(e,t.anyOf)):M(t)?ut(qa(e,t.allOf)):Qc(t)?k(e):t}function MS(e,t){return Fa(e,t)}function Ij(e,t){let n=t in e?e[t]:me();return MS(e,n)}function DS(e,t){return t.reduce((n,o)=>[...n,Ij(e,o)],[])}function bj(e,t){let n=ei(t),o=DS(e,n);return Lt(o)}var Sj=new RegExp(pn);function Aj(e){return e.filter(n=>Sj.test(n))}function Oj(e){let t=Pc(e),n=Aj(t),o=DS(e,n);return Lt(o)}function GS(e,t){return Ce(t)?Oj(e):bj(e,t)}function xj(e){return z(Jo(e))}function $S(e){return e.map(t=>bm(t))}function bm(e){return M(e)?ut($S(e.allOf)):R(e)?F($S(e.anyOf)):Q(e)?xj(e.const):e}function Rj(e,t){return e.reduceRight((n,o,i)=>{let a=dt({},z(i),t);return G.IsExtendsTrueLike(a)?[o,...n]:n},[])}function Cj(e,t){let n=bm(t),o=Rj(e,n);return Dr(o)}function Pj(e){return Dr(e)}function jS(e,t){return Q(t)&&s.IsEqual(t.const,"length")?z(e.length):Ce(t)||ot(t)?Pj(e):Cj(e,t)}function qS(e,t){return Z(e)?CS(e.items,t):D(e)?GS(e.properties,t):Y(e)?jS(e.items,t):me()}function Uj(e){return Te(e)||Le(e)||M(e)||R(e)?Xo(e):e}function Im(e,t,n){return K([e,t])?y.Update(qS(Uj(e),t),{},n):Ca(e,t,n)}function FS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Im(a,c,i)}function ap(e,t={}){return v("InstanceType",[e],t)}function BS(e,t={}){return Sm(e,t)}function wj(e){return Be(e)?e.instanceType:me()}function Sm(e,t){return K([e])?y.Update(wj(e),{},t):ap(e,t)}function HS(e,t,n,o={}){let i=O(e,t,n);return Sm(i,o)}function Pa(e,t={}){return v("KeyOf",[e],t)}function KS(e,t={}){return Am(e,t)}function zS(){return F([Nt(),It(),$o()])}function YS(e){return Nt()}function vj(e){return e.reduce((n,o)=>Mc(o)?[...n,z(Jo(o))]:ge(),[])}function VS(e){let t=s.Keys(e),n=vj(t);return Dr(n)}function QS(e){return un(e)}function WS(e){let t=e.map((n,o)=>z(o));return Dr(t)}function ZS(e){return Ve(e)?zS():Z(e)?YS(e.items):D(e)?VS(e.properties):de(e)?QS(e):Y(e)?WS(e.items):me()}function Nj(e){return Te(e)||Le(e)||M(e)||R(e)?Xo(e):e}function Am(e,t){return K([e])?y.Update(ZS(Nj(e)),{},t):Pa(e,t)}function XS(e,t,n,o){let i=O(e,t,n);return Am(i,o)}function Oa(e,t,n,o,i={}){return v("Mapped",[e,t,n,o],i)}function JS(e,t,n,o,i={}){return Om({},be([],[]),e,t,n,o,i)}function Lj(e){let t=ht(e);return Up(t)}function kj(e){return e.reduce((t,n)=>[...t,...Up(n)],[])}function Mj(e){let t=wt(e);return Up(t)}function Dj(e){return s.IsNumber(e)?[z(`${e}`)]:[z(e)]}function Up(e){return ze(e)?Mj(e.enum):Q(e)?Dj(e.const):Ee(e)?Lj(e.pattern):R(e)?kj(e.anyOf):[e]}function eA(e){return Up(e)}function Gj(e){return Ee(e)?ht(e.pattern):e}function $j(e,t,n,o,i,a){let c=y.Assign(e,{[n.name]:o}),l=O(c,t,i),m=Gj(l),f=O(c,t,a);return Dc(m)||Gc(m)?{[m.const]:f}:{}}function jj(e,t,n,o,i,a){return o.reduce((c,l)=>[...c,$j(e,t,n,l,i,a)],[])}function qj(e){return e.reduce((t,n)=>[...t,k(n)],[])}function tA(e,t,n,o,i,a){let c=eA(o),l=jj(e,t,n,c,i,a),m=qj(l);return we(m)}function Om(e,t,n,o,i,a,c){return K([o])?y.Update(tA(e,t,n,o,i,a),{},c):Oa(n,o,i,a,c)}function rA(e,t,n,o,i,a,c){let l=O(e,t,o);return Om(e,t,n,l,i,a,c)}function Fj(e,t,n){let o=y.Assign(e,t);return s.Keys(t).filter(a=>n.includes(a)).reduce((a,c)=>({...a,[c]:Db(o,c,t[c])}),{})}function Bj(e,t,n){let o=y.Assign(e,t);return s.Keys(t).filter(a=>!n.includes(a)).reduce((a,c)=>({...a,[c]:O(o,be([],[]),t[c])}),{})}function Hj(e,t,n){let o=Nb(t),i=Fj(e,t,o),a=Bj(e,t,o),c={...i,...a};return y.Update(c,{},n)}function wp(e,t,n,o){return Hj(e,n,o)}function sp(e,t={}){return v("NonNullable",[e],t)}function nA(e,t={}){return xm(e,t)}function Kj(e){let t=F([Go(),Bo()]);return ja(e,t,{})}function xm(e,t){return K([e])?y.Update(Kj(e),{},t):sp(e,t)}function oA(e,t,n,o){let i=O(e,t,n);return xm(i,o)}function cp(e,t,n={}){return v("Omit",[e,t],n)}function iA(e,t,n={}){let o=s.IsArray(t)?Zo(t):t;return Rm(e,o,n)}function vp(e){let t=Xo(e);return D(t)?t.properties:ge()}function zj(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?o:{...o,[i]:e[i]},{})}function aA(e,t){let n=vp(e),o=ei(t),i=zj(n,o);return k(i)}function Rm(e,t,n){return K([e,t])?y.Update(aA(e,t),{},n):cp(e,t,n)}function sA(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Rm(a,c,i)}function pp(e,t={}){return v("Parameters",[e],t)}function cA(e,t={}){return Cm(e,t)}function Yj(e){let t=He(e)?e.parameters:[],n=gn({},be([],[]),t);return ke(n)}function Cm(e,t){return K([e])?y.Update(Yj(e),{},t):pp(e,t)}function pA(e,t,n,o){let i=O(e,t,n);return Cm(i,o)}function up(e,t={}){return v("Partial",[e],t)}function uA(e,t={}){return Pm(e,t)}function lA(e,t){let n=Tr(e,t),o=Er(n);return fr(y.Assign(e,{[t]:o}),t)}function mA(e,t,n){let o=nr(e,t,n);return Er(o)}function dA(e){let t=we(e);return Er(t)}function fA(e){let t=e.map(n=>Er(n));return F(t)}function gA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:qn(e[i])}),{});return k(t)}function Er(e){return Te(e)?lA(e.$defs,e.$ref):Le(e)?mA(e.if,e.then,e.else):M(e)?dA(e.allOf):R(e)?fA(e.anyOf):D(e)?gA(e.properties):k({})}function Pm(e,t){return K([e])?y.Update(Er(e),{},t):up(e,t)}function hA(e,t,n,o){let i=O(e,t,n);return Pm(i,o)}function lp(e,t,n={}){return v("Pick",[e,t],n)}function yA(e,t,n={}){let o=s.IsArray(t)?Zo(t):t;return Um(e,o,n)}function Vj(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function TA(e,t){let n=vp(e),o=ei(t),i=Vj(n,o);return k(i)}function Um(e,t,n){return K([e,t])?y.Update(TA(e,t),{},n):lp(e,t,n)}function EA(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Um(a,c,i)}function mp(e,t={}){return v("ReadonlyObject",[e],t)}function wm(e,t={}){return vm(e,t)}var _A=wm;function IA(e){return Do(Pt(e))}function bA(e,t){let n=Tr(e,t),o=_r(n);return fr(y.Assign(e,{[t]:o}),t)}function SA(e,t,n){let o=nr(e,t,n);return _r(o)}function AA(e){let t=we(e);return _r(t)}function OA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:zn(e[i])}),{});return k(t)}function xA(e){return Do(ke(e))}function RA(e){let t=e.map(n=>_r(n));return F(t)}function _r(e){return Z(e)?IA(e.items):Te(e)?bA(e.$defs,e.$ref):Le(e)?SA(e.if,e.then,e.else):M(e)?AA(e.allOf):D(e)?OA(e.properties):Y(e)?xA(e.items):R(e)?RA(e.anyOf):e}function vm(e,t){return K([e])?y.Update(_r(e),{},t):mp(e)}function CA(e,t,n,o){let i=O(e,t,n);return vm(i,o)}function PA(e,t,n,o){return t.visited.includes(o)?n:o in e?O(e,be(t.callstack,[...t.visited,o]),e[o]):n}function UA(e,t){let n=Tr(e,t),o=Ir(n);return fr(y.Assign(e,{[t]:o}),t)}function wA(e,t,n){let o=nr(e,t,n);return Ir(o)}function vA(e){let t=we(e);return Ir(t)}function NA(e){let t=e.map(n=>Ir(n));return F(t)}function LA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:Bc(e[i])}),{});return k(t)}function Ir(e){return Te(e)?UA(e.$defs,e.$ref):Le(e)?wA(e.if,e.then,e.else):M(e)?vA(e.allOf):R(e)?NA(e.anyOf):D(e)?LA(e.properties):k({})}function dp(e,t={}){return v("Required",[e],t)}function kA(e,t={}){return Nm(e,t)}function Nm(e,t){return K([e])?y.Update(Ir(e),{},t):dp(e,t)}function MA(e,t,n,o){let i=O(e,t,n);return Nm(i,o)}function fp(e,t={}){return v("ReturnType",[e],t)}function DA(e,t={}){return Lm(e,t)}function Qj(e){return He(e)?e.returnType:me()}function Lm(e,t){return K([e])?y.Update(Qj(e),{},t):fp(e,t)}function GA(e,t,n,o={}){let i=O(e,t,n);return Lm(i,o)}function gp(e,t){return v("With",[e,t],{})}function Np(e,t){return km(e,t)}function km(e,t){return K([e])?y.Update(e,{},t):gp(e,t)}function $A(e,t,n,o){let i=O(e,t,n);return km(i,o)}function Wj(e){return ln(e)?Y(e.items)?Mm(e.items.items):Ke(e.items)?[e]:ce(e.items)?[e]:[me()]:[e]}function Mm(e){return e.reduce((n,o)=>[...n,...Wj(o)],[])}function be(e,t){return{callstack:e,visited:t}}function K(e){return s.ShiftLeft(e,(t,n)=>ce(t)?!1:K(n),()=>!0)}function ka(e,t,n){return s.Keys(n).reduce((o,i)=>({...o,[i]:O(e,t,n[i])}),{})}function gn(e,t,n){let o=jt(e,t,n);return Mm(o)}function jt(e,t,n){return n.map(o=>O(e,t,o))}function Zj(e,t){let n=et(e)?da(t,{}):t,o=Yn(e)?ma(n,{}):n;return Kn(e)?Ba(o,{}):o}function Xj(e,t,n,o,i){return s.IsEqual(n,"AddImmutable")?jA(e,t,o[0],i):s.IsEqual(n,"RemoveImmutable")?Zb(e,t,o[0],i):s.IsEqual(n,"AddReadonly")?wy(e,t,o[0],i):s.IsEqual(n,"RemoveReadonly")?ST(e,t,o[0],i):s.IsEqual(n,"AddOptional")?vy(e,t,o[0],i):s.IsEqual(n,"RemoveOptional")?xT(e,t,o[0],i):s.IsEqual(n,"Capitalize")?aS(e,t,o[0],i):s.IsEqual(n,"Conditional")?lS(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?dS(e,t,o[0],i):s.IsEqual(n,"Evaluate")?jb(e,t,o[0],i):s.IsEqual(n,"Exclude")?gS(e,t,o[0],o[1],i):s.IsEqual(n,"Extract")?TS(e,t,o[0],o[1],i):s.IsEqual(n,"Index")?FS(e,t,o[0],o[1],i):s.IsEqual(n,"InstanceType")?HS(e,t,o[0],i):s.IsEqual(n,"Interface")?Pb(e,t,o[0],o[1],i):s.IsEqual(n,"KeyOf")?XS(e,t,o[0],i):s.IsEqual(n,"Lowercase")?sS(e,t,o[0],i):s.IsEqual(n,"Mapped")?rA(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?wp(e,t,o[0],i):s.IsEqual(n,"NonNullable")?oA(e,t,o[0],i):s.IsEqual(n,"Pick")?EA(e,t,o[0],o[1],i):s.IsEqual(n,"Parameters")?pA(e,t,o[0],i):s.IsEqual(n,"Partial")?hA(e,t,o[0],i):s.IsEqual(n,"Omit")?sA(e,t,o[0],o[1],i):s.IsEqual(n,"ReadonlyObject")?CA(e,t,o[0],i):s.IsEqual(n,"Record")?BT(e,t,o[0],o[1],i):s.IsEqual(n,"Required")?MA(e,t,o[0],i):s.IsEqual(n,"ReturnType")?GA(e,t,o[0],i):s.IsEqual(n,"TemplateLiteral")?YI(e,t,o[0],i):s.IsEqual(n,"Uncapitalize")?cS(e,t,o[0],i):s.IsEqual(n,"Uppercase")?pS(e,t,o[0],i):s.IsEqual(n,"With")?$A(e,t,o[0],o[1]):v(n,o,i)}function Jj(e,t,n){let o=ce(n)?PA(e,t,n,n.$ref):Z(n)?Pt(O(e,t,n.items),No(n)):Wo(n)?Pp(e,t,n.target,n.arguments):Be(n)?lr(jt(e,t,n.parameters),O(e,t,n.instanceType),Ny(n)):He(n)?mr(jt(e,t,n.parameters),O(e,t,n.returnType),Ly(n)):Le(n)?Fn(O(e,t,n.if),O(e,t,n.then),O(e,t,n.else),jy(n)):M(n)?ut(jt(e,t,n.allOf),Ky(n)):D(n)?k(ka(e,t,n.properties),Gy(n)):de(n)?zc(it(n),O(e,t,Se(n))):ln(n)?Zn(O(e,t,n.items)):Y(n)?ke(gn(e,t,n.items),bT(n)):R(n)?F(jt(e,t,n.anyOf),mT(n)):n;return Zj(n,o)}function O(e,t,n){return on(n)?Xj(e,t,n.action,n.parameters,n.options):Jj(e,t,n)}function Qt(e,t){return O(e,be([],[]),t)}function eq(e){return y.Update(e,{"~immutable":!0},{})}function Ba(e,t){return y.Update(eq(e),{},t)}function jA(e,t,n,o){let i=O(e,t,n);return Ba(i,o)}function B_(e,t={}){return v("AddImmutable",[e],t)}function Do(e,t={}){return Ba(e,t)}function H_(e,t={}){return v("Evaluate",[e],t)}function ft(e,t={}){return um(e,t)}function K_(e,t={}){return v("Module",[e],t)}function qA(e,t={}){return wp({},be([],[]),e,t)}function tq(e,t){let n=Wn(e,t);return s.IsEqual(n,"right-inside")||s.IsEqual(n,"disjoint")?1:0}function FA(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>s.IsEqual(tq(e,o),1)?FA(e,i,[...n,o]):[...n,e,...t],()=>[...n,e])}function BA(e,t=[]){return s.ShiftLeft(e,(n,o)=>BA(o,FA(n,t)),()=>t)}function HA(e){return BA(e)}function KA(...e){let[t,n,o]=oe.Match(e,{2:(c,l)=>s.IsString(c)?[{},c,l]:[c,l,{}],3:(c,l,m)=>[c,l,m],1:c=>[{},c,{}]}),i=FI(n),a=s.IsArray(i)&&s.IsEqual(i.length,2)?O(t,be([],[]),i[0]):me();return y.Update(a,{},o)}var r={};Yt(r,{Any:()=>ko,Array:()=>Pt,BigInt:()=>ya,Boolean:()=>Lc,Call:()=>Qb,Capitalize:()=>rS,Codec:()=>vc,Conditional:()=>uS,Constructor:()=>lr,ConstructorParameters:()=>mS,Cyclic:()=>fr,Decode:()=>rT,DecodeBuilder:()=>ha,Dependent:()=>Fn,Encode:()=>nT,EncodeBuilder:()=>ga,Enum:()=>Hy,Evaluate:()=>ft,Exclude:()=>fS,Extends:()=>dt,ExtendsResult:()=>G,Extract:()=>hS,Function:()=>mr,Generic:()=>an,Identifier:()=>Ta,Immutable:()=>oT,Index:()=>ES,Infer:()=>fa,InstanceType:()=>BS,Instantiate:()=>Qt,Integer:()=>Vn,Interface:()=>Ub,Intersect:()=>ut,IsAny:()=>Ve,IsArray:()=>Z,IsBigInt:()=>vt,IsBoolean:()=>_t,IsCall:()=>Wo,IsCodec:()=>Hn,IsConstructor:()=>Be,IsCyclic:()=>Te,IsDependent:()=>Le,IsEnum:()=>ze,IsEnumValue:()=>By,IsFunction:()=>He,IsGeneric:()=>Lo,IsIdentifier:()=>cT,IsImmutable:()=>Kn,IsInfer:()=>Ke,IsInteger:()=>ot,IsIntersect:()=>M,IsKind:()=>w,IsLiteral:()=>Q,IsNever:()=>rr,IsNull:()=>hr,IsNumber:()=>Ce,IsObject:()=>D,IsOptional:()=>et,IsParameter:()=>lT,IsReadonly:()=>Yn,IsRecord:()=>de,IsRef:()=>ce,IsRefine:()=>Nc,IsRest:()=>ln,IsSchema:()=>Ue,IsString:()=>We,IsSymbol:()=>yr,IsTemplateLiteral:()=>Ee,IsThis:()=>Qc,IsTuple:()=>Y,IsUndefined:()=>or,IsUnion:()=>R,IsUnknown:()=>tt,IsUnsafe:()=>wc,IsVoid:()=>kt,KeyOf:()=>KS,Literal:()=>z,Lowercase:()=>nS,Mapped:()=>JS,Module:()=>qA,Never:()=>me,NonNullable:()=>nA,Null:()=>Go,Number:()=>Nt,Object:()=>k,Omit:()=>iA,Optional:()=>My,Parameter:()=>Qn,Parameters:()=>cA,Partial:()=>uA,Pick:()=>yA,Readonly:()=>iT,ReadonlyObject:()=>wm,ReadonlyType:()=>_A,Record:()=>Fo,RecordKey:()=>un,RecordPattern:()=>it,RecordValue:()=>Se,Ref:()=>nt,Refine:()=>aT,Required:()=>kA,Rest:()=>Zn,ReturnType:()=>DA,Script:()=>KA,String:()=>It,Symbol:()=>$o,TemplateLiteral:()=>QI,This:()=>Vc,Tuple:()=>ke,Uncapitalize:()=>oS,Undefined:()=>Bo,Union:()=>F,Unknown:()=>Qe,Unsafe:()=>$y,Uppercase:()=>iS,Void:()=>Wc,With:()=>Np});var zA="Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported.";var rq=rn(VA());var QA="lowercase-email",Dm="iana-timezone",Gm="simple-time",$m="simple-date-time";var nq=(e,t)=>RegExp(`^${e.source}(${t.source}${e.source})*$`),oq=/[a-zA-Z0-9-_]+/,iq=/\./,eCe=nq(oq,iq);var WA="lowercase-domain";var ti="kebab-case";var ZA="camel-case";var aq=new Set;function C(e,t,n={}){let o=t.map(i=>{let a=i;return a.$id?(aq.add(i),r.Ref(a.$id)):i});return r.Unsafe({...n,type:"object",discriminator:{propertyName:e},required:[e],oneOf:o})}function _e(e,t){return r.Object({values:r.Array(e,{maxItems:t.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:r.Optional(r.Boolean({description:"If true, exclude rows matching these values instead of including them"}))},{description:t.description})}function jm(e,t={}){return C("type",[r.Object({type:r.Literal("ids"),ids:r.Array(u({allowEmpty:!1}),{minItems:1,...t.maxIds!==void 0&&{maxItems:t.maxIds}})}),r.Object({type:r.Literal("all"),filters:r.Optional(e)})])}var ni=1e3,kp=100,fe={limit:r.Optional(r.Integer({minimum:1,maximum:ni,description:"Maximum number of items to return in this page."})),offset:r.Optional(r.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."}))},Ze={...fe,limit:r.Optional(r.Integer({minimum:1,maximum:ni,default:kp,description:`Maximum number of items to return in this page. Omit to use the public API default of ${kp}.`}))},sq=r.Object({totalCount:r.Integer({description:"Total number of items matching the query before `limit` and `offset` are applied."}),pageCount:r.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."}),aCe=r.Object({pagination:sq},{$id:"ResponseMetadata",description:"Metadata accompanying `data` on paginated operations, describing the full result set the page was taken from."});function A(e={}){return r.Unsafe({...e,type:"string"})}var ri=250;function u({allowEmpty:e=!0,type:t="short",description:n,default:o}={}){let i=e?0:1,a={...n===void 0?{}:{description:n},...o===void 0?{}:{default:o}};switch(t){case"camel-case":return r.String({format:ZA,minLength:i,maxLength:ri,...a});case"kebab-case":return r.String({format:ti,minLength:i,maxLength:ri,...a});case"email":return r.String({format:QA,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return r.String({format:WA,minLength:i,maxLength:ri,...a});case"tsuga-query":return r.String({format:"tsuga-query",minLength:i,maxLength:1e4,...a});case"tags-query":return r.String({format:"tags-query",minLength:i,maxLength:1e4,errorMessage:{format:`${zA} The query you provided is invalid: \${0}`},...a});case"date-time":return r.String({format:"date-time",...a});case"uri":return r.String({format:"uri",...a});case"user-password":return r.String({format:"user-password",minLength:12,maxLength:ri,...a});case"long":return r.String({minLength:i,maxLength:5e4,...a});case"short":return r.String({minLength:i,maxLength:ri,...a});case"tsuga-formula":return r.String({format:"tsuga-formula",minLength:i,maxLength:ri,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 r.String({format:"time",...a});case"readonly-sql-query":return r.String({format:"readonly-sql-query",minLength:i,maxLength:5e4,errorMessage:{format:"Must be a readonly SQL query - only SELECT statements are allowed."},...a});default:Je(t)}}var Ha=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],Mp=r.Array(r.Enum(Ha,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var qm=["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"],ECe=r.Enum(qm),cq=["CLUSTER_AGGREGATION_STRUCTURE"],_Ce=r.Object({code:r.Enum(qm),message:r.String()}),JA=[...qm,...cq,"ABORT_ERROR","BAD_REQUEST","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"],eO=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var pq=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],uq=[...JA,...eO,...pq],lq=r.Object({assetId:r.Optional(r.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:r.String({description:"Name of the asset that violated the policy. Set from submitted data or the existing asset row. Returned for every violation."}),assetType:r.Enum(Ha,{description:"Type of Tsuga asset validated by the policy. Set by the route that ran tag-policy validation. Returned for every violation."}),tagPolicyId:r.String({description:"Identifier of the active tag policy that was violated. Generated by Tsuga when the policy is created. Returned for every violation."}),tagKey:r.String({description:"Tag key required or constrained by the violated policy. Set by the tag policy. Returned for every violation."}),message:r.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."}),mq=C("type",[r.Object({type:r.Literal("invalid-syntax",{description:"Discriminator identifying a rule the grok parser could not parse at all."}),error:r.Object({offset:r.Integer({description:"Byte offset in the rule where parsing failed."}),detail:r.String({description:"Parser detail message."})},{description:"Position and parser message for the syntax failure."})},{$id:"GrokInvalidSyntax"}),r.Object({type:r.Literal("unknown-pattern",{description:"Discriminator identifying a rule that references a pattern name the grok engine does not provide."}),error:r.Object({offset:r.Integer({description:"Byte offset of the unknown pattern."}),unknownPattern:r.String({description:"The pattern name that is not supported."})},{description:"Position and name of the unsupported pattern."})},{$id:"GrokUnknownPattern"}),r.Object({type:r.Literal("invalid-filter",{description:"Discriminator identifying a rule whose filter is a known filter used incorrectly."}),error:r.Object({offset:r.Integer({description:"Byte offset of the invalid filter."}),invalidFilter:r.String({description:"The filter that is invalid."}),message:r.String({description:"Why the filter is invalid."})},{description:"Position, text, and reason for the invalid filter."})},{$id:"GrokInvalidFilter"}),r.Object({type:r.Literal("unknown-filter",{description:"Discriminator identifying a rule that references a filter name the grok engine does not implement."}),error:r.Object({offset:r.Integer({description:"Byte offset of the unknown filter."}),unknownFilter:r.String({description:"The filter name that is not implemented."}),message:r.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`."}),dq=r.Object({rule:r.String({description:"The rule that failed to compile."}),ruleIndex:r.Integer({description:"0-based index of the failing rule in the submitted `rules` array."}),error:mq},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),tO=C("type",[r.Object({type:r.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:r.Array(lq,{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"}),r.Object({type:r.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:r.Array(dq,{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."}),ICe=r.Object({code:r.Optional(r.Enum(uq,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"}),details:r.Optional(tO)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),bCe=r.Object({code:r.Optional(r.Enum(JA,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"}),details:r.Optional(tO)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),SCe=r.Object({code:r.Optional(r.Enum(eO,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),ACe=r.Object({requestId:r.String({description:"Identifier used to trace the lifecycle of this API request"}),error:r.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),OCe=r.Object({requestId:r.String({description:"Identifier used to trace the lifecycle of this API request"}),error:r.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function d({body:e,description:t,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},...t===void 0?{}:{description:t},...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},...t===void 0?{}:{description:t},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}}function rO(e,t){if(!t||typeof t!="object")return e;let n=new URLSearchParams;return Object.entries(t).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 N=r.Object({success:r.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 Gp="tsuga-cli";var to="/v0/oauth",nO=d({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${to}/authorize`,method:"GET",query:r.Partial(r.Object({response_type:r.String({description:"Must be `code`"}),client_id:r.String({description:"First-party client id or CIMD document URL"}),redirect_uri:r.String({description:"Client redirect URI"}),code_challenge:r.String({description:"PKCE code challenge"}),code_challenge_method:r.String({description:"Must be `S256`"}),state:r.String({description:"Opaque client state, echoed back"}),resource:r.String({description:"RFC 8707 resource indicator"})})),response:r.Object({},{description:"Never returned: this endpoint redirects (302) or renders an HTML error (400)"})}),oO=d({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${to}/token`,method:"POST",body:r.Partial(r.Object({grant_type:r.String({description:"`authorization_code` or `refresh_token`"}),code:r.String({description:"Authorization code being exchanged"}),code_verifier:r.String({description:"PKCE code verifier"}),redirect_uri:r.String({description:"Must match the redirect URI used on /authorize"}),client_id:r.String({description:"Client id, when sent by the client"}),refresh_token:r.String({description:"Refresh token, for `grant_type=refresh_token`"})})),response:r.Object({access_token:r.String(),token_type:r.Literal("Bearer"),expires_in:r.Number({description:"Access token lifetime in seconds"}),refresh_token:r.String()})}),qCe=d({description:"Resolve a signed authorization request handle for the consent page",url:`${to}/authorization-request`,method:"GET",query:r.Object({handle:r.String()}),response:r.Object({clientId:r.String(),clientName:r.String(),redirectUri:r.String()})}),FCe=d({description:"Approve or deny an OAuth authorization request from the consent page",url:`${to}/approve`,method:"POST",body:r.Object({handle:r.String({description:"The signed authorization request handle"}),approve:r.Boolean()}),response:r.Object({redirectTo:r.String({description:"The client's redirect URI carrying either the code or the denial"})})}),BCe=d({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${to}/introspect`,method:"POST",body:r.Object({token:r.String()}),response:r.Object({active:r.Boolean(),userId:r.Optional(r.String()),orgId:r.Optional(r.String())})}),fq=["pending","active","revoked"],gq=r.Object({id:r.String(),createdAt:A(),clientId:r.String({description:"Client ID Metadata Document URL or first-party client id"}),clientName:r.String({description:"Display name derived from the client identity"}),userId:r.String(),status:r.Enum(fq),lastUsedAt:r.Optional(A())}),HCe=d({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${to}/grants`,method:"GET",query:r.Object({allUsers:r.Optional(r.Boolean({description:"Admins only: list grants of every user in the org"}))}),response:r.Array(gq)}),KCe=d({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${to}/grants/:id`,method:"DELETE",params:r.Object({id:r.String()}),response:N});function iO(e,t){let n=new URL(nO.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:Gp,redirect_uri:t.redirectUri,code_challenge:t.challenge,code_challenge_method:"S256",state:t.state}).toString(),n.href}var Ka=class extends Error{constructor(n,o){super(n);this.code=o;this.name="OAuthTokenError"}};function hq(e){if(!e)return{};try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}async function aO(e,t){let n=await fetch(new URL(oO.url,e).href,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(t).toString()}),o=await n.text(),i=hq(o);if(n.status!==200){let a=i.error??`HTTP ${n.status}`;throw new Ka(`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*Pl)}}async function sO(e,t){return aO(e,{grant_type:"authorization_code",client_id:Gp,code:t.code,code_verifier:t.verifier,redirect_uri:t.redirectUri})}async function $p(e,t){return aO(e,{grant_type:"refresh_token",client_id:Gp,refresh_token:t})}var yq="Your session expired. Run `tsuga auth login` to sign in again.",Tq="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.",Eq=5*ca;function cO(e,t){return new Date(e.accessExpiresAt)<=new Date(t.getTime()+Eq)}function za(e){return`\u2022\u2022\u2022\u2022${e.slice(-4)}`}function Fm(e){return{accessToken:e.accessToken,accessExpiresAt:e.expiresAt.toISOString(),refreshToken:e.refreshToken}}function pO(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 uO(e){if(e)switch(e.kind){case"operation-api-key":return e.token;case"user-session":return e.userAuth.accessToken;default:Je(e)}}async function jp({userAuth:e,now:t,reload:n,refresh:o,persist:i}){if(!cO(e,t))return e;let a=n()??e;if(!cO(a,t))return a;if(!a.refreshToken)throw new Error(yq);let c;try{c=await o(a.refreshToken)}catch(m){throw m instanceof Ka&&m.code==="invalid_grant"?new Error(Tq,{cause:m}):new Error(`Could not renew your session: ${m instanceof Error?m.message:String(m)}. Retry the command.`,{cause:m})}let l=Fm(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 Bm={r:8,g:203,b:0},Hm={r:0,g:130,b:0},Km=["\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 zm(e,t,n){return Math.round(e+(t-e)*n)}function _q(e,t){let n=zm(Bm.r,Hm.r,t),o=zm(Bm.g,Hm.g,t),i=zm(Bm.b,Hm.b,t);return`\x1B[38;2;${n};${o};${i}m${e}\x1B[0m`}function Iq(e){if(!e)return`
|
|
33
|
+
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),BI=(e,t=[])=>p(p(qI(e),([n,o])=>p(om(o),([i,a])=>[[n,i],a])),([n,o])=>BI(o,[...t,n]),()=>[t,e]),Q$=e=>p(p(p(om(e),([t,n])=>p(BI(n),([o,i])=>p(p(qI(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[q_(t),n]),om=e=>p(p(V$(e),([t,n])=>p(p(H$(n),([o,i])=>[o,i],()=>p(K$(n),([o,i])=>[o,i],()=>p(z$(n),([o,i])=>[o,i],()=>p(Y$(n),([o,i])=>[o,i],()=>[])))),([o,i])=>p(fI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[B_(t),n]),W$=e=>p(p(om(e),([t,n])=>p(Q$(n),([o,i])=>[[t,o],i])),([t,n])=>[H_(t),n]),HI=e=>p(p(W$(e),([t,n])=>[t,n],()=>p(o$(e),([t,n])=>[t,n],()=>p(re(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function KI(e){let t=em(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:ge()}function X$(e){return e.join("|")}function J$(e){return e.slice(1,e.length-1)}function e1(e,t,n){return fn(t,`${n}${e}`)}function t1(e,t){return fn(e,`${t}${pT}`)}function r1(e,t){return fn(e,`${t}${kc}`)}function n1(e,t){return fn(e,`${t}${$c}`)}function o1(e,t){return va(q([z("false"),z("true")]),e,t)}function i1(e,t){return fn(e,`${t}${jc}`)}function a1(e,t,n){return fn(t,`${n}${J$(e)}`)}function s1(e,t,n){let o=Na(e,{});return va(o,t,n)}function c1(e,t,n){let o=wt(e);return va(o,t,n)}function zI(e,t,n,o=[]){return s.ShiftLeft(e,(i,a)=>zI(a,t,n,[...o,va(i,[],"")]),()=>fn(t,`${n}(${X$(o)})`))}function va(e,t,n){return ze(e)?c1(e.enum,t,n):ot(e)?r1(t,n):Q(e)?e1(e.const,t,n):vt(e)?t1(t,n):_t(e)?o1(t,n):Ce(e)?n1(t,n):We(e)?i1(t,n):Ee(e)?a1(e.pattern,t,n):VI(e)?s1(e.parameters[0],t,n):R(e)?zI(e.anyOf,t,n):Dy}function fn(e,t){return s.ShiftLeft(e,(n,o)=>va(n,o,t),()=>t)}function p1(e){return`^${fn(e,"")}$`}function YI(e){let t=p1(e);return qc(t)}function Na(e,t){return K(e)?y.Update(YI(e),{},t):Zc(e,t)}function QI(e,t,n,o){let i=jt(e,t,n);return Na(i,o)}function Zc(e,t={}){return v("TemplateLiteral",[e],t)}function VI(e){return Ue(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function WI(e){return Na(e,{})}function u1(e){let t=KI(e);return WI(t)}function ZI(e,t={}){let n=s.IsString(e)?u1(e):WI(e);return y.Update(n,{},t)}function Ee(e){return w(e,"TemplateLiteral")}var G={};Yt(G,{ExtendsFalse:()=>B,ExtendsTrue:()=>U,ExtendsUnion:()=>im,IsExtendsFalse:()=>l1,IsExtendsTrue:()=>JI,IsExtendsTrueLike:()=>Vo,IsExtendsUnion:()=>XI,Match:()=>Ae});function im(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function XI(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 JI(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 l1(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function Vo(e){return XI(e)||JI(e)}function Ae(e,t,n){return Vo(e)?t(e.inferred):n()}function m1(e,t,n,o){return Ae(J(e,n,o),i=>U(y.Assign(y.Assign(e,i),{[t]:n})),()=>B())}function d1(e,t){return U(e)}function f1(e,t,n,o,i){return Ae(J(e,t,n),a=>Ae(J(a,t,o),c=>U(c),()=>B()),()=>Ae(J(e,t,i),a=>U(a),()=>B()))}function g1(e,t,n){let o=wt(n);return J(e,t,o)}function eb(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(J(e,t,o),a=>eb(a,t,i),()=>B()),()=>U(e))}function h1(e,t,n){let o=ht(n);return J(e,t,o)}function tb(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(J(e,t,o),a=>U(a),()=>tb(e,t,i)),()=>B())}function ae(e,t,n){return Ve(n)?d1(e,t):Le(n)?f1(e,t,n.if,n.then,n.else):ze(n)?g1(e,t,n.enum):Ke(n)?m1(e,n.name,t,n.extends):M(n)?eb(e,t,n.allOf):Ee(n)?h1(e,t,n.pattern):R(n)?tb(e,t,n.anyOf):tt(n)?U(e):B()}function rb(e,t,n){return Ke(n)?ae(e,t,n):Ve(n)?U(e):tt(n)?U(e):im(e)}function y1(e,t){let n=zn(e),o=zn(t);return n&&o||!n&&o?!0:!(n&&!o)}function nb(e,t,n,o){return Z(o)?y1(t,o)?J(e,n,o.items):B():ae(e,t,o)}function ob(e,t,n){return vt(n)?U(e):ae(e,t,n)}function ib(e,t,n){return _t(n)?U(e):ae(e,t,n)}function T1(e,t,n,o,i){let a=Ke(o)?t:o,c=Ke(o)?o:t,l=et(t),m=et(o);return!l&&m?B():Ae(J(e,a,c),f=>La(f,n,i),()=>B())}function E1(e,t,n,o){return s.ShiftLeft(o,(i,a)=>T1(e,t,n,i,a),()=>et(t)?U(e):B())}function _1(e,t,n){return s.ShiftLeft(t,(o,i)=>E1(e,o,i,n),()=>U(e))}function La(e,t,n){return _1(e,t,n)}function Op(e,t,n){return kt(n)?U(e):J(e,t,n)}function ab(e,t,n,o){return Ve(o)?U(e):tt(o)?U(e):Be(o)?Ae(La(e,t,o.parameters),i=>Op(i,n,o.instanceType),()=>B()):B()}function sb(e,t,n,o,i){return Ae(J(e,t,i),()=>J(e,n,i),()=>J(e,o,i))}function cb(e,t,n){let o=wt(t);return J(e,o,n)}function pb(e,t,n,o){return Ve(o)?U(e):tt(o)?U(e):He(o)?Ae(La(e,t,o.parameters),i=>Op(i,n,o.returnType),()=>B()):B()}function ub(e,t,n){return ot(n)?U(e):Ce(n)?U(e):ae(e,t,n)}function lb(e,t,n){let o=we(t);return J(e,o,n)}function xp(e,t,n){return t===n?U(e):B()}function I1(e,t,n){return Q(n)?xp(e,t,n.const):vt(n)?U(e):ae(e,z(t),n)}function b1(e,t,n){return Q(n)?xp(e,t,n.const):_t(n)?U(e):ae(e,z(t),n)}function S1(e,t,n){return Q(n)?xp(e,t,n.const):Ce(n)?U(e):ae(e,z(t),n)}function A1(e,t,n){return Q(n)?xp(e,t,n.const):We(n)?U(e):ae(e,z(t),n)}function mb(e,t,n){return s.IsBigInt(t.const)?I1(e,t.const,n):s.IsBoolean(t.const)?b1(e,t.const,n):s.IsNumber(t.const)?S1(e,t.const,n):s.IsString(t.const)?A1(e,t.const,n):ge()}function db(e,t,n){return Ke(n)?ae(e,t,n):U(e)}function fb(e,t,n){return hr(n)?U(e):ae(e,t,n)}function gb(e,t,n){return Ce(n)?U(e):ae(e,t,n)}function O1(e,t,n){return et(t)?et(n)?U(e):B():U(e)}function x1(e,t,n){return Ke(n)&&rr(n.extends)?B():Ae(J(e,t,n),o=>O1(o,t,n),()=>B())}function R1(e,t){return e.reduce((n,o)=>o in t?Vo(t[o])?{...n,...t[o].inferred}:ge():ge(),{})}function C1(e,t,n){let o={};for(let c of s.Keys(n))o[c]=c in t?x1({},t[c],n[c]):et(n[c])?Ke(n[c])?U(y.Assign(e,{[n[c].name]:n[c].extends})):U(e):B();let i=s.Values(o).every(c=>Vo(c)),a=i?R1(s.Keys(o),o):{};return i?U(a):B()}function P1(e,t,n){let o=C1(e,t,n);return Vo(o)?U(y.Assign(e,o.inferred)):B()}function U1(e,t,n){return P1(e,t,n)}function w1(e,t){return s.Keys(t).reduce((n,o)=>({...n,[o]:s.HasPropertyKey(e,o)?R(n[o])?q([...n[o].anyOf,t[o]]):q([e[o],t[o]]):t[o]}),e)}function hb(e,t,n,o){return s.ShiftLeft(t,(i,a)=>Ae(J({},e[i],n),c=>hb(e,a,n,w1(o,c)),()=>B()),()=>U(o))}function v1(e,t,n,o){let i=s.Keys(t);return hb(t,i,o,e)}function yb(e,t,n){return de(n)?v1(e,t,it(n),Se(n)):D(n)?U1(e,t,n.properties):ae(e,k(t),n)}function N1(e,t){return s.IsEqual(s.Keys(t).length,0)?U(e):B()}function L1(e,t,n,o,i){return J(e,n,i)}function Tb(e,t,n,o){return de(o)?L1(e,Yc(t),n,Yc(it(o)),Se(o)):D(o)?N1(e,o.properties):Ve(o)?U(e):tt(o)?U(e):B()}function Eb(e,t,n){return We(n)?U(e):ae(e,t,n)}function _b(e,t,n){return yr(n)?U(e):ae(e,t,n)}function Ib(e,t,n){let o=ht(t);return J(e,o,n)}function am(e,t){return y.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function ka(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 sm(e){return ln(e)?Ke(e.items)?Z(e.items.extends)?am(e.items.name,e.items.extends.items):tt(e.items.extends)?am(e.items.name,e.items.extends):void 0:ge():void 0}function Rp(e){return Ke(e)?am(e.name,e.extends):void 0}function cm(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>Ae(J({},o,t),()=>cm(i,t,[...n,o]),()=>{}),()=>n)}function bb(e,t,n,o){let i=cm(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:ke(i)})):B()}function Cp(e,t,n,o){let i=cm(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:q(i)})):B()}function k1(e){return[...e].reverse()}function pm(e,t){return t?k1(e):e}function M1(e){let t=e.length>0?e[0]:void 0,n=Ue(t)?sm(t):void 0;return Ue(n)}function D1(e,t,n,o,i,a){return Ae(J(e,n,i),c=>Sb(c,t,o,a),()=>B())}function G1(e,t,n,o,i){let a=sm(o);return ka(a)?bb(e,a.name,pm(n,t),a.type):s.ShiftLeft(n,(c,l)=>D1(e,t,c,l,o,i),()=>B())}function $1(e,t,n,o){return s.ShiftLeft(o,(i,a)=>G1(e,t,n,i,a),()=>s.IsEqual(n.length,0)?U(e):B())}function Sb(e,t,n,o){return $1(e,t,n,o)}function j1(e,t,n){let o=gn(e,be([],[]),n),i=M1(o);return Sb(e,i,pm(t,i),pm(o,i))}function Ab(e,t,n){let o=Rp(n);return ka(o)?Cp(e,o.name,t,o.type):s.ShiftLeft(t,(i,a)=>Ae(J(e,i,n),c=>Ab(c,a,n),()=>B()),()=>U(e))}function Ob(e,t,n){let o=gn(e,be([],[]),t);return Y(n)?j1(e,o,n.items):Z(n)?Ab(e,o,n.items):ae(e,ke(o),n)}function xb(e,t,n){return kt(n)?U(e):or(n)?U(e):ae(e,t,n)}function Rb(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(J(e,t,o),a=>U(a),()=>Rb(e,t,i)),()=>B())}function um(e,t,n){return s.ShiftLeft(t,(o,i)=>Ae(Rb(e,o,n),a=>um(a,i,n),()=>B()),()=>U(e))}function Cb(e,t,n){let o=Rp(n);return ka(o)?Cp(e,o.name,t,o.type):R(n)?um(e,t,n.anyOf):um(e,t,[n])}function Pb(e,t,n){return Ke(n)?ae(e,t,n):Ve(n)?U(e):tt(n)?U(e):B()}function Ub(e,t,n){return kt(n)?U(e):ae(e,t,n)}function J(e,t,n){return Ve(t)?rb(e,t,n):Z(t)?nb(e,t,t.items,n):vt(t)?ob(e,t,n):_t(t)?ib(e,t,n):Be(t)?ab(e,t.parameters,t.instanceType,n):Le(t)?sb(e,t.if,t.then,t.else,n):ze(t)?cb(e,t.enum,n):He(t)?pb(e,t.parameters,t.returnType,n):ot(t)?ub(e,t,n):M(t)?lb(e,t.allOf,n):Q(t)?mb(e,t,n):rr(t)?db(e,t,n):hr(t)?fb(e,t,n):Ce(t)?gb(e,t,n):D(t)?yb(e,t.properties,n):de(t)?Tb(e,it(t),Se(t),n):We(t)?Eb(e,t,n):yr(t)?_b(e,t,n):Ee(t)?Ib(e,t.pattern,n):Y(t)?Ob(e,t.items,n):or(t)?xb(e,t,n):R(t)?Cb(e,t.anyOf,n):tt(t)?Pb(e,t,n):kt(t)?Ub(e,t,n):B()}function F1(e,t){return we([...e,k(t)])}function lm(e,t,n){return K(e)?y.Update(F1(e,t),{},n):Ra(e,t,n)}function wb(e,t,n,o,i){let a=jt(e,t,n),c=Ma(e,t,o);return lm(a,c,i)}function Ra(e,t,n={}){return v("Interface",[e,t],n)}function Qo(e){return Ue(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function vb(e,t,n={}){return lm(e,t,n)}function q1(e,t,n){return e.includes(n)?!0:Da([...e,n],t,t[n])}function Nb(e,t,n){let o=Uc(n);return eo(e,t,o)}function eo(e,t,n){return s.ShiftLeft(n,(o,i)=>Da(e,t,o)?!0:eo(e,t,i),()=>!1)}function Da(e,t,n){return ce(n)?q1(e,t,n.$ref):Z(n)?Da(e,t,n.items):Be(n)?eo(e,t,[...n.parameters,n.instanceType]):He(n)?eo(e,t,[...n.parameters,n.returnType]):Qo(n)?Nb(e,t,n.parameters[1]):M(n)?eo(e,t,n.allOf):D(n)?Nb(e,t,n.properties):R(n)?eo(e,t,n.anyOf):Y(n)?eo(e,t,n.items):de(n)?Da(e,t,Se(n)):!1}function Lb(e,t,n){return Da(e,t,n)}function B1(e,t){return t.reduce((n,o)=>Lb([o],e,e[o])?[...n,o]:n,[])}function kb(e){let t=Pc(e);return B1(e,t)}function H1(e,t,n){return n.includes(t)?n:t in e?Ga(e,e[t],[...n,t]):ge()}function Mb(e,t,n){let o=Uc(t);return Wo(e,o,n)}function Wo(e,t,n){return t.reduce((o,i)=>Ga(e,i,o),n)}function Ga(e,t,n){return ce(t)?H1(e,t.$ref,n):Z(t)?Ga(e,t.items,n):Be(t)?Wo(e,[...t.parameters,t.instanceType],n):He(t)?Wo(e,[...t.parameters,t.returnType],n):Qo(t)?Mb(e,t.parameters[1],n):M(t)?Wo(e,t.allOf,n):D(t)?Mb(e,t.properties,n):R(t)?Wo(e,t.anyOf,n):Y(t)?Wo(e,t.items,n):de(t)?Ga(e,Se(t),n):n}function Db(e,t,n){return Ga(e,n,[t])}function K1(e){return Mo()}function z1(e){return s.Keys(e).reduce((t,n)=>({...t,[n]:to(e[n])}),{})}function $a(e){return e.reduce((t,n)=>[...t,to(n)],[])}function to(e){return ce(e)?K1(e.$ref):Z(e)?Pt(to(e.items),Lo(e)):Be(e)?lr($a(e.parameters),to(e.instanceType)):He(e)?mr($a(e.parameters),to(e.returnType)):M(e)?ut($a(e.allOf)):D(e)?k(z1(e.properties)):de(e)?Bo(un(e),to(Se(e))):R(e)?q($a(e.anyOf)):Y(e)?ke($a(e.items)):e}function Y1(e,t){return t in e?to(e[t]):Qe()}function Gb(e){return Y1(e.$defs,e.$ref)}function V1(e,t,n){let o=jt(e,be([],[]),t),i=Ma({},be([],[]),n);return we([...o,k(i)])}function Q1(e,t){return s.Keys(e).filter(o=>t.includes(o)).reduce((o,i)=>{let a=e[i],c=Qo(a)?V1(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function $b(e,t,n){let o=Db(e,t,n),i=Q1(e,o);return fr(i,t)}function jb(e,t){return t in e?ce(e[t])?jb(e,e[t].$ref):e[t]:me()}function Tr(e,t){return jb(e,t)}function Fb(e){return Te(e)?Gb(e):wc(e)?Qe():e}function dt(e,t,n){let o=Fb(t),i=Fb(n);return J(e,o,i)}var ba="equal",W1="disjoint",Sa="left-inside",Aa="right-inside";function Zn(e,t){let n=[tt(e)?G.ExtendsFalse():dt({},e,t),tt(e)?G.ExtendsTrue({}):dt({},t,e)];return G.IsExtendsTrueLike(n[0])&&G.IsExtendsTrueLike(n[1])?ba:G.IsExtendsTrueLike(n[0])&&G.IsExtendsFalse(n[1])?Sa:G.IsExtendsFalse(n[0])&&G.IsExtendsTrueLike(n[1])?Aa:W1}function Z1(e,t){return t.filter(n=>Zn(e,n)!==Aa)}function X1(e,t){let n=t.some(o=>{let i=Zn(e,o);return s.IsEqual(i,Sa)||s.IsEqual(i,ba)});return s.IsEqual(n,!1)}function J1(e,t){let n=Vt(e);return Ve(n)?[n]:X1(n,t)?[...Z1(n,t),n]:t}function ej(e){return e.reduce((t,n)=>D(n)?[...t,n]:rr(n)?t:J1(n,t),[])}function Bl(e){let t=ej(e);return qo(t)}function mm(e,t){return y.Update(Vt(e),{},t)}function qb(e,t,n,o){let i=O(e,t,n);return mm(i,o)}function ja(e,t=[]){return on(e)&&s.IsEqual(e.action,"Conditional")?ce(e.parameters[0])?ja(e.parameters[2],ja(e.parameters[3],[...t,e.parameters[0].$ref])):ja(e.parameters[2],ja(e.parameters[3],t)):on(e)&&s.IsEqual(e.action,"Mapped")&&on(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&ce(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function tj(e,t){return e.reduce((n,o)=>[...n,t.includes(o.name)],[])}function Kb(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>s.ShiftLeft(t,(a,c)=>Kb(i,c,[...n,[a,o]]),()=>n),()=>n)}function rj(e){return Ee(e)?ht(e.pattern):ze(e)?wt(e.enum):e}function nj(e){let t=rj(e);return R(t)?[...t.anyOf]:[t]}function oj(e,t){return e.reduce((n,o)=>[...n,[...o,t]],[])}function Bb(e,t){return t.reduce((n,o)=>[...n,...oj(e,o)],[])}function Hb(e){return e.reduce((t,n)=>s.IsEqual(n[0],!0)?Bb(t,nj(n[1])):Bb(t,[n[1]]),[[]])}function zb(e,t,n){let o=ja(n),i=tj(e,o),a=Kb(t,i);return on(n)&&s.IsEqual(n.action,"Conditional")||on(n)&&s.IsEqual(n.action,"Mapped")?Hb(a):[t]}function ij(){return["(not-resolvable)",me()]}function aj(){return["(not-generic)",me()]}function sj(e,t,n){return[e,an(t,n)]}function cj(e,t,n){return t in e?Yb(e,t,e[t],n):ij()}function Yb(e,t,n,o){return ko(n)?sj(t,n.parameters,n.expression):ce(n)?cj(e,n.$ref,o):aj()}function Vb(e,t,n){return Yb(e,"(anonymous)",t,n)}function pj(e,t,n){if(Ke(t)||Zo(t)||G.IsExtendsTrueLike(dt({},t,n)))return;let o={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:o})}function Qb(e,t,n,o,i){let a=O(e,t,i);return pj(n,a,o),y.Assign(e,{[n]:a})}function uj(e,t,n,o,i){let a=O(e,t,n.extends),c=O(e,t,n.equals);return s.ShiftLeft(i,(l,m)=>dm(Qb(e,t,n.name,a,l),t,o,m),()=>dm(Qb(e,t,n.name,a,c),t,o,[]))}function dm(e,t,n,o){return s.ShiftLeft(n,(i,a)=>uj(e,t,i,a,o),()=>e)}function Wb(e,t,n,o){return dm(e,t,n,o)}var fm=0,gm=0;function lj(){if(!s.IsLessThan(gm,rt.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function mj(){lj(),gm++,fm++}function dj(){fm--,s.IsEqual(fm,0)&&(gm=0)}function fj(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function gj(e,t){return s.IsEqual(fj(e),t)}function hj(e,t,n,o,i,a){mj();try{let c=Wb(e,t,o,a),l=O(c,be([...t.callstack,n.$ref],t.visited),i);return O(c,be([],[]),l)}finally{dj()}}function yj(e,t,n,o,i,a){return a.reduce((c,l)=>{let m=hj(e,t,n,o,i,l);return[...c,m]},[])}function Tj(e,t,n,o,i,a){let c=zb(o,a,i),l=yj(e,t,n,o,i,c);return s.IsEqual(l.length,1)?l[0]:Lt(l)}function Pp(e,t,n,o){let i=jt(e,t,o),a=Vb(e,n,o),c=a[0],l=a[1];return ko(l)?gj(t,c)?Ca(nt(c),i):Tj(e,t,nt(c),l.parameters,l.expression,i):Ca(n,i)}function Ca(e,t){return y.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Zb(e,t){return Pp({},be([],[]),e,t)}function Zo(e){return w(e,"Call")}function Ej(e){return y.Discard(e,["~immutable"])}function Xb(e,t){return y.Update(Ej(e),{},t)}function Jb(e,t,n,o){let i=O(e,t,n);return Xb(i,o)}function eS(e,t){return e(t)}function tS(e,t){return s.IsString(t)?z(eS(e,t)):z(t)}function rS(e,t){let n=ht(t);return $r(e,n)}function nS(e,t){let n=t.map(o=>$r(e,o));return q(n)}function $r(e,t){return Q(t)?tS(e,t.const):Ee(t)?rS(e,t.pattern):R(t)?nS(e,t.anyOf):t}function Xc(e,t={}){return v("Capitalize",[e],t)}function oS(e,t={}){return hm(e,t)}function Jc(e,t={}){return v("Lowercase",[e],t)}function iS(e,t={}){return ym(e,t)}function ep(e,t={}){return v("Uncapitalize",[e],t)}function aS(e,t={}){return Tm(e,t)}function tp(e,t={}){return v("Uppercase",[e],t)}function sS(e,t={}){return Em(e,t)}var _j=e=>e[0].toUpperCase()+e.slice(1),Ij=e=>e.toLowerCase(),bj=e=>e[0].toLowerCase()+e.slice(1),Sj=e=>e.toUpperCase();function hm(e,t){return K([e])?y.Update($r(_j,e),{},t):Xc(e,t)}function ym(e,t){return K([e])?y.Update($r(Ij,e),{},t):Jc(e,t)}function Tm(e,t){return K([e])?y.Update($r(bj,e),{},t):ep(e,t)}function Em(e,t){return K([e])?y.Update($r(Sj,e),{},t):tp(e,t)}function cS(e,t,n,o){let i=O(e,t,n);return hm(i,o)}function pS(e,t,n,o){let i=O(e,t,n);return ym(i,o)}function uS(e,t,n,o){let i=O(e,t,n);return Tm(i,o)}function lS(e,t,n,o){let i=O(e,t,n);return Em(i,o)}function rp(e,t,n,o,i={}){return v("Conditional",[e,t,n,o],i)}function mS(e,t,n,o,i={}){return _m({},be([],[]),e,t,n,o,i)}function Aj(e,t,n,o,i,a){let c=dt(e,n,o);return G.IsExtendsUnion(c)?q([O(c.inferred,t,i),O(e,t,a)]):G.IsExtendsTrue(c)?O(c.inferred,t,i):O(e,t,a)}function _m(e,t,n,o,i,a,c){return K([n,o])?y.Update(Aj(e,t,n,o,i,a),{},c):rp(n,o,i,a,c)}function dS(e,t,n,o,i,a,c){let l=O(e,t,n),m=O(e,t,o);return _m(e,t,l,m,i,a,c)}function np(e,t={}){return v("ConstructorParameters",[e],t)}function fS(e,t={}){return Im(e,t)}function Oj(e){let t=Be(e)?e.parameters:[],n=gn({},be([],[]),t);return ke(n)}function Im(e,t){return K([e])?y.Update(Oj(e),{},t):np(e,t)}function gS(e,t,n,o){let i=O(e,t,n);return Im(i,o)}function op(e,t,n={}){return v("Exclude",[e,t],n)}function hS(e,t,n={}){return Fa(e,t,n)}function Fa(e,t,n){return K([e,t])?y.Update(Hc(e,t),{},n):op(e,t,n)}function yS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Fa(a,c,i)}function ip(e,t,n={}){return v("Extract",[e,t],n)}function TS(e,t,n={}){return bm(e,t,n)}function xj(e,t){let n=dt({},e,t);return G.IsExtendsTrueLike(n)?[e]:[]}function Rj(e,t){return e.reduce((n,o)=>[...n,...xj(o,t)],[])}function ES(e,t){let n=Vt(e),o=R(n)?n.anyOf:[n],i=Rj(o,t);return Lt(i)}function bm(e,t,n){return K([e,t])?y.Update(ES(e,t),{},n):ip(e,t,n)}function _S(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return bm(a,c,i)}function Cj(e){return e.reduce((t,n)=>Mc(n)?[...t,z(n)]:t,[])}function Xo(e){let t=Cj(e);return q(t)}function Pa(e,t,n={}){return v("Index",[e,t],n)}function IS(e,t,n={}){let o=s.IsArray(t)?Xo(t):t;return Sm(e,o,n)}function bS(e,t){let n=Tr(e,t);return Ft(n)}function SS(e,t,n){let o=nr(e,t,n);return Ft(o)}function Pj(e,t){let n=s.Keys(e).filter(h=>!s.HasPropertyKey(t,h)),o=s.Keys(t).filter(h=>!s.HasPropertyKey(e,h)),i=s.Keys(e).filter(h=>s.HasPropertyKey(t,h)),a=n.reduce((h,E)=>({...h,[E]:e[E]}),{}),c=o.reduce((h,E)=>({...h,[E]:t[E]}),{}),l=i.reduce((h,E)=>({...h,[E]:we([e[E],t[E]])}),{}),m=y.Assign(a,c);return y.Assign(m,l)}function AS(e){return e.reduce((t,n)=>Pj(t,Ft(n)),{})}function OS(e){let t=UT(ke(e));return Ft(t)}function Uj(e,t){return s.Keys(e).filter(i=>i in t).reduce((i,a)=>({...i,[a]:Lt([e[a],t[a]])}),{})}function xS(e,t){return s.ShiftLeft(e,(n,o)=>xS(o,Uj(t,Ft(n))),()=>t)}function RS(e){return s.ShiftLeft(e,(t,n)=>xS(n,Ft(t)),()=>ge())}function Ft(e){return Te(e)?bS(e.$defs,e.$ref):Le(e)?SS(e.if,e.then,e.else):M(e)?AS(e.allOf):R(e)?RS(e.anyOf):Y(e)?OS(e.items):D(e)?e.properties:{}}function Jo(e){let t=Ft(e);return k(t)}var wj=new RegExp("^(?:0|[1-9][0-9]*)$");function ei(e){let t=`${e}`;return wj.test(t)?parseInt(t):e}function vj(e){return z(ei(e))}function CS(e){return e.map(t=>PS(t))}function PS(e){return M(e)?ut(CS(e.allOf)):R(e)?q(CS(e.anyOf)):Q(e)?vj(e.const):e}function US(e,t){let n=PS(t),o=dt({},n,Nt());return G.IsExtendsTrueLike(o)?e:Q(t)&&s.IsEqual(t.const,"length")?Nt():me()}function wS(e,t){let n=Tr(e,t);return Mt(n)}function vS(e,t,n){let o=nr(e,t,n);return Mt(o)}function NS(e){let t=wt(e);return Mt(t)}function LS(e){let t=we(e);return Mt(t)}function kS(e){return[`${e}`]}function MS(e){let t=ht(e);return Mt(t)}function DS(e){return e.reduce((t,n)=>[...t,...Mt(n)],[])}function Mt(e){return Te(e)?wS(e.$defs,e.$ref):Le(e)?vS(e.if,e.then,e.else):ze(e)?NS(e.enum):M(e)?LS(e.allOf):Q(e)?kS(e.const):Ee(e)?MS(e.pattern):R(e)?DS(e.anyOf):[]}function ti(e){return Mt(e)}function qa(e,t){return t.map(n=>Ba(e,n))}function Ba(e,t){return Z(t)?Pt(Ba(e,t.items)):Be(t)?lr(qa(e,t.parameters),Ba(e,t.instanceType)):He(t)?mr(qa(e,t.parameters),Ba(e,t.returnType)):Y(t)?ke(qa(e,t.items)):R(t)?q(qa(e,t.anyOf)):M(t)?ut(qa(e,t.allOf)):Qc(t)?k(e):t}function GS(e,t){return Ba(e,t)}function Nj(e,t){let n=t in e?e[t]:me();return GS(e,n)}function $S(e,t){return t.reduce((n,o)=>[...n,Nj(e,o)],[])}function Lj(e,t){let n=ti(t),o=$S(e,n);return Lt(o)}var kj=new RegExp(pn);function Mj(e){return e.filter(n=>kj.test(n))}function Dj(e){let t=Pc(e),n=Mj(t),o=$S(e,n);return Lt(o)}function jS(e,t){return Ce(t)?Dj(e):Lj(e,t)}function Gj(e){return z(ei(e))}function FS(e){return e.map(t=>Am(t))}function Am(e){return M(e)?ut(FS(e.allOf)):R(e)?q(FS(e.anyOf)):Q(e)?Gj(e.const):e}function $j(e,t){return e.reduceRight((n,o,i)=>{let a=dt({},z(i),t);return G.IsExtendsTrueLike(a)?[o,...n]:n},[])}function jj(e,t){let n=Am(t),o=$j(e,n);return Dr(o)}function Fj(e){return Dr(e)}function qS(e,t){return Q(t)&&s.IsEqual(t.const,"length")?z(e.length):Ce(t)||ot(t)?Fj(e):jj(e,t)}function BS(e,t){return Z(e)?US(e.items,t):D(e)?jS(e.properties,t):Y(e)?qS(e.items,t):me()}function qj(e){return Te(e)||Le(e)||M(e)||R(e)?Jo(e):e}function Sm(e,t,n){return K([e,t])?y.Update(BS(qj(e),t),{},n):Pa(e,t,n)}function HS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Sm(a,c,i)}function ap(e,t={}){return v("InstanceType",[e],t)}function KS(e,t={}){return Om(e,t)}function Bj(e){return Be(e)?e.instanceType:me()}function Om(e,t){return K([e])?y.Update(Bj(e),{},t):ap(e,t)}function zS(e,t,n,o={}){let i=O(e,t,n);return Om(i,o)}function Ua(e,t={}){return v("KeyOf",[e],t)}function YS(e,t={}){return xm(e,t)}function VS(){return q([Nt(),It(),jo()])}function QS(e){return Nt()}function Hj(e){return e.reduce((n,o)=>Mc(o)?[...n,z(ei(o))]:ge(),[])}function WS(e){let t=s.Keys(e),n=Hj(t);return Dr(n)}function ZS(e){return un(e)}function XS(e){let t=e.map((n,o)=>z(o));return Dr(t)}function JS(e){return Ve(e)?VS():Z(e)?QS(e.items):D(e)?WS(e.properties):de(e)?ZS(e):Y(e)?XS(e.items):me()}function Kj(e){return Te(e)||Le(e)||M(e)||R(e)?Jo(e):e}function xm(e,t){return K([e])?y.Update(JS(Kj(e)),{},t):Ua(e,t)}function eA(e,t,n,o){let i=O(e,t,n);return xm(i,o)}function xa(e,t,n,o,i={}){return v("Mapped",[e,t,n,o],i)}function tA(e,t,n,o,i={}){return Rm({},be([],[]),e,t,n,o,i)}function zj(e){let t=ht(e);return Up(t)}function Yj(e){return e.reduce((t,n)=>[...t,...Up(n)],[])}function Vj(e){let t=wt(e);return Up(t)}function Qj(e){return s.IsNumber(e)?[z(`${e}`)]:[z(e)]}function Up(e){return ze(e)?Vj(e.enum):Q(e)?Qj(e.const):Ee(e)?zj(e.pattern):R(e)?Yj(e.anyOf):[e]}function rA(e){return Up(e)}function Wj(e){return Ee(e)?ht(e.pattern):e}function Zj(e,t,n,o,i,a){let c=y.Assign(e,{[n.name]:o}),l=O(c,t,i),m=Wj(l),f=O(c,t,a);return Dc(m)||Gc(m)?{[m.const]:f}:{}}function Xj(e,t,n,o,i,a){return o.reduce((c,l)=>[...c,Zj(e,t,n,l,i,a)],[])}function Jj(e){return e.reduce((t,n)=>[...t,k(n)],[])}function nA(e,t,n,o,i,a){let c=rA(o),l=Xj(e,t,n,c,i,a),m=Jj(l);return we(m)}function Rm(e,t,n,o,i,a,c){return K([o])?y.Update(nA(e,t,n,o,i,a),{},c):xa(n,o,i,a,c)}function oA(e,t,n,o,i,a,c){let l=O(e,t,o);return Rm(e,t,n,l,i,a,c)}function eF(e,t,n){let o=y.Assign(e,t);return s.Keys(t).filter(a=>n.includes(a)).reduce((a,c)=>({...a,[c]:$b(o,c,t[c])}),{})}function tF(e,t,n){let o=y.Assign(e,t);return s.Keys(t).filter(a=>!n.includes(a)).reduce((a,c)=>({...a,[c]:O(o,be([],[]),t[c])}),{})}function rF(e,t,n){let o=kb(t),i=eF(e,t,o),a=tF(e,t,o),c={...i,...a};return y.Update(c,{},n)}function wp(e,t,n,o){return rF(e,n,o)}function sp(e,t={}){return v("NonNullable",[e],t)}function iA(e,t={}){return Cm(e,t)}function nF(e){let t=q([$o(),Ho()]);return Fa(e,t,{})}function Cm(e,t){return K([e])?y.Update(nF(e),{},t):sp(e,t)}function aA(e,t,n,o){let i=O(e,t,n);return Cm(i,o)}function cp(e,t,n={}){return v("Omit",[e,t],n)}function sA(e,t,n={}){let o=s.IsArray(t)?Xo(t):t;return Pm(e,o,n)}function vp(e){let t=Jo(e);return D(t)?t.properties:ge()}function oF(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?o:{...o,[i]:e[i]},{})}function cA(e,t){let n=vp(e),o=ti(t),i=oF(n,o);return k(i)}function Pm(e,t,n){return K([e,t])?y.Update(cA(e,t),{},n):cp(e,t,n)}function pA(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Pm(a,c,i)}function pp(e,t={}){return v("Parameters",[e],t)}function uA(e,t={}){return Um(e,t)}function iF(e){let t=He(e)?e.parameters:[],n=gn({},be([],[]),t);return ke(n)}function Um(e,t){return K([e])?y.Update(iF(e),{},t):pp(e,t)}function lA(e,t,n,o){let i=O(e,t,n);return Um(i,o)}function up(e,t={}){return v("Partial",[e],t)}function mA(e,t={}){return wm(e,t)}function dA(e,t){let n=Tr(e,t),o=Er(n);return fr(y.Assign(e,{[t]:o}),t)}function fA(e,t,n){let o=nr(e,t,n);return Er(o)}function gA(e){let t=we(e);return Er(t)}function hA(e){let t=e.map(n=>Er(n));return q(t)}function yA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:qn(e[i])}),{});return k(t)}function Er(e){return Te(e)?dA(e.$defs,e.$ref):Le(e)?fA(e.if,e.then,e.else):M(e)?gA(e.allOf):R(e)?hA(e.anyOf):D(e)?yA(e.properties):k({})}function wm(e,t){return K([e])?y.Update(Er(e),{},t):up(e,t)}function TA(e,t,n,o){let i=O(e,t,n);return wm(i,o)}function lp(e,t,n={}){return v("Pick",[e,t],n)}function EA(e,t,n={}){let o=s.IsArray(t)?Xo(t):t;return vm(e,o,n)}function aF(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function _A(e,t){let n=vp(e),o=ti(t),i=aF(n,o);return k(i)}function vm(e,t,n){return K([e,t])?y.Update(_A(e,t),{},n):lp(e,t,n)}function IA(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return vm(a,c,i)}function mp(e,t={}){return v("ReadonlyObject",[e],t)}function Nm(e,t={}){return Lm(e,t)}var bA=Nm;function SA(e){return Go(Pt(e))}function AA(e,t){let n=Tr(e,t),o=_r(n);return fr(y.Assign(e,{[t]:o}),t)}function OA(e,t,n){let o=nr(e,t,n);return _r(o)}function xA(e){let t=we(e);return _r(t)}function RA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:Yn(e[i])}),{});return k(t)}function CA(e){return Go(ke(e))}function PA(e){let t=e.map(n=>_r(n));return q(t)}function _r(e){return Z(e)?SA(e.items):Te(e)?AA(e.$defs,e.$ref):Le(e)?OA(e.if,e.then,e.else):M(e)?xA(e.allOf):D(e)?RA(e.properties):Y(e)?CA(e.items):R(e)?PA(e.anyOf):e}function Lm(e,t){return K([e])?y.Update(_r(e),{},t):mp(e)}function UA(e,t,n,o){let i=O(e,t,n);return Lm(i,o)}function wA(e,t,n,o){return t.visited.includes(o)?n:o in e?O(e,be(t.callstack,[...t.visited,o]),e[o]):n}function vA(e,t){let n=Tr(e,t),o=Ir(n);return fr(y.Assign(e,{[t]:o}),t)}function NA(e,t,n){let o=nr(e,t,n);return Ir(o)}function LA(e){let t=we(e);return Ir(t)}function kA(e){let t=e.map(n=>Ir(n));return q(t)}function MA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:Bc(e[i])}),{});return k(t)}function Ir(e){return Te(e)?vA(e.$defs,e.$ref):Le(e)?NA(e.if,e.then,e.else):M(e)?LA(e.allOf):R(e)?kA(e.anyOf):D(e)?MA(e.properties):k({})}function dp(e,t={}){return v("Required",[e],t)}function DA(e,t={}){return km(e,t)}function km(e,t){return K([e])?y.Update(Ir(e),{},t):dp(e,t)}function GA(e,t,n,o){let i=O(e,t,n);return km(i,o)}function fp(e,t={}){return v("ReturnType",[e],t)}function $A(e,t={}){return Mm(e,t)}function sF(e){return He(e)?e.returnType:me()}function Mm(e,t){return K([e])?y.Update(sF(e),{},t):fp(e,t)}function jA(e,t,n,o={}){let i=O(e,t,n);return Mm(i,o)}function gp(e,t){return v("With",[e,t],{})}function Np(e,t){return Dm(e,t)}function Dm(e,t){return K([e])?y.Update(e,{},t):gp(e,t)}function FA(e,t,n,o){let i=O(e,t,n);return Dm(i,o)}function cF(e){return ln(e)?Y(e.items)?Gm(e.items.items):Ke(e.items)?[e]:ce(e.items)?[e]:[me()]:[e]}function Gm(e){return e.reduce((n,o)=>[...n,...cF(o)],[])}function be(e,t){return{callstack:e,visited:t}}function K(e){return s.ShiftLeft(e,(t,n)=>ce(t)?!1:K(n),()=>!0)}function Ma(e,t,n){return s.Keys(n).reduce((o,i)=>({...o,[i]:O(e,t,n[i])}),{})}function gn(e,t,n){let o=jt(e,t,n);return Gm(o)}function jt(e,t,n){return n.map(o=>O(e,t,o))}function pF(e,t){let n=et(e)?fa(t,{}):t,o=Vn(e)?da(n,{}):n;return zn(e)?Ha(o,{}):o}function uF(e,t,n,o,i){return s.IsEqual(n,"AddImmutable")?qA(e,t,o[0],i):s.IsEqual(n,"RemoveImmutable")?Jb(e,t,o[0],i):s.IsEqual(n,"AddReadonly")?Ny(e,t,o[0],i):s.IsEqual(n,"RemoveReadonly")?OT(e,t,o[0],i):s.IsEqual(n,"AddOptional")?Ly(e,t,o[0],i):s.IsEqual(n,"RemoveOptional")?CT(e,t,o[0],i):s.IsEqual(n,"Capitalize")?cS(e,t,o[0],i):s.IsEqual(n,"Conditional")?dS(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?gS(e,t,o[0],i):s.IsEqual(n,"Evaluate")?qb(e,t,o[0],i):s.IsEqual(n,"Exclude")?yS(e,t,o[0],o[1],i):s.IsEqual(n,"Extract")?_S(e,t,o[0],o[1],i):s.IsEqual(n,"Index")?HS(e,t,o[0],o[1],i):s.IsEqual(n,"InstanceType")?zS(e,t,o[0],i):s.IsEqual(n,"Interface")?wb(e,t,o[0],o[1],i):s.IsEqual(n,"KeyOf")?eA(e,t,o[0],i):s.IsEqual(n,"Lowercase")?pS(e,t,o[0],i):s.IsEqual(n,"Mapped")?oA(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?wp(e,t,o[0],i):s.IsEqual(n,"NonNullable")?aA(e,t,o[0],i):s.IsEqual(n,"Pick")?IA(e,t,o[0],o[1],i):s.IsEqual(n,"Parameters")?lA(e,t,o[0],i):s.IsEqual(n,"Partial")?TA(e,t,o[0],i):s.IsEqual(n,"Omit")?pA(e,t,o[0],o[1],i):s.IsEqual(n,"ReadonlyObject")?UA(e,t,o[0],i):s.IsEqual(n,"Record")?KT(e,t,o[0],o[1],i):s.IsEqual(n,"Required")?GA(e,t,o[0],i):s.IsEqual(n,"ReturnType")?jA(e,t,o[0],i):s.IsEqual(n,"TemplateLiteral")?QI(e,t,o[0],i):s.IsEqual(n,"Uncapitalize")?uS(e,t,o[0],i):s.IsEqual(n,"Uppercase")?lS(e,t,o[0],i):s.IsEqual(n,"With")?FA(e,t,o[0],o[1]):v(n,o,i)}function lF(e,t,n){let o=ce(n)?wA(e,t,n,n.$ref):Z(n)?Pt(O(e,t,n.items),Lo(n)):Zo(n)?Pp(e,t,n.target,n.arguments):Be(n)?lr(jt(e,t,n.parameters),O(e,t,n.instanceType),ky(n)):He(n)?mr(jt(e,t,n.parameters),O(e,t,n.returnType),My(n)):Le(n)?Bn(O(e,t,n.if),O(e,t,n.then),O(e,t,n.else),qy(n)):M(n)?ut(jt(e,t,n.allOf),Yy(n)):D(n)?k(Ma(e,t,n.properties),jy(n)):de(n)?zc(it(n),O(e,t,Se(n))):ln(n)?Xn(O(e,t,n.items)):Y(n)?ke(gn(e,t,n.items),AT(n)):R(n)?q(jt(e,t,n.anyOf),fT(n)):n;return pF(n,o)}function O(e,t,n){return on(n)?uF(e,t,n.action,n.parameters,n.options):lF(e,t,n)}function Qt(e,t){return O(e,be([],[]),t)}function mF(e){return y.Update(e,{"~immutable":!0},{})}function Ha(e,t){return y.Update(mF(e),{},t)}function qA(e,t,n,o){let i=O(e,t,n);return Ha(i,o)}function K_(e,t={}){return v("AddImmutable",[e],t)}function Go(e,t={}){return Ha(e,t)}function z_(e,t={}){return v("Evaluate",[e],t)}function ft(e,t={}){return mm(e,t)}function Y_(e,t={}){return v("Module",[e],t)}function BA(e,t={}){return wp({},be([],[]),e,t)}function dF(e,t){let n=Zn(e,t);return s.IsEqual(n,"right-inside")||s.IsEqual(n,"disjoint")?1:0}function HA(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>s.IsEqual(dF(e,o),1)?HA(e,i,[...n,o]):[...n,e,...t],()=>[...n,e])}function KA(e,t=[]){return s.ShiftLeft(e,(n,o)=>KA(o,HA(n,t)),()=>t)}function zA(e){return KA(e)}function YA(...e){let[t,n,o]=oe.Match(e,{2:(c,l)=>s.IsString(c)?[{},c,l]:[c,l,{}],3:(c,l,m)=>[c,l,m],1:c=>[{},c,{}]}),i=HI(n),a=s.IsArray(i)&&s.IsEqual(i.length,2)?O(t,be([],[]),i[0]):me();return y.Update(a,{},o)}var r={};Yt(r,{Any:()=>Mo,Array:()=>Pt,BigInt:()=>Ta,Boolean:()=>Lc,Call:()=>Zb,Capitalize:()=>oS,Codec:()=>vc,Conditional:()=>mS,Constructor:()=>lr,ConstructorParameters:()=>fS,Cyclic:()=>fr,Decode:()=>oT,DecodeBuilder:()=>ya,Dependent:()=>Bn,Encode:()=>iT,EncodeBuilder:()=>ha,Enum:()=>zy,Evaluate:()=>ft,Exclude:()=>hS,Extends:()=>dt,ExtendsResult:()=>G,Extract:()=>TS,Function:()=>mr,Generic:()=>an,Identifier:()=>Ea,Immutable:()=>aT,Index:()=>IS,Infer:()=>ga,InstanceType:()=>KS,Instantiate:()=>Qt,Integer:()=>Qn,Interface:()=>vb,Intersect:()=>ut,IsAny:()=>Ve,IsArray:()=>Z,IsBigInt:()=>vt,IsBoolean:()=>_t,IsCall:()=>Zo,IsCodec:()=>Kn,IsConstructor:()=>Be,IsCyclic:()=>Te,IsDependent:()=>Le,IsEnum:()=>ze,IsEnumValue:()=>Ky,IsFunction:()=>He,IsGeneric:()=>ko,IsIdentifier:()=>uT,IsImmutable:()=>zn,IsInfer:()=>Ke,IsInteger:()=>ot,IsIntersect:()=>M,IsKind:()=>w,IsLiteral:()=>Q,IsNever:()=>rr,IsNull:()=>hr,IsNumber:()=>Ce,IsObject:()=>D,IsOptional:()=>et,IsParameter:()=>dT,IsReadonly:()=>Vn,IsRecord:()=>de,IsRef:()=>ce,IsRefine:()=>Nc,IsRest:()=>ln,IsSchema:()=>Ue,IsString:()=>We,IsSymbol:()=>yr,IsTemplateLiteral:()=>Ee,IsThis:()=>Qc,IsTuple:()=>Y,IsUndefined:()=>or,IsUnion:()=>R,IsUnknown:()=>tt,IsUnsafe:()=>wc,IsVoid:()=>kt,KeyOf:()=>YS,Literal:()=>z,Lowercase:()=>iS,Mapped:()=>tA,Module:()=>BA,Never:()=>me,NonNullable:()=>iA,Null:()=>$o,Number:()=>Nt,Object:()=>k,Omit:()=>sA,Optional:()=>Gy,Parameter:()=>Wn,Parameters:()=>uA,Partial:()=>mA,Pick:()=>EA,Readonly:()=>sT,ReadonlyObject:()=>Nm,ReadonlyType:()=>bA,Record:()=>Bo,RecordKey:()=>un,RecordPattern:()=>it,RecordValue:()=>Se,Ref:()=>nt,Refine:()=>cT,Required:()=>DA,Rest:()=>Xn,ReturnType:()=>$A,Script:()=>YA,String:()=>It,Symbol:()=>jo,TemplateLiteral:()=>ZI,This:()=>Vc,Tuple:()=>ke,Uncapitalize:()=>aS,Undefined:()=>Ho,Union:()=>q,Unknown:()=>Qe,Unsafe:()=>Fy,Uppercase:()=>sS,Void:()=>Wc,With:()=>Np});var VA="Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported.";var fF=rn(WA());var ZA="lowercase-email",$m="iana-timezone",jm="simple-time",Fm="simple-date-time";var gF=(e,t)=>RegExp(`^${e.source}(${t.source}${e.source})*$`),hF=/[a-zA-Z0-9-_]+/,yF=/\./,yCe=gF(hF,yF);var XA="lowercase-domain";var ri="kebab-case";var JA="camel-case";var TF=new Set;function C(e,t,n={}){let o=t.map(i=>{let a=i;return a.$id?(TF.add(i),r.Ref(a.$id)):i});return r.Unsafe({...n,type:"object",discriminator:{propertyName:e},required:[e],oneOf:o})}function _e(e,t){return r.Object({values:r.Array(e,{maxItems:t.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:r.Optional(r.Boolean({description:"If true, exclude rows matching these values instead of including them"}))},{description:t.description})}function qm(e,t={}){return C("type",[r.Object({type:r.Literal("ids"),ids:r.Array(u({allowEmpty:!1}),{minItems:1,...t.maxIds!==void 0&&{maxItems:t.maxIds}})}),r.Object({type:r.Literal("all"),filters:r.Optional(e)})])}var oi=1e3,kp=100,fe={limit:r.Optional(r.Integer({minimum:1,maximum:oi,description:"Maximum number of items to return in this page."})),offset:r.Optional(r.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."}))},Ze={...fe,limit:r.Optional(r.Integer({minimum:1,maximum:oi,default:kp,description:`Maximum number of items to return in this page. Omit to use the public API default of ${kp}.`}))},EF=r.Object({totalCount:r.Integer({description:"Total number of items matching the query before `limit` and `offset` are applied."}),pageCount:r.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."}),SCe=r.Object({pagination:EF},{$id:"ResponseMetadata",description:"Metadata accompanying `data` on paginated operations, describing the full result set the page was taken from."});function A(e={}){return r.Unsafe({...e,type:"string"})}var ni=250;function u({allowEmpty:e=!0,type:t="short",description:n,default:o}={}){let i=e?0:1,a={...n===void 0?{}:{description:n},...o===void 0?{}:{default:o}};switch(t){case"camel-case":return r.String({format:JA,minLength:i,maxLength:ni,...a});case"kebab-case":return r.String({format:ri,minLength:i,maxLength:ni,...a});case"email":return r.String({format:ZA,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return r.String({format:XA,minLength:i,maxLength:ni,...a});case"tsuga-query":return r.String({format:"tsuga-query",minLength:i,maxLength:1e4,...a});case"tags-query":return r.String({format:"tags-query",minLength:i,maxLength:1e4,errorMessage:{format:`${VA} The query you provided is invalid: \${0}`},...a});case"date-time":return r.String({format:"date-time",...a});case"uri":return r.String({format:"uri",...a});case"user-password":return r.String({format:"user-password",minLength:12,maxLength:ni,...a});case"long":return r.String({minLength:i,maxLength:5e4,...a});case"short":return r.String({minLength:i,maxLength:ni,...a});case"tsuga-formula":return r.String({format:"tsuga-formula",minLength:i,maxLength:ni,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 r.String({format:"time",...a});case"readonly-sql-query":return r.String({format:"readonly-sql-query",minLength:i,maxLength:5e4,errorMessage:{format:"Must be a readonly SQL query - only SELECT statements are allowed."},...a});default:Je(t)}}var Ka=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],Mp=r.Array(r.Enum(Ka,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var Bm=["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"],MCe=r.Enum(Bm),_F=["CLUSTER_AGGREGATION_STRUCTURE"],DCe=r.Object({code:r.Enum(Bm),message:r.String()}),tO=[...Bm,..._F,"ABORT_ERROR","BAD_REQUEST","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"],rO=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var IF=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],bF=[...tO,...rO,...IF],SF=r.Object({assetId:r.Optional(r.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:r.String({description:"Name of the asset that violated the policy. Set from submitted data or the existing asset row. Returned for every violation."}),assetType:r.Enum(Ka,{description:"Type of Tsuga asset validated by the policy. Set by the route that ran tag-policy validation. Returned for every violation."}),tagPolicyId:r.String({description:"Identifier of the active tag policy that was violated. Generated by Tsuga when the policy is created. Returned for every violation."}),tagKey:r.String({description:"Tag key required or constrained by the violated policy. Set by the tag policy. Returned for every violation."}),message:r.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."}),AF=C("type",[r.Object({type:r.Literal("invalid-syntax",{description:"Discriminator identifying a rule the grok parser could not parse at all."}),error:r.Object({offset:r.Integer({description:"Byte offset in the rule where parsing failed."}),detail:r.String({description:"Parser detail message."})},{description:"Position and parser message for the syntax failure."})},{$id:"GrokInvalidSyntax"}),r.Object({type:r.Literal("unknown-pattern",{description:"Discriminator identifying a rule that references a pattern name the grok engine does not provide."}),error:r.Object({offset:r.Integer({description:"Byte offset of the unknown pattern."}),unknownPattern:r.String({description:"The pattern name that is not supported."})},{description:"Position and name of the unsupported pattern."})},{$id:"GrokUnknownPattern"}),r.Object({type:r.Literal("invalid-filter",{description:"Discriminator identifying a rule whose filter is a known filter used incorrectly."}),error:r.Object({offset:r.Integer({description:"Byte offset of the invalid filter."}),invalidFilter:r.String({description:"The filter that is invalid."}),message:r.String({description:"Why the filter is invalid."})},{description:"Position, text, and reason for the invalid filter."})},{$id:"GrokInvalidFilter"}),r.Object({type:r.Literal("unknown-filter",{description:"Discriminator identifying a rule that references a filter name the grok engine does not implement."}),error:r.Object({offset:r.Integer({description:"Byte offset of the unknown filter."}),unknownFilter:r.String({description:"The filter name that is not implemented."}),message:r.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`."}),OF=r.Object({rule:r.String({description:"The rule that failed to compile."}),ruleIndex:r.Integer({description:"0-based index of the failing rule in the submitted `rules` array."}),error:AF},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),nO=C("type",[r.Object({type:r.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:r.Array(SF,{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"}),r.Object({type:r.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:r.Array(OF,{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."}),GCe=r.Object({code:r.Optional(r.Enum(bF,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"}),details:r.Optional(nO)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),$Ce=r.Object({code:r.Optional(r.Enum(tO,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"}),details:r.Optional(nO)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),jCe=r.Object({code:r.Optional(r.Enum(rO,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),FCe=r.Object({requestId:r.String({description:"Identifier used to trace the lifecycle of this API request"}),error:r.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),qCe=r.Object({requestId:r.String({description:"Identifier used to trace the lifecycle of this API request"}),error:r.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function d({body:e,description:t,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},...t===void 0?{}:{description:t},...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},...t===void 0?{}:{description:t},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}}function oO(e,t){if(!t||typeof t!="object")return e;let n=new URLSearchParams;return Object.entries(t).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 N=r.Object({success:r.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 Gp="tsuga-cli";var ro="/v0/oauth",iO=d({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${ro}/authorize`,method:"GET",query:r.Partial(r.Object({response_type:r.String({description:"Must be `code`"}),client_id:r.String({description:"First-party client id or CIMD document URL"}),redirect_uri:r.String({description:"Client redirect URI"}),code_challenge:r.String({description:"PKCE code challenge"}),code_challenge_method:r.String({description:"Must be `S256`"}),state:r.String({description:"Opaque client state, echoed back"}),resource:r.String({description:"RFC 8707 resource indicator"})})),response:r.Object({},{description:"Never returned: this endpoint redirects (302) or renders an HTML error (400)"})}),aO=d({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${ro}/token`,method:"POST",body:r.Partial(r.Object({grant_type:r.String({description:"`authorization_code` or `refresh_token`"}),code:r.String({description:"Authorization code being exchanged"}),code_verifier:r.String({description:"PKCE code verifier"}),redirect_uri:r.String({description:"Must match the redirect URI used on /authorize"}),client_id:r.String({description:"Client id, when sent by the client"}),refresh_token:r.String({description:"Refresh token, for `grant_type=refresh_token`"})})),response:r.Object({access_token:r.String(),token_type:r.Literal("Bearer"),expires_in:r.Number({description:"Access token lifetime in seconds"}),refresh_token:r.String()})}),oPe=d({description:"Resolve a signed authorization request handle for the consent page",url:`${ro}/authorization-request`,method:"GET",query:r.Object({handle:r.String()}),response:r.Object({clientId:r.String(),clientName:r.String(),redirectUri:r.String()})}),iPe=d({description:"Approve or deny an OAuth authorization request from the consent page",url:`${ro}/approve`,method:"POST",body:r.Object({handle:r.String({description:"The signed authorization request handle"}),approve:r.Boolean()}),response:r.Object({redirectTo:r.String({description:"The client's redirect URI carrying either the code or the denial"})})}),aPe=d({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${ro}/introspect`,method:"POST",body:r.Object({token:r.String()}),response:r.Object({active:r.Boolean(),userId:r.Optional(r.String()),orgId:r.Optional(r.String())})}),xF=["pending","active","revoked"],RF=r.Object({id:r.String(),createdAt:A(),clientId:r.String({description:"Client ID Metadata Document URL or first-party client id"}),clientName:r.String({description:"Display name derived from the client identity"}),userId:r.String(),status:r.Enum(xF),lastUsedAt:r.Optional(A())}),sPe=d({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${ro}/grants`,method:"GET",query:r.Object({allUsers:r.Optional(r.Boolean({description:"Admins only: list grants of every user in the org"}))}),response:r.Array(RF)}),cPe=d({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${ro}/grants/:id`,method:"DELETE",params:r.Object({id:r.String()}),response:N});function sO(e,t){let n=new URL(iO.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:Gp,redirect_uri:t.redirectUri,code_challenge:t.challenge,code_challenge_method:"S256",state:t.state}).toString(),n.href}var za=class extends Error{constructor(n,o){super(n);this.code=o;this.name="OAuthTokenError"}};function CF(e){if(!e)return{};try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}async function cO(e,t){let n=await fetch(new URL(aO.url,e).href,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(t).toString()}),o=await n.text(),i=CF(o);if(n.status!==200){let a=i.error??`HTTP ${n.status}`;throw new za(`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*wl)}}async function pO(e,t){return cO(e,{grant_type:"authorization_code",client_id:Gp,code:t.code,code_verifier:t.verifier,redirect_uri:t.redirectUri})}async function $p(e,t){return cO(e,{grant_type:"refresh_token",client_id:Gp,refresh_token:t})}var PF="Your session expired. Run `tsuga auth login` to sign in again.",UF="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.",wF=5*pa;function uO(e,t){let n=new Date(e.accessExpiresAt).getTime();return Number.isNaN(n)||n<=t.getTime()+wF}function Ya(e){return`\u2022\u2022\u2022\u2022${e.slice(-4)}`}function jp(e){let t;try{t=JSON.parse(e)}catch{return}if(typeof t!="object"||t===null)return;let{accessToken:n,accessExpiresAt:o,refreshToken:i}=t;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 Hm(e){return{accessToken:e.accessToken,accessExpiresAt:e.expiresAt.toISOString(),refreshToken:e.refreshToken}}function lO(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 mO(e){if(e)switch(e.kind){case"operation-api-key":return e.token;case"user-session":return e.userAuth.accessToken;default:Je(e)}}async function Fp({userAuth:e,now:t,reload:n,refresh:o,persist:i}){if(!uO(e,t))return e;let a=n()??e;if(!uO(a,t))return a;if(!a.refreshToken)throw new Error(PF);let c;try{c=await o(a.refreshToken)}catch(m){throw m instanceof za&&m.code==="invalid_grant"?new Error(UF,{cause:m}):new Error(`Could not renew your session: ${m instanceof Error?m.message:String(m)}. Retry the command.`,{cause:m})}let l=Hm(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 Km={r:8,g:203,b:0},zm={r:0,g:130,b:0},Ym=["\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 Vm(e,t,n){return Math.round(e+(t-e)*n)}function vF(e,t){let n=Vm(Km.r,zm.r,t),o=Vm(Km.g,zm.g,t),i=Vm(Km.b,zm.b,t);return`\x1B[38;2;${n};${o};${i}m${e}\x1B[0m`}function NF(e){if(!e)return`
|
|
34
34
|
|
|
35
|
-
${
|
|
36
|
-
`)}`;let t=
|
|
35
|
+
${Ym.join(`
|
|
36
|
+
`)}`;let t=Ym.length-1;return`
|
|
37
37
|
|
|
38
|
-
${
|
|
39
|
-
`)}`}function
|
|
40
|
-
`)}function ee(e){V(JSON.stringify(e,null,2))}function
|
|
41
|
-
`)}var
|
|
42
|
-
`)}var
|
|
43
|
-
`);return
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
${Ym.map((o,i)=>vF(o,t===0?0:i/t)).join(`
|
|
39
|
+
`)}`}function dO(){return NF(process.stdout.isTTY&&!process.env.NO_COLOR)}var tx=require("node:crypto");var Va=require("node:crypto");function LF(e){return(0,Va.createHash)("sha256").update(e).digest("base64url")}function fO(){let e=(0,Va.randomBytes)(32).toString("base64url");return{verifier:e,challenge:LF(e)}}var EO=require("node:child_process"),_O=require("node:http"),td=require("node:os");var kF={"&":"&","<":"<",">":">",'"':""","'":"'"};function Qm(e){return e.replace(/[&<>"']/g,t=>kF[t]??t)}var MF=[":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(""),DF=['<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 Wm(e,t){let n=Qm(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>${MF}</style></head><body><main>`,`<span class="tile">${DF}</span>`,`<div class="copy"><h1>${n}</h1><p>${Qm(t)}</p></div>`,"</main></body></html>"].join("")}function V(e){process.stdout.write(`${e}
|
|
40
|
+
`)}function ee(e){V(JSON.stringify(e,null,2))}function hO(e){process.stderr.write(`${e}
|
|
41
|
+
`)}var gO=["json","tsv","csv"];function Zm(e){let t=gO.find(n=>n===e);if(t!==void 0)return t;throw new Error(`--output must be one of: ${gO.join(", ")} (got: ${e})`)}function Xm(e){let t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(t.length===0)throw new Error("--fields must contain at least one field name");return t}function yO(e,t){let n=e;for(let o of t.split(".")){if(n===null||typeof n!="object"||!Object.hasOwn(n,o))return;n=n[o]}return n}function Jm(e,t){let n=Object.create(null);for(let o of t){let i=yO(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 TO(e){return e==null?null:typeof e=="string"?e:JSON.stringify(e)}var GF={"\\":"\\\\"," ":"\\t","\r":"\\r","\n":"\\n"};function $F(e){let t=TO(e);return t===null?"":t.replace(/[\\\t\r\n]/g,n=>GF[n]??n)}function jF(e){let t=TO(e);return t===null?"":/[,"\n\r]/.test(t)?`"${t.replaceAll('"','""')}"`:t}function ed(e,t,n){if(t.length===0)return"";let o=e==="csv"?",":" ",i=e==="csv"?jF:$F,a=n.map(l=>i(l)).join(o),c=t.map(l=>n.map(m=>i(yO(l,m))).join(o));return[a,...c].join(`
|
|
42
|
+
`)}var IO="/oauth/callback",qF=5*pa,BF=Wm("Login complete","You can close this tab and return to the terminal."),qp=Wm("Login failed","Return to the terminal for details.");function HF(e){return(0,td.platform)()==="darwin"?["open",[e]]:(0,td.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function KF(e){let[t,n]=HF(e),o=(0,EO.spawnSync)(t,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function zF(e,t,n){return new Promise((o,i)=>{let a=setTimeout(()=>{i(new Error("Timed out waiting for the browser to complete login (5 minutes)."))},qF),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!==IO){m.writeHead(404,{"Content-Type":"text/html"}),m.end(qp);return}let h=f.searchParams.get("error");if(h){let I=f.searchParams.get("error_description")??"";c(m,400,qp,()=>i(new Error(`Authorization failed: ${h}${I?` (${I})`:""}`)));return}if(f.searchParams.get("state")!==t){c(m,400,qp,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let E=f.searchParams.get("code");if(!E){c(m,400,qp,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(m,200,BF,()=>o(E))})})}async function bO(e){let t=(0,_O.createServer)();t.on("connection",a=>a.unref()),await new Promise((a,c)=>{t.once("error",c),t.listen(0,"127.0.0.1",()=>{t.off("error",c),a()})});let{port:n}=t.address(),o=`http://127.0.0.1:${n}`,i=`${o}${IO}`;try{let a=e.buildAuthorizeUrl(i);return KF(a)?V("Opening your browser to complete login..."):(V("Visit this URL in your browser to complete login:"),V(` ${a}`)),{code:await zF(t,e.state,o),redirectUri:i}}finally{t.close()}}var Wt=require("node:fs"),pd=require("node:os"),oo=require("node:path");var AO=rn(require("os"),1),Qa=rn(require("path"),1),hn=AO.default.homedir(),{env:no}=process,SO=no.XDG_DATA_HOME||(hn?Qa.default.join(hn,".local","share"):void 0),Bp=no.XDG_CONFIG_HOME||(hn?Qa.default.join(hn,".config"):void 0),CPe=no.XDG_STATE_HOME||(hn?Qa.default.join(hn,".local","state"):void 0),OO=no.XDG_CACHE_HOME||(hn?Qa.default.join(hn,".cache"):void 0),PPe=no.XDG_RUNTIME_DIR||void 0,YF=(no.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");SO&&YF.unshift(SO);var VF=(no.XDG_CONFIG_DIRS||"/etc/xdg").split(":");Bp&&VF.unshift(Bp);var xO=new Set(["api.tsuga.com","api.tsuga-staging.com"]),QF=new Set(["localhost","127.0.0.1","[::1]"]);function rd(e){let t=e.replace(/\/+$/,"");if(!URL.canParse(t))throw new Error(`TSUGA_API_URL is not a URL: ${t}`);if(/[\s"'\\]/.test(t))throw new Error(`TSUGA_API_URL holds whitespace, quotes or a backslash: ${JSON.stringify(t)}`);let n=new URL(t);if(!QF.has(n.hostname)&&(n.protocol!=="https:"||!xO.has(n.hostname)))throw new Error(`Refusing to send credentials to ${t}. Set TSUGA_API_URL to ${[...xO].map(o=>`https://${o}`).join(", ")}, or a localhost URL.`);return t}var RO=require("node:child_process"),CO=require("node:fs");var yn="tsuga-cli";var PO="/usr/bin/secret-tool",WF="Tsuga CLI session",UO="the login keyring";function ZF(){try{return(0,CO.lstatSync)(PO).isFile()}catch{return!1}}var XF=["DBUS_SESSION_BUS_ADDRESS","XDG_RUNTIME_DIR"];function JF(){let e={};for(let t of XF){let n=process.env[t];n!==void 0&&(e[t]=n)}return e}function nd(e,t){if(!(process.platform!=="linux"||!ZF()))try{return{status:0,stdout:(0,RO.execFileSync)(PO,e,{env:JF(),input:t,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function od(e){let t=nd(["lookup","service",yn,"account",e]);if(t&&t.status===0)return jp(t.stdout)}function wO(e,t){let n=nd(["store","--label",WF,"service",yn,"account",e],`${JSON.stringify(t)}
|
|
43
|
+
`);return!(!n||n.status!==0)}function vO(e){return nd(["clear","service",yn,"account",e]),od(e)===void 0}var NO=require("node:child_process"),LO=require("node:fs");var kO="/usr/bin/security",MO="the macOS Keychain";function id(){if(process.platform!=="darwin")return!1;try{return(0,LO.lstatSync)(kO).isFile()}catch{return!1}}function ad(e,t){try{return{status:0,stdout:(0,NO.execFileSync)(kO,e,{env:{},input:t,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function sd(e){if(!id())return;let t=ad(["find-generic-password","-s",yn,"-a",e,"-w"]);if(t.status===0)return jp(t.stdout)}function DO(e,t){if(!id())return!1;let n=Buffer.from(JSON.stringify(t),"utf-8").toString("hex");return ad(["-i"],`add-generic-password -U -s ${yn} -a ${e} -X ${n}
|
|
44
|
+
`).status===0}function GO(e){return id()?(ad(["delete-generic-password","-s",yn,"-a",e]),sd(e)===void 0):!0}var eq={friendlyLocationName:MO,read:sd,save:DO,remove:GO},tq={friendlyLocationName:UO,read:od,save:wO,remove:vO},Hp=class e extends Error{constructor(t){super(t),this.name="SecretStoreError"}static stillHoldsSession(t){return new e(`The session is still in ${t.friendlyLocationName}. Unlock it and run \`tsuga auth logout\` again.`)}};function Wa(){return process.platform==="darwin"?eq:process.platform==="linux"?tq:void 0}function $O(e){return Wa()?.read(e)}function jO(e,t){return Wa()?.save(e,t)??!1}function FO(e){let t=Wa();return t&&!t.remove(e)?t:void 0}var qO=(0,oo.join)(Bp??(0,oo.join)((0,pd.homedir)(),".config"),"tsuga"),ii=(0,oo.join)(qO,"config.json"),BO=(0,oo.join)(OO??(0,oo.join)((0,pd.homedir)(),".cache"),"tsuga"),cd=(0,oo.join)(BO,"update-check.json"),Za=rd("https://api.tsuga.com");function HO(e){return mO(e.credential)}function zp(){if(!(0,Wt.existsSync)(ii))return{};try{let e=JSON.parse((0,Wt.readFileSync)(ii,"utf-8")),{operationApiKey:t,userAuth:n,...o}=e;return!t&&!n?e:{...o,credentials:{...e.credentials,[Za]:{...t?{operationApiKey:t}:{},...n?{userAuth:n}:{},...e.credentials?.[Za]}}}}catch{throw new Error(`Config file corrupted: ${ii}
|
|
45
|
+
Re-authenticate with \`tsuga auth login\` or \`tsuga auth operation-key <OPERATION_API_KEY>\`.`)}}function Xa(){try{return zp()}catch{return{}}}function ai(e){(0,Wt.mkdirSync)(qO,{recursive:!0,mode:448}),(0,Wt.writeFileSync)(ii,`${JSON.stringify(e,null,2)}
|
|
46
|
+
`,{mode:384})}function ud(e,t=Tn()){let n=e.credentials?.[t]??{};if(n.operationApiKey)return n;let o=$O(t);return o?{...n,userAuth:o}:n}function Kp(e,t,n=Tn()){return{...e,credentials:{...e.credentials,[n]:t}}}function Tn(){return rd(process.env.TSUGA_API_URL?.trim()||Za)}function si(e){let t=zp(),n=Tn(),o=process.env.TSUGA_OPERATION_API_KEY,i=o?{}:ud(t,n),a=lO({overrideKey:o,operationApiKey:i.operationApiKey,userAuth:i.userAuth}),c=t.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 Ja(){return ud(zp()).userAuth}function KO(e,t){let n=Xa(),o=Tn(),{operationApiKey:i}=n.credentials?.[o]??{},a=t&&i?{operationApiKey:i}:{},c=Wa();return c&&jO(o,e)?(ai(Kp(n,a,o)),c.friendlyLocationName):(ai(Kp(n,{...a,userAuth:e},o)),ii)}function zO(e){return KO(e,!1)}function Yp(e){KO(e,!0)}function YO(e){let t=Xa();ai(Kp(t,{operationApiKey:e}))}function VO(){let e=Tn(),t=FO(e),n=Xa(),o=ud(n,e);if(ai(Kp(n,o.operationApiKey?{operationApiKey:o.operationApiKey}:{},e)),t)throw Hp.stillHoldsSession(t)}function Vp(){return ii}var QO={from:"-30m",to:"now",query:"*","max-results":"100"};function jr(e){return(zp().defaults??{})[e]??QO[e]}function WO(e,t){let n=Xa();ai({...n,defaults:{...n.defaults,[e]:t}})}function ZO(){let{defaults:e,...t}=Xa();ai(t)}function XO(e,t){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: ${Ya(o.userAuth.accessToken)} (expires ${o.userAuth.accessExpiresAt})`);break;default:Je(a)}}else n.push("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");n.push(`Config: ${t}`),n.push(""),n.push("Defaults (custom overrides marked with *):");let i={...QO,...e.defaults};for(let[a,c]of Object.entries(i)){let l=a in e.defaults?" *":"";n.push(` ${a}: ${c}${l}`)}return`${n.join(`
|
|
46
47
|
`)}
|
|
47
|
-
`}function
|
|
48
|
-
`,{mode:384})}async function
|
|
49
|
-
`),process.exitCode=1;return}try{let n=await
|
|
50
|
-
`),process.exitCode=1}}function Yp(e,t){let n=ly(my({start:e,end:t}),{format:["years","months","days","hours","minutes"]});return n===""?"less than a minute":n}function qq(e){let t=za(e.accessToken),n=new Date,o=new Date(e.accessExpiresAt),i=!!e.refreshToken;return Number.isNaN(o.getTime())?`Logged in as a user (token ${t}, expires ${e.accessExpiresAt}).`:o<=n?i?`Logged in as a user (token ${t}). Access token expired ${Yp(o,n)} ago, on ${e.accessExpiresAt}; the next command renews it automatically.`:`Logged in as a user (token ${t}). Session expired ${Yp(o,n)} ago, on ${e.accessExpiresAt}. Run \`tsuga auth login\` to sign in again.`:i?`Logged in as a user (token ${t}). Access token expires in ${Yp(n,o)}, on ${e.accessExpiresAt}; the session renews automatically.`:`Logged in as a user (token ${t}). Session expires in ${Yp(n,o)}, on ${e.accessExpiresAt}.`}function Fq(){let{credential:e}=ai({});if(!e){V("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");return}switch(e.kind){case"user-session":V(qq(e.userAuth));return;case"operation-api-key":V("Authenticated with an operation API key.");return;default:Je(e)}}function Bq(){MO(),V("Local user session cleared.")}function HO(e){let t=e.command("auth").description("Manage authentication: user login (OAuth) or operation API key");t.action(()=>t.help()),t.command("login").description("Log in as a user with a browser authorization flow and save the session (replaces any saved operation API key)").action($q),t.command("logout").description("Clear the saved user session").action(Bq),t.command("token").description("Print the saved user access token to stdout").action(jq),t.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(n=>{kO(n),V(`Operation API key saved to ${zp()}`)}),t.command("status").description("Show the current authentication method").action(Fq)}var Hq=["allowed-domains","cluster-integration-config","custom-usage-tag","database","databricks-connection","explorer-saved-view","github-connection","host","inventory","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"],Kq=["adaptive-notification-rule","audit-log","cloud-account","dashboard-folder","dashboard-report","dashboard","ingestion-api-key","investigation","log-route","metric-route","monitor","notification-integration","notification-rule","notification-silence","operation-api-key","quality-report","rum-public-token","slo","tag-policy","team-members","team","user-data","user-invitation","user-permissions"],zq=["log","metric","trace","rum"],pd=[...Kq,...zq],kPe=[...Hq,...pd];var KO=["admin","public_editor","public_viewer","teams_only"],si=["admin","editor","viewer"];var oo="/v0/team-membership",ud="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.",ld=r.Object({id:r.String({description:"Tsuga-generated team membership ID assigned when the membership is created."}),userId:r.String({description:"User ID that belongs to the team."}),teamId:r.String({description:"Team ID that contains the user."}),roleKey:r.Enum(si,{description:ud})}),zO=r.Object({userId:u({allowEmpty:!1,description:"User ID to add to or update in the team."}),teamId:u({allowEmpty:!1,description:"Team ID receiving the membership change."}),roleKey:r.Enum(si,{description:ud})}),Yq=r.Object({userId:u({allowEmpty:!1,description:"User ID to remove from the team."}),teamId:u({allowEmpty:!1,description:"Team ID to remove the user from."})}),Vq=r.Optional(r.Object({userId:r.Optional(u({allowEmpty:!1,description:"Restrict results to memberships for this user ID."})),teamId:r.Optional(u({allowEmpty:!1,description:"Restrict results to memberships for this team ID."}))})),MPe=d({tags:["access-control"],url:oo,method:"GET",query:Vq,response:r.Array(ld)}),DPe=d({tags:["access-control"],url:oo,method:"POST",body:zO,response:ld}),GPe=d({tags:["access-control"],url:oo,method:"PUT",body:zO,response:ld}),$Pe=d({tags:["access-control"],url:oo,method:"DELETE",body:Yq,response:N}),Vp=500,YO=r.Object({teamId:u({allowEmpty:!1,description:"Team ID receiving all requested memberships."}),members:r.Array(r.Object({userId:r.Optional(u({allowEmpty:!1,description:"Existing user ID to add to the team."})),userEmail:r.Optional(u({allowEmpty:!1,type:"email",description:"Existing user email to resolve and add to the team."})),roleKey:r.Enum(si,{description:ud})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:Vp,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."}),Qq={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(YO,{examples:[Qq]});var VO=r.Object({results:r.Array(r.Object({userId:r.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:r.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."}),Wq={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(VO,{examples:[Wq]});var jPe=d({tags:["access-control"],url:`${oo}/bulk-add`,method:"POST",body:YO,response:VO}),qPe=d({tags:["access-control"],url:`${oo}/bulk-update-user-roles`,method:"PUT",body:r.Object({userIds:r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:Vp}),teamId:u({allowEmpty:!1}),role:r.Enum(si)}),response:r.Object({})}),QO=r.Object({teamId:u({allowEmpty:!1,description:"Team ID to remove the requested users from."}),userIds:r.Optional(r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:Vp,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:r.Optional(r.Array(u({allowEmpty:!1,type:"email"}),{minItems:1,maxItems:Vp,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."}),Zq={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(QO,{examples:[Zq]});var WO=r.Object({results:r.Array(r.Object({userId:r.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:r.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."}),Xq={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(WO,{examples:[Xq]});var FPe=d({tags:["access-control"],url:`${oo}/bulk-remove`,method:"DELETE",body:QO,response:WO});var Jq={"github-connection":{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"]},"audit-log":{read:["public_viewer","public_editor","admin"],write:[]},"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"]},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:[]}},eF={"github-connection":{read:["admin"],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"]},"audit-log":{read:["viewer","editor","admin"],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"]},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:[]}},tF={user:Jq,team:eF};function md(e){return ZO(e,"team")}function dd(e){return ZO(e,"user")}function ZO(e,t){let n=[],o=tF[t];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 VPe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:dd("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:dd("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:dd("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},QPe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:md("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:md("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:md("viewer"),roleKey:"viewer"}};var WPe=new Set(pd);var rF={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-rule":"notification-rule","notification-silence":"notification-silence","quality-report":"quality-report","retention-policy":"retention-policy","rum-public-token":"rum-public-token",service:"service","service-target":"service-target",slo:"slo","tag-policy":"tag-policy",team:"team","user-invitation":"user-invitation"},nF=Object.entries(rF),ZPe=new Map(nF.flatMap(([e,t])=>t?[[t,e]]:[]));var $="context";var XO="trace_id",Qp=`${$}.team`,JPe=`${$}.env`,eUe=`${$}.api_key_id`,Wp=`${$}.service.name`,tUe=`${$}.service.version`,Zp=`${$}.span.kind`,Xp=`${$}.span.name`,io=`${$}.status.code`,fd="resource.attributes.team",JO=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var es=`${$}.host.name`,oF=`${$}.instance`,iF=`${$}.instanceid`,aF=`${$}.instance_name`,rUe=`${$}.telemetry.sdk.language`,nUe=`${$}.process.runtime.name`,oUe=`${$}.scope.name`,iUe=`${$}.cloud.provider`,aUe=`${$}.cloud.platform`,sUe=`${$}.aws.ecs.task.arn`,cUe=`${$}.k8s.cluster.name`,pUe=`${$}.k8s.cluster.uid`,uUe=`${$}.k8s.namespace.name`,sF=`${$}.k8s.pod.name`,lUe=`${$}.k8s.pod.uid`,mUe=`${$}.k8s.container.name`,dUe=`${$}.k8s.node.name`,fUe=`${$}.k8s.node.uid`,cF=`${$}.k8s.deployment.name`,gUe=`${$}.k8s.deployment.uid`,pF=`${$}.k8s.replicaset.name`,hUe=`${$}.k8s.replicaset.uid`,uF=`${$}.k8s.statefulset.name`,yUe=`${$}.k8s.statefulset.uid`,lF=`${$}.k8s.daemonset.name`,TUe=`${$}.k8s.daemonset.uid`,EUe=`${$}.k8s.job.name`,_Ue=`${$}.k8s.job.uid`,IUe=`${$}.k8s.cronjob.name`,bUe=`${$}.k8s.cronjob.uid`,ci="status_code",Jp="span.name";var eu="span.kind";var mF="db.system.name",dF="db.system",fF="db.namespace",gF="db.name";var SUe=`span_attributes.${fF}`,AUe=`span_attributes.${gF}`,OUe=`span_attributes.${mF}`,xUe=`span_attributes.${dF}`;var RUe={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${$}.tag_policy_id`,dataSource:`${$}.data_source`}};var CUe={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${$}.batch_kind`,batchKindMetricsFilter:`${$}.batch_kind:metrics`,sourceApiKeyId:`${$}.source_api_key_id`,sourceEnv:`${$}.source_env`,sourceTeam:`${$}.source_team`}};var gd="__tsuga_metadata__",PUe=`${gd}.signature`,UUe=`${gd}.routes`,wUe=`${gd}.trace_id_bucket`;var GUe=[ci,io,io.replace(`${$}.`,"")];var ex="__tsuga_cluster_id__",hF=r.Object({}),yF=r.Object({status:r.Literal("error"),message:r.String({description:"Why this cluster failed to answer the query."})});function pi(e=hF){let t=C("status",[r.Object({...e.properties,status:r.Literal("ok")}),yF]);return Object.assign(zc($t,t),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var TF=5,ts=r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:TF,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var tx=r.Object({type:r.Literal("number"),number:r.String()}),EF=r.Object({type:r.Literal("string"),string:r.String()}),_F=r.Object({type:r.Literal("timestamp"),timestamp:r.String()}),rs=C("type",[tx,EF,_F]),IF=r.Object({by:r.Record(r.String(),rs),computed:r.Record(r.String(),tx)}),bF=r.Object({type:r.Literal("buckets"),buckets:r.Array(IF),clusterResponses:r.Optional(pi())}),SF=r.Object({type:r.Literal("distribution"),bounds:r.Array(r.Number()),buckets:r.Array(r.Object({timestamp:r.Number(),counts:r.Array(r.Number())})),percentiles:r.Optional(r.Array(r.Number()))}),tu=C("type",[bF,SF]);var AF=["all","owning-team-and-public","owning-team-only"],Tn=r.Enum(AF,{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 nx=1456444800,ox=4927737600,OF=nx*1e3,xF=ox*1e3,ru=1704067200,hd=ru*1e3,ix={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:ru,to:ru}]},RF={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:hd,to:hd}]},nu=e=>r.Integer({description:e,examples:[ru],minimum:nx,maximum:ox,format:"int64"}),rx=e=>r.Integer({description:e,examples:[hd],minimum:OF,maximum:xF,format:"int64"}),at=r.Object({from:r.Optional(nu("Start of the query window as a Unix timestamp in seconds")),to:r.Optional(nu("End of the query window as a Unix timestamp in seconds"))},ix),bt=r.Object({from:nu("Start of the query window as a Unix timestamp in seconds"),to:nu("End of the query window as a Unix timestamp in seconds")},ix),ui=r.Object({from:rx("Start of the query window as a Unix timestamp in milliseconds"),to:rx("End of the query window as a Unix timestamp in milliseconds")},RF);var UF="/v0/aggregation",wF=r.Union([r.Literal("a"),r.Literal("d"),r.Literal("q"),r.Literal("w"),r.Literal("t")]),yd=r.Object({parallelism:r.Number(),engine:wF,recordBatchCache:r.Optional(r.Boolean()),includeNullGroups:r.Optional(r.Boolean()),restartAwareGaugeSum:r.Optional(r.Boolean())}),Td=["logs","metrics","traces"];var cx={logs:"Logs",metrics:"Metrics",traces:"Spans"},vF=[...Td,"connections","log-patterns","spans","rum"];var swe={...cx,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},br=[...Td,"rum"];var cwe={...cx,rum:"RUM events"};var pwe=r.Enum(vF,{description:"Data source being queried"}),px=r.Enum(Td,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),ir=r.Enum(br,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),ao=r.String({description:"Attribute containing the values to aggregate"}),so=u({description:"Attribute containing the values to aggregate"}),NF=C("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(ao)},{$id:"AggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:ao},{$id:"AggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:ao},{$id:"AggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:ao},{$id:"AggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:ao},{$id:"AggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:ao},{$id:"AggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:ao,percentile:r.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`."}),LF=C("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(so)},{$id:"InputAggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:so},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:so},{$id:"InputAggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:so},{$id:"InputAggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:so},{$id:"InputAggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:so},{$id:"InputAggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:so,percentile:r.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`."}),ux=r.Object({type:r.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),lx=r.Object({type:r.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),mx=r.Object({type:r.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),dx=r.Object({type:r.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),fx=r.Object({type:r.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"}),gx=r.Object({type:r.Literal("power",{description:"Raises values to a specified power"}),exponent:r.Integer({description:"The exponent to raise values to"})},{$id:"FunctionPower",title:"Power"}),hx=r.Object({type:r.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),yx=r.Object({type:r.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),kF=r.Object({type:r.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:r.String({description:"Duration of the rolling window"})},{$id:"FunctionRolling",title:"Rolling"}),MF=r.Object({type:r.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:u({allowEmpty:!1,description:"Duration of the rolling window"})},{$id:"InputFunctionRolling",title:"Rolling"}),DF=r.Object({type:r.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:r.Integer({description:"The base of the logarithm"})},{$id:"FunctionLog",title:"Log"}),GF=r.Object({type:r.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:r.Integer({description:"The base of the logarithm",minimum:2})},{$id:"InputFunctionLog",title:"Log"}),$F=r.Object({type:r.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:r.Integer({description:"Number of seconds to offset"})},{$id:"FunctionTimeOffset",title:"TimeOffset"}),jF=r.Object({type:r.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:r.Integer({description:"Number of seconds to offset",minimum:1})},{$id:"InputFunctionTimeOffset",title:"TimeOffset"}),qF=C("type",[ux,lx,mx,dx,fx,kF,DF,gx,hx,yx,$F],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),FF=C("type",[ux,lx,mx,dx,fx,MF,GF,gx,hx,yx,jF],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var ax=r.Object({min:r.Number({description:"Lower bound of the distribution range."}),max:r.Number({description:"Upper bound of the distribution range."})}),BF=["linear","log"],ou=r.Enum(BF,{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."}),sx=r.Integer({minimum:1}),HF=C("type",[r.Object({type:r.Literal("scalar")},{title:"Scalar",description:"Returns a single value"}),r.Object({type:r.Literal("timeseries"),aggregationWindow:u({description:'Time bucket size for aggregation (e.g. "10s", "60s", "1m")'})},{title:"Timeseries",description:"Returns a time series"}),r.Object({type:r.Literal("histogram"),by:r.Optional(u()),bucketCount:r.Optional(sx),bounds:r.Optional(ax),boundsScale:r.Optional(ou),percentiles:r.Optional(r.Array(r.Number({minimum:0,maximum:100,multipleOf:1}),{minItems:1}))},{title:"Histogram",description:"Returns a single distribution over the entire time range"}),r.Object({type:r.Literal("heatmap"),aggregationWindow:u({description:'Time bucket size for the heatmap (e.g. "10s", "60s", "1m")'}),by:r.Optional(u()),bucketCount:r.Optional(sx),bounds:r.Optional(ax)},{title:"Heatmap",description:"Returns a distribution per time window"})]),ns=15,KF=["zero","null"],zF=r.Enum(KF,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),Tx=r.Object({mode:r.Object({type:zF},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),YF=["avg","sum","min","max","last"],Ex=r.Enum(YF,{description:"Per-series rollup applied within each time bucket before the cross-series aggregate. Supported only on metric queries whose `aggregate` is `sum`, and cannot be combined with the `rate`, `increase`, `last`, or `rolling` functions. When omitted, a default is derived from the metric type."});var _x={aggregate:NF,functions:r.Optional(r.Array(qF,{description:"Post-processing functions applied to aggregation results"})),fill:r.Optional(Tx),timeAggregate:r.Optional(Ex)},Ix={aggregate:LF,functions:r.Optional(r.Array(FF,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:r.Optional(Tx),timeAggregate:r.Optional(Ex)},VF={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."},bx={maxItems:ns,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").'},Sx=r.Array(r.Object({..._x,filter:r.Optional(r.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),VF),os=r.Array(r.Object({...Ix,filter:r.Optional(u({type:"tsuga-query",description:"Tsuga query filter to apply to the aggregation. Defaults to an empty string when omitted."}))},{title:"AggregationQuery"}),bx),qr=r.Array(r.Object({..._x,filter:r.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."}),En=r.Array(r.Object({...Ix,filter:u({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."}),{...bx,description:"Aggregation queries used by alerting. Each query is referenced from formulas as q1, q2, and so on."}),Ax=r.Array(r.Omit(En.items,["fill"],{title:"SloAggregationQuery",description:"Single aggregation query evaluated by an SLO."}),{minItems:1,maxItems:ns,description:"Aggregation queries used by SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var iu=r.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),co=u({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."}),QF=r.Object({fields:r.Array(r.String(),{description:"Telemetry attribute names used to group aggregation results."}),limit:r.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:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:r.Optional(r.String({description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),WF=r.Object({fields:r.Array(u(),{maxItems:1,description:"Telemetry attribute name to group aggregation results by. Currently limited to one field per grouping level."}),limit:r.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:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:r.Optional(u({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),Ox=7;var li=r.Array(QF,{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."}),Fr=r.Array(WF,{maxItems:Ox,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 uwe=d({tags:["aggregation"],url:`${UF}/multi-query`,method:"POST",body:r.Object({timeRange:ui,queries:os,groupBy:r.Optional(Fr),returnType:HF,dataSource:ir,formula:co,executionOptions:yd,triggeredBy:r.Optional(r.Literal("refresh")),shouldStreamResults:r.Optional(r.Boolean()),clusterId:r.Optional(u({allowEmpty:!1})),clusterIds:r.Optional(ts),viewAs:r.Optional(r.Object({owner:u({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:Tn}))}),response:tu});var Ed=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],_d=["light","dark"];var ZF={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)"}},xx=["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 hwe=ZF.light.red.background;var Id=2,bd=2;var Rx=[{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-----
|
|
48
|
+
`}function JO(){if((0,Wt.existsSync)(cd))try{return JSON.parse((0,Wt.readFileSync)(cd,"utf-8")).lastUpdateCheck}catch{return}}function ex(e){(0,Wt.mkdirSync)(BO,{recursive:!0,mode:448}),(0,Wt.writeFileSync)(cd,`${JSON.stringify({lastUpdateCheck:e})}
|
|
49
|
+
`,{mode:384})}async function rq(){let e=Tn(),{verifier:t,challenge:n}=fO(),o=(0,tx.randomBytes)(16).toString("base64url"),{code:i,redirectUri:a}=await bO({state:o,buildAuthorizeUrl:m=>sO(e,{redirectUri:m,challenge:n,state:o})}),c=await pO(e,{code:i,verifier:t,redirectUri:a}),l=zO(Hm(c));V(`Logged in. Session token ${Ya(c.accessToken)} saved to ${l}`)}async function nq(){let e=Tn(),t=Ja();if(!t){let n=e===Za?"":` for ${e}`;process.stderr.write(`No user session${n}. Run \`tsuga auth login\`.
|
|
50
|
+
`),process.exitCode=1;return}try{let n=await Fp({userAuth:t,now:new Date,reload:Ja,refresh:o=>$p(e,o),persist:Yp});V(n.accessToken)}catch(n){process.stderr.write(`${n instanceof Error?n.message:String(n)}
|
|
51
|
+
`),process.exitCode=1}}function Qp(e,t){let n=dy(fy({start:e,end:t}),{format:["years","months","days","hours","minutes"]});return n===""?"less than a minute":n}function oq(e){let t=Ya(e.accessToken),n=new Date,o=new Date(e.accessExpiresAt),i=!!e.refreshToken;return Number.isNaN(o.getTime())?`Logged in as a user (token ${t}, expires ${e.accessExpiresAt}).`:o<=n?i?`Logged in as a user (token ${t}). Access token expired ${Qp(o,n)} ago, on ${e.accessExpiresAt}; the next command renews it automatically.`:`Logged in as a user (token ${t}). Session expired ${Qp(o,n)} ago, on ${e.accessExpiresAt}. Run \`tsuga auth login\` to sign in again.`:i?`Logged in as a user (token ${t}). Access token expires in ${Qp(n,o)}, on ${e.accessExpiresAt}; the session renews automatically.`:`Logged in as a user (token ${t}). Session expires in ${Qp(n,o)}, on ${e.accessExpiresAt}.`}function iq(){let{credential:e}=si({});if(!e){V("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");return}switch(e.kind){case"user-session":V(oq(e.userAuth));return;case"operation-api-key":V("Authenticated with an operation API key.");return;default:Je(e)}}function aq(){VO(),V("Local user session cleared.")}function rx(e){let t=e.command("auth").description("Manage authentication: user login (OAuth) or operation API key");t.action(()=>t.help()),t.command("login").description("Log in as a user with a browser authorization flow and save the session (replaces any saved operation API key)").action(rq),t.command("logout").description("Clear the saved user session").action(aq),t.command("token").description("Print the saved user access token to stdout").action(nq),t.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(n=>{YO(n),V(`Operation API key saved to ${Vp()}`)}),t.command("status").description("Show the current authentication method").action(iq)}var sq=["allowed-domains","cluster-integration-config","custom-usage-tag","database","databricks-connection","explorer-saved-view","github-connection","host","inventory","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"],cq=["adaptive-notification-rule","audit-log","cloud-account","dashboard-folder","dashboard-report","dashboard","ingestion-api-key","investigation","log-route","metric-route","monitor","notification-integration","notification-rule","notification-silence","operation-api-key","quality-report","rum-public-token","slo","tag-policy","team-members","team","user-data","user-invitation","user-permissions"],pq=["log","metric","trace","rum"],ld=[...cq,...pq],sUe=[...sq,...ld];var nx=["admin","public_editor","public_viewer","teams_only"],ci=["admin","editor","viewer"];var io="/v0/team-membership",md="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.",dd=r.Object({id:r.String({description:"Tsuga-generated team membership ID assigned when the membership is created."}),userId:r.String({description:"User ID that belongs to the team."}),teamId:r.String({description:"Team ID that contains the user."}),roleKey:r.Enum(ci,{description:md})}),ox=r.Object({userId:u({allowEmpty:!1,description:"User ID to add to or update in the team."}),teamId:u({allowEmpty:!1,description:"Team ID receiving the membership change."}),roleKey:r.Enum(ci,{description:md})}),uq=r.Object({userId:u({allowEmpty:!1,description:"User ID to remove from the team."}),teamId:u({allowEmpty:!1,description:"Team ID to remove the user from."})}),lq=r.Optional(r.Object({userId:r.Optional(u({allowEmpty:!1,description:"Restrict results to memberships for this user ID."})),teamId:r.Optional(u({allowEmpty:!1,description:"Restrict results to memberships for this team ID."}))})),cUe=d({tags:["access-control"],url:io,method:"GET",query:lq,response:r.Array(dd)}),pUe=d({tags:["access-control"],url:io,method:"POST",body:ox,response:dd}),uUe=d({tags:["access-control"],url:io,method:"PUT",body:ox,response:dd}),lUe=d({tags:["access-control"],url:io,method:"DELETE",body:uq,response:N}),Wp=500,ix=r.Object({teamId:u({allowEmpty:!1,description:"Team ID receiving all requested memberships."}),members:r.Array(r.Object({userId:r.Optional(u({allowEmpty:!1,description:"Existing user ID to add to the team."})),userEmail:r.Optional(u({allowEmpty:!1,type:"email",description:"Existing user email to resolve and add to the team."})),roleKey:r.Enum(ci,{description:md})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:Wp,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."}),mq={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(ix,{examples:[mq]});var ax=r.Object({results:r.Array(r.Object({userId:r.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:r.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."}),dq={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(ax,{examples:[dq]});var mUe=d({tags:["access-control"],url:`${io}/bulk-add`,method:"POST",body:ix,response:ax}),dUe=d({tags:["access-control"],url:`${io}/bulk-update-user-roles`,method:"PUT",body:r.Object({userIds:r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:Wp}),teamId:u({allowEmpty:!1}),role:r.Enum(ci)}),response:r.Object({})}),sx=r.Object({teamId:u({allowEmpty:!1,description:"Team ID to remove the requested users from."}),userIds:r.Optional(r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:Wp,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:r.Optional(r.Array(u({allowEmpty:!1,type:"email"}),{minItems:1,maxItems:Wp,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."}),fq={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(sx,{examples:[fq]});var cx=r.Object({results:r.Array(r.Object({userId:r.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:r.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."}),gq={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(cx,{examples:[gq]});var fUe=d({tags:["access-control"],url:`${io}/bulk-remove`,method:"DELETE",body:sx,response:cx});var hq={"github-connection":{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"]},"audit-log":{read:["public_viewer","public_editor","admin"],write:[]},"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"]},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:[]}},yq={"github-connection":{read:["admin"],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"]},"audit-log":{read:["viewer","editor","admin"],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"]},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:[]}},Tq={user:hq,team:yq};function fd(e){return px(e,"team")}function gd(e){return px(e,"user")}function px(e,t){let n=[],o=Tq[t];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 _Ue={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:gd("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:gd("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:gd("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},IUe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:fd("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:fd("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:fd("viewer"),roleKey:"viewer"}};var bUe=new Set(ld);var Eq={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-rule":"notification-rule","notification-silence":"notification-silence","quality-report":"quality-report","retention-policy":"retention-policy","rum-public-token":"rum-public-token",service:"service","service-target":"service-target",slo:"slo","tag-policy":"tag-policy",team:"team","user-invitation":"user-invitation"},_q=Object.entries(Eq),SUe=new Map(_q.flatMap(([e,t])=>t?[[t,e]]:[]));var $="context";var ux="trace_id",Zp=`${$}.team`,OUe=`${$}.env`,xUe=`${$}.api_key_id`,Xp=`${$}.service.name`,RUe=`${$}.service.version`,Jp=`${$}.span.kind`,eu=`${$}.span.name`,ao=`${$}.status.code`,hd="resource.attributes.team",lx=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var es=`${$}.host.name`,Iq=`${$}.instance`,bq=`${$}.instanceid`,Sq=`${$}.instance_name`,CUe=`${$}.telemetry.sdk.language`,PUe=`${$}.process.runtime.name`,UUe=`${$}.scope.name`,wUe=`${$}.cloud.provider`,vUe=`${$}.cloud.platform`,NUe=`${$}.aws.ecs.task.arn`,LUe=`${$}.k8s.cluster.name`,kUe=`${$}.k8s.cluster.uid`,MUe=`${$}.k8s.namespace.name`,Aq=`${$}.k8s.pod.name`,DUe=`${$}.k8s.pod.uid`,GUe=`${$}.k8s.container.name`,$Ue=`${$}.k8s.node.name`,jUe=`${$}.k8s.node.uid`,Oq=`${$}.k8s.deployment.name`,FUe=`${$}.k8s.deployment.uid`,xq=`${$}.k8s.replicaset.name`,qUe=`${$}.k8s.replicaset.uid`,Rq=`${$}.k8s.statefulset.name`,BUe=`${$}.k8s.statefulset.uid`,Cq=`${$}.k8s.daemonset.name`,HUe=`${$}.k8s.daemonset.uid`,KUe=`${$}.k8s.job.name`,zUe=`${$}.k8s.job.uid`,YUe=`${$}.k8s.cronjob.name`,VUe=`${$}.k8s.cronjob.uid`,pi="status_code",tu="span.name";var ru="span.kind";var Pq="db.system.name",Uq="db.system",wq="db.namespace",vq="db.name";var QUe=`span_attributes.${wq}`,WUe=`span_attributes.${vq}`,ZUe=`span_attributes.${Pq}`,XUe=`span_attributes.${Uq}`;var JUe={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${$}.tag_policy_id`,dataSource:`${$}.data_source`}};var ewe={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${$}.batch_kind`,batchKindMetricsFilter:`${$}.batch_kind:metrics`,sourceApiKeyId:`${$}.source_api_key_id`,sourceEnv:`${$}.source_env`,sourceTeam:`${$}.source_team`}};var yd="__tsuga_metadata__",twe=`${yd}.signature`,rwe=`${yd}.routes`,nwe=`${yd}.trace_id_bucket`;var uwe=[pi,ao,ao.replace(`${$}.`,"")];var mx="__tsuga_cluster_id__",Nq=r.Object({}),Lq=r.Object({status:r.Literal("error"),message:r.String({description:"Why this cluster failed to answer the query."})});function ui(e=Nq){let t=C("status",[r.Object({...e.properties,status:r.Literal("ok")}),Lq]);return Object.assign(zc($t,t),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var kq=5,ts=r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:kq,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var dx=r.Object({type:r.Literal("number"),number:r.String()}),Mq=r.Object({type:r.Literal("string"),string:r.String()}),Dq=r.Object({type:r.Literal("timestamp"),timestamp:r.String()}),rs=C("type",[dx,Mq,Dq]),Gq=r.Object({by:r.Record(r.String(),rs),computed:r.Record(r.String(),dx)}),$q=r.Object({type:r.Literal("buckets"),buckets:r.Array(Gq),clusterResponses:r.Optional(ui())}),jq=r.Object({type:r.Literal("distribution"),bounds:r.Array(r.Number()),buckets:r.Array(r.Object({timestamp:r.Number(),counts:r.Array(r.Number())})),percentiles:r.Optional(r.Array(r.Number()))}),nu=C("type",[$q,jq]);var Fq=["all","owning-team-and-public","owning-team-only"],En=r.Enum(Fq,{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 gx=1456444800,hx=4927737600,qq=gx*1e3,Bq=hx*1e3,ou=1704067200,Td=ou*1e3,yx={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:ou,to:ou}]},Hq={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:Td,to:Td}]},iu=e=>r.Integer({description:e,examples:[ou],minimum:gx,maximum:hx,format:"int64"}),fx=e=>r.Integer({description:e,examples:[Td],minimum:qq,maximum:Bq,format:"int64"}),at=r.Object({from:r.Optional(iu("Start of the query window as a Unix timestamp in seconds")),to:r.Optional(iu("End of the query window as a Unix timestamp in seconds"))},yx),bt=r.Object({from:iu("Start of the query window as a Unix timestamp in seconds"),to:iu("End of the query window as a Unix timestamp in seconds")},yx),li=r.Object({from:fx("Start of the query window as a Unix timestamp in milliseconds"),to:fx("End of the query window as a Unix timestamp in milliseconds")},Hq);var Yq="/v0/aggregation",Vq=r.Union([r.Literal("a"),r.Literal("d"),r.Literal("q"),r.Literal("w"),r.Literal("t")]),Ed=r.Object({parallelism:r.Number(),engine:Vq,recordBatchCache:r.Optional(r.Boolean()),includeNullGroups:r.Optional(r.Boolean()),restartAwareGaugeSum:r.Optional(r.Boolean())}),_d=["logs","metrics","traces"];var _x={logs:"Logs",metrics:"Metrics",traces:"Spans"},Qq=[..._d,"connections","log-patterns","spans","rum"];var Nwe={..._x,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},br=[..._d,"rum"];var Lwe={..._x,rum:"RUM events"};var kwe=r.Enum(Qq,{description:"Data source being queried"}),Ix=r.Enum(_d,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),ir=r.Enum(br,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),so=r.String({description:"Attribute containing the values to aggregate"}),co=u({description:"Attribute containing the values to aggregate"}),Wq=C("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(so)},{$id:"AggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:so},{$id:"AggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:so},{$id:"AggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:so},{$id:"AggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:so},{$id:"AggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:so},{$id:"AggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:so,percentile:r.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`."}),Zq=C("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(co)},{$id:"InputAggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:co},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:co},{$id:"InputAggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:co},{$id:"InputAggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:co},{$id:"InputAggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:co},{$id:"InputAggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:co,percentile:r.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`."}),bx=r.Object({type:r.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),Sx=r.Object({type:r.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),Ax=r.Object({type:r.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),Ox=r.Object({type:r.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),xx=r.Object({type:r.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"}),Rx=r.Object({type:r.Literal("power",{description:"Raises values to a specified power"}),exponent:r.Integer({description:"The exponent to raise values to"})},{$id:"FunctionPower",title:"Power"}),Cx=r.Object({type:r.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),Px=r.Object({type:r.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),Xq=r.Object({type:r.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:r.String({description:"Duration of the rolling window"})},{$id:"FunctionRolling",title:"Rolling"}),Jq=r.Object({type:r.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:u({allowEmpty:!1,description:"Duration of the rolling window"})},{$id:"InputFunctionRolling",title:"Rolling"}),eB=r.Object({type:r.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:r.Integer({description:"The base of the logarithm"})},{$id:"FunctionLog",title:"Log"}),tB=r.Object({type:r.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:r.Integer({description:"The base of the logarithm",minimum:2})},{$id:"InputFunctionLog",title:"Log"}),rB=r.Object({type:r.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:r.Integer({description:"Number of seconds to offset"})},{$id:"FunctionTimeOffset",title:"TimeOffset"}),nB=r.Object({type:r.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:r.Integer({description:"Number of seconds to offset",minimum:1})},{$id:"InputFunctionTimeOffset",title:"TimeOffset"}),oB=C("type",[bx,Sx,Ax,Ox,xx,Xq,eB,Rx,Cx,Px,rB],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),iB=C("type",[bx,Sx,Ax,Ox,xx,Jq,tB,Rx,Cx,Px,nB],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var Tx=r.Object({min:r.Number({description:"Lower bound of the distribution range."}),max:r.Number({description:"Upper bound of the distribution range."})}),aB=["linear","log"],au=r.Enum(aB,{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."}),Ex=r.Integer({minimum:1}),sB=C("type",[r.Object({type:r.Literal("scalar")},{title:"Scalar",description:"Returns a single value"}),r.Object({type:r.Literal("timeseries"),aggregationWindow:u({description:'Time bucket size for aggregation (e.g. "10s", "60s", "1m")'})},{title:"Timeseries",description:"Returns a time series"}),r.Object({type:r.Literal("histogram"),by:r.Optional(u()),bucketCount:r.Optional(Ex),bounds:r.Optional(Tx),boundsScale:r.Optional(au),percentiles:r.Optional(r.Array(r.Number({minimum:0,maximum:100,multipleOf:1}),{minItems:1}))},{title:"Histogram",description:"Returns a single distribution over the entire time range"}),r.Object({type:r.Literal("heatmap"),aggregationWindow:u({description:'Time bucket size for the heatmap (e.g. "10s", "60s", "1m")'}),by:r.Optional(u()),bucketCount:r.Optional(Ex),bounds:r.Optional(Tx)},{title:"Heatmap",description:"Returns a distribution per time window"})]),ns=15,cB=["zero","null"],pB=r.Enum(cB,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),Ux=r.Object({mode:r.Object({type:pB},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),uB=["avg","sum","min","max","last"],wx=r.Enum(uB,{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 vx={aggregate:Wq,functions:r.Optional(r.Array(oB,{description:"Post-processing functions applied to aggregation results"})),fill:r.Optional(Ux),timeAggregate:r.Optional(wx)},Nx={aggregate:Zq,functions:r.Optional(r.Array(iB,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:r.Optional(Ux),timeAggregate:r.Optional(wx)},lB={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."},Lx={maxItems:ns,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").'},kx=r.Array(r.Object({...vx,filter:r.Optional(r.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),lB),os=r.Array(r.Object({...Nx,filter:r.Optional(u({type:"tsuga-query",description:"Tsuga query filter to apply to the aggregation. Defaults to an empty string when omitted."}))},{title:"AggregationQuery"}),Lx),Fr=r.Array(r.Object({...vx,filter:r.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."}),_n=r.Array(r.Object({...Nx,filter:u({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."}),{...Lx,description:"Aggregation queries used by alerting. Each query is referenced from formulas as q1, q2, and so on."}),Mx=r.Array(r.Omit(_n.items,["fill"],{title:"SloAggregationQuery",description:"Single aggregation query evaluated by an SLO."}),{minItems:1,maxItems:ns,description:"Aggregation queries used by SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var su=r.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),po=u({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."}),mB=r.Object({fields:r.Array(r.String(),{description:"Telemetry attribute names used to group aggregation results."}),limit:r.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:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:r.Optional(r.String({description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),dB=r.Object({fields:r.Array(u(),{maxItems:1,description:"Telemetry attribute name to group aggregation results by. Currently limited to one field per grouping level."}),limit:r.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:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:r.Optional(u({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),Dx=7;var mi=r.Array(mB,{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."}),qr=r.Array(dB,{maxItems:Dx,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 Mwe=d({tags:["aggregation"],url:`${Yq}/multi-query`,method:"POST",body:r.Object({timeRange:li,queries:os,groupBy:r.Optional(qr),returnType:sB,dataSource:ir,formula:po,executionOptions:Ed,triggeredBy:r.Optional(r.Literal("refresh")),shouldStreamResults:r.Optional(r.Boolean()),clusterId:r.Optional(u({allowEmpty:!1})),clusterIds:r.Optional(ts),viewAs:r.Optional(r.Object({owner:u({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:En}))}),response:nu});var Id=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],bd=["light","dark"];var fB={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)"}},Gx=["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 qwe=fB.light.red.background;var Sd=2,Ad=2;var $x=[{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-----
|
|
51
52
|
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAC4AWkdwKYSd8
|
|
52
53
|
Ks14IReLcYgADhoXk56ZzXI=
|
|
53
|
-
-----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}"}],XF=Rx.map(e=>e.key);var Owe=new Set(XF),xwe=Rx.map(e=>e.key);var $we={[Zp]:eu,[Zp.replace(`${$}.`,"")]:eu,[Xp]:Jp,[Xp.replace(`${$}.`,"")]:Jp,[io]:ci,[io.replace(`${$}.`,"")]:ci},jwe={[eu]:Zp,[Jp]:Xp,[ci]:io};function Cx(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var Px=["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"],Ux=["alert_queries","alert_thresholds","alert_values"],JF=[...Px,...Ux],wx=["alert_event_name","alert_message"],mve=[...JF,...wx],dve=new Set([...Px,...wx]),fve=new Set(Ux);var Sd={aws:"aws",gcp:"gcp",azure:"azure"},_n=[Sd.aws,Sd.gcp,Sd.azure];var vx=r.Object({id:r.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:r.String({description:"Cluster name stored in Tsuga. Usable as a display label when `friendlyName` is not set."}),friendlyName:r.Optional(r.String({description:"Human-readable display name for the cluster. Present when a friendly name is configured."})),clusterType:r.Enum(_n,{description:"Cloud provider selected for the Tsuga cluster."}),clusterRegion:r.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`."}),eB={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(vx,{examples:[eB]});var Nx=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:r.Array(vx)});function Lx(e,t){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 t()(Nx);ee(o)})}function Mx(e,t,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(t.join(" "),{cmds:i,flags:[...a,"--help"]});for(let c of e.commands)c.name().startsWith("__")||Mx(c,[...t,c.name()],n,o)}function tB(e){let t=new Map,n=new Set;return Mx(e,[],t,n),{rows:[...t].map(([i,{cmds:a,flags:c}])=>({key:i,cmds:[...new Set(a)].join(" "),flags:[...new Set(c)].join(" ")})),valueFlags:[...n].join(" ")}}function kx(e){return e.map(({key:t,cmds:n,flags:o})=>` ${JSON.stringify(t)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
|
|
54
|
-
`)}function
|
|
54
|
+
-----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}"}],gB=$x.map(e=>e.key);var Zwe=new Set(gB),Xwe=$x.map(e=>e.key);var lve={[Jp]:ru,[Jp.replace(`${$}.`,"")]:ru,[eu]:tu,[eu.replace(`${$}.`,"")]:tu,[ao]:pi,[ao.replace(`${$}.`,"")]:pi},mve={[ru]:Jp,[tu]:eu,[pi]:ao};function jx(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var Fx=["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"],qx=["alert_queries","alert_thresholds","alert_values"],hB=[...Fx,...qx],Bx=["alert_event_name","alert_message"],Gve=[...hB,...Bx],$ve=new Set([...Fx,...Bx]),jve=new Set(qx);var Od={aws:"aws",gcp:"gcp",azure:"azure"},In=[Od.aws,Od.gcp,Od.azure];var Hx=r.Object({id:r.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:r.String({description:"Cluster name stored in Tsuga. Usable as a display label when `friendlyName` is not set."}),friendlyName:r.Optional(r.String({description:"Human-readable display name for the cluster. Present when a friendly name is configured."})),clusterType:r.Enum(In,{description:"Cloud provider selected for the Tsuga cluster."}),clusterRegion:r.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`."}),yB={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(Hx,{examples:[yB]});var Kx=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:r.Array(Hx)});function zx(e,t){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 t()(Kx);ee(o)})}function Vx(e,t,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(t.join(" "),{cmds:i,flags:[...a,"--help"]});for(let c of e.commands)c.name().startsWith("__")||Vx(c,[...t,c.name()],n,o)}function TB(e){let t=new Map,n=new Set;return Vx(e,[],t,n),{rows:[...t].map(([i,{cmds:a,flags:c}])=>({key:i,cmds:[...new Set(a)].join(" "),flags:[...new Set(c)].join(" ")})),valueFlags:[...n].join(" ")}}function Yx(e){return e.map(({key:t,cmds:n,flags:o})=>` ${JSON.stringify(t)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
|
|
55
|
+
`)}function EB(e,t){return`_tsuga_complete() {
|
|
55
56
|
local cur key cmds flags words i word prev
|
|
56
57
|
local valueflags="${t}"
|
|
57
58
|
local -a path
|
|
@@ -72,7 +73,7 @@ ${e}
|
|
|
72
73
|
COMPREPLY=( $(compgen -W "$words" -- "$cur") )
|
|
73
74
|
}
|
|
74
75
|
complete -F _tsuga_complete tsuga
|
|
75
|
-
`}function
|
|
76
|
+
`}function _B(e,t){return`#compdef tsuga
|
|
76
77
|
_tsuga_complete() {
|
|
77
78
|
local cur key cmds flags out i word prev
|
|
78
79
|
local valueflags="${t}"
|
|
@@ -94,10 +95,10 @@ ${e}
|
|
|
94
95
|
compadd -- \${=out}
|
|
95
96
|
}
|
|
96
97
|
compdef _tsuga_complete tsuga
|
|
97
|
-
`}function
|
|
98
|
-
set cmds ${
|
|
99
|
-
set flags ${
|
|
100
|
-
`)}function
|
|
98
|
+
`}function xd(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function IB(e){return e.map(({key:t,cmds:n,flags:o})=>` case ${xd(t)}
|
|
99
|
+
set cmds ${xd(n)}
|
|
100
|
+
set flags ${xd(o)}`).join(`
|
|
101
|
+
`)}function bB(e,t){return`# Update with: tsuga completion fish > ~/.config/fish/completions/tsuga.fish
|
|
101
102
|
function __tsuga_complete
|
|
102
103
|
set -l valueflags -- ${t}
|
|
103
104
|
set -l tokens (commandline -xpc)
|
|
@@ -132,47 +133,47 @@ ${e}
|
|
|
132
133
|
end
|
|
133
134
|
end
|
|
134
135
|
complete -c tsuga -f -a '(__tsuga_complete)'
|
|
135
|
-
`}function
|
|
136
|
+
`}function Qx(e){e.command("completion <SHELL>").description("Print a shell completion script (bash, zsh, or fish)").addHelpText("after",`
|
|
136
137
|
Usage:
|
|
137
138
|
bash: eval "$(tsuga completion bash)" # add to ~/.bashrc
|
|
138
139
|
zsh: eval "$(tsuga completion zsh)" # add to ~/.zshrc
|
|
139
|
-
fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(t=>{let{rows:n,valueFlags:o}=
|
|
140
|
-
...`};Object.assign(jx,{examples:[aB]});var qx=r.Object({kind:r.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:r.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:r.String({description:'Title of the result (e.g. "How to Add Resource Attributes" or "POST /v1/aggregation/multi-query/scalar")'}),subsection:r.Optional(r.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:r.Optional(r.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:r.Optional(r.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:r.Number({description:"Relevance score between 0 and 1 (higher is more relevant)"}),excerpt:r.String({description:"Short snippet of matching content"}),link:r.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"}),sB={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(qx,{examples:[sB]});var Fx=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:$x,method:"GET",query:r.Object({path:u({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:jx}),Bx=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:`${$x}/search`,method:"GET",query:r.Object({query:u({allowEmpty:!1,description:"Search text to match against documentation and API-reference content."})},{description:"Documentation search query."}),response:r.Array(qx)});function Hx(e,t){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 t()(Fx,{query:{path:o}});ee(i)}),n.command("search <SEARCH_TEXT>").description("Search Tsuga documentation and the full API reference, ranked by relevance").action(async o=>{let i=await t()(Bx,{query:{query:o}});ee(i)})}var cB=`/${"v1"}/feedback`,Kx=r.Object({id:r.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),pB={id:"request-123-abc"};Object.assign(Kx,{examples:[pB]});var zx=r.Object({content:u({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."})}),uB={content:"The traces command times out for large services."};Object.assign(zx,{examples:[uB]});var Yx=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:cB,method:"POST",body:zx,response:Kx});function Vx(e,t){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 t()(Yx,{body:{content:n.join(" ")}});ee(o)})}var lB="^\\S(.*\\S)?$",mB=128,dB=256,fB=r.Object({key:r.String({description:"Tag key attached to the resource. Consumers can use key/value tags for filtering, ownership context, and policy checks."}),value:r.String({description:"Tag value attached to the resource for this key. Tsuga returns the value exactly as stored."})},{title:"Tag"}),gB=r.Object({key:r.String({maxLength:mB,description:"Tag key to attach to the resource."}),value:r.String({maxLength:dB,pattern:lB,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),Ft=r.Array(fB,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),Bt=r.Array(gB,{title:"Tags",maxItems:50,description:"Key/value tags to apply to the resource. Tag policies may require specific keys or values."}),De=r.Optional(Ft),Xe=r.Optional(Bt);var In="/v0/teams",su=["public","private"],au={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},hB=r.Enum([au.NAME,au.CREATED_AT,au.MEMBER_COUNT,au.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),Zx=r.Object({color:r.Enum(Ed,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:r.Enum(_d,{description:"Avatar rendering mode selected for the team."}),iconName:r.Enum(xx,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),Od=r.Object({color:r.Enum(Ed),mode:r.Enum(_d)}),Qx=100,Wx=250,mi=r.Object({id:r.String({description:"Unique identifier of the team. Generated by Tsuga and stable for the team lifetime."}),name:r.String({description:"Human-readable team name displayed throughout Tsuga and used in team search."}),description:r.Optional(r.String({description:"Optional free-text description of the team."})),visibility:r.Enum(su,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:De,createdAt:A({description:"Timestamp when Tsuga created the team."}),updatedAt:A({description:"Timestamp when Tsuga last updated the team metadata."}),memberCount:r.Optional(r.Number({description:"Number of members currently in the team"})),avatar:r.Optional(Zx)}),cu=r.Object({name:r.String({minLength:1,maxLength:Qx,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 ${Qx} characters.`}),description:r.Optional(r.String({maxLength:Wx,description:`Optional team description. Maximum length is ${Wx} characters.`})),visibility:r.Enum(su,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:Xe,avatar:r.Optional(Zx)}),yB=r.Object({id:r.String(),name:r.String(),email:r.String(),role:r.Enum(si),joinedTeamAt:A(),orgRole:r.Enum(KO),avatar:r.Optional(Od)}),Xx=r.Object({searchQuery:r.Optional(u({description:"Substring matched against team names and descriptions."})),visibility:r.Optional(r.Enum(su,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:r.Optional(r.Boolean({description:"If true, return only teams that include the authenticated user."}))}),HNe=d({tags:["teams"],url:In,method:"GET",paginated:!0,response:r.Array(mi),query:r.Object({...fe,includeMemberCount:r.Optional(r.Boolean()),...Xx.properties,sortBy:r.Optional(hB),sortDirection:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending."}))})}),KNe=d({tags:["teams"],url:`${In}/:id`,method:"GET",params:r.Object({id:u()}),response:mi}),zNe=d({tags:["teams"],url:`${In}/:id/members`,method:"GET",params:r.Object({id:u()}),response:r.Array(yB)}),YNe=d({tags:["teams"],url:`${In}/:id/assets`,method:"GET",params:r.Object({id:u()}),response:r.Object({apiKeyCount:r.Number(),logRouteCount:r.Number(),monitorCount:r.Number(),notificationRuleCount:r.Number(),dashboardCount:r.Number()})}),VNe=d({tags:["teams"],url:In,method:"POST",body:cu,response:mi}),QNe=d({tags:["teams"],url:`${In}/:id`,method:"PUT",params:r.Object({id:u()}),body:cu,response:mi}),TB=C("type",[r.Object({type:r.Literal("ids"),teamIds:r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:100})}),r.Object({type:r.Literal("all"),filters:r.Optional(Xx)})]),WNe=d({tags:["teams"],url:`${In}/bulk-update`,method:"POST",body:r.Object({selection:TB,config:r.Object({visibility:r.Enum(su)})}),response:r.Object({})}),ZNe=d({tags:["teams"],url:`${In}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N});var EB=r.Enum(["agent","cli","mcp-codemode","mcp-server","terraform-provider","web-frontend"],{description:"Tsuga client surface that performed the operation. Use this to distinguish UI, CLI, MCP, and Terraform-originated changes."}),pe=C("type",[r.Object({type:r.Literal("user",{description:"The resource was created or updated by a user."}),id:r.String({description:"Unique identifier of the user actor."}),name:r.String({description:"Display name of the user actor at the time of response."}),avatar:r.Optional(Od)}),r.Object({type:r.Literal("operation-api-key",{description:"The resource was created or updated by an operation API key."}),id:r.String({description:"Unique identifier of the operation API key actor."}),name:r.String({description:"Display name of the operation API key actor."}),source:r.Optional(EB)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var At="/v0/monitors",di=["alert","resolve","keep_last_status","consider_zero"],fi=["alert","resolve","keep_last_status"];var eR=["no_aggregation","all","any","each","proportion"],tR=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var _B=r.Object({formula:r.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(tR,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:r.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),IB=r.Object({formula:u({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(tR,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:r.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),bB=5,xd=r.Array(_B,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Rd=r.Array(IB,{minItems:1,maxItems:bB,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Cd=r.Object({formula:r.String({description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:r.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`."}),Pd=r.Object({formula:u({type:"tsuga-formula",description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:r.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`."}),St=[1,2,3,4,5];var pu={timeframe:r.Number({description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over. Always a whole number, at least 1."}),groupByFields:r.Array(r.Object({fields:r.Array(r.String(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty means the monitor evaluates a single ungrouped series."}),limit:r.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:r.Optional(r.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:r.Optional(r.Enum(eR,{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:r.Optional(r.Integer({description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},uu={timeframe:r.Integer({minimum:1,description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over."}),groupByFields:r.Array(r.Object({fields:r.Array(u(),{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:r.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:r.Optional(u({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:r.Optional(r.Enum(eR,{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:r.Optional(r.Integer({minimum:1,maximum:99,description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},Ud={...pu,timeframe:r.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},wd={...uu,timeframe:r.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},rR=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:xd,noDataBehavior:r.Enum(di,{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."}),...pu,queries:qr},{$id:"MonitorConfigurationMetric"}),nR=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Rd,noDataBehavior:r.Enum(di,{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."}),...uu,queries:En},{$id:"InputMonitorConfigurationMetric"}),oR=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:xd,noDataBehavior:r.Enum(di,{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."}),...pu,queries:qr},{$id:"MonitorConfigurationLog"}),iR=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Rd,noDataBehavior:r.Enum(di,{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."}),...uu,queries:En},{$id:"InputMonitorConfigurationLog"}),aR=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:xd,noDataBehavior:r.Enum(di,{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."}),...pu,queries:qr},{$id:"MonitorConfigurationTrace"}),SB=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Rd,noDataBehavior:r.Enum(di,{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."}),...uu,queries:En},{$id:"InputMonitorConfigurationTrace"}),sR=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Cd,noDataBehavior:r.Enum(fi,{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."}),...Ud,queries:qr},{$id:"MonitorConfigurationAnomalyLog"}),cR=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Pd,noDataBehavior:r.Enum(fi,{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."}),...wd,queries:En},{$id:"InputMonitorConfigurationAnomalyLog"}),pR=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Cd,noDataBehavior:r.Enum(fi,{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."}),...Ud,queries:qr},{$id:"MonitorConfigurationAnomalyMetric"}),uR=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Pd,noDataBehavior:r.Enum(fi,{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."}),...wd,queries:En},{$id:"InputMonitorConfigurationAnomalyMetric"}),lR=r.Object({type:r.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:Cd,noDataBehavior:r.Enum(fi,{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."}),...Ud,queries:qr},{$id:"MonitorConfigurationAnomalyTrace"}),AB=r.Object({type:r.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:Pd,noDataBehavior:r.Enum(fi,{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."}),...wd,queries:En},{$id:"InputMonitorConfigurationAnomalyTrace"}),mR=r.Object({type:r.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:r.Integer({description:"Number of days before certificate expiry when the monitor should warn."}),cloudAccounts:r.Optional(r.Array(r.String(),{description:"Cloud account IDs whose certificates are checked. Omitted means certificates from all cloud accounts are checked."})),aggregationAlertLogic:r.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:r.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"MonitorConfigurationCertificateExpiry"}),OB=r.Object({type:r.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:r.Integer({minimum:1,maximum:365,description:"Number of days before certificate expiry when the monitor should warn. Valid values are 1 through 365."}),cloudAccounts:r.Optional(r.Array(r.String(),{minItems:1,description:"Cloud account IDs whose certificates are checked. Omit to check certificates from all cloud accounts."})),aggregationAlertLogic:r.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:r.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"InputMonitorConfigurationCertificateExpiry"}),xB=r.Object({type:r.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured team, environment, and optional service. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:r.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:r.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:r.Object({teamIds:r.Array(r.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:r.String({description:"Environment whose logs are searched for new error patterns."}),service:r.Optional(r.String({description:"Optional service name whose logs are searched for new error patterns. If omitted, the monitor searches all services matching the team and environment filter."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included."})},{$id:"MonitorConfigurationLogErrorPattern"}),RB=r.Object({type:r.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured team, environment, and optional service. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:r.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:r.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:r.Object({teamIds:r.Array(u(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets."}),env:u({description:"Environment whose logs are searched for new error patterns."}),service:r.Optional(u({description:"Optional service name whose logs are searched for new error patterns. If omitted, the monitor searches all services matching the team and environment filter."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included."})},{$id:"InputMonitorConfigurationLogErrorPattern"}),CB=C("type",[rR,oR,aR,sR,pR,xB,lR,mR],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),PB=C("type",[nR,iR,SB,cR,uR,AB,RB,OB],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var Br=r.Object({id:r.String({description:"Tsuga-generated monitor ID assigned when the monitor is created."}),name:r.String({description:"Display name of the monitor and alert source."}),owner:r.String({description:"Team ID that owns and manages the monitor."}),message:r.Optional(r.String({description:"Caller-supplied message included in notifications triggered by this monitor. Omitted when the monitor was created or last updated without one."})),tags:De,configuration:CB,priority:r.Enum(St,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:Tn,dashboardId:r.Optional(r.String({description:"ID of the dashboard linked to this monitor for context when investigating alerts. Caller-supplied. Omitted when no dashboard is linked."})),pauseUntil:r.Optional(A({description:"Timestamp until which the monitor is snoozed."})),creator:r.Optional(pe),updater:r.Optional(pe),createdAt:A({description:"Timestamp when Tsuga created the monitor."}),updatedAt:A({description:"Timestamp when Tsuga last updated the monitor."}),assetUpdatedAt:A({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."}),clusterIds:r.Array(r.String(),{description:"Cluster IDs where the monitor is deployed. Empty means all eligible clusters."})},{title:"Monitor"}),UB=C("type",[rR,oR,aR,sR,pR,lR,mR]),fLe=r.Object({...Br.properties,configuration:UB},{title:"Monitor"}),gLe=r.Object({...Br.properties,configuration:C("type",[nR,iR,cR,uR])},{title:"Monitor"}),is=r.Object({name:u({description:"Display name of the monitor and alert source."}),message:r.Optional(u({type:"long",description:"Message included in notifications triggered by this monitor. Optional on create. On update, omitting it keeps the existing message."})),tags:Xe,configuration:PB,priority:r.Enum(St,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the monitor."}),dashboardId:r.Optional(r.Union([r.Null(),u({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:r.Optional(u({allowEmpty:!1,type:"date-time",description:"ISO timestamp until which the monitor should be snoozed."})),permissions:Tn,clusterIds:r.Optional(r.Array(u({allowEmpty:!1}),{description:"Cluster IDs where the monitor should be deployed. Empty or omitted means all eligible clusters for cluster-deployed monitor types."}))}),Jx=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],bn={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var vd=r.Object({owners:_e(u({allowEmpty:!1}),{description:"Restrict results to monitors owned by any of these team IDs",maxItems:50}),searchQuery:r.Object({value:u({allowEmpty:!1,description:"Case-insensitive substring matched against monitor ID, monitor name, query filters, and aggregate fields. Wildcard characters are treated literally."}),exclude:r.Optional(r.Boolean({description:"If true, exclude monitors matching this value instead of including them"}))},{description:"Search query filter for monitors."}),tags:_e(Bt.items,{description:"Restrict results to monitors that have at least one of the listed key/value tags",maxItems:50}),priorities:_e(r.Enum(St),{description:"Restrict results to monitors with one of these priorities",maxItems:St.length}),types:_e(r.Enum(Jx),{description:"Restrict results to monitors with these types",maxItems:Jx.length}),activity:r.Enum(["active","snoozed"],{description:"Restrict results by activity status: active monitors or currently snoozed monitors"}),clusterIds:_e(u({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"}),Nd=r.Partial(r.Object({...fe,filters:r.Partial(vd),sort:r.Object({by:r.Enum([bn.PRIORITY,bn.TYPE,bn.NAME,bn.OWNER,bn.TAGS,bn.CLUSTER_IDS,bn.PAUSE_UNTIL,bn.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:r.Enum(["asc","desc"],{description:"Sort direction. For `priority`, `desc` returns priority 1 first and `asc` returns priority 5 first."})},{description:"Optional sorting applied to the returned monitors. Ties are broken by creation time and monitor ID for stable pagination."})})),hLe=d({tags:["monitors"],url:`${At}/query`,method:"POST",paginated:!0,response:r.Array(Br),body:Nd}),yLe=d({tags:["monitors"],url:`${At}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(vd,["tags"])))}),response:Ft}),TLe=d({tags:["monitors"],url:`${At}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(vd,["activity"])))}),response:r.Object({all:r.Integer({description:"Total number of monitors matching the filters that the user can read."}),active:r.Integer({description:"Number of matching readable monitors that are not currently snoozed."}),snoozed:r.Integer({description:"Number of matching readable monitors that are currently snoozed."})})}),ELe=d({tags:["monitors"],url:`${At}/:id`,method:"GET",params:r.Object({id:u()}),response:Br}),_Le=d({tags:["monitors"],url:At,method:"POST",body:is,response:Br}),ILe=d({tags:["monitors"],url:`${At}/:id`,method:"PUT",params:r.Object({id:u()}),body:is,response:Br}),bLe=d({tags:["monitors"],url:`${At}/bulk-update`,method:"PUT",body:r.Object({monitorIds:r.Array(u({allowEmpty:!1}),{minItems:1}),owner:u({allowEmpty:!1})}),response:r.Object({})}),SLe=d({tags:["monitors"],url:`${At}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),ALe=d({tags:["monitors"],url:`${At}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),OLe=d({tags:["monitors"],url:`${At}/:id/snooze`,method:"POST",params:r.Object({id:u()}),body:r.Object({pauseUntil:u({allowEmpty:!1,type:"date-time"})}),response:Br}),xLe=d({tags:["monitors"],url:`${At}/bulk-snooze`,method:"POST",body:r.Object({monitorIds:r.Array(u()),pauseUntil:u({allowEmpty:!1,type:"date-time"})}),response:r.Object({})}),wB=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],vB=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],NB=[...wB,...vB],po=r.Enum(NB),LB=C("type",[r.Object({type:r.Literal("each"),subStates:r.Record(r.String(),r.Object({stateValue:r.Union([po,r.Null()]),lastChangedAt:A()}))}),r.Object({type:r.Literal("no_aggregation"),stateValue:r.Optional(po)}),r.Object({type:r.Literal("any"),stateValue:r.Optional(po)}),r.Object({type:r.Literal("all"),stateValue:r.Optional(po)}),r.Object({type:r.Literal("proportion"),stateValue:r.Optional(po)})]),kB=r.Object({monitorId:r.String(),currentState:LB,lastChangedAt:r.Optional(A())}),RLe=d({tags:["monitors"],url:`${At}/states/:id`,method:"GET",params:r.Object({id:u()}),response:kB}),CLe=d({tags:["monitors"],url:`${At}/:id/transitions`,method:"GET",params:r.Object({id:u()}),query:r.Object({from:r.Number(),to:r.Number()}),response:r.Array(r.Object({id:r.String(),createdAt:A(),fromState:r.Optional(po),toState:r.Optional(po),dimension:r.Optional(r.String())}))}),MB=["unprocessed","processed","failed-to-process"],PLe=d({tags:["monitors"],url:`${At}/:id/results`,method:"GET",params:r.Object({id:u()}),query:r.Object({from:r.Number(),to:r.Number()}),response:r.Object({isTruncated:r.Boolean(),results:r.Array(r.Object({id:r.String(),evaluationAt:A(),formulaResult:r.Object({groups:r.Array(r.Object({groupKey:r.Record(r.String(),rs),results:r.Array(r.Union([r.Number(),r.Null()])),conditionMet:r.Enum(["true","false","nan-no-data"])}))}),createdAt:A(),status:r.Enum(MB)}))})});var Hr="/v0/slos",DB=[7,30,90],GB=["good","bad"],hR=r.Enum(GB,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),$B=["good","bad","ignore"],yR=r.Enum($B,{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)"}),dR=30,fR=1440,TR=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],jB=["healthy","breached","no_data"],lu=r.Enum(jB,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),gR={sli:r.Optional(r.Number({description:"Service level indicator for the latest evaluation; absent when there is no data"})),errorBudget:r.Optional(r.Number({description:"Remaining error budget at the latest evaluation; negative when exhausted, absent when there is no data"})),status:lu},qB=r.Object({overall:r.Object(gR,{description:"Latest overall evaluation for the cluster"}),perGroup:r.Array(r.Object({groupKey:r.Record(r.String(),rs,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...gR}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),ER=r.Record(r.String(),qB,{description:"Latest evaluation results keyed by cluster ID."}),Ld=r.Object({queries:qr,formula:iu},{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."}),kd=r.Object({queries:Ax,formula:co},{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."}),FB=r.Object({type:r.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:r.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"}),BB=r.Object({type:r.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:r.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 HB=r.Object({type:r.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:r.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"}),KB=r.Object({type:r.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:r.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"}),zB=C("type",[FB,HB],{description:"Alert trigger configuration: burn-rate or threshold"}),_R=C("type",[BB,KB],{description:"Alert trigger configuration: burn-rate or threshold"}),Md=r.Enum(St,{description:"Alert priority (1 is highest, 5 is lowest)"}),Dd=r.Object({id:r.String({description:"Tsuga-generated SLO alert ID assigned when the alert is created."}),sloId:r.String({description:"Parent SLO ID for this alert."}),priority:Md,configuration:zB,createdAt:A({description:"Timestamp when Tsuga created the alert."}),updatedAt:A({description:"Timestamp when Tsuga last updated the alert."}),assetUpdatedAt:A({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"SloAlert"}),YB=r.Object({priority:Md,configuration:_R}),VB=r.Object({id:r.Optional(u({allowEmpty:!1,description:"Identifier of an existing alert to update. Omit to create a new alert on this SLO."})),priority:Md,configuration:_R}),QB=C("type",[r.Object({type:r.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:ir,goodQuery:Ld,totalQuery:Ld,groupByFields:r.Optional(li),noDataBehavior:hR},{title:"EventSloConfiguration"}),r.Object({type:r.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:ir,query:Ld,sliceSizeMinutes:r.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:r.Object({operator:r.Enum(TR,{description:"Comparison operator between the query value and the threshold"}),value:r.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:r.Optional(li),noDataBehavior:yR},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),WB=C("type",[r.Object({type:r.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:ir,goodQuery:kd,totalQuery:kd,groupByFields:r.Optional(Fr),noDataBehavior:hR},{title:"EventSloConfiguration"}),r.Object({type:r.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:ir,query:kd,sliceSizeMinutes:r.Integer({minimum:dR,maximum:fR,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${dR} through ${fR}.`}),threshold:r.Object({operator:r.Enum(TR,{description:"Comparison operator between the query value and the threshold"}),value:r.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:r.Optional(Fr),noDataBehavior:yR},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),ZB=r.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),IR=r.Enum(DB,{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."}),XB=r.Array(r.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."}),JB=r.Array(u({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."}),gi=r.Object({id:r.String({description:"Tsuga-generated SLO ID assigned when the SLO is created."}),name:r.String({description:"Display name of the SLO, set by the caller."}),description:r.Optional(r.String({description:"Free-form, caller-provided description of what the SLO measures. Absent when not set."})),tags:De,configuration:QB,target:r.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:IR,owner:r.String({description:"Team ID that owns the SLO"}),permissions:Tn,clusterIds:XB,creator:r.Optional(pe),updater:r.Optional(pe),alerts:r.Array(Dd,{description:"Alerts attached to this SLO"}),createdAt:A({description:"Timestamp when Tsuga created the SLO."}),updatedAt:A({description:"Timestamp when Tsuga last updated the SLO."}),assetUpdatedAt:A({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"Slo"}),eH=r.Object({...gi.properties,results:ER},{title:"SloWithResults"}),mu=r.Object({name:u({allowEmpty:!1,description:"Display name of the SLO."}),description:r.Optional(u({type:"long",description:"Free-form, caller-provided description of what the SLO measures. Optional."})),tags:Xe,configuration:WB,target:ZB,timeframeDays:IR,owner:u({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:Tn,clusterIds:r.Optional(JB),alerts:r.Array(YB,{description:"Alerts to create on this SLO. Send an empty array for none."})}),Gd=r.Object({...r.Omit(mu,["alerts"]).properties,alerts:r.Array(VB,{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."})}),bR=r.Object({owners:_e(u({allowEmpty:!1}),{description:"Restrict results to SLOs owned by any of these team IDs",maxItems:50}),searchQuery:r.Object({value:u({allowEmpty:!1,description:"Substring matched case-insensitively against the SLO name or SLO ID."}),exclude:r.Optional(r.Boolean({description:"If true, exclude SLOs matching this value instead of including them"}))},{description:"Text filter for SLO names or IDs. Optional; `exclude: true` removes matching SLOs."}),tags:_e(Bt.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:_e(u({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:_e(lu,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),$d=r.Partial(bR),jd=r.Partial(r.Object({...fe,filters:$d,sort:r.Object({by:r.Enum(["name","owner","tags","updatedAt","sli","errorBudget","status"],{description:"Field to sort by"}),direction:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned SLOs"})})),qLe=d({tags:["slos"],url:`${Hr}/query`,method:"POST",paginated:!0,response:r.Array(eH),body:jd}),FLe=d({tags:["slos"],url:`${Hr}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(bR,["tags","statuses"])))}),response:Ft}),BLe=d({tags:["slos"],url:`${Hr}/:id`,method:"GET",params:r.Object({id:u()}),response:gi}),HLe=d({tags:["slos"],url:`${Hr}/:id/results`,method:"GET",params:r.Object({id:u()}),response:ER}),KLe=d({tags:["slos"],url:Hr,method:"POST",body:mu,response:gi}),zLe=d({tags:["slos"],url:`${Hr}/:id`,method:"PUT",params:r.Object({id:u()}),body:Gd,response:gi}),YLe=d({tags:["slos"],url:`${Hr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),tH=jm($d),VLe=d({tags:["slos"],url:`${Hr}/bulk-delete`,method:"DELETE",body:r.Object({selection:tH}),response:r.Object({})}),rH=jm($d,{maxIds:100}),QLe=d({tags:["slos"],url:`${Hr}/bulk-update`,method:"PUT",body:r.Object({selection:rH,owner:u({allowEmpty:!1})}),response:r.Object({})});var hi="/v0/notifications",Sn=`${hi}/rules`,SR=`${hi}/slack/setup`,as=`${hi}/integrations`,uo=["triggered","resolved","no-data"],nH=["sent","stale","pending","rate-limited","failed","silenced"],oH=r.Optional(r.Object({maxMessages:r.Integer({description:"Maximum number of notifications this target can send during the rate-limiting window."}),minutes:r.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."})),qd=r.Object({maxMessages:r.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:r.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."}),iH=r.Optional(qd),Sr=r.Optional(r.Object({mode:r.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:r.Array(r.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:r.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."})),Ar=r.Optional(r.Object({mode:r.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:r.Array(r.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:r.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."})),ss=r.Object({id:r.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:oH,config:C("type",[r.Object({type:r.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:r.String({description:"Slack channel ID that receives the notification"}),integrationId:r.String({description:"Slack workspace ID that receives the notification"}),integrationName:r.String({description:"Human readable name of the Slack integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigSlack"}),r.Object({type:r.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:r.String({description:"Identifier of the incident.io integration to use"}),integrationName:r.String({description:"Human readable name of the incident.io integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigIncidentIo"}),r.Object({type:r.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:r.Array(r.String(),{description:"Email addresses that will receive the alert"}),renotifyConfig:Sr},{$id:"RuleTargetConfigEmail"}),r.Object({type:r.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:r.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:r.String({description:"Human readable name of the Grafana IRM integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigGrafanaIrm"}),r.Object({type:r.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:r.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:r.String({description:"Human readable name of the PagerDuty integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigPagerDuty"}),r.Object({type:r.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:r.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:r.String({description:"Human readable name of the Microsoft Teams integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigMicrosoftTeams"}),r.Object({type:r.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:r.String({description:"Identifier of the webhook integration to use"}),integrationName:r.String({description:"Human readable name of the webhook integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigWebhook"}),r.Object({type:r.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:r.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:r.String({description:"Human readable name of the ServiceNow integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigServiceNow"}),r.Object({type:r.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:r.String({description:"Identifier of the Google Chat integration to use"}),integrationName:r.String({description:"Human readable name of the Google Chat integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigGoogleChat"}),r.Object({type:r.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:r.String({description:"Identifier of the Squadcast integration to use"}),integrationName:r.String({description:"Human readable name of the Squadcast integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigSquadcast"}),r.Object({type:r.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:r.String({description:"Identifier of the Jira integration to use"}),integrationName:r.String({description:"Human readable name of the Jira integration"}),projectKey:r.String({description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:r.String({description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:r.Optional(r.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:r.Optional(r.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`."})}),yi=r.Object({id:u({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:iH,config:C("type",[r.Object({type:r.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:u({allowEmpty:!1,description:"Slack channel ID that receives the notification"}),integrationId:u({allowEmpty:!1,description:"Slack workspace ID that receives the notification"}),renotifyConfig:Ar},{$id:"RuleTargetInputSlack"}),r.Object({type:r.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the incident.io integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputIncidentIo"}),r.Object({type:r.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the PagerDuty integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputPagerDuty"}),r.Object({type:r.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:r.Array(u({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"}),renotifyConfig:Ar},{$id:"RuleTargetInputEmail"}),r.Object({type:r.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the Grafana IRM integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputGrafanaIrm"}),r.Object({type:r.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the Microsoft Teams integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputMicrosoftTeams"}),r.Object({type:r.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the webhook integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputWebhook"}),r.Object({type:r.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the ServiceNow integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputServiceNow"}),r.Object({type:r.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the Google Chat integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputGoogleChat"}),r.Object({type:r.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the Squadcast integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputSquadcast"}),r.Object({type:r.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:u({allowEmpty:!1,description:"Identifier of the Jira integration to use"}),projectKey:u({allowEmpty:!1,description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:u({allowEmpty:!1,description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:r.Optional(u({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:r.Optional(u({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)."})}),Fd=C("type",[r.Object({type:r.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:r.Array(r.String(),{description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),r.Object({type:r.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"}),r.Object({type:r.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."}),Bd=C("type",[r.Object({type:r.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:r.Array(u(),{minItems:1,maxItems:100,description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),r.Object({type:r.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"}),r.Object({type:r.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."}),Ti=r.Object({id:r.String({description:"Tsuga-generated notification rule ID assigned when the rule is created."}),name:r.String({description:"Display name of the notification rule."}),queryString:r.Optional(r.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:Fd,prioritiesFilter:r.Array(r.Enum(St),{description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(uo),{description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:r.Array(r.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:r.String({description:"Team ID that owns and manages the rule."}),createdAt:A({description:"Timestamp when Tsuga created the rule."}),updatedAt:A({description:"Timestamp when Tsuga last updated the rule."}),isActive:r.Boolean({description:"Whether the rule currently sends notifications when its filters match."}),tags:De,targets:r.Array(ss,{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:r.Optional(pe),updater:r.Optional(pe)}),cs=r.Object({name:u({description:"Display name of the notification rule."}),queryString:r.Optional(u({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:Bd,prioritiesFilter:r.Array(r.Enum(St),{maxItems:St.length,description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(uo),{maxItems:uo.length,description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:r.Optional(r.Array(u({allowEmpty:!1}),{description:"Cluster IDs that must match for this rule to fire. Omit it, or leave it empty, to match every cluster."})),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:Xe,isActive:r.Boolean({description:"Set to true for the rule to send notifications when its filters match."}),targets:r.Array(yi,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),du=r.Object({id:r.String({description:"Unique identifier of the adaptive notification rule. Generated by Tsuga."}),name:r.String({description:"Display name of the adaptive notification rule."}),owner:r.String({description:"Team ID that owns and manages the rule."}),createdAt:A({description:"Timestamp when Tsuga created the rule."}),updatedAt:A({description:"Timestamp when Tsuga last updated the rule."}),isActive:r.Boolean({description:"Whether the rule currently sends notifications when one of its monitors fires."}),shouldCreateInvestigation:r.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:De,monitorIds:r.Array(r.String(),{description:"Monitors this rule reacts to."}),sloIds:r.Array(r.String(),{description:"SLOs this rule reacts to."}),fallbackTarget:ss,creator:r.Optional(pe),updater:r.Optional(pe)}),AR=r.Object({name:u({description:"Display name of the adaptive notification rule."}),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:Xe,isActive:r.Boolean({description:"Set to true for the rule to send notifications when one of its monitors fires."}),shouldCreateInvestigation:r.Optional(r.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:r.Optional(r.Array(u({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:r.Optional(r.Array(u({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:yi}),oke=d({tags:["notification-rules"],url:Sn,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(Ti)}),ike=d({tags:["notification-rules"],url:`${Sn}/:id`,params:r.Object({id:u()}),method:"GET",response:Ti}),ake=d({tags:["notification-rules"],url:Sn,method:"POST",body:cs,response:Ti}),ske=d({tags:["notification-rules"],url:`${Sn}/:id`,method:"PUT",params:r.Object({id:u()}),body:cs,response:Ti}),cke=d({tags:["notification-rules"],url:`${Sn}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),pke=d({tags:["notification-rules"],url:`${Sn}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),Ei=`${hi}/adaptive-rules`,uke=d({tags:["notification-rules"],url:Ei,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(du)}),lke=d({tags:["notification-rules"],url:`${Ei}/:id`,params:r.Object({id:u()}),method:"GET",response:du}),mke=d({tags:["notification-rules"],url:Ei,method:"POST",body:AR,response:du}),dke=d({tags:["notification-rules"],url:`${Ei}/:id`,method:"PUT",params:r.Object({id:u()}),body:AR,response:du}),fke=d({tags:["notification-rules"],url:`${Ei}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),gke=d({tags:["notification-rules"],url:`${Ei}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),hke=d({tags:["notification-integrations"],url:`${SR}/start`,method:"POST",response:r.Object({redirectUrl:r.String()})}),aH=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],sH=r.Object({id:r.String(),name:r.String(),type:r.Enum(aH),createdAt:A(),ruleCount:r.Number(),creator:r.Optional(pe)}),yke=d({tags:["notification-integrations"],url:`${Sn}/integrations`,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(sH)}),Tke=d({tags:["notification-integrations"],url:`${SR}/callback`,method:"GET",query:r.Object({code:u()}),response:r.Object({success:r.Boolean()})}),Hd=["POST","PUT"],cH=r.Record(r.String(),r.String()),pH=r.Record(r.String(),r.Unknown()),uH=r.Record(r.String(),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))])),lH=C("type",[r.Object({type:r.Literal("json"),value:pH}),r.Object({type:r.Literal("form"),value:uH})]),mH=r.Object({ok:r.String(),alert:r.String()}),Kd=r.Object({id:r.String(),name:r.String(),setting:C("type",[r.Object({type:r.Literal("incident-io"),alertSourceConfigId:r.String(),tokenLastChars:r.String()}),r.Object({type:r.Literal("grafana-irm"),urlLastChars:r.String()}),r.Object({type:r.Literal("pagerduty"),integrationKeyLastChars:r.String()}),r.Object({type:r.Literal("microsoft-teams"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("webhook"),urlLastChars:r.String(),method:r.Enum(Hd),authentication:C("type",[r.Object({type:r.Literal("bearer"),tokenLastChars:r.String()}),r.Object({type:r.Literal("basic"),username:r.String(),passwordLastChars:r.String()}),r.Object({type:r.Literal("custom-header"),key:r.String(),valueLastChars:r.String()}),r.Object({type:r.Literal("none")})]),customHeaders:r.Optional(cH),payloadTemplate:lH,eventNameMapping:r.Optional(mH)}),r.Object({type:r.Literal("servicenow"),instanceName:r.String(),username:r.String(),passwordLastChars:r.String()}),r.Object({type:r.Literal("google-chat"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("squadcast"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("jira"),siteUrl:r.String(),email:r.String(),apiTokenLastChars:r.String()})]),tags:De}),dH=r.Object({type:r.Literal("webhook"),url:u({type:"uri"}),method:r.Enum(Hd),authentication:C("type",[r.Object({type:r.Literal("bearer"),token:u({allowEmpty:!1})}),r.Object({type:r.Literal("basic"),username:u({allowEmpty:!1}),password:u({allowEmpty:!1})}),r.Object({type:r.Literal("custom-header"),key:u({allowEmpty:!1}),value:u({allowEmpty:!1})}),r.Object({type:r.Literal("none")})]),customHeaders:r.Record(u({allowEmpty:!1}),u()),payloadTemplate:C("type",[r.Object({type:r.Literal("json"),value:r.Record(u({allowEmpty:!1}),r.Unknown())}),r.Object({type:r.Literal("form"),value:r.Record(u({allowEmpty:!1}),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))]))})]),eventNameMapping:r.Optional(r.Object({ok:u({allowEmpty:!1}),alert:u({allowEmpty:!1})}))}),OR=r.Object({type:r.Literal("incident-io"),alertSourceConfigId:u(),token:u()}),xR=r.Object({type:r.Literal("grafana-irm"),url:u({type:"uri"})}),RR=r.Object({type:r.Literal("pagerduty"),integrationKey:u()}),CR=r.Object({type:r.Literal("microsoft-teams"),webhookUrl:u({type:"uri"})}),fH=r.Object({type:r.Literal("servicenow"),instanceName:u({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:u({allowEmpty:!1}),password:u({allowEmpty:!1})}),gH=r.Object({type:r.Literal("google-chat"),webhookUrl:u({type:"uri"})}),hH=r.Object({type:r.Literal("squadcast"),webhookUrl:u({type:"uri"})}),yH=r.Object({type:r.Literal("jira"),siteUrl:u({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:u({type:"email",allowEmpty:!1,description:"Atlassian account email used together with the API token for Basic authentication."}),apiToken:u({allowEmpty:!1,description:"Atlassian API token minted for the account, used as the Basic auth password."})}),TH=r.Object({name:u(),setting:C("type",[OR,xR,RR,CR,dH,fH,gH,hH,yH]),tags:Xe}),EH=r.Object({type:r.Literal("webhook"),url:r.Optional(u({type:"uri"})),method:r.Optional(r.Enum(Hd)),authentication:r.Optional(C("type",[r.Object({type:r.Literal("bearer"),token:r.Optional(u({allowEmpty:!1}))}),r.Object({type:r.Literal("basic"),username:r.Optional(u({allowEmpty:!1})),password:r.Optional(u({allowEmpty:!1}))}),r.Object({type:r.Literal("custom-header"),key:r.Optional(u({allowEmpty:!1})),value:r.Optional(u({allowEmpty:!1}))}),r.Object({type:r.Literal("none")})])),customHeaders:r.Optional(r.Record(u({allowEmpty:!1}),u())),payloadTemplate:r.Optional(C("type",[r.Object({type:r.Literal("json"),value:r.Record(u({allowEmpty:!1}),r.Unknown())}),r.Object({type:r.Literal("form"),value:r.Record(u({allowEmpty:!1}),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))]))})])),eventNameMapping:r.Optional(r.Object({ok:r.Optional(u({allowEmpty:!1})),alert:r.Optional(u({allowEmpty:!1}))}))}),_H=r.Object({type:r.Literal("servicenow"),instanceName:r.Optional(u({allowEmpty:!1})),username:r.Optional(u({allowEmpty:!1})),password:r.Optional(u({allowEmpty:!1}))}),IH=r.Object({type:r.Literal("jira"),siteUrl:r.Optional(u({type:"uri",allowEmpty:!1})),email:r.Optional(u({allowEmpty:!1})),apiToken:r.Optional(u({allowEmpty:!1}))}),bH=r.Object({type:r.Literal("google-chat"),webhookUrl:u({type:"uri"})}),SH=r.Object({type:r.Literal("squadcast"),webhookUrl:u({type:"uri"})}),AH=r.Object({name:r.Optional(u()),setting:r.Optional(C("type",[OR,xR,RR,CR,EH,_H,bH,SH,IH]))}),Eke=d({tags:["notification-integrations"],url:as,method:"POST",body:TH,response:Kd}),_ke=d({tags:["notification-integrations"],url:`${as}/:id`,method:"GET",params:r.Object({id:u()}),response:Kd}),Ike=d({tags:["notification-integrations"],url:`${as}/:id`,method:"PUT",params:r.Object({id:u()}),body:AH,response:Kd}),bke=d({tags:["notification-integrations"],url:`${as}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),OH=C("status",[r.Object({status:r.Literal("ok",{description:"Tsuga reached Jira and listed the projects the credentials can file into."}),projects:r.Array(r.Object({key:r.String({description:'Jira project key, like "OPS".'}),name:r.String({description:"Human readable Jira project name."}),issueTypes:r.Array(r.String(),{description:"Issue type names available when creating an issue in this project."}),statuses:r.Optional(r.Array(r.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"}),r.Object({status:r.Literal("error",{description:"Tsuga could not load Jira metadata with the stored credentials."}),message:r.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."}),Ske=d({tags:["notification-integrations"],url:`${as}/:id/jira-metadata`,method:"GET",params:r.Object({id:u()}),response:OH}),Ake=d({tags:["notification-rules"],url:`${At}/:id/notifications`,method:"GET",params:r.Object({id:u()}),query:r.Optional(r.Object({from:r.Optional(r.Number()),to:r.Optional(r.Number())})),response:r.Object({notifications:r.Array(r.Object({id:r.String(),monitorId:r.String(),monitorResultId:r.String(),ruleId:r.Optional(r.String()),targetId:r.Optional(r.String()),status:r.Enum(nH),tryCount:r.Number(),nextTryAt:A(),createdAt:A(),updatedAt:A(),sentAt:r.Optional(A())})),isTruncated:r.Boolean()})}),xH=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],Oke=d({tags:["notification-rules"],url:`${Sn}/test`,method:"POST",body:r.Object({notificationRule:cs,targetIds:r.Optional(r.Array(u({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:r.Union([r.Object({success:r.Literal(!1),overallMessage:r.String({description:"Message when there is an overall error"})}),r.Object({success:r.Boolean(),results:r.Array(r.Object({targetId:r.String({description:"The ID of the target that was tested"}),targetType:r.Enum(xH,{description:"The type of the target (e.g., slack, webhook)"}),status:r.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:r.Optional(r.String({description:"Message if the notification failed for this specific target"}))}))})])});var Dt="/v0/service-catalog";var RH=r.Object({team:r.String({description:"Team name observed on telemetry for this service."}),lastSeenAt:A({description:"Most recent time this team was observed for the service."})},{description:"A team name observed on telemetry for this service, with the last time it was seen."}),CH=r.Object({ingestionApiKey:r.String({description:"Ingestion API key name or identifier observed on telemetry for this service."}),lastSeenAt:A({description:"Most recent time this ingestion key was observed for the service."})},{description:"An ingestion API key observed on telemetry for this service, with the last time it was seen."}),PH=r.Object({version:r.String({description:"Service version value observed in telemetry."}),firstSeenAt:A({description:"First time this version was observed for the service."}),lastSeenAt:A({description:"Most recent time this version was observed for the service."}),faulty:r.Optional(r.Boolean({description:"Whether Tsuga detected this version as associated with faulty behavior."})),faultyLatency:r.Optional(r.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:r.Optional(r.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."}),UH=r.Object({language:r.String({description:"Programming language observed for this service."}),lastSeenAt:A({description:"Most recent time this language was observed."})},{description:"A programming language observed for this service, with the last time it was seen."}),wH=r.Object({runtime:r.String({description:"Runtime observed for this service."}),lastSeenAt:A({description:"Most recent time this runtime was observed."})},{description:"A runtime observed for this service, with the last time it was seen."}),PR=r.Object({protocol:r.String({description:"Observed API protocol (e.g. 'http', 'grpc', 'graphql')"}),lastSeenAt:A({description:"Most recent observation timestamp"})},{description:"An API protocol observed for this service, with the last time it was seen."}),vH=r.Object({framework:r.String({description:"Observed application framework (e.g. 'express', 'fastify', 'django', 'rails')"}),lastSeenAt:A({description:"Most recent observation timestamp"})},{description:"An application framework detected from OpenTelemetry instrumentation scope, with the last time it was seen."}),NH=r.Object({platform:r.String({description:"Observed cloud or orchestration platform (e.g. 'aws_eks', 'kubernetes')"}),lastSeenAt:A({description:"Most recent observation timestamp"})},{description:"A cloud or orchestration platform this service runs on, with the last time it was seen."}),LH=r.Object({provider:r.String({description:"Observed cloud provider (e.g. 'aws', 'gcp', 'azure')"}),lastSeenAt:A({description:"Most recent observation timestamp"})},{description:"A cloud provider this service runs on, with the last time it was seen."}),_i=r.Object({id:r.String({description:"Tsuga-generated identifier of this service target, unique across all services. Used with delivery state such as rate limiting and re-notification."}),serviceId:r.String({description:"Identifier of the service catalog entry this target is attached to."}),config:ss.properties.config,rateLimit:ss.properties.rateLimit,createdAt:A({description:"Timestamp when user created this service target."}),updatedAt:A({description:"Timestamp when user last updated this service target."})}),zd=r.Object({config:yi.properties.config,rateLimit:yi.properties.rateLimit}),Yd=r.Object({config:yi.properties.config,rateLimit:r.Union([qd,r.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."})}),ps=r.Object({id:r.String({description:"Unique identifier of this service. Use it with service detail and graph endpoints."}),serviceName:r.String({description:"OpenTelemetry service name observed in telemetry."}),serviceNamespace:r.Optional(r.String({description:"OpenTelemetry service namespace observed in telemetry."})),env:r.Optional(r.String({description:"Environment value observed for this service."})),teams:r.Array(RH,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:r.Array(CH,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:r.Array(PH,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:r.Array(UH,{description:"Programming languages observed for this service."}),runtimes:r.Array(wH,{description:"Runtime values observed for this service."}),serverProtocols:r.Array(PR,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:r.Array(PR,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:r.Array(vH,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:r.Array(NH,{description:"Cloud platforms this service is running on"}),cloudProviders:r.Array(LH,{description:"Cloud providers this service is running on"}),lastSeenAt:A({description:"Most recent time Tsuga observed telemetry for this service."}),firstSeenAt:A({description:"First time Tsuga observed telemetry for this service."}),sources:r.Array(r.String(),{description:"Telemetry sources that contributed evidence for this service entry."}),additionalUserFields:r.Optional(r.Unsafe({type:"object",additionalProperties:!0,description:"Additional user-defined service metadata, when configured."})),logsCount24h:r.Number({description:"Number of logs observed for this service in the last 24 hours."}),errorLogsCount24h:r.Number({description:"Number of error logs observed for this service in the last 24 hours."}),tracesCount24h:r.Number({description:"Number of traces observed for this service in the last 24 hours."}),errorTracesCount24h:r.Number({description:"Number of error traces observed for this service in the last 24 hours."}),notificationTargets:r.Array(_i,{description:"Notification targets attached to this service, used by adaptive notification rules to page its owners."}),createdAt:A({description:"Timestamp when Tsuga created this service catalog entry."}),updatedAt:A({description:"Timestamp when Tsuga last updated this service catalog entry."})}),Mke=d({tags:["service-catalog"],query:r.Object({...fe,clusterId:r.Optional(u())}),method:"GET",paginated:!0,url:`${Dt}/services`,response:r.Array(ps)}),kH=r.Object({spanKind:r.Enum(JO),count:r.Number()}),Vd=r.Object({...ps.properties,spanKindCounts:r.Array(kH),envs:r.Object({primaryEnv:r.String(),allEnvs:r.Array(r.String())})}),Dke=d({tags:["service-catalog"],query:r.Object({...fe,clusterId:r.Optional(u()),env:r.Optional(u())}),method:"GET",paginated:!0,url:`${Dt}/v2/services`,response:r.Array(Vd)}),MH=["serviceName","envs","lastDeploy","traceErrorRate","traceRequestRate","logErrorRate","logRequestRate","teams","api","frameworks","languages","pagingDestination"],DH=r.Object({searchQuery:r.Object({value:u({allowEmpty:!1,description:"Substring matched case-insensitively against service names."})},{description:"Text filter for service names."}),teams:_e(u({allowEmpty:!1}),{description:"Restrict results to services observed under any of these team names",maxItems:50}),envs:_e(u({allowEmpty:!1}),{description:"Restrict results to services observed in any of these environments",maxItems:50}),versions:_e(u({allowEmpty:!1}),{description:"Restrict results to services whose latest observed version is one of these",maxItems:50}),languages:_e(u({allowEmpty:!1}),{description:"Restrict results to services written in any of these languages",maxItems:50}),hasRecentData:r.Boolean({description:"When true, only return services that received logs or traces in the last 24 hours"})}),GH=r.Partial(r.Object({...fe,clusterId:u(),filters:r.Partial(DH,{description:"Optional filters applied to narrow the returned services"}),sort:r.Object({by:r.Enum(MH,{description:"Field to sort the returned services by"}),direction:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned services"})})),Gke=d({tags:["service-catalog"],url:`${Dt}/v2/services/query`,method:"POST",paginated:!0,body:GH,response:r.Array(Vd)}),$ke=d({tags:["service-catalog"],query:r.Object({serviceName:u({allowEmpty:!1}),serviceNamespace:r.Optional(u({allowEmpty:!1})),env:u({allowEmpty:!1}),clusterId:r.Optional(u())}),method:"GET",url:`${Dt}/v2/service`,response:Vd}),jke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId`,params:r.Object({serviceId:u()}),response:ps}),qke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId/targets`,params:r.Object({serviceId:u()}),response:r.Array(_i)}),Fke=d({tags:["service-catalog"],method:"POST",url:`${Dt}/services/:serviceId/targets`,params:r.Object({serviceId:u()}),body:zd,response:_i}),Bke=d({tags:["service-catalog"],method:"PUT",url:`${Dt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:u(),targetId:u()}),body:Yd,response:_i}),Hke=d({tags:["service-catalog"],method:"DELETE",url:`${Dt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:u(),targetId:u()}),response:N}),$H=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var UR=r.Object({id:r.String(),hostName:r.String(),env:r.Optional(r.String()),cpuUtilizationAverage:r.Number(),hostType:r.Enum($H),teams:r.Array(r.String()),tags:r.Array(r.String()),firstSeenAt:A(),lastSeenAt:A(),clusterId:r.String()}),Kke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/hosts`,response:r.Array(UR)}),zke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/hosts/:hostId`,params:r.Object({hostId:u()}),response:UR}),jH=["http","rpc","messaging","genai","object_store"],wR={name:r.String({description:"Service or inferred dependency name shown in the graph."}),env:r.Optional(r.String({description:"Environment observed from spans."}))},Qd=r.Object({...wR,nodeType:r.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:r.Union([r.String(),r.Null()],{description:"Service ID, or null when multiple namespaces match the observed service name."}),namespace:r.Union([r.String(),r.Null()],{description:"Service namespace, or null when multiple namespaces match the observed service name."}),errorRate:r.Optional(r.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."})),entryErrorRequestCount:r.Number({description:"Number of entry requests on this service where at least one entry span had error status."}),entryRequestCount:r.Number({description:"Number of entry requests observed on this service, counted 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."})}),vR={...wR,endpoint:r.Optional(r.String({description:"Inferred service endpoint address"})),resourceName:r.Optional(r.String({description:"Inferred resource name, e.g. table or queue name"}))},Wd=r.Object({...vR,nodeType:r.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:r.Literal("db",{description:"Inferred dependency type. Always `db` for this node variant."}),databaseName:r.Optional(r.String({description:"Database name from span_attributes db.namespace (falling back to legacy db.name). Matches the database catalog `name`."})),databaseSystem:r.String({description:"Database system from span_attributes db.system.name (falling back to legacy db.system). Matches the database catalog `databaseSystem`."})}),Zd=r.Object({...vR,nodeType:r.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:r.Enum(jH,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),qH=C("nodeType",[Qd,Wd,Zd]),Xd=r.Object({from:r.Object({env:r.Optional(r.String({description:"Environment of the source node"})),name:r.String({description:"Name of the source node"})},{description:"Reference to the caller node, i.e. the service or dependency that issued the request."}),to:r.Object({env:r.Optional(r.String({description:"Environment of the target node"})),name:r.String({description:"Name of the target node"}),databaseSystem:r.Optional(r.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:r.Number({description:"Number of cross-service transitions observed on this directed edge in the graph query window."}),errorRate:r.Optional(r.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."})),errorCount:r.Number({description:"Number of client spans with error status observed on this edge"}),clientSpanCount:r.Number({description:"Number of client spans observed on this edge"})},{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."}),Yke=d({tags:["service-catalog"],url:`${Dt}/services/:serviceId/graph`,method:"GET",params:r.Object({serviceId:u()}),query:r.Object({...at.properties,query:r.Optional(u({type:"tsuga-query"}))}),response:r.Object({clusterId:r.String(),nodes:r.Array(qH),edges:r.Array(Xd)})}),FH=r.Object({monitors:r.Array(r.Object({id:r.String({description:"Identifier of the monitor"}),name:r.String({description:"Display name of the monitor"}),owner:r.String({description:"Team ID that owns the monitor"}),priority:r.Enum(St,{description:"Priority of the monitor"})})),slos:r.Array(r.Object({id:r.String({description:"Identifier of the SLO"}),name:r.String({description:"Display name of the SLO"}),owner:r.String({description:"Team ID that owns the SLO"}),statusCount:r.Partial(r.Record(lu,r.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"})}))}),Vke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId/related-resources`,params:r.Object({serviceId:u()}),response:FH}),Qke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/by-api-keys`,response:r.Record(r.String(),r.Array(r.Object({serviceName:r.String(),serviceNamespace:r.Optional(r.String())})))});var fu=`/${"v1"}/services`,Jd=r.Pick(ps,["id","serviceName","serviceNamespace","env","teams","versions","languages","runtimes","serverProtocols","clientProtocols","frameworks","cloudPlatforms","cloudProviders","lastSeenAt","firstSeenAt","sources","logsCount24h","errorLogsCount24h","tracesCount24h","errorTracesCount24h"],{$id:"Service",description:"Service inferred from telemetry, with observed metadata, activity counts, and version signals. See [Services](/documentation/categorize/services/index)."}),BH={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",sources:["logs","metrics","traces"],logsCount24h:12e3,errorLogsCount24h:42,tracesCount24h:8500,errorTracesCount24h:17};Object.assign(Jd,{examples:[BH]});var NR=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:fu,method:"GET",paginated:!0,query:r.Object({...Ze,clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Omit to use the first cluster in the organization; this does not query all clusters."}))},{description:"Service list query. Use pagination and optional cluster scope."}),response:r.Array(Jd)}),LR=d({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${fu}/:serviceId`,method:"GET",params:r.Object({serviceId:u({allowEmpty:!1,description:"Identifier of the service to retrieve. Use the `id` returned by service list responses."})}),response:Jd}),HH=r.Pick(Qd,["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."}),KH=r.Pick(Zd,["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."}),zH=r.Pick(Wd,["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."}),YH=C("nodeType",[HH,zH,KH]),VH=r.Pick(Xd,["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."}),QH=r.Optional(r.Integer({...at.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."})),WH=r.Optional(r.Integer({...at.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."})),ZH=u({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."}),kR=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:`${fu}/:serviceId/graph`,method:"GET",params:r.Object({serviceId:u({allowEmpty:!1,description:"Identifier of the service to use as the graph root. Use the `id` returned by service list or get responses."})}),query:r.Object({from:QH,to:WH,query:r.Optional(ZH)},{description:"Service graph query. Use time range and optional span query filters."}),response:r.Object({clusterId:r.String({description:"Cluster ID the graph was built from"}),nodes:r.Array(YH,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:r.Array(VH,{description:"Directed dependency edges between graph nodes."})})}),gu=`${fu}/:serviceId/notification-targets`,hu=r.Pick(_i,["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)."}),ef={rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}},XH={id:"789-abc-def",serviceId:"123-456-abc",...ef};Object.assign(hu,{examples:[XH]});var yu=u({allowEmpty:!1,description:"Identifier of the service the notification target belongs to. Use the `id` returned by service list or get responses."}),oMe=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:gu,method:"GET",params:r.Object({serviceId:yu}),response:r.Array(hu)}),JH=r.Pick(zd,["config","rateLimit"],{description:"Service notification target create request. Provide the delivery destination and an optional per-target rate limit.",examples:[ef]}),e2=r.Pick(Yd,["config","rateLimit"],{description:"Service notification target update request. The submitted destination and rate limit overwrite the stored ones.",examples:[ef]}),iMe=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:gu,method:"POST",params:r.Object({serviceId:yu}),body:JH,response:hu}),aMe=d({description:"Updates one notification target attached to a service.",operationId:"updateServiceNotificationTarget",tags:["services"],url:`${gu}/:targetId`,method:"PUT",params:r.Object({serviceId:yu,targetId:u({allowEmpty:!1,description:"Identifier of the notification target to update. Use the `id` returned by service notification target list or create responses."})}),body:e2,response:hu}),sMe=d({description:"Detaches a notification target from a service. Notification rules stop paging this destination for the service.",operationId:"deleteServiceNotificationTarget",tags:["services"],url:`${gu}/:targetId`,method:"DELETE",params:r.Object({serviceId:yu,targetId:u({allowEmpty:!1,description:"Identifier of the notification target to delete. Use the `id` returned by service notification target list or create responses."})}),response:N});var Ge=" (unix seconds, ISO 8601, or relative like -1h/-30m/now)";function MR(e,t){let n=t??jr(e);return n===void 0?void 0:Ic(n)}function tf(e){let t=jr(e);return t===void 0?"":` (default: ${t})`}function DR(e,t){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${Ge}${tf("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${tf("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${tf("query")}`).action(async(o,i)=>{let a={},c=MR("from",i.from),l=MR("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 t()(kR,{params:{serviceId:o},query:a});ee(m)})}var t2=`/${"v1"}/grok`,r2=25,n2=100,GR=r.Object({rules:r.Array(u({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:r2,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:r.Array(u({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:n2,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."}),o2={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(GR,{examples:[o2]});var $R=r.Object({results:r.Array(r.Object({sample:r.String({description:"Echo of the submitted log line, so results can be matched to the samples in the request."}),matched:r.Boolean({description:"Whether any submitted rule matched this sample. `true` means `extracted` contains the captured fields; `false` means no rule matched."}),extracted:r.Union([r.Record(r.String(),r.Unknown()),r.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."}),i2={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($R,{examples:[i2]});var jR=d({url:`${t2}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:GR,response:$R,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`."});var qR=rn(require("node:fs"));function Ii(e){if(e.file){let t=qR.default.readFileSync(e.file==="-"?0:e.file,"utf-8");return JSON.parse(t)}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 rf(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>s.IsObject(t)&&s.HasPropertyKey(t,"check")&&s.HasPropertyKey(t,"error")&&s.IsFunction(t.check)&&s.IsFunction(t.error))}function ar(e){return s.IsObject(e)&&!s.IsArray(e)}function Tu(e){return s.IsBoolean(e)}function q(e){return ar(e)||Tu(e)}function nf(e){return s.HasPropertyKey(e,"additionalItems")&&q(e.additionalItems)}function Kr(e){return s.HasPropertyKey(e,"additionalProperties")&&q(e.additionalProperties)}function of(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(t=>q(t))}function us(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function af(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>q(t))}function sf(e){return s.HasPropertyKey(e,"const")}function lo(e){return s.HasPropertyKey(e,"contains")&&q(e.contains)}function Ht(e){return s.HasPropertyKey(e,"default")}function cf(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(t=>q(t)||s.IsArray(t)&&t.every(n=>s.IsString(n)))}function pf(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>s.IsArray(t)&&t.every(n=>s.IsString(n)))}function uf(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>q(t))}function An(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function lf(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function mf(e){return s.HasPropertyKey(e,"else")&&q(e.else)}function df(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function ff(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function zr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function ls(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Yr(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function gf(e){return s.HasPropertyKey(e,"if")&&q(e.if)}function bi(e){return s.HasPropertyKey(e,"items")&&(q(e.items)||s.IsArray(e.items)&&e.items.every(t=>q(t)))}function hf(e){return bi(e)&&s.IsArray(e.items)}function yf(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function Tf(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function Eu(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Ef(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function _f(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function Vr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function mo(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function Si(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function ms(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function ds(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function If(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function bf(e){return s.HasPropertyKey(e,"not")&&q(e.not)}function Sf(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>q(t))}function fs(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function gs(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>q(t))}function Ai(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>q(t))}function hs(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>q(t))}function Af(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||q(e.propertyNames))}function a2(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function _u(e){return a2(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function Of(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function xf(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function fo(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function Rf(e){return s.HasPropertyKey(e,"then")&&q(e.then)}function Cf(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function Oi(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Iu(e){return s.HasPropertyKey(e,"unevaluatedItems")&&q(e.unevaluatedItems)}function bu(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&q(e.unevaluatedProperties)}var xt=class{constructor(){let t=new Set,n=new Set;this.stack=[{indices:t,keys:n}]}Push(){let t=new Set,n=new Set;return this.stack.push({indices:t,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(let n of t)n.GetIndices().forEach(o=>this.GetIndices().add(o)),n.GetKeys().forEach(o=>this.GetKeys().add(o));return!0}},ys=class extends xt{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}},st=class extends ys{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}};function FR(e,t,n,o){return s.Every(n["~refine"],0,(i,a)=>i.check(o))}function BR(e,t,n,o,i,a){return s.EveryAll(i["~refine"],0,(c,l)=>c.check(a)||t.AddError({keyword:"~refine",schemaPath:n,instancePath:o,params:{index:l,message:c.error(a)}}))}function HR(e){return bi(e)&&s.IsArray(e.items)}function KR(e,t,n,o){return HR(n)?s.Every(o,0,(a,c)=>s.IsLessThan(c,n.items.length)||Kt(e,t,n.additionalItems,a)&&t.AddIndex(c)):!0}function zR(e,t,n,o,i,a){return HR(i)?s.Every(a,0,(l,m)=>{let f=`${n}/additionalItems`,h=`${o}/${m}`;return s.IsLessThan(m,i.items.length)||zt(e,t,f,h,i.additionalItems,l)&&t.AddIndex(m)}):!0}function s2(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function YR(e){let t=[];return gs(e)&&t.push(...s.Keys(e.patternProperties)),hs(e)&&t.push(...s.Keys(e.properties).map(s2)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function VR(e,t,n,o){let i=new RegExp(YR(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||Kt(e,t,n.additionalProperties,o[c])&&t.AddKey(c))}function QR(e,t,n,o,i,a){let c=new RegExp(YR(i)),l=[];return s.EveryAll(s.Keys(a),0,(f,h)=>{let E=`${n}/additionalProperties`,I=`${o}/${f}`,g=new st,T=c.test(f)||zt(e,g,E,I,i.additionalProperties,a[f])&&t.AddKey(f);return T||l.push(f),T})||t.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:o,params:{additionalProperties:l}})}function WR(e,t,n,o){let i=n.allOf.reduce((a,c)=>{let l=new xt;return ne(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,n.allOf.length)&&t.Merge(i)}function ZR(e,t,n,o,i,a){let c=[],l=i.allOf.reduce((f,h,E)=>{let I=`${n}/allOf/${E}`,g=new st,T=Ie(e,g,I,o,h,a);return T||c.push(g),T?[...f,g]:f},[]),m=s.IsEqual(l.length,i.allOf.length)&&t.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>t.AddError(h))),m}function XR(e,t,n,o){let i=n.anyOf.reduce((a,c)=>{let l=new xt;return ne(e,l,c,o)?[...a,l]:a},[]);return s.IsGreaterThan(i.length,0)&&t.Merge(i)}function JR(e,t,n,o,i,a){let c=[],l=i.anyOf.reduce((f,h,E)=>{let I=new st,g=`${n}/anyOf/${E}`,T=Ie(e,I,g,o,h,a);return T||c.push(I),T?[...f,I]:f},[]),m=s.IsGreaterThan(l.length,0)&&t.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>t.AddError(h))),m||t.AddError({keyword:"anyOf",schemaPath:n,instancePath:o,params:{}})}function Uf(e,t,n,o){return n}function eC(e,t,n,o,i,a){return Uf(e,t,i,a)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function wf(e,t,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function tC(e,t,n,o,i,a){return wf(e,t,i,a)||t.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function c2(e){return!(mo(e)&&s.IsEqual(e.minContains,0))}function vf(e,t,n,o){return c2(n)?!s.IsEqual(o.length,0)&&s.SomeAll(o,(i,a)=>ne(e,t,n.contains,i)&&t.AddIndex(a)):!0}function rC(e,t,n,o,i,a){return vf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function nC(e,t,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)):ne(e,t,l,o)));return i||a}function oC(e,t,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)||t.AddError({keyword:"dependencies",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})):Ie(e,t,h,o,f,a))});return c||l}function iC(e,t,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 aC(e,t,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)||t.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})));return c||l}function sC(e,t,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)||ne(e,t,l,o));return i||a}function cC(e,t,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)||Ie(e,t,h,o,f,a)});return c||l}function pC(e,t,n,o){let i=e.DynamicRef(n)??!1;return q(i)&&ne(e,t,i,o)}function uC(e,t,n,o,i,a){let c=e.DynamicRef(i)??!1;return q(c)&&Ie(e,t,"#",o,c,a)}function kf(e,t,n,o){return s.Some(n.enum,i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function lC(e,t,n,o,i,a){return kf(e,t,i,a)||t.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function Mf(e,t,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function mC(e,t,n,o,i,a){return Mf(e,t,i,a)||t.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function Df(e,t,n,o){return s.IsGreaterThan(o,n.exclusiveMinimum)}function dC(e,t,n,o,i,a){return Df(e,t,i,a)||t.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var Pi={};Yt(Pi,{Clear:()=>AC,Entries:()=>Y2,Get:()=>W2,Has:()=>Q2,IsDate:()=>Ri,IsDateTime:()=>Su,IsDuration:()=>Au,IsEmail:()=>Ou,IsHostname:()=>Ru,IsIPv4:()=>Uu,IsIPv6:()=>wu,IsIdnEmail:()=>Cu,IsIdnHostname:()=>Pu,IsIri:()=>Nu,IsIriReference:()=>vu,IsJsonPointer:()=>ku,IsJsonPointerUriFragment:()=>Lu,IsRegex:()=>Mu,IsRelativeJsonPointer:()=>Du,IsTime:()=>Ci,IsUri:()=>qu,IsUriReference:()=>Gu,IsUriTemplate:()=>$u,IsUrl:()=>Fu,IsUuid:()=>Bu,Reset:()=>OC,Set:()=>V2,Test:()=>Z2});var p2=[0,31,28,31,30,31,30,31,31,30,31,30,31],u2=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function l2(e){return e%4===0&&(e%100!==0||e%400===0)}function Ri(e){let t=u2.exec(e);if(!t)return!1;let n=+t[1],o=+t[2],i=+t[3];return o>=1&&o<=12&&i>=1&&i<=(o===2&&l2(n)?29:p2[o])}var m2=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Ci(e,t=!0){let n=m2.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||t&&!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 Su(e,t=!0){let n=e.split(/T/i);return n.length===2&&Ri(n[0])&&Ci(n[1],t)}var d2=/^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 Au(e){return d2.test(e)}var f2=/^(?!.*\.\.)[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 Ou(e){return f2.test(e)}var go=36,xu=1,Gf=26,g2=38,h2=700,y2=72,T2=128;function E2(e,t,n){e=n?Math.floor(e/h2):e>>1,e+=Math.floor(e/t);let o=0;for(;e>(go-xu)*Gf>>1;)e=Math.floor(e/(go-xu)),o+=go;return o+Math.floor((go-xu+1)*e/(e+g2))}function fC(e){let t=[],n=T2,o=0,i=y2,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");t.push(m)}let c=a<0?0:a+1;for(;c<e.length;){let l=o,m=1,f=go;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)ge();else throw new Error("Invalid punycode: bad digit character");o+=I*m;let g=f<=i?xu:f>=i+Gf?Gf:f-i;if(I<g)break;m*=go-g,f+=go}let h=t.length+1;i=E2(o-l,h,l===0),n+=Math.floor(o/h),o%=h,t.splice(o,0,n),o++}return globalThis.String.fromCodePoint(...t)}function I2(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function b2(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function S2(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function A2(e){return I2(e)||b2(e)||S2(e)}var O2=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),x2=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 R2(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function C2(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function P2(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function U2(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function w2(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function v2(e){return e>=1632&&e<=1641}function N2(e){return e>=1776&&e<=1785}function gC(e){return x2.has(e)}function hC(e){if(e.length===0)return ge();let t=[...e].map(c=>c.codePointAt(0)),n=t.length;if(t[0]===45||t[n-1]===45||n>=4&&t[2]===45&&t[3]===45||A2(t[0]))return!1;let o=!1,i=!1,a=!1;for(let c=0;c<n;c++){let l=t[c];if(O2.has(l))return!1;(P2(l)||U2(l)||w2(l))&&(o=!0),v2(l)&&(i=!0),N2(l)&&(a=!0);let m=t[c-1],f=t[c+1];switch(l){case 183:if(m!==108||f!==108)return!1;break;case 885:if(f===void 0||!R2(f))return!1;break;case 1523:case 1524:if(m===void 0||!C2(m))return!1;break;case 8204:if(m===void 0||m<128&&!gC(m))return!1;break;case 8205:if(m===void 0||!gC(m))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o||i&&a)}function L2(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 t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45))return!1}return!0}function yC(e){return e.toLowerCase().startsWith("xn--")}function TC(e){try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let o=fC(t);return o?hC(o):!1}catch{return!1}}function EC(e){return e.length===0||e.length>63?!1:yC(e)?TC(e):hC(e)}function _C(e){return e.length===0||e.length>63?!1:yC(e)?TC(e):L2(e)}function Ru(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(let t of e.split("."))if(!_C(t))return!1;return!0}var M2=/^(?!.*\.\.)[\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 Cu(e){return M2.test(e)}function Pu(e){if(e.length===0||e.includes(" "))return!1;let t=e.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".");if(t.length>253)return!1;for(let n of t.split("."))if(!EC(n))return!1;return!0}function $f(e,t,n){let o=0,i=0,a=0,c=0;for(let l=t;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 Uu(e){return $f(e,0,e.length)}function D2(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function wu(e){let t=e.length;if(t===0)return!1;let n=0,o=!1,i=0;if(e.charCodeAt(0)===58&&e.charCodeAt(1)===58){if(t===2)return!0;o=!0,i=2}for(;i<t;){let a=0,c=i;for(;i<t&&D2(e.charCodeAt(i));)i++,a++;if(a===0)return!1;let l=e.charCodeAt(i);if(l===46){if(!$f(e,c,t))return!1;n+=2,i=t;break}if(a>4)return!1;if(n++,i===t)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===t)break}}return o?n<=7:n===8}function IC(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function vu(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 t=e.indexOf(":");return t>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,t))?IC(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:IC(e)}function Nu(e){try{return new URL(e),!0}catch{return!1}}var G2=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Lu(e){return G2.test(e)}var $2=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function ku(e){return $2.test(e)}function Mu(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var j2=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Du(e){return j2.test(e)}var q2=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function Gu(e){return q2.test(e)}var F2=/^(?:(?:[^\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 $u(e){return F2.test(e)}function bC(e){return e>=97&&e<=122||e>=65&&e<=90}function SC(e){return bC(e)||e>=48&&e<=57}function ju(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function B2(e){return SC(e)||e===43||e===45||e===46}function jf(e){return SC(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 H2(e){return jf(e)||qf(e)||e===58||e===64}function qu(e){let t=e.length;if(t===0||!bC(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){let o=e.charCodeAt(n);if(o===58)break;if(!B2(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<t;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||!ju(e.charCodeAt(a+1))||!ju(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<t&&e.charCodeAt(n)!==93;)n++;if(e.charCodeAt(n)!==93)return!1;n++}else for(;n<t;){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<t;){let a=e.charCodeAt(n);if(a===47||a===63||a===35)break;if(a<48||a>57)return!1;n++}}for(;n<t;){let o=e.charCodeAt(n);if(o===37){if(n+2>=t||!ju(e.charCodeAt(n+1))||!ju(e.charCodeAt(n+2)))return!1;n+=2}else{if(o>127)return!1;if(!(H2(o)||o===47||o===63||o===35))return!1}n++}return!0}var K2=/^(?: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 Fu(e){return K2.test(e)}var z2=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Bu(e){return z2.test(e)}var Oe=new Map;function AC(){Oe.clear()}function Y2(){return[...Oe.entries()]}function V2(e,t){Oe.set(e,t)}function Q2(e){return Oe.has(e)}function W2(e){return Oe.get(e)}function Z2(e,t){return Oe.get(e)?.(t)??!0}function OC(){AC(),Oe.set("date-time",Su),Oe.set("date",Ri),Oe.set("duration",Au),Oe.set("email",Ou),Oe.set("hostname",Ru),Oe.set("idn-email",Cu),Oe.set("idn-hostname",Pu),Oe.set("ipv4",Uu),Oe.set("ipv6",wu),Oe.set("iri-reference",vu),Oe.set("iri",Nu),Oe.set("json-pointer-uri-fragment",Lu),Oe.set("json-pointer",ku),Oe.set("regex",Mu),Oe.set("relative-json-pointer",Du),Oe.set("time",Ci),Oe.set("uri-reference",Gu),Oe.set("uri-template",$u),Oe.set("uri",qu),Oe.set("url",Fu),Oe.set("uuid",Bu)}OC();function Ff(e,t,n,o){return Pi.Test(n.format,o)}function xC(e,t,n,o,i,a){return Ff(e,t,i,a)||t.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function RC(e,t,n,o){let i=Rf(n)?n.then:!0,a=mf(n)?n.else:!0;return ne(e,t,n.if,o)?ne(e,t,i,o):ne(e,t,a,o)}function CC(e,t,n,o,i,a){let c=Rf(i)?i.then:!0,l=mf(i)?i.else:!0,m=new st,f=Ie(e,m,`${n}/if`,o,i.if,a)?Ie(e,m,`${n}/then`,o,c,a)||t.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"then"}}):Ie(e,t,`${n}/else`,o,l,a)||t.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"else"}});return f&&t.Merge([m]),f}function X2(e,t,n,o){return s.Every(n.items,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Kt(e,t,i,o[a])&&t.AddIndex(a))}function J2(e,t,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,t,m,f,c,a[l])&&t.AddIndex(l)})}function eK(e,t,n,o){let i=Ai(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>Kt(e,t,n.items,a)&&t.AddIndex(c))}function tK(e,t,n,o,i,a){let c=Ai(i)?i.prefixItems.length:0;return s.EveryAll(a,c,(l,m)=>{let f=`${n}/items`,h=`${o}/${m}`;return zt(e,t,f,h,i.items,l)&&t.AddIndex(m)})}function PC(e,t,n,o){return hf(n)?X2(e,t,n,o):eK(e,t,n,o)}function UC(e,t,n,o,i,a){return hf(i)?J2(e,t,n,o,i,a):tK(e,t,n,o,i,a)}function rK(e){return lo(e)}function Bf(e,t,n,o){if(!rK(n))return!0;let i=s.Counted(o,a=>ne(e,t,n.contains,a));return s.IsLessEqualThan(i,n.maxContains)}function wC(e,t,n,o,i,a){let c=mo(i)?i.minContains:1;return Bf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function Hf(e,t,n,o){return s.IsLessEqualThan(o,n.maximum)}function vC(e,t,n,o,i,a){return Hf(e,t,i,a)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function Kf(e,t,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function NC(e,t,n,o,i,a){return Kf(e,t,i,a)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function zf(e,t,n,o){return s.IsMaxLength(o,n.maxLength)}function LC(e,t,n,o,i,a){return zf(e,t,i,a)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function Yf(e,t,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function kC(e,t,n,o,i,a){return Yf(e,t,i,a)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function nK(e){return lo(e)}function Vf(e,t,n,o){if(!nK(n))return!0;let i=s.Counted(o,(a,c)=>ne(e,t,n.contains,a)&&t.AddIndex(c));return s.IsGreaterEqualThan(i,n.minContains)}function MC(e,t,n,o,i,a){return Vf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function Qf(e,t,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function DC(e,t,n,o,i,a){return Qf(e,t,i,a)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function Wf(e,t,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function GC(e,t,n,o,i,a){return Wf(e,t,i,a)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function Zf(e,t,n,o){return s.IsMinLength(o,n.minLength)}function $C(e,t,n,o,i,a){return Zf(e,t,i,a)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function Xf(e,t,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function jC(e,t,n,o,i,a){return Xf(e,t,i,a)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function Jf(e,t,n,o){return s.IsMultipleOf(o,n.multipleOf)}function qC(e,t,n,o,i,a){return Jf(e,t,i,a)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function eg(e,t,n,o){let i=new xt;return!ne(e,i,n.not,o)&&t.Merge([i])}function FC(e,t,n,o,i,a){return eg(e,t,i,a)||t.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function BC(e,t,n,o){let i=n.oneOf.reduce((a,c)=>{let l=new xt;return ne(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,1)&&t.Merge(i)}function HC(e,t,n,o,i,a){let c=[],l=[],m=i.oneOf.reduce((h,E,I)=>{let g=new st,T=`${n}/oneOf/${I}`,S=Ie(e,g,T,o,E,a);return S&&l.push(I),S||c.push(g),S?[...h,g]:h},[]),f=s.IsEqual(m.length,1)&&t.Merge(m);return!f&&s.IsEqual(l.length,0)&&c.forEach(h=>h.GetErrors().forEach(E=>t.AddError(E))),f||t.AddError({keyword:"oneOf",schemaPath:n,instancePath:o,params:{passingSchemas:l}})}function tg(e,t,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(o)}function KC(e,t,n,o,i,a){return tg(e,t,i,a)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function zC(e,t,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)||Kt(e,t,a,m)&&t.AddKey(l))})}function YC(e,t,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,t,m,I,l,E)&&t.AddKey(h)})})}function VC(e,t,n,o){return s.IsEqual(o.length,0)||s.Every(n.prefixItems,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Kt(e,t,i,o[a])&&t.AddIndex(a))}function QC(e,t,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,t,m,f,c,a[l])&&t.AddIndex(l)})}function rg(e,t){return e.includes(t)||rt.Get().exactOptionalPropertyTypes}function ng(e,t){return s.IsUndefined(e[t])}function WC(e,t,n,o){let i=fo(n)?n.required:[];return s.Every(s.Entries(n.properties),0,([c,l])=>{let m=!s.HasPropertyKey(o,c)||Kt(e,t,l,o[c])&&t.AddKey(c);return rg(i,c)?m:ng(o,c)||m})}function ZC(e,t,n,o,i,a){let c=fo(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,t,h,E,f,a[m])&&t.AddKey(m);return rg(c,m)?I():ng(a,m)||I()})}function XC(e,t,n,o){return s.Every(s.Keys(o),0,(i,a)=>ne(e,t,n.propertyNames,i))}function JC(e,t,n,o,i,a){let c=[];return s.EveryAll(s.Keys(a),0,(m,f)=>{let h=`${o}/${m}`,E=`${n}/propertyNames`,I=new st,g=Ie(e,I,E,h,i.propertyNames,m);return g||c.push(m),g})||t.AddError({keyword:"propertyNames",schemaPath:n,instancePath:o,params:{propertyNames:c}})}function eP(e,t,n,o){let i=e.RecursiveRef(n)??!1;return q(i)&&ne(e,t,i,o)}function tP(e,t,n,o,i,a){let c=e.RecursiveRef(i)??!1;return q(c)&&Ie(e,t,"#",o,c,a)}function rP(e,t,n,o){let i=e.Ref(n)??!1,a=new xt,c=q(i)&&ne(e,a,i,o);return c&&t.Merge([a]),c}function nP(e,t,n,o,i,a){let c=e.Ref(i)??!1,l=new st,m=q(c)&&Ie(e,l,"#",o,c,a);return m&&t.Merge([l]),m||l.GetErrors().forEach(f=>t.AddError(f)),m}function oP(e,t,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function iP(e,t,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})||t.AddError({keyword:"required",schemaPath:n,instancePath:o,params:{requiredProperties:c}})}function og(e,t,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 aP(e,t,n,o,i){return s.Some(n,a=>og(e,t,a,o,i))}function sP(e,t,n,o){return s.IsArray(n.type)?aP(e,t,n.type,n,o):og(e,t,n.type,n,o)}function cP(e,t,n,o,i,a){return(s.IsArray(i.type)?aP(e,t,i.type,i,a):og(e,t,i.type,i,a))||t.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function pP(e,t,n,o){let i=t.GetIndices();return s.Every(o,0,(a,c)=>(i.has(c)||ne(e,t,n.unevaluatedItems,a))&&t.AddIndex(c))}function uP(e,t,n,o,i,a){let c=t.GetIndices(),l=[];return s.EveryAll(a,0,(f,h)=>{let E=new st,I=(c.has(h)||Ie(e,E,n,o,i.unevaluatedItems,f))&&t.AddIndex(h);return I||l.push(h),I})||t.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:o,params:{unevaluatedItems:l}})}function lP(e,t,n,o){let i=t.GetKeys();return s.Every(s.Entries(o),0,([a,c])=>i.has(a)||ne(e,t,n.unevaluatedProperties,c)&&t.AddKey(a))}function mP(e,t,n,o,i,a){let c=t.GetKeys(),l=[];return s.EveryAll(s.Entries(a),0,([f,h])=>{let E=new st,I=c.has(f)||Ie(e,E,n,o,i.unevaluatedProperties,h)&&t.AddKey(f);return I||l.push(f),I})||t.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function dP(e){return!s.IsEqual(e.uniqueItems,!1)}function fP(e,t,n,o){if(!dP(n))return!0;let i=new Set(o.map(Bn.Hash)).size,a=o.length;return s.IsEqual(i,a)}function gP(e,t,n,o,i,a){if(!dP(i))return!0;let c=new Set,l=a.reduce((f,h,E)=>{let I=Bn.Hash(h);return c.has(I)?[...f,E]:(c.add(I),f)},[]);return s.IsEqual(l.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:o,params:{duplicateItems:l}})}function Kt(e,t,n,o){return t.Push()&&ne(e,t,n,o)&&t.Pop()}function ne(e,t,n,o){e.Push(n);let i=Tu(n)?Uf(e,t,n,o):(!Cf(n)||sP(e,t,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!fo(n)||oP(e,t,n,o))&&(!Kr(n)||VR(e,t,n,o))&&(!cf(n)||nC(e,t,n,o))&&(!pf(n)||iC(e,t,n,o))&&(!uf(n)||sC(e,t,n,o))&&(!gs(n)||zC(e,t,n,o))&&(!hs(n)||WC(e,t,n,o))&&(!Af(n)||XC(e,t,n,o))&&(!ds(n)||Xf(e,t,n,o))&&(!_f(n)||Yf(e,t,n,o)))&&(!s.IsArray(o)||(!nf(n)||KR(e,t,n,o))&&(!lo(n)||vf(e,t,n,o))&&(!bi(n)||PC(e,t,n,o))&&(!Tf(n)||Bf(e,t,n,o))&&(!Eu(n)||Kf(e,t,n,o))&&(!mo(n)||Vf(e,t,n,o))&&(!Si(n)||Wf(e,t,n,o))&&(!Ai(n)||VC(e,t,n,o))&&(!Oi(n)||fP(e,t,n,o)))&&(!s.IsString(o)||(!Ef(n)||zf(e,t,n,o))&&(!ms(n)||Zf(e,t,n,o))&&(!ls(n)||Ff(e,t,n,o))&&(!fs(n)||tg(e,t,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!ff(n)||Mf(e,t,n,o))&&(!zr(n)||Df(e,t,n,o))&&(!yf(n)||Hf(e,t,n,o))&&(!Vr(n)||Qf(e,t,n,o))&&(!If(n)||Jf(e,t,n,o)))&&(!xf(n)||rP(e,t,n,o))&&(!Of(n)||eP(e,t,n,o))&&(!lf(n)||pC(e,t,n,o))&&(!sf(n)||wf(e,t,n,o))&&(!df(n)||kf(e,t,n,o))&&(!gf(n)||RC(e,t,n,o))&&(!bf(n)||eg(e,t,n,o))&&(!of(n)||WR(e,t,n,o))&&(!af(n)||XR(e,t,n,o))&&(!Sf(n)||BC(e,t,n,o))&&(!Iu(n)||!s.IsArray(o)||pP(e,t,n,o))&&(!bu(n)||!s.IsObject(o)||lP(e,t,n,o))&&(!rf(n)||FR(e,t,n,o));return e.Pop(n),i}function zt(e,t,n,o,i,a){return t.Push()&&Ie(e,t,n,o,i,a)&&t.Pop()}function Ie(e,t,n,o,i,a){e.Push(i);let c=Tu(i)?eC(e,t,n,o,i,a):!!(+(!Cf(i)||cP(e,t,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!fo(i)||iP(e,t,n,o,i,a))&+(!Kr(i)||QR(e,t,n,o,i,a))&+(!cf(i)||oC(e,t,n,o,i,a))&+(!pf(i)||aC(e,t,n,o,i,a))&+(!uf(i)||cC(e,t,n,o,i,a))&+(!gs(i)||YC(e,t,n,o,i,a))&+(!hs(i)||ZC(e,t,n,o,i,a))&+(!Af(i)||JC(e,t,n,o,i,a))&+(!ds(i)||jC(e,t,n,o,i,a))&+(!_f(i)||kC(e,t,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!nf(i)||zR(e,t,n,o,i,a))&+(!lo(i)||rC(e,t,n,o,i,a))&+(!bi(i)||UC(e,t,n,o,i,a))&+(!Tf(i)||wC(e,t,n,o,i,a))&+(!Eu(i)||NC(e,t,n,o,i,a))&+(!mo(i)||MC(e,t,n,o,i,a))&+(!Si(i)||GC(e,t,n,o,i,a))&+(!Ai(i)||QC(e,t,n,o,i,a))&+(!Oi(i)||gP(e,t,n,o,i,a))))&+(!s.IsString(a)||!!(+(!Ef(i)||LC(e,t,n,o,i,a))&+(!ms(i)||$C(e,t,n,o,i,a))&+(!ls(i)||xC(e,t,n,o,i,a))&+(!fs(i)||KC(e,t,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!ff(i)||mC(e,t,n,o,i,a))&+(!zr(i)||dC(e,t,n,o,i,a))&+(!yf(i)||vC(e,t,n,o,i,a))&+(!Vr(i)||DC(e,t,n,o,i,a))&+(!If(i)||qC(e,t,n,o,i,a))))&+(!xf(i)||nP(e,t,n,o,i,a))&+(!Of(i)||tP(e,t,n,o,i,a))&+(!lf(i)||uC(e,t,n,o,i,a))&+(!sf(i)||tC(e,t,n,o,i,a))&+(!df(i)||lC(e,t,n,o,i,a))&+(!gf(i)||CC(e,t,n,o,i,a))&+(!bf(i)||FC(e,t,n,o,i,a))&+(!of(i)||ZR(e,t,n,o,i,a))&+(!af(i)||JR(e,t,n,o,i,a))&+(!Sf(i)||HC(e,t,n,o,i,a))&+(!Iu(i)||!s.IsArray(a)||uP(e,t,n,o,i,a))&+(!bu(i)||!s.IsObject(a)||mP(e,t,n,o,i,a)))&&(!rf(i)||BR(e,t,n,o,i,a));return e.Pop(i),c}var On={};Yt(On,{DynamicRef:()=>TK,Ref:()=>ag});var Ui={};Yt(Ui,{Delete:()=>lK,Get:()=>pK,Has:()=>cK,Indices:()=>_s,Set:()=>uK});function hP(e){if(e.length===0)throw Error("Cannot set root")}function yP(e){if(!s.IsObject(e))throw Error("Cannot set value")}function oK(e){if(s.IsUnsafePropertyKey(e))throw Error("Pointer contains unsafe property key")}function TP(e){for(let t of e)oK(t)}function iK(e){return/^(0|[1-9]\d*)$/.test(e)}function EP(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function aK(e,t){return s.IsObject(t)&&s.HasPropertyKey(t,e)}function sK(e,t){return s.IsObject(t)&&!s.IsUnsafePropertyKey(e)?t[e]:void 0}function ig(e,t){return e.reduce((n,o)=>sK(o,n),t)}function _s(e){if(s.IsEqual(e.length,0))return[];let t=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return t.length>0&&t[0]===""?t.slice(1):t}function cK(e,t){let n=e;return _s(t).every(o=>aK(o,n)?(n=n[o],!0):!1)}function pK(e,t){let n=_s(t);return ig(n,e)}function uK(e,t,n){let o=_s(t);hP(o),TP(o);let[i,a]=EP(o),c=ig(i,e);return yP(c),c[a]=n,e}function lK(e,t){let n=_s(t);hP(n),TP(n);let[o,i]=EP(n),a=ig(o,e);return yP(a),s.IsArray(a)&&iK(i)?a.splice(+i,1):delete a[i],e}function mK(e,t,n){if(e.$id===n.hash)return e;let o=new URL(e.$id,t.href),i=new URL(n.href,t.href);if(s.IsEqual(o.pathname,i.pathname))return n.hash.startsWith("#")?_P(e,t,n):e}function dK(e,t,n){let o=new URL(`#${e.$anchor}`,t.href),i=new URL(n.href,t.href);return s.IsEqual(o.href,i.href)?e:void 0}function fK(e,t,n){let o=new URL(`#${e.$dynamicAnchor}`,t.href),i=new URL(n.href,t.href);return s.IsEqual(o.href,i.href)?e:void 0}function _P(e,t,n){if(n.href.endsWith("#"))return e;if(!n.hash.startsWith("#"))return;let o=decodeURIComponent(n.hash.slice(1));if(o.startsWith("/"))return Ui.Get(e,o)}function gK(e,t,n){if(Yr(e)){let o=mK(e,t,n);if(!s.IsUndefined(o))return o}if(us(e)){let o=dK(e,t,n);if(!s.IsUndefined(o))return o}if(An(e)){let o=fK(e,t,n);if(!s.IsUndefined(o))return o}return _P(e,t,n)}function hK(e,t,n){return e.reduce((o,i)=>{let a=sg(i,t,n);return s.IsUndefined(a)?o:a},void 0)}function yK(e,t,n){return s.Keys(e).reduce((o,i)=>{let a=sg(e[i],t,n);return s.IsUndefined(a)?o:a},void 0)}function sg(e,t,n){let o=ar(e)&&Yr(e)?new URL(e.$id,t.href):t;if(ar(e)){let i=gK(e,o,n);if(!s.IsUndefined(i))return i}if(s.IsArray(e))return hK(e,o,n);if(s.IsObject(e))return yK(e,o,n)}function ag(e,t){let n=new URL("http://unknown/"),o=Yr(e)?new URL(e.$id,n.href):n,i=new URL(t,o.href);return sg(e,o,i)}function TK(e,t,n,o){let i=n.$dynamicRef.startsWith("#")?ag(t,n.$dynamicRef):ag(e,n.$dynamicRef);return s.IsUndefined(i)?void 0:!ar(i)||!An(i)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?i:o.find(l=>l.$dynamicAnchor===i.$dynamicAnchor)??i}var wi=function(e,t,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.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:t.get(e)},xn,IP,bP,SP,AP,ho=class{constructor(t,n){xn.add(this),this.context=t,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((t,n)=>new URL(n.$id,t),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(t){ar(t)&&(Yr(t)&&(this.ids.push(t),wi(this,xn,"m",IP).call(this,t)),us(t)&&this.anchors.push(t),_u(t)&&this.recursiveAnchors.push(t),An(t)&&this.dynamicAnchors.push(t))}Pop(t){ar(t)&&(Yr(t)&&(this.ids.pop(),wi(this,xn,"m",bP).call(this,t)),us(t)&&this.anchors.pop(),_u(t)&&this.recursiveAnchors.pop(),An(t)&&this.dynamicAnchors.pop())}Ref(t){return wi(this,xn,"m",SP).call(this,t)??wi(this,xn,"m",AP).call(this,t)}RecursiveRef(t){return _u(this.Base())?On.Ref(this.recursiveAnchors[0],t.$recursiveRef):On.Ref(this.Base(),t.$recursiveRef)}DynamicRef(t){let n=this.schema;return On.DynamicRef(n,this.Base(),t,this.dynamicAnchors)}};xn=new WeakSet,IP=function e(t,n=!0){if(!ar(t))return;let o=t;if(!(!n&&Yr(o))){!n&&An(o)&&this.dynamicAnchors.push(o);for(let i of s.Keys(o))wi(this,xn,"m",e).call(this,o[i],!1)}},bP=function e(t,n=!0){if(!ar(t))return;let o=t;if(!(!n&&Yr(o))){!n&&An(o)&&this.dynamicAnchors.pop();for(let i of s.Keys(o))wi(this,xn,"m",e).call(this,o[i],!1)}},SP=function(t){return s.HasPropertyKey(this.context,t.$ref)?this.context[t.$ref]:void 0},AP=function(t){let n=this.schema;return t.$ref.startsWith("#")?On.Ref(this.Base(),t.$ref):On.Ref(n,t.$ref)};function Hu(...e){let[t,n,o]=oe.Match(e,{3:(h,E,I)=>[h,E,I],2:(h,E)=>[{},h,E]}),i=rt.Get(),a=eT(),c=[],l=new ho(t,n),m=new ys(h=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...h,message:a(h)})});return[Ie(l,m,"#","",n,o),c]}function pg(...e){let[t,n,o]=oe.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),i=new ho(t,n),a=new xt;return ne(i,a,n,o)}function he(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return pg(t,n,o)}function Rn(...e){let[t,n,o]=oe.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),[i,a]=Hu(t,n,o);return a}var Cn=class extends Error{constructor(t,n,o){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:o,value:n},writable:!1,configurable:!1,enumerable:!1})}};function OP(e,t,n){return s.IsArray(n)?n.map(o=>ct(e,t.items,o)):n}function xP(e,t,n){return ct({...e,...t.$defs},nt(t.$ref),n)}function IK(e,t){let n=s.HasPropertyKey(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},o=Qt(e,t),i=ft(o);return D(i)?Np(i,n):i}function RP(e,t,n){let o=IK(e,t);return ct(e,o,n)}function Ku(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function CP(e,t,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=Ku(t);for(let i of s.Keys(n)){if(s.HasPropertyKey(t.properties,i)){n[i]=ct(e,t.properties[i],n[i]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Ue(o)&&he(e,o,n[i])){n[i]=ct(e,o,n[i]);continue}delete n[i]}return n}function PP(e,t,n){if(!s.IsObject(n))return n;let o=Ku(t),[i,a]=[new RegExp(it(t)),Se(t)];for(let c of s.Keys(n)){if(i.test(c)){n[c]=ct(e,a,n[c]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Ue(o)&&he(e,o,n[c])){n[c]=ct(e,o,n[c]);continue}delete n[c]}return n}function UP(e,t,n){return s.HasPropertyKey(e,t.$ref)?ct(e,e[t.$ref],n):n}function wP(e,t,n){if(!s.IsArray(n))return n;let o=Math.min(n.length,t.items.length);for(let i=0;i<o;i++)n[i]=ct(e,t.items[i],n[i]);return s.IsGreaterThan(n.length,o)?n.slice(0,o):n}function $e(e){return jn(e)}function vP(e,t,n){for(let o of t.anyOf){let i=ct(e,o,$e(n));if(he(e,o,i))return i}return n}function ct(e,t,n){return Z(t)?OP(e,t,n):Te(t)?xP(e,t,n):M(t)?RP(e,t,n):D(t)?CP(e,t,n):de(t)?PP(e,t,n):ce(t)?UP(e,t,n):Y(t)?wP(e,t,n):R(t)?vP(e,t,n):n}function bK(e,t){for(let n of Cc.Keys(e))Cc.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function SK(e){let t={};for(let n of Cc.Keys(e))t[n]=Is(e[n]);return t}function AK(e){return ug(HA(e))}function ug(e){return e.map(t=>Is(t))}function Is(e){let t=Z(e)?Pt(Is(e.items),No(e)):M(e)?ut(ug(e.allOf)):R(e)?F(AK(e.anyOf)):D(e)?k(SK(e.properties)):de(e)?Fo(un(e),Is(Se(e))):Y(e)?ke(ug(e.items)):e;return bK(e,t)}function vi(e){return Is(e)}function Or(...e){let[t,n,o]=oe.Match(e,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]}),i=rt.Get().unionPrioritySort?vi(n):n;return ct(t,i,o)}var ie={};Yt(ie,{Fail:()=>To,IsOk:()=>lg,Ok:()=>L,TryArray:()=>OK,TryBigInt:()=>mg,TryBoolean:()=>DK,TryNull:()=>FK,TryNumber:()=>zK,TryString:()=>YK,TryUndefined:()=>XK});function lg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function L(e){return{value:e}}function To(){}function OK(e){return s.IsArray(e)?L(e):L([e])}function xK(e){return s.IsEqual(e,!0)?L(BigInt(1)):L(BigInt(0))}var RK=/^-?(0|[1-9]\d*)n$/,CK=/^-?(0|[1-9]\d*)\.\d+$/,PK=/^-?(0|[1-9]\d*)$/;function UK(e){return RK.test(e)}function wK(e){return CK.test(e)}function vK(e){return PK.test(e)}function NK(e){let t=e.toLowerCase();return UK(e)?L(BigInt(e.slice(0,e.length-1))):wK(e)?L(BigInt(e.split(".")[0])):vK(e)?L(BigInt(e)):s.IsEqual(t,"false")?L(BigInt(0)):s.IsEqual(t,"true")?L(BigInt(1)):void 0}function mg(e){return s.IsBigInt(e)?L(e):s.IsBoolean(e)?xK(e):s.IsNumber(e)?L(BigInt(Math.trunc(e))):s.IsNull(e)?L(BigInt(0)):s.IsString(e)?NK(e):s.IsUndefined(e)?L(BigInt(0)):void 0}function LK(e){return s.IsEqual(e,BigInt(0))?L(!1):s.IsEqual(e,BigInt(1))?L(!0):void 0}function kK(e){return s.IsEqual(e,0)?L(!1):s.IsEqual(e,1)?L(!0):void 0}function MK(e){return s.IsEqual(e.toLowerCase(),"false")?L(!1):s.IsEqual(e.toLowerCase(),"true")?L(!0):s.IsEqual(e,"0")?L(!1):s.IsEqual(e,"1")?L(!0):void 0}function DK(e){return s.IsBigInt(e)?LK(e):s.IsBoolean(e)?L(e):s.IsNumber(e)?kK(e):s.IsNull(e)?L(!1):s.IsString(e)?MK(e):s.IsUndefined(e)?L(!1):void 0}function GK(e){return s.IsEqual(e,BigInt(0))?L(null):void 0}function $K(e){return s.IsEqual(e,!1)?L(null):void 0}function jK(e){return s.IsEqual(e,0)?L(null):void 0}function qK(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?L(null):void 0}function FK(e){return s.IsBigInt(e)?GK(e):s.IsBoolean(e)?$K(e):s.IsNumber(e)?jK(e):s.IsNull(e)?L(null):s.IsString(e)?qK(e):s.IsUndefined(e)?L(null):void 0}var NP=BigInt(Number.MAX_SAFE_INTEGER),LP=BigInt(Number.MIN_SAFE_INTEGER);function BK(e){return e<=NP&&e>=LP?L(Number(e)):void 0}function HK(e){return L(e?1:0)}function KK(e){let t=+e;if(s.IsNumber(t))return L(t);let n=e.toLowerCase();if(s.IsEqual(n,"false"))return L(0);if(s.IsEqual(n,"true"))return L(1);let o=mg(e);return lg(o)?o.value<=NP&&o.value>=LP?L(Number(o.value)):void 0:void 0}function zK(e){return s.IsBigInt(e)?BK(e):s.IsBoolean(e)?HK(e):s.IsNumber(e)?L(e):s.IsNull(e)?L(0):s.IsString(e)?KK(e):s.IsUndefined(e)?L(0):void 0}function YK(e){return s.IsBigInt(e)?L(e.toString()):s.IsBoolean(e)?L(e.toString()):s.IsNumber(e)?L(e.toString()):s.IsNull(e)?L("null"):s.IsString(e)?L(e):s.IsUndefined(e)?L(""):void 0}function VK(e){return s.IsEqual(e,BigInt(0))?L(void 0):void 0}function QK(e){return s.IsEqual(e,!1)?L(void 0):void 0}function WK(e){return s.IsEqual(e,0)?L(void 0):void 0}function ZK(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?L(void 0):void 0}function XK(e){return s.IsBigInt(e)?VK(e):s.IsBoolean(e)?QK(e):s.IsNumber(e)?WK(e):s.IsNull(e)?L(void 0):s.IsString(e)?ZK(e):s.IsUndefined(e)?L(e):void 0}function kP(e,t,n){return ie.TryArray(n).value.map(i=>je(e,t.items,i))}function MP(e,t,n){let o=ie.TryBigInt(n);return ie.IsOk(o)?o.value:n}function DP(e,t,n){let o=ie.TryBoolean(n);return ie.IsOk(o)?o.value:n}function GP(e,t,n){return je({...e,...t.$defs},nt(t.$ref),n)}function $P(e,t,n){return je(e,ft(t),n)}function jP(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)?Math.trunc(o.value):n}function qP(e,t,n){let o=Qt(e,t),i=ft(o);return je(e,i,n)}function JK(e,t,n){let o=ie.TryBigInt(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function ez(e,t,n){let o=ie.TryBoolean(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function tz(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function rz(e,t,n){let o=ie.TryString(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function FP(e,t,n){return s.IsEqual(t.const,n)?n:pT(t)?JK(e,t,n):uT(t)?ez(e,t,n):Dc(t)?tz(e,t,n):Gc(t)?rz(e,t,n):ge()}function BP(e,t,n){let o=ie.TryNull(n);return ie.IsOk(o)?o.value:n}function HP(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)?o.value:n}function zu(e,t,n,o){let i=s.Keys(o);for(let[a,c]of t)for(let l of i)a.test(l)||(o[l]=je(e,n,o[l]));return o}function bs(e,t,n){return et(e)&&s.IsUndefined(n[t])}function nz(e,t,n){let o=s.EntriesRegExp(t.properties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)!a.test(l)||bs(c,l,n)||(n[l]=je(e,c,n[l]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?zu(e,o,t.additionalProperties,n):n}function KP(e,t,n){return s.IsObjectNotArray(n)?nz(e,t,n):n}function oz(e,t,n){let o=s.EntriesRegExp(t.patternProperties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)a.test(l)&&(n[l]=je(e,c,n[l]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?zu(e,o,t.additionalProperties,n):n}function zP(e,t,n){return s.IsObjectNotArray(n)?oz(e,t,n):n}function YP(e,t,n){return s.HasPropertyKey(e,t.$ref)?je(e,e[t.$ref],n):n}function VP(e,t,n){let o=ie.TryString(n);return ie.IsOk(o)?o.value:n}function QP(e,t,n){return je(e,ft(t),n)}function WP(e,t,n){if(!s.IsArray(n))return n;for(let o=0;o<Math.min(t.items.length,n.length);o++)n[o]=je(e,t.items[o],n[o]);return n}function ZP(e,t,n){let o=ie.TryUndefined(n);return ie.IsOk(o)?o.value:n}function XP(e,t,n){if(t.anyOf.some(c=>he(e,c,n)))return n;let a=t.anyOf.map(c=>je(e,c,$e(n))).find(c=>he(e,t,c));return s.IsUndefined(a)?n:a}function JP(e,t,n){let o=ie.TryUndefined(n);return ie.IsOk(o)?void 0:n}function je(e,t,n){return Z(t)?kP(e,t,n):vt(t)?MP(e,t,n):_t(t)?DP(e,t,n):Te(t)?GP(e,t,n):ze(t)?$P(e,t,n):ot(t)?jP(e,t,n):M(t)?qP(e,t,n):Q(t)?FP(e,t,n):hr(t)?BP(e,t,n):Ce(t)?HP(e,t,n):D(t)?KP(e,t,n):de(t)?zP(e,t,n):ce(t)?YP(e,t,n):We(t)?VP(e,t,n):Ee(t)?QP(e,t,n):Y(t)?WP(e,t,n):or(t)?ZP(e,t,n):R(t)?XP(e,t,n):kt(t)?JP(e,t,n):n}function Pn(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return je(t,n,o)}function eU(e,t,n){if(!s.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=pt(e,t.items,n[o]);return n}function tU(e,t,n){return pt({...e,...t.$defs},nt(t.$ref),n)}function rU(e,t){return s.IsUndefined(t)?s.IsFunction(e.default)?e.default():$e(e.default):t}function nU(e,t,n){let o=Qt(e,t),i=ft(o);return pt(e,i,n)}function oU(e,t,n){if(!s.IsObject(n))return n;let o=s.Keys(t.properties);for(let i of o){let a=pt(e,t.properties[i],n[i]);s.IsUndefined(a)&&(et(t.properties[i])||!s.HasPropertyKey(t.properties[i],"default"))||(n[i]=a)}if(!Kr(t)||s.IsBoolean(t.additionalProperties))return n;for(let i of s.Keys(n))o.includes(i)||(n[i]=pt(e,t.additionalProperties,n[i]));return n}function iU(e,t,n){if(!s.IsObject(n))return n;let[o,i]=[new RegExp(it(t)),Se(t)];for(let a of s.Keys(n))o.test(a)&&Ht(i)&&(n[a]=pt(e,i,n[a]));if(!Kr(t))return n;for(let a of s.Keys(n))o.test(a)||(n[a]=pt(e,t.additionalProperties,n[a]));return n}function aU(e,t,n){return s.HasPropertyKey(e,t.$ref)?pt(e,e[t.$ref],n):n}function sU(e,t,n){if(!s.IsArray(n))return n;let[o,i]=[t.items,Math.max(t.items.length,n.length)];for(let a=0;a<i;a++)a<o.length&&(n[a]=pt(e,o[a],n[a]));return n}function cU(e,t,n){for(let o of t.anyOf){let i=pt(e,o,$e(n));if(he(e,o,i))return i}return n}function pt(e,t,n){let o=Ht(t)?rU(t,n):n;return Z(t)?eU(e,t,o):Te(t)?tU(e,t,o):M(t)?nU(e,t,o):D(t)?oU(e,t,o):de(t)?iU(e,t,o):ce(t)?aU(e,t,o):Y(t)?sU(e,t,o):R(t)?cU(e,t,o):o}function Eo(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return pt(t,n,o)}function Ni(e){return(...t)=>{let[n,o,i]=oe.Match(t,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]});return e.reduce((a,c)=>c(n,o,a),i)}}function iz(e,t,n){return t["~codec"].decode(n)}function az(e,t,n){return t["~codec"].encode(n)}function xe(e,t,n,o){return Hn(n)?s.IsEqual(e,"Decode")?iz(t,n,o):az(t,n,o):o}function sz(e,t,n,o){if(!s.IsArray(o))return o;for(let i=0;i<o.length;i++)o[i]=Pe(e,t,n.items,o[i]);return xe(e,t,n,o)}function cz(e,t,n,o){let i=xe(e,t,n,o);if(!s.IsArray(i))return i;for(let a=0;a<i.length;a++)i[a]=Pe(e,t,n.items,i[a]);return i}function pU(e,t,n,o){return s.IsEqual(e,"Decode")?sz(e,t,n,o):cz(e,t,n,o)}function uU(e,t,n,o){return o=Pe(e,{...t,...n.$defs},nt(n.$ref),o),xe(e,t,n,o)}function lU(e){return e.reduce((t,n)=>({...t,...n}),{})}function mU(e,t){for(let n of t)if(!s.IsDeepEqual(e,n))return n;return e}function pz(e,t,n,o){if(s.IsEqual(n.allOf.length,0))return xe(e,t,n,o);let i=n.allOf.map(l=>Pe(e,t,l,Or(l,$e(o)))),c=i.every(l=>s.IsObject(l))?lU(i):mU(o,i);return xe(e,t,n,c)}function uz(e,t,n,o){if(s.IsEqual(n.allOf.length,0))return xe(e,t,n,o);let i=xe(e,t,n,o),a=n.allOf.map(l=>Pe(e,t,l,Or(l,$e(i))));return a.every(l=>s.IsObject(l))?lU(a):mU(i,a)}function dU(e,t,n,o){return s.IsEqual(e,"Decode")?pz(e,t,n,o):uz(e,t,n,o)}function lz(e,t,n,o){if(!s.IsObjectNotArray(o))return o;for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||bs(n.properties[i],i,o)||(o[i]=Pe(e,t,n.properties[i],o[i]));return xe(e,t,n,o)}function mz(e,t,n,o){let i=xe(e,t,n,o);if(!s.IsObjectNotArray(i))return i;for(let a of s.Keys(n.properties))!s.HasPropertyKey(i,a)||bs(n.properties[a],a,i)||(i[a]=Pe(e,t,n.properties[a],i[a]));return i}function fU(e,t,n,o){return s.IsEqual(e,"Decode")?lz(e,t,n,o):mz(e,t,n,o)}function dz(e,t,n,o){if(!s.IsObjectNotArray(o))return o;let i=new RegExp(it(n));for(let a of s.Keys(o))i.test(a)&&(o[a]=Pe(e,t,Se(n),o[a]));return xe(e,t,n,o)}function fz(e,t,n,o){let i=xe(e,t,n,o);if(!s.IsObjectNotArray(i))return i;let a=new RegExp(it(n));for(let c of s.Keys(i))a.test(c)&&(i[c]=Pe(e,t,Se(n),i[c]));return i}function gU(e,t,n,o){return s.IsEqual(e,"Decode")?dz(e,t,n,o):fz(e,t,n,o)}function hU(e,t,n,o){return s.HasPropertyKey(t,n.$ref)?Pe(e,t,t[n.$ref],o):o}function yU(e,t,n,o){return s.IsEqual(e,"Decode")?xe(e,t,n,hU(e,t,n,o)):hU(e,t,n,xe(e,t,n,o))}function gz(e,t,n,o){if(!s.IsArray(o))return o;for(let i=0;i<Math.min(n.items.length,o.length);i++)o[i]=Pe(e,t,n.items[i],o[i]);return xe(e,t,n,o)}function hz(e,t,n,o){let i=xe(e,t,n,o);if(!s.IsArray(i))return o;for(let a=0;a<Math.min(n.items.length,i.length);a++)i[a]=Pe(e,t,n.items[a],i[a]);return i}function TU(e,t,n,o){return s.IsEqual(e,"Decode")?gz(e,t,n,o):hz(e,t,n,o)}function yz(e,t,n,o){for(let i of n.anyOf){if(!he(t,i,o))continue;let a=Pe(e,t,i,o);return xe(e,t,n,a)}return o}function Tz(e,t,n,o){let i=xe(e,t,n,o);for(let a of n.anyOf){let c=Pe(e,t,a,$e(i));if(he(t,a,c))return c}return i}function EU(e,t,n,o){return s.IsEqual(e,"Decode")?yz(e,t,n,o):Tz(e,t,n,o)}function Pe(e,t,n,o){return Z(n)?pU(e,t,n,o):Te(n)?uU(e,t,n,o):M(n)?dU(e,t,n,o):D(n)?fU(e,t,n,o):de(n)?gU(e,t,n,o):ce(n)?yU(e,t,n,o):Y(n)?TU(e,t,n,o):R(n)?EU(e,t,n,o):xe(e,t,n,o)}var dg=class extends Cn{constructor(t,n){super("Decode",t,n)}};function Ez(e,t,n){if(!he(e,t,n))throw new dg(n,Rn(e,t,n));return n}function _z(e,t,n){let o=rt.Get().unionPrioritySort?vi(t):t;return Pe("Decode",e,o,n)}var i9e=Ni([(e,t,n)=>$e(n),(e,t,n)=>Eo(e,t,n),(e,t,n)=>Pn(e,t,n),(e,t,n)=>Or(e,t,n),(e,t,n)=>Ez(e,t,n),(e,t,n)=>_z(e,t,n)]);var fg=class extends Cn{constructor(t,n){super("Encode",t,n)}};function Iz(e,t,n){if(!he(e,t,n))throw new fg(n,Rn(e,t,n));return n}function bz(e,t,n){let o=rt.Get().unionPrioritySort?vi(t):t;return Pe("Encode",e,o,n)}var T9e=Ni([(e,t,n)=>$e(n),(e,t,n)=>bz(e,t,n),(e,t,n)=>Eo(e,t,n),(e,t,n)=>Pn(e,t,n),(e,t,n)=>Or(e,t,n),(e,t,n)=>Iz(e,t,n)]);var Zt=class extends Error{constructor(t,n){super(n),this.type=t}};function _U(e,t){return s.IsFunction(t.default)?t.default(t):s.IsObject(t.default)?$e(t.default):t.default}function IU(e,t){if(Oi(t)&&!Ht(t))throw new Zt(t,"Arrays with uniqueItems constraints must specify a default annotation");let n=Si(t)?t.minItems:0;return Array.from({length:n},()=>qe(e,t.items))}function bU(e,t){return zr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Vr(t)?BigInt(t.minimum):BigInt(0)}function SU(e,t){return!1}function AU(e,t){let n=qe(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function OU(e,t){return qe({...e,...t.$defs},nt(t.$ref))}function xU(e,t){return qe(e,ft(t))}function RU(e,t){let n=qe(e,t.returnType);return()=>n}function CU(e,t){return zr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Vr(t)?t.minimum:0}function PU(e,t){let n=Qt(e,t),o=ft(n);return qe(e,o)}function UU(e,t){return t.const}function wU(e,t){throw new Zt(t,"Cannot create TNever types")}function vU(e,t){return null}function NU(e,t){return zr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Vr(t)?t.minimum:0}function LU(e,t){return(s.IsUndefined(t.required)?[]:t.required).reduce((o,i)=>({...o,[i]:qe(e,t.properties[i])}),{})}function kU(e,t){if(ds(t)&&!Ht(t))throw new Zt(t,"Record with the minProperties constraint must have a default annotation");return{}}function MU(e,t){return s.HasPropertyKey(e,t.$ref)?qe(e,e[t.$ref]):(()=>{throw new Zt(t,"Unable to deref Ref")})()}function DU(e,t){if((fs(t)||ls(t))&&!Ht(t))throw Error("Strings with format or pattern constraints must specify default");let o=ms(t)?t.minLength:0;return"".padEnd(o)}function GU(e,t){return Symbol()}function $U(e,t){let n=_a(t.pattern);if(We(n))throw new Zt(t,"Unable to create TemplateLiteral due to infinite type expansion");return qe(e,n)}function jU(e,t){return Array.from({length:t.minItems},(n,o)=>qe(e,t.items[o]))}function qU(e,t){if(s.IsEqual(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return qe(e,t.anyOf[0])}function qe(e,t){return Ht(t)?_U(e,t):Z(t)?IU(e,t):vt(t)?bU(e,t):_t(t)?SU(e,t):Be(t)?AU(e,t):Te(t)?OU(e,t):ze(t)?xU(e,t):He(t)?RU(e,t):ot(t)?CU(e,t):M(t)?PU(e,t):Q(t)?UU(e,t):rr(t)?wU(e,t):hr(t)?vU(e,t):Ce(t)?NU(e,t):D(t)?LU(e,t):de(t)?kU(e,t):ce(t)?MU(e,t):We(t)?DU(e,t):yr(t)?GU(e,t):Ee(t)?$U(e,t):Y(t)?jU(e,t):or(t)?void 0:R(t)?qU(e,t):kt(t)?void 0:void 0}function xr(...e){let[t,n]=oe.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return qe(t,n)}var gg=class extends Cn{constructor(t,n){super("Parse",t,n)}};function Sz(e,t,n){if(!he(e,t,n))throw new gg(n,Rn(e,t,n));return n}var $6e=Ni([(e,t,n)=>$e(n),(e,t,n)=>Eo(e,t,n),(e,t,n)=>Pn(e,t,n),(e,t,n)=>Or(e,t,n),(e,t,n)=>Sz(e,t,n)]);var Oz=k({type:z("insert"),path:It(),value:Qe()}),xz=Object({type:z("update"),path:It(),value:Qe()}),Rz=k({type:z("delete"),path:It()}),z6e=F([Oz,xz,Rz]);function Li(e){if(!e.body)throw new Error("This command does not accept a request body");let t=e.body;return t.examples?.length?t.examples[0]:xr(t)}function Zr(e,t,n,o,i){e.command(t).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){ee(Li(o));return}let c=Ii(a),l=await i()(o,{body:c});ee(l)})}function HU(e,t){let n=e.command("grok").description("Test and preview grok parsing rules");Zr(n,"parse","Parse sample log lines with grok rules and return the extracted fields",jR,t)}var KU=require("node:child_process"),zU=require("node:fs"),YU=require("node:os"),Qu=require("node:path");var _o=require("node:fs");function Ss(e,t){let n=`${e}.tmp.${process.pid}`;(0,_o.writeFileSync)(n,t),(0,_o.renameSync)(n,e)}function As(e){try{return(0,_o.readFileSync)(e,"utf8")}catch(t){if(t.code==="ENOENT")return;throw t}}function Os(e,t){if(t===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,_o.writeFileSync)(n,t),n}function Io(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var hg="tsuga-dev/agent-plugins",Yu="tsuga";function Vu(e,t){V(` $ ${e} ${t.join(" ")}`);try{(0,KU.execFileSync)(e,t,{stdio:["ignore","inherit","inherit"]})}catch(n){let o=n.status??1;throw new Error(`${e} ${t.join(" ")} exited ${o}`,{cause:n})}}function Uz(e,t){V("Claude Code \u2192 installing Tsuga plugin"),Vu("claude",["plugin","marketplace","add",hg]),Vu("claude",["plugin","install",`tsuga@${Yu}`]),t.autoUpdate&&wz(e)}function wz(e){let t=(0,Qu.join)(e,".claude","settings.json");V(`Claude Code \u2192 ${t} (autoUpdate)`),(0,zU.mkdirSync)((0,Qu.dirname)(t),{recursive:!0});let n=As(t),o=JSON.parse(n??"{}");if(!Io(o))throw new Error(`${t} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!Io(i))throw new Error(`${t} "extraKnownMarketplaces" must be a JSON object`);let a=i[Yu],c=Io(a)?a:{};o.extraKnownMarketplaces={...i,[Yu]:{source:{source:"github",repo:hg},...c,autoUpdate:!0}};let l=Os(t,n);Ss(t,`${JSON.stringify(o,null,2)}
|
|
141
|
-
`),V(l===void 0?" created":` patched (backup: ${l})`)}function vz(){V("Codex \u2192 installing Tsuga plugin"),Vu("codex",["plugin","marketplace","add",hg]),Vu("codex",["plugin","add",`tsuga@${Yu}`])}function VU(e){let t=e.command("install").description("Install Tsuga plugins into local LLM CLIs").command("plugin").description("Install the Tsuga plugin into a specific LLM CLI");t.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=>{Uz((0,YU.homedir)(),n),V("Restart your claude session to load the new plugins.")}),t.command("codex").description("Install the Tsuga plugin into Codex (requires the codex CLI in PATH)").action(()=>{vz(),V("Restart your codex session to load the new plugins.")})}var Nz=10,Lz=r.Object({key:u({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:r.Optional(u({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:r.Optional(r.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`."}))}),yg=r.Object({field:r.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:r.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:r.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:r.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:r.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:r.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:r.Object({groupBy:r.Number({description:"Number of distinct readable matching artifacts that use this field as a group-by or split dimension."}),filter:r.Number({description:"Number of distinct readable matching artifacts that filter on this field in widget queries, monitor queries, or dashboard-wide filters."}),measure:r.Number({description:"Number of distinct readable matching artifacts that aggregate this field as `aggregate.field`."}),column:r.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."})}),Tg=r.Object({logs:r.Array(yg,{description:"Top log fields for the requested scope, ranked by score and mined from readable logs-sourced dashboards and monitors."}),traces:r.Array(yg,{description:"Top trace fields for the requested scope, ranked by score and mined from readable traces-sourced dashboards and monitors."}),metrics:r.Array(yg,{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:r.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:r.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."})}),Eg=r.Object({scope:r.Array(Lz,{minItems:1,maxItems:Nz,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."})}),H8e=d({tags:["interesting-fields"],url:"/v0/interesting-fields",method:"POST",body:Eg,response:Tg});var kz=`/${"v1"}/interesting-fields`,Mz={scope:[{key:"context.service.name",value:"payments"},{key:"context.env",value:"prod",valueMustMatch:!0}]},Dz=r.Object(Eg.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:[Mz]}),QU=d({url:kz,method:"POST",operationId:"getInterestingFields",tags:["public","interesting-fields"],body:Dz,response:Tg,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 WU(e,t){let n=e.command("interesting-fields").description("Discover the telemetry fields an org already uses for a scope");Zr(n,"list","Rank the log, trace and metric fields most relevant to a scope, mined from dashboards and monitors",QU,t)}var Xt="/v0/kubernetes-explorer",Gz="^[a-z0-9.-]+$",$z="^[A-Za-z0-9._-]+$",ZU=256,XU=r.Optional(u({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 sr=e=>r.Optional(r.Array(u({allowEmpty:!1}),{description:e})),_g={clusterId:XU,search:r.Optional(r.String({pattern:Gz,minLength:1,maxLength:ZU,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."}))},JU={clusterId:XU,search:r.Optional(r.String({pattern:$z,minLength:1,maxLength:ZU,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."}))},ew=r.Object(_g),tw=r.Object(JU),xs={..._g,includeInternalNamespaces:r.Optional(r.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:sr("Restrict results to these Kubernetes cluster names."),namespaces:sr("Restrict results to these namespaces."),teams:sr("Restrict results to these team names."),envs:sr("Restrict results to these environments."),...fe},rw=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],jz={...xs,nodes:sr("Restrict results to pods scheduled on these nodes."),deployments:sr("Restrict results to pods owned by these Deployments."),statefulsets:sr("Restrict results to pods owned by these StatefulSets."),daemonsets:sr("Restrict results to pods owned by these DaemonSets."),podStatus:r.Optional(r.Array(r.Enum(rw),{description:"Restrict results to pods whose resolved status matches any of these values. Includes 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."}))},bo=r.Enum(["asc","desc"],{description:"Sort direction. Defaults to ascending."}),qz=["deployment","statefulset","daemonset"],nw=r.Object({kind:r.Enum(qz,{description:"Kind of Kubernetes workload associated with the pod. Derived from workload attributes in pod telemetry."}),name:r.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."}),ow=r.Object({podName:r.String({description:"Name of the Kubernetes pod. Set when the pod is created."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the pod. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that reported the pod. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the pod. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the pod, such as production or staging. Present when an environment label or mapping is observed."})),node:r.Optional(r.String({description:"Kubernetes node currently or most recently running the pod. Present when node telemetry is observed."})),phase:r.Enum(rw,{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:r.Integer({description:"Number of containers in the pod that are currently ready. From container readiness telemetry. Zero or greater."}),totalContainers:r.Integer({description:"Number of observed containers for the pod based on container readiness telemetry. Zero or greater."}),restarts:r.Integer({description:"Total restart count across containers in the pod. From container restart telemetry. Zero or greater."}),createdAt:r.Optional(A({description:"Timestamp from pod start time telemetry for the selected pod instance. Present when pod start time telemetry is observed."}))}),Ig=r.Object({...ow.properties,workload:r.Optional(nw),cpuUsageMilli:r.Optional(r.Number({description:"Recent pod CPU usage in millicores. Present when CPU usage telemetry is observed."})),cpuLimitMilli:r.Optional(r.Number({description:"Configured pod CPU limit in millicores, summed across observed containers. Present when a CPU limit is configured and observed."})),cpuRequestMilli:r.Optional(r.Number({description:"Configured pod CPU request in millicores, summed across observed containers. Present when a CPU request is configured and observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent pod memory usage in bytes. Present when memory usage telemetry is observed."})),memoryLimitBytes:r.Optional(r.Number({description:"Configured pod memory limit in bytes, summed across observed containers. Present when a memory limit is configured and observed."})),memoryRequestBytes:r.Optional(r.Number({description:"Configured pod memory request in bytes, summed across observed containers. Present when a memory request is configured and observed."})),cpuUtilization:r.Optional(r.Number({description:"Recent CPU usage divided by the configured CPU limit. Present when both usage and limit are observed."})),memoryUtilization:r.Optional(r.Number({description:"Recent memory usage divided by the configured memory limit. Present when both usage and limit are observed."})),cpuRequestUtilization:r.Optional(r.Number({description:"Recent CPU usage divided by the configured CPU request. Present when both usage and request are observed."})),memoryRequestUtilization:r.Optional(r.Number({description:"Recent memory usage divided by the configured memory request. Present when both usage and request are observed."}))}),Fz=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],nWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/pods`,query:r.Object({...jz,sortBy:r.Optional(r.Enum(Fz,{description:"Field to sort pods by."})),sortDirection:r.Optional(bo)}),paginated:!0,response:r.Array(Ig)}),bg=r.Object({cluster:r.String({description:"Kubernetes cluster name from cluster telemetry."}),teams:r.Optional(r.Array(r.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:r.Optional(r.Array(r.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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.Integer({description:"Number of Kubernetes nodes in the cluster that are ready. Present when node readiness telemetry is observed."})),podPhaseCounts:r.Optional(r.Object({Pending:r.Integer({description:"Number of observed pods currently in the Pending phase."}),Running:r.Integer({description:"Number of observed pods currently in the Running phase."}),Succeeded:r.Integer({description:"Number of observed pods currently in the Succeeded phase."}),Failed:r.Integer({description:"Number of observed pods currently in the Failed phase."}),Unknown:r.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."}))}),Bz=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],oWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/clusters`,query:r.Object({...JU,teams:sr("Restrict to clusters that host workloads from these team names."),envs:sr("Restrict to clusters that host workloads in these environments."),sortBy:r.Optional(r.Enum(Bz,{description:"Field to sort clusters by."})),sortDirection:r.Optional(bo),...fe}),paginated:!0,response:r.Array(bg)}),Hz=["Ready","NotReady","Unknown"],Sg=r.Object({node:r.String({description:"Kubernetes node name from node telemetry."}),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the node. Present when cluster telemetry is observed."})),status:r.Optional(r.Enum(Hz,{description:"Readiness of the node, derived from its Ready condition. Present when node condition telemetry is observed."})),instanceType:r.Optional(r.String({description:"Cloud instance type backing the node (for example `r7g.2xlarge`). Present when host telemetry is observed."})),pods:r.Optional(r.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:r.Optional(r.Integer({description:"Maximum number of pods the node can run. Present when node allocatable telemetry is observed."})),cpuUsageMilli:r.Optional(r.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:r.Optional(r.Number({description:"CPU available to pods on the node, in millicores. Present when node allocatable telemetry is observed."})),cpuUtilization:r.Optional(r.Number({description:"Node CPU usage divided by allocatable CPU. Present when both usage and allocatable telemetry are observed."})),memoryUsageBytes:r.Optional(r.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:r.Optional(r.Number({description:"Memory available to pods on the node, in bytes. Present when node allocatable telemetry is observed."})),memoryUtilization:r.Optional(r.Number({description:"Node memory usage divided by allocatable memory. Present when both usage and allocatable telemetry are observed."}))}),Kz=["node","cluster","status","instanceType","pods","allocatablePods","cpuUsageMilli","cpuAllocatableMilli","cpuUtilization","memoryUsageBytes","memoryAllocatableBytes","memoryUtilization"],iWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/nodes`,query:r.Object({..._g,clusters:sr("Restrict results to these Kubernetes cluster names."),sortBy:r.Optional(r.Enum(Kz,{description:"Field to sort nodes by."})),sortDirection:r.Optional(bo),...fe}),paginated:!0,response:r.Array(Sg)}),Ag=r.Object({namespace:r.String({description:"Kubernetes namespace name from namespace telemetry. Includes namespaces with no observed pods when namespace telemetry is observed."}),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the namespace. Present when cluster telemetry is observed."})),teams:r.Optional(r.Array(r.String(),{description:"Team metadata values observed in workloads in the namespace. Present when team labels or mappings are observed."})),envs:r.Optional(r.Array(r.String(),{description:"Environment metadata values observed in workloads in the namespace. Present when environment labels or mappings are observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods in the namespace. Present when pod telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Aggregate recent CPU usage for observed pods in the namespace, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Aggregate recent memory usage for observed pods in the namespace, in bytes. Present when memory usage telemetry is observed."}))}),zz=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],aWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/namespaces`,query:r.Object({...xs,sortBy:r.Optional(r.Enum(zz,{description:"Field to sort namespaces by."})),sortDirection:r.Optional(bo)}),paginated:!0,response:r.Array(Ag)}),Og=r.Object({deployment:r.String({description:"Kubernetes Deployment name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the Deployment. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the Deployment. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the Deployment. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the Deployment. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the Deployment. Present when pod telemetry and workload attributes are observed."})),availableReplicas:r.Optional(r.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed Deployment pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed Deployment pods, in bytes. Present when memory usage telemetry is observed."}))}),Yz=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],sWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/deployments`,query:r.Object({...xs,sortBy:r.Optional(r.Enum(Yz,{description:"Field to sort deployments by."})),sortDirection:r.Optional(bo)}),paginated:!0,response:r.Array(Og)}),xg=r.Object({statefulSet:r.String({description:"Kubernetes StatefulSet name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the StatefulSet. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the StatefulSet. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the StatefulSet. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the StatefulSet. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the StatefulSet. Present when pod telemetry and workload attributes are observed."})),readyReplicas:r.Optional(r.Integer({description:"Number of ready StatefulSet replicas from StatefulSet status telemetry. Present when StatefulSet status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the StatefulSet. Present when StatefulSet spec telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed StatefulSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed StatefulSet pods, in bytes. Present when memory usage telemetry is observed."}))}),Vz=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],cWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/statefulsets`,query:r.Object({...xs,sortBy:r.Optional(r.Enum(Vz,{description:"Field to sort StatefulSets by."})),sortDirection:r.Optional(bo)}),paginated:!0,response:r.Array(xg)}),Rg=r.Object({daemonSet:r.String({description:"Kubernetes DaemonSet name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the DaemonSet. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the DaemonSet. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the DaemonSet. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the DaemonSet. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the DaemonSet. Present when pod telemetry and workload attributes are observed."})),readyNodes:r.Optional(r.Integer({description:"Number of eligible nodes with a ready DaemonSet pod. Present when DaemonSet status telemetry is observed."})),desiredNodes:r.Optional(r.Integer({description:"Number of eligible nodes where the DaemonSet should run a pod. Present when DaemonSet status telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed DaemonSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed DaemonSet pods, in bytes. Present when memory usage telemetry is observed."}))}),Qz=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],pWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/daemonsets`,query:r.Object({...xs,sortBy:r.Optional(r.Enum(Qz,{description:"Field to sort DaemonSets by."})),sortDirection:r.Optional(bo)}),paginated:!0,response:r.Array(Rg)}),Cg=r.Object({overview:r.Object({...ow.properties,workload:r.Optional(nw)},{description:"Pod identity, status, and owning workload, derived from recent pod metrics."}),healthMetrics:r.Object({cpu:r.Object({usage:r.String({description:"Metric name callers can use to query pod CPU usage. This is not the current CPU value."}),limit:r.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:r.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:r.Object({usage:r.String({description:"Metric name callers can use to query pod memory usage. This is not the current memory value."}),limit:r.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:r.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:r.Object({logs:r.String({description:"TQL log search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."}),traces:r.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."})}),iw=r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),podName:u({allowEmpty:!1})}),uWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/pod-details`,query:iw,response:Cg}),Pg=r.Object({configuration:r.Optional(r.Object({spec:r.Record(r.String(),r.Unknown(),{description:"Kubernetes PodSpec from the latest observed pod manifest. Fields outside `object.spec` are stripped."}),lastObservedAt:A({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:r.Record(r.String(),r.String(),{description:"Kubernetes labels on the pod from the latest observed pod manifest. Key-value strings."}),annotations:r.Record(r.String(),r.String(),{description:"Kubernetes annotations on the pod from the latest observed pod manifest. Key-value strings."}),deletedAt:r.Optional(A({description:"Timestamp when Tsuga last observed the pod deletion event. Present when the latest observed pod event is deleted."}))}),lWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/pod-manifest`,query:iw,response:Pg}),Ug=r.Object({podName:r.String({description:"Name of a pod instance associated with the workload. Resolved from recent pod usage telemetry and workload attributes."}),podUid:r.Optional(r.String({description:"Kubernetes UID for the pod replica. Present when UID telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent CPU usage for the pod replica, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.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."}),wg=r.Object({overview:r.Object({deploymentName:r.String({description:"Kubernetes Deployment name for this detail response."}),namespace:r.Optional(r.String({description:"Kubernetes namespace for this detail response. Present when any deployment signal is found."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name for this detail response. Present when any deployment signal is found."})),team:r.Optional(r.String({description:"Team metadata from the Deployment available-replica metric. Present when the metric includes team metadata."})),env:r.Optional(r.String({description:"Environment metadata from the Deployment available-replica metric. Present when the metric includes environment metadata."})),availableReplicas:r.Optional(r.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),latestRevisionAt:r.Optional(A({description:"Latest ReplicaSet metadata.creationTimestamp observed for the Deployment. Present when ReplicaSet object telemetry is observed."}))}),podReplicas:r.Array(Ug,{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:r.Array(r.Object({replicaSetName:r.String({description:"ReplicaSet name for a Deployment revision from workload telemetry."}),revision:r.Integer({description:"Deployment revision number from ReplicaSet annotations. Integer greater than or equal to zero."}),firstSeen:r.Optional(A({description:"ReplicaSet metadata.creationTimestamp from the latest observed ReplicaSet object. Present when creation time is observed."})),observedGeneration:r.Optional(r.Integer({description:"Latest generation observed for the ReplicaSet revision. Present when generation telemetry is observed."})),readyReplicas:r.Optional(r.Integer({description:"Number of ready replicas for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),replicas:r.Optional(r.Integer({description:"Total replica count for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),logsSearchFilter:r.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."})}),mWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/deployment-details`,query:r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),deploymentName:u({allowEmpty:!1})}),response:wg}),Wz=r.Object({overview:r.Object({statefulSetName:r.String(),namespace:r.Optional(r.String()),cluster:r.Optional(r.String()),team:r.Optional(r.String()),env:r.Optional(r.String()),readyReplicas:r.Optional(r.Integer()),desiredReplicas:r.Optional(r.Integer()),latestRevisionAt:r.Optional(A())}),podReplicas:r.Array(Ug,{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:r.Array(r.Object({revisionName:r.String(),firstSeen:r.Optional(A())}))}),dWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/statefulset-details`,query:r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),statefulSetName:u({allowEmpty:!1})}),response:Wz}),Zz=r.Object({overview:r.Object({daemonSetName:r.String(),namespace:r.Optional(r.String()),cluster:r.Optional(r.String()),team:r.Optional(r.String()),env:r.Optional(r.String()),readyNodes:r.Optional(r.Integer()),desiredNodes:r.Optional(r.Integer()),latestRevisionAt:r.Optional(A())}),podReplicas:r.Array(Ug,{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:r.Array(r.Object({observedGeneration:r.Integer(),firstSeen:r.Optional(A())}))}),fWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/daemonset-details`,query:r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),daemonSetName:u({allowEmpty:!1})}),response:Zz});var Rr=`/${"v1"}/kubernetes-explorer`,aw=r.Pick(Ig,["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."}),Xz={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(aw,{examples:[Xz]});var sw=r.Pick(bg,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),Jz={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(sw,{examples:[Jz]});var cw=r.Pick(Ag,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),e4={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(cw,{examples:[e4]});var pw=r.Pick(Sg,["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."}),t4={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(pw,{examples:[t4]});var uw=r.Pick(Og,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),r4={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(uw,{examples:[r4]});var lw=r.Pick(xg,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),n4={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(lw,{examples:[n4]});var mw=r.Pick(Rg,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),o4={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(mw,{examples:[o4]});var dw=r.Pick(Cg,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),i4={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(dw,{examples:[i4]});var fw=r.Pick(Pg,["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."}),a4={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(fw,{examples:[a4]});var gw=r.Pick(wg,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),s4={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(gw,{examples:[s4]});var hw=r.Object({clusterId:r.Optional(u({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."}))}),ki=r.Pick(ew,["clusterId","search"]),c4=r.Pick(tw,["clusterId","search"]),yw=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:`${Rr}/pods`,query:ki,response:r.Array(aw)}),Tw=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:`${Rr}/clusters`,query:c4,response:r.Array(sw)}),Ew=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:`${Rr}/namespaces`,query:ki,response:r.Array(cw)}),_w=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:`${Rr}/nodes`,query:ki,response:r.Array(pw)}),Iw=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:`${Rr}/deployments`,query:ki,response:r.Array(uw)}),bw=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:`${Rr}/statefulsets`,query:ki,response:r.Array(lw)}),Sw=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:`${Rr}/daemonsets`,query:ki,response:r.Array(mw)}),Aw=r.Object({...hw.properties,k8sCluster:u({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:u({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:u({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."})}),Ow=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:`${Rr}/pod-details`,query:Aw,response:dw}),xw=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:`${Rr}/pod-manifest`,query:Aw,response:fw}),Rw=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:`${Rr}/deployment-details`,query:r.Object({...hw.properties,k8sCluster:u({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:u({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:u({allowEmpty:!1,description:"Kubernetes Deployment name to retrieve. From workload telemetry. Required to fetch deployment details for the selected cluster and namespace."})}),response:gw});var p4="clusterId";function Cw(e,t,n){let o=t.query.properties??{},i=Object.keys(o).filter(a=>a!==p4);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 So(e,t,n,o){let i=e.command(t).description(n.description??`List Kubernetes ${t}`),a=Cw(i,n,!1);i.action(async c=>{let l={};for(let m of a)c[m]!==void 0&&(l[m]=c[m]);ee(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function vg(e,t,n,o){let i=e.command(t).description(n.description??`Get Kubernetes ${t}`),a=Cw(i,n,!0);i.action(async c=>{let l={};for(let m of a)l[m]=c[m];ee(await o()(n,{query:l}))})}function Pw(e,t){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");So(n,"pods",yw,t),So(n,"clusters",Tw,t),So(n,"namespaces",Ew,t),So(n,"nodes",_w,t),So(n,"deployments",Iw,t),So(n,"statefulsets",bw,t),So(n,"daemonsets",Sw,t),vg(n,"pod-details",Ow,t),vg(n,"pod-manifest",xw,t),vg(n,"deployment-details",Rw,t)}var u4=r.Union([r.Literal("scalar"),r.Literal("timeseries")]),l4="/v0/promql",Wu=r.Object({query:u({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:ui,step:u({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:r.Optional(u4),executionOptions:yd,shouldStreamResults:r.Optional(r.Boolean()),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),m4={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(Wu,{examples:[m4]});var wWe=d({tags:["promql"],url:l4,method:"POST",body:Wu,response:tu});var Uw=`/${"v1"}/aggregation`,ww=r.Object({id:r.String({description:"Result identifier. Query results use `q1`, `q2`, and so on; formula results use `formula`."}),group:r.Record(r.String(),r.Union([r.String(),r.Number()]),{description:"Group-by field values for this result. Empty when no group-by is requested."})}),vw=r.Object({results:r.Array(r.Object({...ww.properties,value:r.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."}),d4={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(vw,{examples:[d4]});var Zu=r.Object({series:r.Array(r.Object({...ww.properties,points:r.Array(r.Object({timestamp:r.Integer({description:"Unix timestamp in milliseconds for this point, spaced by `aggregationWindow`."}),value:r.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."}),f4={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign(Zu,{examples:[f4]});var g4=r.Omit(os.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),h4=r.Optional(Fr),Nw={timeRange:bt,queries:r.Array(g4,{maxItems:ns,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 ${ns} 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:h4,dataSource:px,formula:r.Optional(co)},Lw=r.Object({clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),kw=r.Object(Nw,{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."}),y4={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(kw,{examples:[y4]});var Mw=d({description:"Runs one or more aggregation queries over logs, metrics, or traces 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:`${Uw}/multi-query/scalar`,method:"POST",body:kw,query:Lw,response:vw}),Dw=r.Object({...Nw,aggregationWindow:u({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."}),T4={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(Dw,{examples:[T4]});var Gw=d({description:"Runs one or more aggregation queries over logs, metrics, or traces 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:`${Uw}/multi-query/timeseries`,method:"POST",body:Dw,query:Lw,response:Zu});var E4=`/${"v1"}/promql`,_4=r.Object({...r.Pick(Wu,["query","step"]).properties,timeRange:bt},{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"}]}),I4=r.Object({clusterId:r.Optional(u({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."}))}),$w=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:E4,method:"POST",body:_4,query:I4,response:Zu});function jw(e,t){let n=e.command("promql").description("Run PromQL queries over metric data");Zr(n,"query","Run a PromQL range query over metric data",$w,t)}var Di="/v0/dashboard-folders",Gi=r.Object({id:r.String({description:"Tsuga-generated dashboard folder ID assigned when the folder is created. Use it as dashboard `folderId` or child-folder `parentFolderId`."}),name:r.String({description:"Display name of the dashboard folder. Set by the caller on create or update."}),owner:r.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:r.Optional(r.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:De,creator:r.Optional(pe),updater:r.Optional(pe),createdAt:A(),updatedAt:A()},{title:"DashboardFolder"}),Ng=r.Object({...Gi.properties,dashboardCount:r.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."})}),Xu=r.Object({name:u({allowEmpty:!1,description:"Display name of the dashboard folder. Required and non-empty."}),owner:u({allowEmpty:!1,description:"ID of the team that owns the dashboard folder. Required and used for folder access control."}),parentFolderId:r.Optional(r.Union([r.Null(),u({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:Xe}),Ju=r.Partial(r.Object({owners:_e(u({allowEmpty:!1}),{description:"Restrict results to dashboard folders owned by any of these team IDs",maxItems:50}),searchQuery:r.Object({value:u({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard folder names or folder IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:r.Optional(r.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:_e(Bt.items,{description:"Restrict results to dashboard folders that have at least one of the listed key/value tags",maxItems:50}),parentFolderId:r.Union([r.Null(),u({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"})),Mi={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},Lg=[Mi.OWNER,Mi.TAGS,Mi.DASHBOARD_COUNT,Mi.UPDATED_AT,Mi.NAME],b4=r.Partial(r.Object({...fe,filters:Ju,sort:r.Object({by:r.Enum([...Lg,Mi.IS_FAVORITE],{description:"Field to sort the returned dashboard folders by"}),direction:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboard folders"})})),n7e=d({tags:["dashboard-folders"],url:`${Di}/query`,method:"POST",paginated:!0,body:b4,response:r.Array(Ng)}),o7e=d({tags:["dashboard-folders"],url:`${Di}/:id`,method:"GET",params:r.Object({id:u()}),response:Gi}),i7e=d({tags:["dashboard-folders"],url:Di,method:"POST",body:Xu,response:Gi}),a7e=d({tags:["dashboard-folders"],url:`${Di}/:id`,method:"PUT",params:r.Object({id:u()}),body:Xu,response:Gi}),s7e=d({tags:["dashboard-folders"],url:`${Di}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),c7e=d({tags:["dashboard-folders"],url:`${Di}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(Ju,["tags"]))}),response:Ft});var Rs=`/${"v1"}/dashboard-folders`,el=r.Pick(Gi,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),qw={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(el,{examples:[qw]});var Fw=r.Pick(Ng,["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."}),S4={...qw,dashboardCount:10};Object.assign(Fw,{examples:[S4]});var kg=r.Pick(Xu,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),A4={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(kg,{examples:[A4]});var O4=r.Object({by:r.Enum(Lg,{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:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboard folders"}),Bw=r.Object({...Ze,filters:r.Optional(r.Pick(Ju,["owners","searchQuery","tags","parentFolderId"])),sort:r.Optional(O4)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),x4={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(Bw,{examples:[x4]});var Hw=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:`${Rs}/query`,method:"POST",paginated:!0,body:Bw,response:r.Array(Fw)}),Kw=d({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${Rs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the dashboard folder to retrieve. Use the `id` returned by folder list, get, create, or update responses."})}),response:el}),zw=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:Rs,method:"POST",body:kg,response:el}),Yw=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:`${Rs}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the dashboard folder to update. Use the `id` returned by folder list, get, create, or update responses."})}),body:kg,response:el}),Vw=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:`${Rs}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the dashboard folder to delete. Use the `id` returned by folder list, get, create, or update responses."})}),response:N});var Cr="/v0/dashboards",Ww=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],R4=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],C7e=[...R4,"note"];var C4=["ns","us","ms","s","m","h","days"];var P4=["B","KB","MB","GB","TB","PB"];var U4=20;var Zw=r.Object({type:r.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),Xw=r.Object({type:r.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:r.Enum(C4,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),Jw=r.Object({type:r.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:r.Enum(P4,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),ev=r.Object({type:r.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"}),tv=r.Object({type:r.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"}),rv=r.Object({type:r.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),nv=r.Object({type:r.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),ov=r.Object({type:r.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"}),w4=r.Object({type:r.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:r.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"}),v4=r.Object({type:r.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:r.String({description:"Text label describing the custom unit. Must not be empty.",minLength:1,maxLength:U4})},{$id:"InputDataNormalizerCustom",title:"Custom"}),Rt=C("type",[Xw,Jw,ev,tv,rv,nv,Zw,ov,w4],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Ct=C("type",[Xw,Jw,ev,tv,rv,nv,Zw,ov,v4],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Mg=r.Object({attribute:r.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:r.Optional(Rt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),Dg=r.Object({attribute:r.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:r.Optional(Ct)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),$i=["background","no-background"],N4=["table","legend-only","no-legend"];var L4=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],iv=["alert","warning","success"],Pr=r.Object({operator:r.Enum(L4,{description:"Comparator used to evaluate the metric value"}),value:r.Number({description:"Threshold value used when evaluating the operator"}),color:r.Enum(iv,{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."}),k4=r.Object({value:r.Number({description:"Y-axis value where the threshold marker is placed"}),level:r.Enum(iv,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),M4=["sec","min","hour","day"],wn=r.Object({time:r.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:r.Enum(M4,{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 Un=r.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),ji=r.Object({formula:r.Optional(r.String({description:"Optional alias for formula (only used for display in the UI)"})),queries:r.Optional(r.Record(r.String(),r.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."}),qi=r.Object({formula:r.Optional(u({type:"short",description:"Optional alias for formula (only used for display in the UI)"})),queries:r.Optional(r.Record(r.String(),u({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."}),rl={source:ir,queries:Sx,formula:r.Optional(iu),aliases:r.Optional(ji),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},nl={source:ir,queries:os,formula:r.Optional(co),aliases:r.Optional(qi),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},Ur=r.Optional(r.Enum(["relative","absolute"],{description:"Whether each group holds its own value or its percentage of the ungrouped total (defaults to absolute)"})),Fi={...rl,groupBy:r.Optional(li)},Bi={...nl,groupBy:r.Optional(Fr)},Fe=r.Enum(N4,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),ye=r.Optional(r.Union([r.Number(),r.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."})),Jt=r.Optional(r.Array(k4,{description:"Threshold markers displayed on the chart"})),D4=r.Object({name:r.String({description:"Display name of the table column"}),...rl,source:ir,normalizer:r.Optional(Rt),precision:ye},{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`."}),G4=r.Object({name:u({description:"Display name of the table column"}),...nl,source:ir,normalizer:r.Optional(Ct),precision:ye},{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`."}),$4=r.Array(r.Object({id:r.String({description:"ID of the column to sort by"}),desc:r.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."}),j4=r.Array(r.Object({id:u({description:"ID of the column to sort by"}),desc:r.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."}),Gg=r.Array(r.Object({id:r.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:r.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."}),$g=r.Array(r.Object({id:u({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:r.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."}),av=["horizontal","vertical"],q4=r.Object({type:r.Literal("list",{description:"Displays matching logs in a tabular list"}),query:r.String({description:"Query that selects logs for the list"}),listColumns:r.Optional(r.Array(Mg,{description:"Custom columns to display for each log"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets."})),defaultSorting:r.Optional(Gg)},{$id:"GraphVisualizationList",title:"List"}),F4=r.Object({type:r.Literal("list",{description:"Displays matching logs in a tabular list"}),query:u({type:"tsuga-query",description:"Query that selects logs for the list"}),listColumns:r.Optional(r.Array(Dg,{description:"Custom columns to display for each log"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional($g)},{$id:"InputGraphVisualizationList",title:"List"}),tl=C("type",[r.Object({type:r.Literal("auto",{description:"Automatically choose this axis bound"})}),r.Object({type:r.Literal("number",{description:"Use a fixed numeric axis bound"}),value:r.Number({description:"Fixed numeric axis bound value"})})],{description:"Axis bound mode: automatic or fixed numeric value"}),Hi=r.Object({min:tl,max:tl,scale:C("type",[r.Object({type:r.Literal("pow",{description:"Power scale"}),exponent:r.Number({description:"Exponent used by the power scale"})}),r.Object({type:r.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:r.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets."}),Ki=r.Object({min:tl,max:tl,scale:C("type",[r.Object({type:r.Literal("pow",{description:"Power scale"}),exponent:r.Number({minimum:0,description:"Exponent used by the power scale"})}),r.Object({type:r.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:r.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."}),B4=r.Array(r.Integer({description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"}),H4=r.Array(r.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 K4=r.Object({type:r.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(Fe),thresholds:Jt,yAxisSettings:r.Optional(Hi)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),z4=r.Object({type:r.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(Fe),thresholds:Jt,yAxisSettings:r.Optional(Ki)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),Y4=r.Object({type:r.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),query:r.String({description:"The read-only SQL query to execute against the connection."}),listColumns:r.Optional(r.Array(Mg,{description:"Custom columns to display for each database row"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets."})),defaultSorting:r.Optional(Gg)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),V4=r.Object({type:r.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),query:u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),listColumns:r.Optional(r.Array(Dg,{description:"Custom columns to display for each database row"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional($g)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),Q4=r.Object({type:r.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."}))},{$id:"GraphVisualizationTopListConnection",title:"TopListConnection"}),W4=r.Object({type:r.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1})},{$id:"InputGraphVisualizationTopListConnection",title:"TopListConnection"}),Z4=r.Object({type:r.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(Fe)},{$id:"GraphVisualizationPieConnection",title:"PieConnection"}),X4=r.Object({type:r.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),J4=r.Object({type:r.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(Fe),thresholds:Jt,yAxisSettings:r.Optional(Hi)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),e3=r.Object({type:r.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(Fe),thresholds:Jt,yAxisSettings:r.Optional(Ki)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),t3=r.Object({type:r.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),backgroundMode:r.Optional(r.Enum($i,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Rt),legendMode:r.Optional(Fe)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),r3=r.Object({type:r.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),backgroundMode:r.Optional(r.Enum($i,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Ct),legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),n3=r.Object({type:r.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:r.String({description:"Tsuga query that selects logs to cluster into patterns"}),layout:r.Optional(r.Enum(av,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),o3=r.Object({type:r.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:u({type:"tsuga-query",description:"Tsuga query that selects logs to cluster into patterns"}),layout:r.Optional(r.Enum(av,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),i3=r.Object({type:r.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:r.String({description:"Query that selects trace spans for the list"}),listColumns:r.Optional(r.Array(Mg,{description:"Custom columns to display for each span"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets."})),defaultSorting:r.Optional(Gg)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),a3=r.Object({type:r.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:u({type:"tsuga-query",description:"Query that selects trace spans for the list"}),listColumns:r.Optional(r.Array(Dg,{description:"Custom columns to display for each span"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional($g)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),Cs=r.Array(r.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."}),Ps=r.Array(u({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),s3=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Cs,aliases:r.Optional(ji),timeBucket:r.Optional(wn),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe),thresholds:Jt,yAxisSettings:r.Optional(Hi),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),c3=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Ps,aliases:r.Optional(qi),timeBucket:r.Optional(wn),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe),thresholds:Jt,yAxisSettings:r.Optional(Ki),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),p3=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Cs,aliases:r.Optional(ji),backgroundMode:r.Optional(r.Enum($i,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Rt),legendMode:r.Optional(Fe)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),u3=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Ps,aliases:r.Optional(qi),backgroundMode:r.Optional(r.Enum($i,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Ct),legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),l3=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Cs,aliases:r.Optional(ji),normalizer:r.Optional(Rt),precision:ye,conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),m3=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Ps,aliases:r.Optional(qi),normalizer:r.Optional(Ct),precision:ye,conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),d3=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Cs,aliases:r.Optional(ji),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),f3=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Ps,aliases:r.Optional(qi),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),g3=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Cs,aliases:r.Optional(ji),timeBucket:r.Optional(wn),precision:ye,normalizer:r.Optional(Rt),thresholds:Jt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(Hi)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),h3=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Ps,aliases:r.Optional(qi),timeBucket:r.Optional(wn),precision:ye,normalizer:r.Optional(Ct),thresholds:Jt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(Ki)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),y3=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...Fi,groupByMode:Ur,timeBucket:r.Optional(wn),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe),thresholds:Jt,yAxisSettings:r.Optional(Hi),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),T3=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...Bi,groupByMode:Ur,timeBucket:r.Optional(wn),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe),thresholds:Jt,yAxisSettings:r.Optional(Ki),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),sv="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.",E3=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...Fi,groupByMode:Ur,normalizer:r.Optional(Rt),precision:ye,conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:r.Optional(r.Boolean({description:sv}))},{$id:"GraphVisualizationTopList",title:"TopList"}),_3=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...Bi,groupByMode:Ur,normalizer:r.Optional(Ct),precision:ye,conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:r.Optional(r.Boolean({description:sv}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),I3=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...Fi,groupByMode:Ur,normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe)},{$id:"GraphVisualizationPie",title:"Pie"}),b3=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...Bi,groupByMode:Ur,normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationPie",title:"Pie"}),S3=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...rl,backgroundMode:r.Optional(r.Enum($i,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Rt),legendMode:r.Optional(Fe)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),A3=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...nl,backgroundMode:r.Optional(r.Enum($i,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Ct),legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),O3=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...Fi,groupByMode:Ur,timeBucket:r.Optional(wn),precision:ye,normalizer:r.Optional(Rt),thresholds:Jt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(Hi)},{$id:"GraphVisualizationBar",title:"Bar"}),x3=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...Bi,groupByMode:Ur,timeBucket:r.Optional(wn),precision:ye,normalizer:r.Optional(Ct),thresholds:Jt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(Ki)},{$id:"InputGraphVisualizationBar",title:"Bar"}),cv='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.',pv=r.String({description:cv}),uv=u({description:cv}),R3=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...Fi,group:r.Optional(pv),precision:ye,normalizer:r.Optional(Rt),percentileMarkers:r.Optional(B4),boundsScale:r.Optional(ou)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),C3=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...Bi,group:r.Optional(uv),precision:ye,normalizer:r.Optional(Ct),percentileMarkers:r.Optional(H4),boundsScale:r.Optional(ou)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),lv=["red","pink","violet","blue","cyan","green","yellow","orange"],mv=r.Enum(lv,{description:"Color palette used to render the heatmap intensity gradient"}),P3=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...Fi,group:r.Optional(pv),precision:ye,normalizer:r.Optional(Rt),palette:r.Optional(mv)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),U3=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...Bi,group:r.Optional(uv),precision:ye,normalizer:r.Optional(Ct),palette:r.Optional(mv)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),dv=r.Object({from:r.Number({description:"Lower bound of the Gauge color threshold; runs up to the next threshold or the max"}),color:r.Enum(lv,{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."}),w3=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...rl,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(dv,{description:"Color thresholds inside the gauge range"})),precision:ye,normalizer:r.Optional(Rt)},{$id:"GraphVisualizationGauge",title:"Gauge"}),v3=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...nl,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(dv,{description:"Color thresholds inside the gauge range"})),precision:ye,normalizer:r.Optional(Ct)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),N3=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(D4,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(li),groupByMode:Ur,defaultSorting:r.Optional($4),columnSizes:r.Optional(r.Record(r.String(),r.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"}),L3=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(G4,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(Fr),groupByMode:Ur,defaultSorting:r.Optional(j4),columnSizes:r.Optional(r.Record(r.String(),r.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"}),k3=r.Object({type:r.Literal("note",{description:"Displays static text on the dashboard"}),note:r.Optional(r.String({description:"Markdown-compatible text shown in the note"})),noteColor:r.Optional(r.Enum(Ww,{description:"Background color used to render the note"})),noteAlign:r.Optional(Un),noteJustifyContent:r.Optional(Un)},{$id:"GraphVisualizationNote",title:"Note"}),M3=r.Object({type:r.Literal("note",{description:"Displays static text on the dashboard"}),note:r.Optional(u({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:r.Optional(r.Enum(Ww,{description:"Background color used to render the note"})),noteAlign:r.Optional(Un),noteJustifyContent:r.Optional(Un)},{$id:"InputGraphVisualizationNote",title:"Note"}),D3=C("type",[K4,Y4,Q4,Z4,J4,t3,s3,p3,l3,d3,g3,y3,E3,I3,S3,w3,O3,R3,P3,N3,q4,k3,n3,i3],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),G3=C("type",[z4,V4,W4,X4,e3,r3,c3,u3,m3,f3,h3,T3,_3,b3,A3,v3,x3,C3,U3,L3,F4,M3,o3,a3],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),ol=r.Object({id:r.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:r.Optional(r.String({description:"Display name of the graph widget."})),description:r.Optional(r.String({description:"Optional text shown with the graph widget."})),descriptionAlign:r.Optional(Un),descriptionJustifyContent:r.Optional(Un),visualization:D3,layout:r.Optional(r.Object({x:r.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:r.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:r.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:r.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 ${Id}\xD7${bd} (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."}),il=r.Object({id:u({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:r.Optional(u({description:"Display name of the graph widget."})),description:r.Optional(r.String({minLength:1,maxLength:800,description:"Text shown with the graph widget."})),descriptionAlign:r.Optional(Un),descriptionJustifyContent:r.Optional(Un),visualization:G3,layout:r.Optional(r.Object({x:r.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:r.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:r.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:r.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 ${Id}\xD7${bd} (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."}),Qw=10,$3=r.Array(r.Object({key:r.String({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:r.Array(r.String({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:r.Optional(r.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."}),j3=r.Array(r.Object({key:u({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:r.Array(u({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:r.Optional(r.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{maxItems:Qw,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${Qw} filters are allowed.`}),zi=r.Object({id:r.String({description:"Tsuga-generated dashboard ID assigned when the dashboard is created."}),name:r.String({description:"Display name of the dashboard. Set by the caller on create or update."}),owner:r.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:r.Array(ol,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional($3),createdAt:A({description:"Timestamp when Tsuga created the dashboard."}),updatedAt:A({description:"Timestamp when Tsuga last updated the dashboard."}),creator:r.Optional(pe),updater:r.Optional(pe),tags:De,timePreset:r.Optional(r.Enum(Ul,{description:"Relative time preset used when opening the dashboard."})),folderId:r.Optional(r.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."}))}),al=r.Object({name:u({description:"Display name of the dashboard."}),owner:u({allowEmpty:!1,description:"ID of the team that owns the dashboard. Required and used for dashboard access control."}),graphs:r.Array(il,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(j3),tags:Xe,timePreset:r.Optional(r.Enum(Ul,{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:r.Optional(r.Union([r.Null(),u({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."}))}),cr={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},fv=[cr.OWNER,cr.TAGS,cr.WIDGET_COUNT,cr.UPDATED_AT,cr.NAME],Us=r.Partial(r.Object({owners:_e(u({allowEmpty:!1}),{description:"Restrict results to dashboards owned by any of these team IDs",maxItems:50}),searchQuery:r.Object({value:u({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard names or dashboard IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:r.Optional(r.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:_e(Bt.items,{description:"Restrict results to dashboards that have at least one of the listed key/value tags",maxItems:50}),folderId:r.Union([r.Null(),u({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"})),q3=r.Partial(r.Object({...fe,filters:Us,sort:r.Object({by:r.Enum([cr.IS_FAVORITE,cr.OWNER,cr.TAGS,cr.WIDGET_COUNT,cr.UPDATED_AT,cr.NAME],{description:"Field to sort the returned dashboards by"}),direction:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"})})),P7e=d({tags:["dashboards"],url:`${Cr}/query`,method:"POST",paginated:!0,response:r.Array(zi),body:q3}),U7e=d({tags:["dashboards"],url:`${Cr}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(Us,["tags"]))}),response:Ft}),w7e=d({tags:["dashboards"],url:`${Cr}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(Us))}),response:r.Object({all:r.Integer({description:"Total number of dashboards matching the filters that the user can read."})})}),v7e=d({tags:["dashboards"],url:`${Cr}/:id`,method:"GET",params:r.Object({id:u()}),response:zi}),N7e=d({tags:["dashboards"],url:Cr,method:"POST",body:al,response:zi}),L7e=d({tags:["dashboards"],url:`${Cr}/:id`,method:"PUT",params:r.Object({id:u()}),body:r.Partial(al),response:zi}),k7e=d({tags:["dashboards"],url:`${Cr}/bulk-update`,method:"PUT",body:r.Object({dashboardIds:r.Array(u(),{description:"Dashboard IDs to update. At least one dashboard ID is required."}),owner:r.Optional(u({allowEmpty:!1,description:"Owning team ID to apply to every dashboard. Optional when folderId is provided; omit to keep the current owner."})),folderId:r.Optional(r.Union([r.Null(),u({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:r.Object({})}),M7e=d({tags:["dashboards"],url:`${Cr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),D7e=d({tags:["dashboards"],url:`${Cr}/:id/graphs/:graphId`,method:"PUT",params:r.Object({id:u({allowEmpty:!1}),graphId:u({allowEmpty:!1})}),body:r.Omit(il,["id"]),response:ol}),G7e=d({tags:["dashboards"],url:`${Cr}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})});var Yi=`/${"v1"}/dashboards`,ws=r.Pick(zi,["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)."}),F3={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(ws,{examples:[F3]});var B3=r.Object({by:r.Enum([...fv],{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:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"}),gv=r.Object({...Ze,filters:r.Optional(r.Pick(Us,["owners","searchQuery","tags","folderId"])),sort:r.Optional(B3)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),H3={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(gv,{examples:[H3]});var hv=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:`${Yi}/query`,method:"POST",paginated:!0,body:gv,response:r.Array(ws)}),yv=d({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${Yi}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the saved dashboard to retrieve. Use the `id` returned by dashboard query, create, or update responses."})}),response:ws}),jg=r.Pick(al,["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."}),K3={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(jg,{examples:[K3]});var z3=r.Omit(il,["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."}),Tv=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:Yi,method:"POST",body:jg,response:ws}),Ev=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:`${Yi}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the saved dashboard to update. Use the `id` returned by dashboard query, get, or create responses."})}),body:r.Partial(jg),response:ws}),Y3=r.Object({id:u({allowEmpty:!1,description:"Identifier of the saved dashboard to delete. Use the `id` returned by dashboard query, get, create, or update responses."})}),_v=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:`${Yi}/:id`,method:"DELETE",params:Y3,response:N}),z7e=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:`${Yi}/:id/graphs/:graphId`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the dashboard that contains the graph to update. Use the `id` returned by dashboard responses."}),graphId:u({allowEmpty:!1,description:"Identifier of the graph to update within the dashboard. Use graph IDs from the dashboard response."})}),body:z3,response:ol});var Iv=100,bv=3,Vi=r.Object({id:r.String({description:"Tsuga-generated ingestion API key ID assigned when the key is created."}),name:r.String({description:"Human-readable key name. Names must be kebab-case when creating or updating keys."}),keyLastCharacters:r.String({description:"Last visible characters of the secret key. Use this to identify a key without exposing the full secret."}),owner:r.String({description:"Team ID that owns and manages the ingestion API key."}),tags:Ft,teamOverrideFields:r.Optional(r.Array(r.String(),{description:"Telemetry attribute names used to override ownership for data sent with this key."})),updatedAt:A({description:"Timestamp when Tsuga last updated the key metadata."}),createdAt:A({description:"Timestamp when Tsuga created the key."}),creator:r.Optional(pe),updater:r.Optional(pe),assetUpdatedAt:A({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})}),vs=r.Object({name:r.String({format:ti,minLength:1,maxLength:Iv,description:`Kebab-case name for the ingestion API key. Maximum length is ${Iv} characters.`}),owner:u({allowEmpty:!1,description:"Team ID that will own and manage the ingestion API key."}),tags:Bt,teamOverrideFields:r.Union([r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:bv,description:`Array form. Up to ${bv} fields are allowed.`}),r.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."})}),Qi="/v0/ingestion-api-keys",tZe=d({tags:["ingestion-api-keys"],url:Qi,method:"POST",body:vs,response:r.Intersect([Vi,r.Object({key:r.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."})})])}),rZe=d({tags:["ingestion-api-keys"],url:Qi,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(Vi)}),nZe=d({tags:["ingestion-api-keys"],url:`${Qi}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1})}),response:Vi}),oZe=d({tags:["ingestion-api-keys"],url:`${Qi}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1})}),body:vs,response:Vi}),iZe=d({tags:["ingestion-api-keys"],url:`${Qi}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1})}),response:N}),aZe=d({tags:["ingestion-api-keys"],url:`${Qi}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u({allowEmpty:!1}))}),response:r.Object({})});var Ns=`/${"v1"}/ingestion-api-keys`,Ls=r.Pick(Vi,["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)."}),Sv={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(Ls,{examples:[Sv]});var Av=r.Pick(vs,["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."}),Ov=r.Pick(vs,["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."}),xv={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(Av,{examples:[xv]});Object.assign(Ov,{examples:[xv]});var V3={...Sv,key:"tsuga_in:v1:abc123xyx7Qm"},Rv=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:Ns,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Ls)}),fZe=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:`${Ns}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the ingestion API key to retrieve. Use the `id` returned by ingestion API key list or create responses."})}),response:Ls}),Q3=r.Intersect([r.Pick(Ls,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),r.Object({key:r.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:V3}),Cv=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:Ns,method:"POST",body:Av,response:Q3}),Pv=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:`${Ns}/:id`,method:"PUT",params:r.Object({id:u({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:Ov,response:Ls}),Uv=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:`${Ns}/:id`,method:"DELETE",params:r.Object({id:u({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:N});var W3={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"]}},[TZe,sl,ks]=Z3(W3),EZe=Object.fromEntries(sl.map(e=>[e,e]));function Z3(e){let t=[],n=[],o=[],i=Object.keys(e);for(let a of i){t.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[qg(t),qg(n),qg(o)]}function qg(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var Fg=r.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),X3=r.Object({versioningStatus:r.Optional(r.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),J3=r.Object({domainName:r.Optional(r.String()),origins:r.Optional(r.Array(r.String()))}),eY=r.Object({allocatedStorageGib:r.Optional(r.Number()),encryptedAtRest:r.Optional(r.Boolean()),engine:r.Optional(r.String()),dynamoDbItemCount:r.Optional(r.Number()),dynamoDbActualSizeGib:r.Optional(r.Number())}),tY=r.Object({version:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),subnets:r.Optional(r.Array(r.String()))}),rY=r.Object({artifactRegistryFormat:r.Optional(r.Enum(["FORMAT_UNSPECIFIED","DOCKER","MAVEN","NPM","APT","YUM","PYTHON","KFP","GO","GENERIC"])),uri:r.Optional(r.String()),tagMutability:r.Optional(r.Enum(["MUTABLE","IMMUTABLE"])),scanOnPush:r.Optional(r.Boolean()),encryptionType:r.Optional(r.String())}),nY=r.Object({status:r.Optional(r.String()),activeServices:r.Optional(r.Number()),pendingTasks:r.Optional(r.Number()),runningTasks:r.Optional(r.Number()),registeredContainerInstances:r.Optional(r.Number()),capacityProviders:r.Optional(r.Array(r.String()))}),oY=r.Object({status:r.Optional(r.String()),desiredStatus:r.Optional(r.String()),healthStatus:r.Optional(r.String()),availabilityZone:r.Optional(r.String()),startedAt:r.Optional(A())}),iY=r.Object({isEncrypted:r.Optional(r.Boolean()),ownerId:r.Optional(r.String()),state:r.Optional(r.Enum(["creating","available","deleting","deleted","error","updating"]))}),aY=r.Object({type:r.Optional(r.String()),osType:r.Optional(r.String()),subnetIds:r.Optional(r.Array(r.String())),nbContainers:r.Optional(r.Number())}),sY=r.Object({digest:r.String(),imageTags:r.Array(r.String()),imageSizeBytes:r.Optional(r.Number()),imagePushedAt:r.Optional(A()),mediaType:r.Optional(r.String()),repositoryName:r.String(),repositoryId:r.Optional(r.String()),scanStatus:r.Optional(r.String())}),cY=r.Object({url:r.Optional(r.String()),maxMessageSizeBytes:r.Optional(r.Number()),messageRetentionHours:r.Optional(r.Number())}),pY=r.Object({runtime:r.Optional(r.String()),memoryAllocationMib:r.Optional(r.Number()),timeoutMs:r.Optional(r.Number()),codeSha256:r.Optional(r.String())}),uY=r.Object({kind:r.Optional(r.String())}),lY=r.Object({instanceId:r.String(),architecture:r.Optional(r.String()),instanceType:r.Optional(r.String()),operatingSystem:r.Optional(r.String()),memoryMib:r.Optional(r.Number()),vCpus:r.Optional(r.Number()),vpcId:r.Optional(r.String()),k8sClusterId:r.Optional(r.String())}),mY=r.Object({id:r.Optional(r.String()),ipCidrBlocks:r.Array(r.String())}),dY=r.Object({protocol:r.Optional(Fg),port:r.Optional(r.Number()),instanceProtocol:r.Optional(Fg),instancePort:r.Optional(r.Number())}),fY=r.Object({protocol:r.Optional(r.String()),ports:r.Optional(r.Array(r.String())),portRange:r.Optional(r.String()),allPorts:r.Optional(r.Boolean())}),gY=r.Object({name:r.String(),ip:r.Optional(r.String()),type:r.Enum(["public","private"])}),hY=r.Object({type:r.String(),name:r.String()}),yY=r.Object({frontendIp:r.Optional(gY),backendIpPools:r.Array(hY)}),TY=r.Object({targetId:r.String(),targetPort:r.Optional(r.Number()),targetType:r.Optional(r.Enum(["instance","ip","lambda","alb"])),healthState:r.Optional(r.String()),healthReason:r.Optional(r.String()),healthDescription:r.Optional(r.String()),availabilityZone:r.Optional(r.String())}),EY=r.Object({protocol:r.Optional(Fg),port:r.Optional(r.Number()),type:r.Optional(r.Enum(["alb","lambda","instance","ip"])),name:r.Optional(r.String()),targetGroupArn:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),healthCheckProtocol:r.Optional(r.String()),healthCheckPort:r.Optional(r.String()),healthCheckPath:r.Optional(r.String()),healthCheckIntervalSeconds:r.Optional(r.Number()),healthCheckTimeoutSeconds:r.Optional(r.Number()),healthyThresholdCount:r.Optional(r.Number()),unhealthyThresholdCount:r.Optional(r.Number()),targets:r.Optional(r.Array(TY)),targetCount:r.Optional(r.Number()),healthyTargetCount:r.Optional(r.Number()),loadBalancerArns:r.Optional(r.Array(r.String()))}),_Y=r.Object({first:r.Optional(r.String()),last:r.Optional(r.String()),scope:r.Optional(r.Number())}),IY=r.Object({type:r.Optional(r.String()),name:r.Optional(r.String()),alwaysServe:r.Optional(r.Boolean()),subnets:r.Optional(r.Array(r.Union([r.Number(),_Y]))),target:r.Optional(r.String()),weight:r.Optional(r.Number()),priority:r.Optional(r.Number()),status:r.Optional(r.String())}),bY=r.Object({instanceId:r.Optional(r.String()),state:r.Optional(r.String()),reasonCode:r.Optional(r.String()),description:r.Optional(r.String())}),SY=r.Object({loadBalancerType:r.Optional(r.String()),dnsName:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),subnetIds:r.Array(r.String()),scheme:r.Optional(r.String()),listeners:r.Optional(r.Union([r.Array(dY),r.Array(fY)])),targets:r.Optional(r.Union([r.Array(r.String()),r.Array(bY),r.Array(IY)])),azureLoadBalancingRules:r.Optional(r.Array(yY))}),AY=r.Object({domainName:r.Optional(r.String()),expiresAt:r.Optional(A()),inUseBy:r.Optional(r.Array(r.String())),renewalEligibility:r.Optional(r.String()),revokedAt:r.Optional(A()),status:r.Optional(r.String()),type:r.Optional(r.String())}),OY=r.Object({state:r.Optional(r.Enum(["creating","available","deleting","deleted","error","in-use"])),volumeType:r.Optional(r.Enum(["gp2","gp3","io1","io2","st1","sc1","standard"]))}),xY=r.Object({osType:r.Optional(r.Enum(["Windows","Linux"]))}),RY=r.Object({state:r.Optional(r.String()),volumeType:r.Optional(r.String())}),CY=r.Intersect([r.Object({isEncrypted:r.Optional(r.Boolean()),sizeGib:r.Optional(r.Number())}),r.Union([OY,RY,xY])]),PY=r.Object({instanceCount:r.Optional(r.Number()),hostnames:r.Optional(r.Array(r.String())),runtime:r.Optional(r.String())}),cl=r.Union([r.Object({category:r.Literal("application"),resourceType:r.Literal("webService"),attributes:r.Optional(PY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("bucket"),attributes:r.Optional(X3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("messagingService"),attributes:r.Optional(cY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("fileSystem"),attributes:r.Optional(iY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("contentDeliveryNetwork"),attributes:r.Optional(J3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("database"),attributes:r.Optional(eY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("storageAccount"),attributes:r.Optional(uY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("volume"),attributes:r.Optional(CY)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("virtualMachine"),attributes:r.Optional(lY)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("serverless"),attributes:r.Optional(pY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("kubernetesCluster"),attributes:r.Optional(tY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerRepository"),attributes:r.Optional(rY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerCluster"),attributes:r.Optional(nY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerServiceTask"),attributes:r.Optional(oY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerService"),attributes:r.Optional(aY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerImage"),attributes:r.Optional(sY)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("virtualNetwork"),attributes:r.Optional(mY)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("loadBalancer"),attributes:SY}),r.Object({category:r.Literal("network"),resourceType:r.Literal("targetGroup"),attributes:r.Optional(EY)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("certificate"),attributes:r.Optional(AY)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var Ao="/v0/inventory",wv=["scan_in_progress","success","failure","partial"],Hg=r.Object({id:r.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:r.Enum(_n,{description:"Cloud platform where Tsuga discovered this resource."}),cloudAccount:r.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:r.Optional(r.String({description:"Cloud region where Tsuga discovered this resource, when the resource is regional."})),fullyQualifiedResourceId:r.String({description:"Cloud-native unique identifier for this resource, such as an AWS ARN, GCP resource name, or Azure resource ID."}),displayName:r.String({description:"Human-readable resource name shown in Tsuga. Derived from cloud provider metadata when available."}),nativeResourceType:r.String({description:"Cloud-native resource type reported by the inventory integration, for example `aws_ec2_instance` or `gcp_bucket`."}),resourceCreatedAt:r.Optional(A({description:"Timestamp when the resource was created in the cloud, when known."})),resourceUpdatedAt:r.Optional(A({description:"Timestamp when the resource was last updated in the cloud, when known."})),resourceLastSeenAt:A({description:"Timestamp when Tsuga last observed this resource during an inventory scan."}),tags:De,nativeAttributes:r.Optional(r.Unsafe({type:"object",additionalProperties:!0})),covered:r.Optional(r.Boolean({description:"Whether the resource is covered by the configured infrastructure-as-code identifiers"}))}),Wi={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},vv=r.Object({cloudPlatforms:_e(r.Enum(_n),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:_n.length}),cloudAccounts:_e(u({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud accounts",maxItems:500}),cloudRegions:_e(u({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud regions",maxItems:500}),nativeResourceTypes:_e(r.Enum(ks),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:ks.length}),resourceTypes:_e(r.Enum(sl),{description:"Restrict results to resources of any of these normalized resource types",maxItems:sl.length}),tags:_e(Bt.items,{description:"Restrict results to resources that have at least one of the listed key/value tags",maxItems:50}),isIacManaged:r.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:r.Object({value:u({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:r.Optional(r.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"}),Kg=r.Partial(r.Object({...fe,filters:r.Partial(vv,{description:"Filters applied to narrow the returned resources."}),sort:r.Object({by:r.Enum([Wi.DISPLAY_NAME,Wi.CLOUD_ACCOUNT,Wi.NATIVE_RESOURCE_TYPE,Wi.CLOUD_REGION,Wi.RESOURCE_TYPE,Wi.RESOURCE_CREATED_AT],{description:"Field to sort the returned resources by"}),direction:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned resources. Ties are broken by resource ID for stable pagination."})})),CZe=d({tags:["inventory"],method:"POST",url:`${Ao}/resources/query`,paginated:!0,body:Kg,response:r.Array(r.Intersect([Hg,cl]))}),UY=["resourceType","cloudAccount","isIacManaged"],PZe=d({tags:["inventory"],method:"POST",url:`${Ao}/resources/counts`,body:r.Object({filters:r.Optional(r.Partial(vv)),groupBy:r.Enum(UY,{description:"Dimension to group the resource counts by."})}),response:r.Array(r.Object({value:r.String({description:'The group value the count belongs to: a resource type, a cloud account id, or "true"/"false" for IaC coverage.'}),count:r.Integer({description:"Number of resources in this group matching the requested filters."})}))}),UZe=d({tags:["inventory"],method:"GET",url:`${Ao}/resources/filter-options`,response:r.Object({cloudRegions:r.Array(r.String(),{description:"Distinct cloud regions present across the tenant's resources."}),nativeResourceTypes:r.Array(r.String(),{description:"Distinct cloud-native resource types present across the tenant's resources."}),tags:Ft})}),wZe=C("type",[r.Object({type:r.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:r.String({description:"AWS account ID that Tsuga scans."}),externalId:r.String({description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:r.String({description:"ARN of the IAM role Tsuga assumes to read inventory in the account."})}),r.Object({type:r.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:r.String({description:"GCP project ID that Tsuga scans."}),serviceAccountId:r.String({description:"Service account Tsuga impersonates to read inventory."}),workloadIdentityProvider:r.String({description:"Workload identity provider resource name used for federated authentication."})}),r.Object({type:r.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:r.String({description:"Client ID of the Azure application Tsuga authenticates as."}),subscriptionId:r.String({description:"Azure subscription ID that Tsuga scans."}),tenantId:r.String({description:"Azure tenant ID that owns the subscription."})})]),wY="^[0-9]{12}$",vY="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",NY="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",LY="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",kY="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",Bg="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",MY=r.Object({type:r.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:r.String({pattern:wY,description:"AWS account ID that Tsuga scans.",errorMessage:{pattern:"Must be a 12-digit AWS account ID."}}),externalId:u({allowEmpty:!1,description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:r.String({pattern:vY,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"}),DY=r.Object({type:r.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:r.String({pattern:NY,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:r.String({pattern:LY,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:r.String({pattern:kY,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"}),GY=r.Object({type:r.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:r.String({pattern:Bg,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:r.String({pattern:Bg,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:r.String({pattern:Bg,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),Nv=C("type",[MY,DY,GY],{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`."}),Zi=r.Object({id:r.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:r.Enum(_n,{description:"Cloud provider of the account."}),cloudAccountId:r.String({description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:r.Optional(r.String({description:"Human-readable name for the account shown in Tsuga."})),organizationId:r.Optional(r.String({description:"Cloud organization identifier, when known."})),createdBy:r.Optional(r.String({description:"Identifier of the user who created the account, when created by a user."})),createdAt:A({description:"Timestamp when the account was registered in Tsuga."}),lastScanStartedAt:r.Optional(A({description:"Timestamp when the most recent inventory scan started."})),lastScanFinishedAt:r.Optional(A({description:"Timestamp when the most recent inventory scan finished."})),lastScanStatus:r.Optional(r.Enum(wv,{description:"Status of the most recent inventory scan."}))}),zg=r.Object({cloudType:r.Enum(_n,{description:"Cloud provider of the account."}),cloudAccountId:u({allowEmpty:!1,description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:r.Optional(u({description:"Human-readable name for the account shown in Tsuga."})),organizationId:r.Optional(u({description:"Cloud organization identifier, when known."})),connectionSettings:Nv,lastScanStatus:r.Optional(r.Enum(wv,{description:"Status of the most recent inventory scan."}))}),Oo=`${Ao}/cloud-accounts`,vZe=d({tags:["inventory"],url:Oo,method:"GET",response:r.Array(Zi)}),NZe=d({tags:["inventory"],url:`${Oo}/:id`,method:"GET",params:r.Object({id:u()}),response:Zi}),LZe=d({tags:["inventory"],url:Oo,method:"POST",body:zg,response:Zi}),Yg=r.Object({accountFriendlyName:u({description:"Human-readable name for the account shown in Tsuga."})}),kZe=d({tags:["inventory"],url:`${Oo}/:id`,method:"PUT",params:r.Object({id:u()}),body:Yg,response:Zi}),MZe=d({tags:["inventory"],url:`${Oo}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),DZe=d({tags:["inventory"],url:`${Ao}/trigger-scan`,method:"POST",body:r.Object({}),response:r.Object({success:r.Literal(!0)})}),GZe=d({tags:["inventory"],url:`${Oo}/azure/onboarding`,method:"POST",body:r.Object({tenantId:u()}),response:r.Object({subjectId:r.String(),audience:r.String()})}),$Ze=d({tags:["inventory"],method:"POST",url:`${Oo}/validate/:type`,params:r.Object({type:u()}),body:r.Object({data:Nv,id:r.Optional(u())}),response:r.Object({areAccountSettingsValid:r.Boolean(),message:r.Optional(r.String())})}),Lv=`${Ao}/settings`,jZe=d({tags:["inventory"],url:Lv,method:"GET",response:r.Object({settings:r.Optional(r.Object({id:r.String(),infrastructureIdentifiers:r.Array(r.Object({name:r.String(),value:r.Optional(r.String())}))}))})}),$Y=50,qZe=d({tags:["inventory"],url:Lv,method:"POST",body:r.Object({infrastructureIdentifiers:r.Array(r.Object({name:u({allowEmpty:!1}),value:r.Optional(u({allowEmpty:!1}))}),{maxItems:$Y})}),response:r.Object({})}),FZe=d({tags:["inventory"],url:`${Ao}/iac-tags-proposal`,method:"GET",response:r.Array(r.Object({name:r.String(),value:r.Optional(r.String())}))});var kv=`/${"v1"}/inventory`,jY=r.Omit(Hg,["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)."}),Mv=r.Intersect([jY,cl],{$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)."}),qY={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(Mv,{examples:[qY]});var Dv=r.Object({...Kg.properties,...Ze},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),FY={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(Dv,{examples:[FY]});var Gv=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:`${kv}/resources/query`,method:"POST",paginated:!0,body:Dv,response:r.Array(Mv)}),Ms=`${kv}/cloud-accounts`,Ds=r.Pick(Zi,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),BY={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(Ds,{examples:[BY]});var $v=r.Pick(zg,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),HY={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($v,{examples:[HY]});var KY=r.Pick(Yg,["accountFriendlyName"]),ZZe=d({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:Ms,method:"GET",response:r.Array(Ds)}),XZe=d({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${Ms}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the cloud account to retrieve. Use the `id` returned by the cloud account list or create operations."})}),response:Ds}),JZe=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:Ms,method:"POST",body:$v,response:Ds}),eXe=d({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${Ms}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the cloud account to update. Use the `id` returned by the cloud account list or create operations."})}),body:KY,response:Ds}),tXe=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:`${Ms}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the cloud account to delete. Use the `id` returned by the cloud account list or create operations."})}),response:N});var Gs="/v0/investigations",zY=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],YY=r.Object({type:r.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:r.String({description:"Identifier of the linked asset"})}),VY=r.Object({type:r.Enum(zY,{description:"Kind of linked asset"}),id:u({allowEmpty:!1,description:"Identifier of the linked asset"})}),Xr=r.Object({id:r.String({description:"Identifier of the investigation"}),name:r.String({description:"Human readable name shown for the investigation"}),slug:r.Optional(r.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:r.Optional(r.String({description:"Markdown content capturing the investigation notes and findings"})),tags:De,owner:r.String({description:"Team ID owning the investigation"}),env:r.Optional(r.String({description:'Environment the investigation relates to, e.g. "prod"'})),linkedAssets:r.Array(YY,{description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}),creator:r.Optional(pe),updater:r.Optional(pe),createdAt:A({description:"Timestamp the investigation was created at."}),updatedAt:A({description:"Timestamp the investigation was last updated at."})},{title:"Investigation"}),pl=r.Object({name:u({allowEmpty:!1,description:"Human readable name shown for the investigation"}),slug:u({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:r.Optional(u({type:"long",description:"Markdown content capturing the investigation notes and findings"})),tags:Xe,owner:u({allowEmpty:!1,description:"Team ID owning the investigation"}),env:r.Optional(u({allowEmpty:!0,description:"Environment the investigation relates to"})),linkedAssets:r.Optional(r.Array(VY,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),Vg=r.Object(r.Omit(pl,["slug"]).properties),pXe=d({tags:["investigations"],url:Gs,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(Xr)}),uXe=d({tags:["investigations"],url:`${Gs}/:id`,params:r.Object({id:u()}),method:"GET",response:Xr}),lXe=d({tags:["investigations"],url:Gs,method:"POST",body:pl,response:Xr}),mXe=d({tags:["investigations"],url:`${Gs}/:id`,method:"PUT",body:Vg,params:r.Object({id:u()}),response:Xr}),dXe=d({tags:["investigations"],url:`${Gs}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N});var $s=`/${"v1"}/investigations`,jv=d({description:"Retrieve all investigations",tags:["private"],url:$s,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Xr)}),qv=d({description:"Retrieve an investigation by its id",tags:["private"],url:`${$s}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1})}),response:Xr}),Fv=d({description:"Create a new investigation",tags:["private"],url:$s,method:"POST",body:pl,response:Xr}),Bv=d({description:"Update an investigation by its id",tags:["private"],url:`${$s}/:id`,method:"PUT",body:Vg,params:r.Object({id:u({allowEmpty:!1})}),response:Xr}),Hv=d({description:"Delete an investigation by its id",tags:["private"],url:`${$s}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1})}),response:N});var Kv=15,ul={id:r.String({description:"Unique identifier of the processor within the route. Used to preserve processor identity during updates."}),description:r.Optional(r.String({description:"Optional user-provided processor note."})),tags:De,updatedAt:r.Optional(A({description:"Timestamp when Tsuga last updated the processor."}))},ll={id:u({allowEmpty:!1,description:"Unique identifier of the processor within the route. Preserve it across updates for existing processors."}),description:r.Optional(u({type:"long",description:"Optional processor note."})),tags:Xe,updatedAt:r.Optional(A({description:"Backend-maintained timestamp for this processor. Omit this field on create and update requests; Tsuga sets or preserves it based on processor changes."}))},zv={...ul,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},Yv={...ll,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},QY=C("subtype",[r.Object({targetAttribute:r.String({description:"Attribute that will receive the formatted value"}),formatString:r.String({description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:r.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Whether missing referenced attributes render as empty strings. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorFormatString"}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the computed value"}),formula:r.String({description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:r.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:r.Optional(r.Boolean({description:"Whether missing referenced attributes evaluate as zero. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorMathFormula"}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:r.String({description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:r.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:r.Optional(r.String({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:r.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."}),WY=C("subtype",[r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:u({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))},{$id:"InputProcessorParamsCreatorFormatString"}),r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the computed value"}),formula:u({allowEmpty:!1,type:"long",description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to evaluate as zero. Defaults to true."}))},{$id:"InputProcessorParamsCreatorMathFormula"}),r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:u({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:u({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:Kv,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:r.Optional(u({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:r.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."}),ZY=r.Object({...zv,params:QY}),XY=r.Object({...Yv,params:WY}),Vv={...ul,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},Qv={...ll,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},JY=C("subtype",[r.Object({attributes:r.Array(r.Object({originAttribute:r.String({description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Whether the source attribute is preserved after mapping. If omitted, route processing treats this as false."})),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),targetAttribute:r.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:r.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"ProcessorParamsMapperMapAttributes"}),r.Object({attributeName:r.String({description:"Attribute whose value will determine the log level"}),subtype:r.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"ProcessorParamsMapperMapLevel"}),r.Object({attributeName:r.String({description:"Attribute whose value will determine the log timestamp"}),subtype:r.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."}),e9=C("subtype",[r.Object({attributes:r.Array(r.Object({originAttribute:u({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:r.Optional(r.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:u({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:r.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"InputProcessorParamsMapperMapAttributes"}),r.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:r.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"InputProcessorParamsMapperMapLevel"}),r.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:r.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."}),t9=r.Object({...Qv,params:e9}),r9=r.Object({...Vv,params:JY}),Wv={...ul,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},Zv={...ll,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},Xv=5,n9=C("subtype",[r.Object({attributeName:r.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(r.String({description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:r.Optional(r.Array(r.String(),{description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:r.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the URL to parse"}),subtype:r.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the user agent string to parse"}),subtype:r.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the key/value string segment to parse"}),targetAttribute:r.String({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:r.String({description:"Delimiter separating keys from values in the source string"}),pairsSplitter:r.String({description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:r.Boolean({description:"Whether keys without explicit values are accepted by the parser."}),subtype:r.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."}),o9=C("subtype",[r.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(u({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:r.Optional(r.Array(u({type:"long"}),{maxItems:Xv,description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:r.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),r.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:r.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),r.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:r.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),r.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the key/value string segment to parse"}),targetAttribute:u({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:u({allowEmpty:!1,description:"Delimiter separating keys from values in the source string"}),pairsSplitter:u({allowEmpty:!0,description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:r.Boolean({description:"Set to true to accept keys without explicit values."}),subtype:r.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."}),i9=r.Object({...Wv,params:n9}),a9=r.Object({...Zv,params:o9}),s9=r.Object({...Yv,params:C("subtype",[r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:u({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("format-string"),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))}),r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:u({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:u({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:Kv,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:r.Optional(u({description:"String category value used when no clause matches."})),subtype:r.Literal("category")})])}),c9=r.Object({...Qv,params:r.Object({attributes:r.Array(r.Object({originAttribute:u({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:r.Optional(r.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:u({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:r.Literal("map-attributes")})}),p9=r.Object({...Zv,params:r.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(u({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:r.Optional(r.Array(u({type:"long"}),{maxItems:Xv,description:"Example log lines for validating the Grok rules."})),subtype:r.Literal("grok")})}),xXe=C("type",[c9,p9,s9]),u9=r.Object({...zv,params:C("subtype",[r.Object({targetAttribute:r.String({description:"Attribute that will receive the formatted value"}),formatString:r.String({description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),subtype:r.Literal("format-string"),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Whether missing referenced attributes render as empty strings."}))}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:r.String({description:"Query that selects logs for this category clause."}),value:r.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value."}),defaultValue:r.Optional(r.String({description:"String category value used when no clause matches."})),subtype:r.Literal("category")})])}),l9=r.Object({...Vv,params:r.Object({attributes:r.Array(r.Object({originAttribute:r.String({description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Whether the source attribute is preserved after mapping."})),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),targetAttribute:r.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:r.Literal("map-attributes")})}),m9=r.Object({...Wv,params:r.Object({attributeName:r.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(r.String({description:"Grok rule applied to parse text."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:r.Optional(r.Array(r.String(),{description:"Example log lines for validating the Grok rules."})),subtype:r.Literal("grok")})}),RXe=C("type",[l9,m9,u9]),d9=11,Jv=r.Cyclic({OutputProcessor:r.Union([r9,i9,ZY,r.Object({...ul,params:r.Object({items:r.Array(r.Object({query:r.String({description:"Query that determines whether logs enter this branch"}),processors:r.Array(r.Ref("OutputProcessor"),{description:"Processors executed when the branch query matches"})}),{description:"Conditional branches evaluated in order before falling back to the default"})}),type:r.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"OutputProcessor",{description:"Processing step executed sequentially on route logs"}),eN=r.Cyclic({InputProcessor:r.Union([t9,a9,XY,r.Object({...ll,params:r.Object({items:r.Array(r.Object({query:u({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:r.Array(r.Ref("InputProcessor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:d9,description:"Conditional branches evaluated in order before falling back to the default"})}),type:r.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 f9="/v0/logs",vn=`${f9}/routes`,Nn=r.Object({id:r.String({description:"Tsuga-generated log route ID assigned when the route is created."}),name:r.String({description:"Human-readable route name shown in Tsuga."}),description:r.Optional(r.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:r.Boolean({description:"Whether this route is active for newly ingested logs. Disabled routes remain saved but do not process logs."}),query:r.String({description:"Tsuga query that selects which newly ingested logs enter the route processor chain."}),rank:r.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:De,owner:r.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 the `query` field or delete the route."}),processors:r.Array(Jv,{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:r.Optional(pe),updater:r.Optional(pe),updatedAt:A({description:"Timestamp when Tsuga last updated the route."}),createdAt:A({description:"Timestamp when Tsuga created the route."}),assetUpdatedAt:A({description:"Timestamp when Tsuga last changed route behavior. This can differ from `updatedAt` when only metadata such as `description` or `tags` changed."})},{title:"LogRoute"}),js=r.Object({name:u({allowEmpty:!1,description:"Human-readable log route name shown in Tsuga."}),description:r.Optional(u({type:"long",description:"Optional free-text note about the log route's purpose. This metadata is not evaluated when matching or processing logs."})),isEnabled:r.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:u({type:"tsuga-query",description:"Tsuga query that selects which newly ingested logs enter the log route processor chain."}),tags:Xe,owner:u({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 the `query` field or delete the log route."}),processors:r.Array(eN,{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 MXe=d({tags:["routes"],url:vn,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(Nn)}),DXe=d({tags:["routes"],url:`${vn}/:id`,params:r.Object({id:u()}),method:"GET",response:Nn}),GXe=d({tags:["routes"],url:vn,method:"POST",body:js,response:Nn}),$Xe=d({tags:["routes"],url:`${vn}/:id`,method:"PUT",body:js,params:r.Object({id:u()}),response:Nn}),jXe=d({tags:["routes"],url:`${vn}/:id/clone`,method:"POST",params:r.Object({id:u()}),body:js,response:Nn}),qXe=d({tags:["routes"],url:`${vn}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),FXe=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:`${vn}/:id/modify-ranking`,method:"PUT",params:r.Object({id:u()}),body:r.Object({rank:r.Integer({minimum:1,description:"Target rank for the route, from 1 to the total number of routes. Requests outside that range are rejected."})}),response:r.Object({})}),BXe=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:`${vn}/:id/enable`,method:"PUT",params:r.Object({id:u()}),body:r.Object({enable:r.Boolean({description:"Set to true to enable the route, or false to disable it."})}),response:Nn});var qs=`/${"v1"}/routes`,tN={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}"]}}]},rN={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}}]},Fs=r.Pick(Nn,["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)."}),g9={id:"123-456-abc",...tN},h9={id:"456-789-def",...rN};Object.assign(Fs,{examples:[g9,h9]});var nN=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:qs,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Fs)}),oN=d({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${qs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the log route to retrieve. Use the `id` returned by route list or create responses."})}),response:Fs}),Qg=r.Pick(js,["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(Qg,{examples:[tN,rN]});var iN=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:qs,method:"POST",body:Qg,response:Fs}),aN=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:`${qs}/:id`,method:"PUT",body:Qg,params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the log route to update. Use the `id` returned by route list, get, or create responses."})}),response:Fs}),sN=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:`${qs}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the log route to delete. Use the `id` returned by route list, create, or update responses."})}),response:N});var Bs=`/${"v1"}/monitors`,Hs=r.Pick(Br,["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)."}),pN={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:[]},uN={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:[]},lN={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:[]},mN={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",service:"api-gateway"}},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},y9={id:"123-456-abc",...pN},T9={id:"234-567-bcd",...uN},E9={id:"345-678-cde",...lN},_9={id:"456-789-def",...mN};Object.assign(Hs,{examples:[y9,T9,E9,_9]});var cN=r.Pick(Nd,["filters","sort","limit","offset"]),dN=r.Object({...cN.properties,...Ze,filters:cN.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),I9={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(dN,{examples:[I9]});var fN=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:`${Bs}/query`,method:"POST",paginated:!0,body:dN,response:r.Array(Hs)}),gN=d({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${Bs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:Hs}),hN=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],yN=r.Pick(is,hN,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),TN=r.Pick(is,hN,{$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."}),EN=pN,_N=uN,IN=lN,bN=mN;Object.assign(yN,{examples:[EN,_N,IN,bN]});Object.assign(TN,{examples:[EN,_N,IN,bN]});var SN=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:Bs,method:"POST",body:yN,response:Hs}),AN=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:`${Bs}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the saved monitor to update. Use the `id` returned by monitor query or create responses."})}),body:TN,response:Hs}),b9=r.Object({id:u({allowEmpty:!1,description:"Identifier of the saved monitor to delete. Use the `id` returned by monitor query, create, or update responses."})}),ON=d({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${Bs}/:id`,method:"DELETE",params:b9,response:N});var Ks=`/${"v1"}/notification-rules`,zs=r.Pick(Ti,["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)."}),xN={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}}}]},S9={id:"123-456-abc",...xN};Object.assign(zs,{examples:[S9]});var RN=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:Ks,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(zs)}),CN=d({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${Ks}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification rule to retrieve. Use the `id` returned by notification rule list or create responses."})}),response:zs}),Wg=r.Pick(cs,["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."}),A9=xN;Object.assign(Wg,{examples:[A9]});var PN=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:Ks,method:"POST",body:Wg,response:zs}),UN=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:`${Ks}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification rule to update. Use the `id` returned by notification rule list, get, or create responses."})}),body:Wg,response:zs}),O9=r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification rule to delete. Use the `id` returned by notification rule list, get, create, or update responses."})}),wN=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:`${Ks}/:id`,method:"DELETE",params:O9,response:N});var Xi=`${hi}/silences`,vN=r.Union([r.Literal("monday"),r.Literal("tuesday"),r.Literal("wednesday"),r.Literal("thursday"),r.Literal("friday"),r.Literal("saturday"),r.Literal("sunday")]),x9=r.Partial(r.Record(vN,r.Array(r.Object({startTime:r.String({format:Gm,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:r.String({format:Gm,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`."}),R9=r.Partial(r.Record(vN,r.Array(r.Object({startTime:r.String({description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:r.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`."}),ml='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',NN="One-time silence schedule with specific start and end times",LN="Recurring weekly silence schedule",C9=C("type",[r.Object({type:r.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:r.String({format:$m,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:r.String({format:$m,description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future."}),timeZone:r.Optional(r.String({format:Dm,description:ml}))},{$id:"InputSilenceScheduleOneTime",description:NN}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:x9,timeZone:r.Optional(r.String({format:Dm,description:ml}))},{$id:"InputSilenceScheduleRecurring",description:LN})],{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."}),P9=C("type",[r.Object({type:r.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:r.String({description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:r.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:r.Optional(r.String({description:ml}))},{$id:"OutputSilenceScheduleOneTime",description:NN}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:R9,timeZone:r.Optional(r.String({description:ml}))},{$id:"OutputSilenceScheduleRecurring",description:LN})],{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."}),U9="monitor_id",kN=`Query on the alerting monitor tags and group-by dimensions, e.g. \`env:prod AND service:bridge\`. The monitor itself can be targeted with \`${U9}:<monitor id>\`.`,dl=r.Object({name:u({description:"Display name of the silence"}),reason:u({allowEmpty:!1,type:"long",description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the silence"}),tags:Xe,isActive:r.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:C9,notificationRuleIds:r.Optional(r.Array(u(),{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:r.Optional(u({type:"tags-query",description:kN})),teamsFilter:Bd,prioritiesFilter:r.Array(r.Enum(St),{maxItems:St.length,description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(uo),{maxItems:uo.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),Ji=r.Object({id:r.String({description:"Tsuga-generated notification silence ID assigned when the silence is created."}),name:r.String({description:"Display name of the silence"}),reason:r.String({description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:r.String({description:"Team ID that owns and manages the silence"}),tags:De,isActive:r.Boolean({description:"Whether the silence suppresses matching notifications while its schedule is active. When false, the silence is kept but never suppresses anything."}),schedule:P9,notificationRuleIds:r.Optional(r.Array(r.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:r.Optional(r.String({description:kN})),teamsFilter:Fd,prioritiesFilter:r.Array(r.Enum(St),{description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(uo),{description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."}),createdAt:A(),updatedAt:A(),creator:r.Optional(pe),updater:r.Optional(pe)}),IJe=d({tags:["notification-silences"],url:Xi,method:"GET",response:r.Array(Ji)}),bJe=d({tags:["notification-silences"],url:`${Xi}/:id`,params:r.Object({id:u()}),method:"GET",response:Ji}),SJe=d({tags:["notification-silences"],url:Xi,method:"POST",body:dl,response:Ji}),AJe=d({tags:["notification-silences"],url:`${Xi}/:id`,method:"PUT",params:r.Object({id:u()}),body:dl,response:Ji}),OJe=d({tags:["notification-silences"],url:`${Xi}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),xJe=d({tags:["notification-silences"],url:`${Xi}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})});var Ys=`/${"v1"}/notification-silences`,Vs=r.Pick(Ji,["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)."}),w9={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"]},v9={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(Vs,{examples:[w9,v9]});var MN=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:Ys,method:"GET",response:r.Array(Vs)}),DN=d({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${Ys}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification silence to retrieve. Use the `id` returned by notification silence list or create responses."})}),response:Vs}),Zg=r.Pick(dl,["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."}),N9={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"]},L9={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(Zg,{examples:[N9,L9]});var GN=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:Ys,method:"POST",body:Zg,response:Vs}),$N=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:`${Ys}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification silence to update. Use the `id` returned by notification silence list, get, or create responses."})}),body:Zg,response:Vs}),k9=r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification silence to delete. Use the `id` returned by notification silence list, get, create, or update responses."})}),jN=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:`${Ys}/:id`,method:"DELETE",params:k9,response:N});var M9={critical:3,important:2,normal:1},se=e=>({label:e,weight:M9[e]}),D9={"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:se("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:se("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:se("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:`${fd} matches ${Qp}`,summary:`Detects logs and spans whose ${fd} resource attribute names a different team than the ${Qp} resolved at ingestion.`,rationale:`${Qp} 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:se("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:`${Wp} present`,summary:`Logs and spans must populate ${Wp} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:se("critical"),recommendation:`Populate ${Wp} 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:se("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:se("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:`${es} presence`,summary:`Logs and spans must populate ${es} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:se("important"),recommendation:`Populate ${es} 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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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 ${XO} 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:se("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"}},qN={"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_"]}},G9=Object.fromEntries(Object.keys(qN).map(e=>{let{label:t,receiver:n}=qN[e];return[e,{key:e,title:`${t} server metrics collected`,summary:`${t} 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:se("important"),recommendation:n?`Configure the ${n} OpenTelemetry receiver so ${t} server metrics are collected.`:`Collect ${t} server metrics, for example via its Prometheus exporter.`,scope:"global"}]})),$9=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),j9=ks.filter(e=>e.startsWith("azure_")&&!$9.has(e)),FN={"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:j9,metricPrefixes:["azure_"]}},q9=Object.fromEntries(Object.keys(FN).map(e=>{let{label:t,source:n}=FN[e];return[e,{key:e,title:`${t} metrics collected`,summary:`${t} 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:se("important"),recommendation:`Enable the ${n} metrics integration so ${t} metrics are ingested.`,scope:"global"}]})),F9={...D9,...G9,...q9},BN=Object.values(F9);var HN=["passed","failed","ignored"],B9=10,H9=r.Enum(HN,{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."}),K9=["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"],z9=["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"],Jg=["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",...z9,...K9],Y9=r.Enum(Jg),V9=["log","metric","resource","span","api-key","dashboard","monitor","route"],Q9=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],W9=["critical","important","normal"],Z9=["team","global"],eh=r.Object({key:r.Enum(Jg),title:r.String(),summary:r.String(),rationale:r.String(),objectType:r.Enum(V9),category:r.Enum(Q9),impact:r.Object({label:r.Enum(W9),weight:r.Number()}),recommendation:r.String(),scope:r.Optional(r.Enum(Z9))}),Qs=r.Object({type:r.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:r.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:r.Object({to:r.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:r.Optional(r.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:r.Optional(r.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."})}),Xg=r.Intersect([eh,r.Object({id:r.Optional(r.String()),status:H9,normalizedScore:r.Number(),details:r.Optional(r.Record(r.String(),r.Unknown())),recommendation:r.Optional(r.String()),examples:r.Optional(r.Array(Qs)),exampleCount:r.Optional(r.Integer())})]),X9=r.Object({generatedAt:r.String(),overallScore:r.Optional(r.Number()),rules:r.Array(eh),teamResults:r.Array(r.Object({teamId:r.String(),teamName:r.String(),teamWeight:r.Number(),score:r.Number(),weightedScore:r.Number(),totalWeight:r.Number(),ruleResults:r.Array(Xg)})),globalResults:r.Optional(r.Object({score:r.Optional(r.Number()),ruleResults:r.Array(Xg)}))}),th=r.Object({id:r.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:r.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:r.Enum(Jg,{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:r.Optional(r.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:r.Enum(HN,{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:r.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:r.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:r.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:r.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:r.Optional(r.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:r.Optional(r.Array(Qs,{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 ${B9}; compare against exampleCount to detect truncation.`})),exampleCount:r.Optional(r.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:r.String({description:"ISO timestamp the row was generated at"})}),FJe=d({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:X9}),rh=r.Optional(u({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."})),BJe=d({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:r.Object({clusterId:rh,team:r.Optional(u({allowEmpty:!1}))}),response:r.Array(th,{description:"Latest persisted rule evaluation rows for the cluster"})}),HJe=d({tags:["quality-reports"],url:"/v0/quality-reports/:id/examples",method:"GET",params:r.Object({id:u({allowEmpty:!1})}),response:r.Object({examples:r.Array(Qs)})}),KJe=d({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:r.Object({ruleKey:Y9,teamId:r.Optional(u({allowEmpty:!1})),lookbackMinutes:r.Optional(r.Integer({minimum:1,maximum:60})),clusterId:r.Optional(u({allowEmpty:!1}))}),response:r.Object({rule:eh,result:Xg,teamId:r.Optional(r.String()),teamName:r.Optional(r.String())})}),zJe=new Map(BN.map(e=>[e.key,e]));var KN=`/${"v1"}/quality-reports`,zN=r.Pick(th,["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)."}),J9={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(zN,{examples:[J9]});var eV=r.Object({clusterId:rh,team:r.Optional(u({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."}),YN=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:`${KN}/latest`,method:"GET",query:eV,response:r.Array(zN)}),JJe=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:`${KN}/:id/examples`,method:"GET",params:r.Object({id:u({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:r.Object({examples:r.Array(Qs,{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 Ws="/v0/admin-center";var wr=`${Ws}/retention-policies`,VN=3650,tV=r.Integer({description:"Number of days Tsuga retains matching telemetry."}),QN=r.Integer({minimum:1,maximum:VN,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${VN}.`}),Jr=r.Object({id:r.String({description:"Unique identifier of the retention policy. Generated by Tsuga."}),env:r.Optional(r.String({description:"Environment tag value this policy applies to. Omitted policies apply across environments unless a more specific policy exists."})),teamId:r.Optional(r.String({description:"Team ID this policy applies to. Omitted policies apply globally unless a team-specific policy exists."})),dataSource:r.Enum(br,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:tV,isEnabled:r.Boolean({description:"Whether this policy participates in retention resolution."}),createdAt:A({description:"Timestamp when Tsuga created the retention policy."}),updatedAt:A({description:"Timestamp when Tsuga last updated the retention policy."})}),fl=r.Object({env:r.Optional(u({description:"Environment tag value this policy applies to. Omit for a policy that is not environment-specific."})),teamId:r.Optional(u({description:"Team ID this policy applies to. Omit for a policy that is not team-specific."})),dataSource:r.Enum(br,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:QN,isEnabled:r.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),WN=r.Array(r.Object({env:u(),dataSource:r.Enum(br),durationDays:r.Union([QN,r.Null()]),isEnabled:r.Boolean()})),ZN=r.Object({inserted:r.Array(Jr),updated:r.Array(Jr),deleted:r.Array(Jr)}),cet=d({tags:["retention-policies"],url:wr,method:"POST",body:fl,response:Jr}),pet=d({tags:["retention-policies"],url:wr,method:"GET",response:r.Array(Jr)}),uet=d({tags:["retention-policies"],url:`${wr}/:id`,method:"GET",params:r.Object({id:u()}),response:Jr}),met=d({tags:["retention-policies"],url:`${wr}/:id`,method:"PUT",params:r.Object({id:u()}),body:fl,response:Jr}),det=d({tags:["retention-policies"],url:`${wr}/bulk-update`,method:"POST",body:WN,response:ZN}),fet=d({tags:["retention-policies"],url:`${wr}/bulk-update-for-team`,method:"POST",body:r.Object({teamId:u(),policies:WN}),response:ZN}),get=d({tags:["retention-policies"],url:`${wr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),Zs=["past-24-hours","past-7-days","past-30-days"],het=d({tags:["retention-policies"],url:`${wr}/requested-history-percentile/:teamId`,method:"POST",params:r.Object({teamId:u()}),body:r.Object({percentile:r.Number({minimum:0,maximum:1}),observationWindow:r.Enum(Zs),dataSource:r.Enum(br)}),response:r.Object({percentile:r.Number(),observationWindow:r.Enum(Zs),dataSource:r.Enum(br),teamId:r.String(),requestedHistoryDays:r.Number()})}),rV=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var nV=r.Array(r.Object({bucket:r.Enum(rV),count:r.Number()})),yet=d({tags:["retention-policies"],url:`${wr}/requested-history-histogram/:teamId`,method:"POST",params:r.Object({teamId:u()}),body:r.Object({observationWindow:r.Enum(Zs),dataSource:r.Enum(br)}),response:r.Object({observationWindow:r.Enum(Zs),dataSource:r.Enum(br),teamId:r.String(),histogram:nV})}),Tet=d({tags:["retention-policies"],url:`${wr}/top-teams-with-retention-surplus`,method:"POST",body:r.Object({dataSource:r.Enum(br),observationWindow:r.Enum(Zs),percentile:r.Number({minimum:0,maximum:1}),topN:r.Optional(r.Number({minimum:1,maximum:20}))}),response:r.Array(r.Object({teamId:r.String(),retentionSurplusDays:r.Number()}))});var Xs=`/${"v1"}/retention-policies`,Js=r.Pick(Jr,["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)."}),oV={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Js,{examples:[oV]});var XN=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:Xs,method:"GET",response:r.Array(Js)}),JN=d({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${Xs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the retention policy to retrieve. Use the `id` returned by retention policy list or create responses."})}),response:Js}),nh=r.Pick(fl,["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."}),iV={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(nh,{examples:[iV]});var eL=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:Xs,method:"POST",body:nh,response:Js}),tL=d({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${Xs}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the retention policy to update. Use the `id` returned by retention policy list, get, or create responses."})}),body:nh,response:Js}),rL=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:`${Xs}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the retention policy to delete. Use the `id` returned by retention policy list, create, or update responses."})}),response:N});var ec=`/${"v1"}/slos`,aV=r.Pick(Dd,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),tc=r.Object({...r.Pick(gi,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:r.Array(aV,{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"}),sV={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(tc,{examples:[sV]});var nL=r.Pick(jd,["filters","sort","limit","offset"]),oL=r.Object({...nL.properties,...Ze,filters:nL.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),cV={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(oL,{examples:[cV]});var iL=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:`${ec}/query`,method:"POST",paginated:!0,body:oL,response:r.Array(tc)}),aL=d({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${ec}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:tc}),sL=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],cL=r.Pick(mu,sL,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),pL=r.Pick(Gd,sL,{$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."}),uL={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(cL,{examples:[uL]});Object.assign(pL,{examples:[uL]});var lL=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:ec,method:"POST",body:cL,response:tc}),mL=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:`${ec}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the SLO to update. Use the `id` returned by SLO query or create."})}),body:pL,response:tc}),dL=d({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${ec}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the SLO to delete. Use the `id` returned by SLO query or create."})}),response:N});var xo=`${Ws}/tag-policies`;var pV=["logs","metrics","traces"],oh=r.Array(r.Enum(pV,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),uV=r.Union([Mp,oh]),lV=r.Object({teamIds:r.Array(r.String(),{description:"Team IDs used by this policy scope."}),mode:r.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."}),mV=C("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:oh,shouldInsertWarning:r.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:r.Optional(r.Number({description:"Percentage of non-compliant telemetry datapoints to drop. Omitted means no sampling drop is configured."}))},{title:"TelemetryTagPolicy"}),r.Object({type:r.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:Mp},{title:"TsugaAssetTagPolicy"})]),dV=C("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:oh,shouldInsertWarning:r.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:r.Optional(r.Number({minimum:0,maximum:100,description:"Percentage of non-compliant telemetry datapoints to drop. Valid values are 0 through 100."}))},{title:"TelemetryTagPolicy"}),r.Object({type:r.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:Mp},{title:"TsugaAssetTagPolicy"})]),fL="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",fV=r.Unsafe({...mV,description:fL}),gV=r.Unsafe({...dV,description:fL}),ea=r.Object({id:r.String({description:"Tsuga-generated tag policy ID assigned when the policy is created."}),name:r.String({description:"Human-readable tag policy name."}),description:r.Optional(r.String({description:"Optional user-provided policy description."})),isActive:r.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:r.String({description:"Tag key enforced by this policy."}),allowedTagValues:r.Array(r.String(),{description:"Allowed values for `tagKey`. An empty array means any value is accepted when the tag exists."}),isRequired:r.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:r.Optional(lV),configuration:fV,creator:r.Optional(pe),updater:r.Optional(pe),owner:r.Optional(r.String({description:"Team ID that owns and manages the policy."})),createdAt:A({description:"Timestamp when Tsuga created the tag policy."}),updatedAt:A({description:"Timestamp when Tsuga last updated the tag policy."}),assetUpdatedAt:A({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})});var rc=r.Object({name:u({description:"Human-readable tag policy name."}),description:r.Optional(u({description:"Optional policy description."})),isActive:r.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:u({allowEmpty:!1,description:"Tag key enforced by this policy. Tsuga trims surrounding whitespace before storing the policy."}),allowedTagValues:r.Array(u({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:r.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:r.Optional(r.Object({teamIds:r.Array(u(),{minItems:1,maxItems:100,description:"Team IDs used by this policy scope."}),mode:r.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:gV,owner:u({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),Fet=d({tags:["tag-policies"],url:xo,method:"GET",query:r.Object({teamIds:r.Optional(r.Array(u(),{maxItems:100})),assetTypes:r.Optional(uV),searchQuery:r.Optional(u())}),response:r.Array(ea)}),Bet=d({tags:["tag-policies"],url:`${xo}/:id`,method:"GET",params:r.Object({id:u()}),response:ea}),Het=d({tags:["tag-policies"],url:xo,method:"POST",body:rc,response:ea}),Ket=d({tags:["tag-policies"],url:`${xo}/:id`,method:"PUT",params:r.Object({id:u()}),body:rc,response:ea}),zet=d({tags:["tag-policies"],url:`${xo}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),Yet=d({tags:["tag-policies"],url:`${Ws}/applicable-tag-rules`,method:"GET",query:r.Object({assetType:r.Enum(Ha),teamId:u()}),response:r.Array(r.Object({tagKey:r.String(),allowedTagValues:r.Array(r.String()),isRequired:r.Boolean(),tagPolicyId:r.String()}))}),gL=r.Object({total:r.Number(),totalNonCompliant:r.Number(),idsNonCompliant:r.Array(r.String())}),hL=r.Union([r.Literal("ingestion-api-key"),r.Literal("operation-api-key"),r.Literal("rum-public-token"),r.Literal("dashboard"),r.Literal("log-route"),r.Literal("metric-route"),r.Literal("monitor"),r.Literal("notification-rule"),r.Literal("notification-silence"),r.Literal("slo")]),hV=r.Object({total:r.Number(),totalNonCompliant:r.Number(),byAssetType:r.Record(hL,gL)}),yV=r.Omit(gL,["total"]),TV=r.Object({totalNonCompliant:r.Number(),byAssetType:r.Record(hL,yV)}),yL=r.Object({totals:hV,byTeam:r.Record(r.String(),TV)}),Vet=d({tags:["tag-policies"],url:`${xo}/:id/stats`,method:"GET",params:r.Object({id:u()}),response:yL}),Qet=d({tags:["tag-policies"],url:`${xo}/new-policy-stats`,method:"POST",body:rc,response:yL});var nc=`/${"v1"}/tag-policies`,TL={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"},EL={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"},EV={id:"123-456-abc",...TL},_V={id:"456-789-def",...EL},oc=r.Pick(ea,["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)."}),IV=EV,bV=_V;Object.assign(oc,{examples:[IV,bV]});var ih=r.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."}),SV=TL,AV=EL;Object.assign(ih,{examples:[SV,AV]});var _L=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:nc,method:"GET",response:r.Array(oc)}),IL=d({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${nc}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the tag policy to retrieve. Use the `id` returned by tag policy list or create responses."})}),response:oc}),bL=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:nc,method:"POST",body:ih,response:oc}),SL=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:`${nc}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the tag policy to update. Use the `id` returned by tag policy list, get, or create responses."})}),body:ih,response:oc}),AL=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:`${nc}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the tag policy to delete. Use the `id` returned by tag policy list, create, or update responses."})}),response:N});var ic=`/${"v1"}/teams`,ac=r.Pick(mi,["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)."}),OV={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(ac,{examples:[OV]});var OL=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:ic,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(ac)}),xL=d({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${ic}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the team to retrieve. Use the `id` returned by team list or create responses."})}),response:ac}),ah=r.Pick(cu,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),xV={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(ah,{examples:[xV]});var RL=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:ic,method:"POST",body:ah,response:ac}),CL=d({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${ic}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the team to update. Use the `id` returned by team list, get, or create responses."})}),body:ah,response:ac}),PL=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:`${ic}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the team to delete. Use the `id` returned by team list, create, or update responses."})}),response:N});function RV(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function UL(e,t){let n=Number(t);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${t})`);return n}function wL(e){let t={};return e.limit!==void 0&&(t.limit=UL("limit",e.limit)),e.offset!==void 0&&(t.offset=UL("offset",e.offset)),t}function sh(e){let t=e.params;if(t?.properties){let n=Object.keys(t.properties);if(n.length===1&&n[0])return n[0]}return"id"}function vL(e,t,n){let o=e.command(t.commandName).description(t.description),i=t.singularOverride??Cx(t.commandName).replace(/-/g," "),a=t.pluralOverride??t.commandName.replace(/-/g," "),c=RV(i),l=o.command("list").description(t.listDescription??`List all ${a}`);if(t.listOptions)for(let m of t.listOptions)l.option(m.flag,m.description);if(t.endpoints.list.paginated===!0&&l.option("--limit <n>",`Maximum number of items to return, up to ${ni} (default: ${kp})`).option("--offset <n>","Number of items to skip, to request a later page"),t.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){ee(Li(t.endpoints.list));return}let f=m.data?Ii({data:m.data}):{},h=await n()(t.endpoints.list,{body:{...f,...wL(m)}});ee(h)}):l.action(async m=>{let f=wL(m);if(t.listOptions)for(let E of t.listOptions){let I=m[E.queryParam];I!==void 0&&(f[E.queryParam]=I)}let h=await n()(t.endpoints.list,Object.keys(f).length>0?{query:f}:void 0);ee(h)}),t.endpoints.get){let m=t.endpoints.get,f=sh(m);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});ee(E)})}if(t.endpoints.create){let m=t.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){ee(Li(m));return}let h=Ii(f),E=await n()(m,{body:h});ee(E)})}if(t.endpoints.update){let m=t.endpoints.update,f=sh(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){ee(Li(m));return}let I=Ii(E),g=await n()(m,{params:{[f]:h},body:I});ee(g)})}if(t.endpoints.delete){let m=t.endpoints.delete,f=sh(m);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});ee(E)})}}var CV=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:Gv},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:Hw,get:Kw,create:zw,update:Yw,delete:Vw},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:hv,get:yv,create:Tv,update:Ev,delete:_v},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:Rv,create:Cv,update:Pv,delete:Uv}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:jv,get:qv,create:Fv,update:Bv,delete:Hv}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:fN,get:gN,create:SN,update:AN,delete:ON},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:RN,get:CN,create:PN,update:UN,delete:wN}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:MN,get:DN,create:GN,update:$N,delete:jN}},{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:YN},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:XN,get:JN,create:eL,update:tL,delete:rL}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:nN,get:oN,create:iN,update:aN,delete:sN}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:NR,get:LR}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:iL,get:aL,create:lL,update:mL,delete:dL},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:_L,get:IL,create:bL,update:SL,delete:AL}},{commandName:"teams",description:"Manage teams",endpoints:{list:OL,get:xL,create:RL,update:CL,delete:PL}}];function NL(e,t){for(let n of CV)vL(e,n,t)}var LL=require("node:child_process");var gl="@tsuga/cli@latest";function PV(){V(`Updating ${gl}`),V(` $ npm install -g ${gl}`);try{(0,LL.execFileSync)("npm",["install","-g",gl],{stdio:["ignore","inherit","inherit"]})}catch(e){let t=e.status??1;throw new Error(`npm install -g ${gl} exited ${t}`,{cause:e})}V("Updated. Run `tsuga --version` to confirm the new version.")}function kL(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{PV()})}var fh=require("node:fs"),dh=require("node:os"),ra=require("node:path");var UV=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,sc=class e extends Date{#t=!1;#r=!1;#e=null;constructor(t){let n=!0,o=!0,i="Z";if(typeof t=="string"){let a=t.match(UV);a?(a[1]||(n=!1,t=`0000-01-01T${t}`),o=!!a[2],o&&t[10]===" "&&(t=t.replace(" ","T")),a[2]&&+a[2]>23?t="":(i=a[3]||null,t=t.toUpperCase(),!i&&o&&(t+="Z"))):t=""}super(t),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 t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;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(t,n="Z"){let o=new e(t);return o.#e=n,o}static wrapAsLocalDateTime(t){let n=new e(t);return n.#e=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#t=!1,n.#e=null,n}};function wV(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function vV(e,t,n){let o=e.split(/\r\n|\n|\r/g),i="",a=(Math.log10(t+1)|0)+1;for(let c=t-1;c<=t+1;c++){let l=o[c-1];l&&(i+=c.toString().padEnd(a," "),i+=": ",i+=l,i+=`
|
|
140
|
+
fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(t=>{let{rows:n,valueFlags:o}=TB(e);if(t==="bash")V(EB(Yx(n),o));else if(t==="zsh")V(_B(Yx(n),o));else if(t==="fish")V(bB(IB(n),o));else throw new Error(`Unsupported shell "${t}". Supported: bash, zsh, fish.`)})}function Wx(e){let t=e.command("config").description("Show or manage configuration");t.action(()=>{let n=e.opts(),o=si({clusterId:n.cluster});V(XO(o,Vp()).trimEnd())}),t.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)=>{WO(n,o),V(`Default set: ${n} = ${o}`)}),t.command("reset").description("Reset configuration values").command("defaults").description("Clear all custom defaults").action(()=>{ZO(),V("Custom defaults cleared")})}var Zx=`/${"v1"}/docs`,Xx=r.Object({path:r.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:r.String({description:'Title of the page (e.g. "Send your first logs" or "POST /v1/aggregation/multi-query/scalar")'}),content:r.String({description:"Raw markdown content of the page"})},{$id:"DocPage",description:"A documentation or API-reference page with its raw markdown content"}),SB={path:"getting-started/send-your-first-logs",title:"Send your first logs",content:`# Send your first logs
|
|
141
|
+
...`};Object.assign(Xx,{examples:[SB]});var Jx=r.Object({kind:r.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:r.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:r.String({description:'Title of the result (e.g. "How to Add Resource Attributes" or "POST /v1/aggregation/multi-query/scalar")'}),subsection:r.Optional(r.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:r.Optional(r.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:r.Optional(r.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:r.Number({description:"Relevance score between 0 and 1 (higher is more relevant)"}),excerpt:r.String({description:"Short snippet of matching content"}),link:r.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"}),AB={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(Jx,{examples:[AB]});var eR=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:Zx,method:"GET",query:r.Object({path:u({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:Xx}),tR=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:`${Zx}/search`,method:"GET",query:r.Object({query:u({allowEmpty:!1,description:"Search text to match against documentation and API-reference content."})},{description:"Documentation search query."}),response:r.Array(Jx)});function rR(e,t){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 t()(eR,{query:{path:o}});ee(i)}),n.command("search <SEARCH_TEXT>").description("Search Tsuga documentation and the full API reference, ranked by relevance").action(async o=>{let i=await t()(tR,{query:{query:o}});ee(i)})}var OB=`/${"v1"}/feedback`,nR=r.Object({id:r.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),xB={id:"request-123-abc"};Object.assign(nR,{examples:[xB]});var oR=r.Object({content:u({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."})}),RB={content:"The traces command times out for large services."};Object.assign(oR,{examples:[RB]});var iR=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:OB,method:"POST",body:oR,response:nR});function aR(e,t){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 t()(iR,{body:{content:n.join(" ")}});ee(o)})}var CB="^\\S(.*\\S)?$",PB=128,UB=256,wB=r.Object({key:r.String({description:"Tag key attached to the resource. Consumers can use key/value tags for filtering, ownership context, and policy checks."}),value:r.String({description:"Tag value attached to the resource for this key. Tsuga returns the value exactly as stored."})},{title:"Tag"}),vB=r.Object({key:r.String({maxLength:PB,description:"Tag key to attach to the resource."}),value:r.String({maxLength:UB,pattern:CB,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),qt=r.Array(wB,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),Bt=r.Array(vB,{title:"Tags",maxItems:50,description:"Key/value tags to apply to the resource. Tag policies may require specific keys or values."}),De=r.Optional(qt),Xe=r.Optional(Bt);var bn="/v0/teams",pu=["public","private"],cu={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},NB=r.Enum([cu.NAME,cu.CREATED_AT,cu.MEMBER_COUNT,cu.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),pR=r.Object({color:r.Enum(Id,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:r.Enum(bd,{description:"Avatar rendering mode selected for the team."}),iconName:r.Enum(Gx,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),Rd=r.Object({color:r.Enum(Id),mode:r.Enum(bd)}),sR=100,cR=250,di=r.Object({id:r.String({description:"Unique identifier of the team. Generated by Tsuga and stable for the team lifetime."}),name:r.String({description:"Human-readable team name displayed throughout Tsuga and used in team search."}),description:r.Optional(r.String({description:"Optional free-text description of the team."})),visibility:r.Enum(pu,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:De,createdAt:A({description:"Timestamp when Tsuga created the team."}),updatedAt:A({description:"Timestamp when Tsuga last updated the team metadata."}),memberCount:r.Optional(r.Number({description:"Number of members currently in the team"})),avatar:r.Optional(pR)}),uu=r.Object({name:r.String({minLength:1,maxLength:sR,format:ri,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 ${sR} characters.`}),description:r.Optional(r.String({maxLength:cR,description:`Optional team description. Maximum length is ${cR} characters.`})),visibility:r.Enum(pu,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:Xe,avatar:r.Optional(pR)}),LB=r.Object({id:r.String(),name:r.String(),email:r.String(),role:r.Enum(ci),joinedTeamAt:A(),orgRole:r.Enum(nx),avatar:r.Optional(Rd)}),uR=r.Object({searchQuery:r.Optional(u({description:"Substring matched against team names and descriptions."})),visibility:r.Optional(r.Enum(pu,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:r.Optional(r.Boolean({description:"If true, return only teams that include the authenticated user."}))}),hLe=d({tags:["teams"],url:bn,method:"GET",paginated:!0,response:r.Array(di),query:r.Object({...fe,includeMemberCount:r.Optional(r.Boolean()),...uR.properties,sortBy:r.Optional(NB),sortDirection:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending."}))})}),yLe=d({tags:["teams"],url:`${bn}/:id`,method:"GET",params:r.Object({id:u()}),response:di}),TLe=d({tags:["teams"],url:`${bn}/:id/members`,method:"GET",params:r.Object({id:u()}),response:r.Array(LB)}),ELe=d({tags:["teams"],url:`${bn}/:id/assets`,method:"GET",params:r.Object({id:u()}),response:r.Object({apiKeyCount:r.Number(),logRouteCount:r.Number(),monitorCount:r.Number(),notificationRuleCount:r.Number(),dashboardCount:r.Number()})}),_Le=d({tags:["teams"],url:bn,method:"POST",body:uu,response:di}),ILe=d({tags:["teams"],url:`${bn}/:id`,method:"PUT",params:r.Object({id:u()}),body:uu,response:di}),kB=C("type",[r.Object({type:r.Literal("ids"),teamIds:r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:100})}),r.Object({type:r.Literal("all"),filters:r.Optional(uR)})]),bLe=d({tags:["teams"],url:`${bn}/bulk-update`,method:"POST",body:r.Object({selection:kB,config:r.Object({visibility:r.Enum(pu)})}),response:r.Object({})}),SLe=d({tags:["teams"],url:`${bn}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N});var MB=r.Enum(["agent","cli","mcp-codemode","mcp-server","terraform-provider","web-frontend"],{description:"Tsuga client surface that performed the operation. Use this to distinguish UI, CLI, MCP, and Terraform-originated changes."}),pe=C("type",[r.Object({type:r.Literal("user",{description:"The resource was created or updated by a user."}),id:r.String({description:"Unique identifier of the user actor."}),name:r.String({description:"Display name of the user actor at the time of response."}),avatar:r.Optional(Rd)}),r.Object({type:r.Literal("operation-api-key",{description:"The resource was created or updated by an operation API key."}),id:r.String({description:"Unique identifier of the operation API key actor."}),name:r.String({description:"Display name of the operation API key actor."}),source:r.Optional(MB)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var At="/v0/monitors",fi=["alert","resolve","keep_last_status","consider_zero"],gi=["alert","resolve","keep_last_status"];var mR=["no_aggregation","all","any","each","proportion"],dR=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var DB=r.Object({formula:r.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(dR,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:r.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),GB=r.Object({formula:u({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(dR,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:r.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),$B=5,Cd=r.Array(DB,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Pd=r.Array(GB,{minItems:1,maxItems:$B,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Ud=r.Object({formula:r.String({description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:r.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`."}),wd=r.Object({formula:u({type:"tsuga-formula",description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:r.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`."}),St=[1,2,3,4,5];var lu={timeframe:r.Number({description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over. Always a whole number, at least 1."}),groupByFields:r.Array(r.Object({fields:r.Array(r.String(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty means the monitor evaluates a single ungrouped series."}),limit:r.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:r.Optional(r.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:r.Optional(r.Enum(mR,{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:r.Optional(r.Integer({description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},mu={timeframe:r.Integer({minimum:1,description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over."}),groupByFields:r.Array(r.Object({fields:r.Array(u(),{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:r.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:r.Optional(u({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:r.Optional(r.Enum(mR,{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:r.Optional(r.Integer({minimum:1,maximum:99,description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},vd={...lu,timeframe:r.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},Nd={...mu,timeframe:r.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},fR=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Cd,noDataBehavior:r.Enum(fi,{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."}),...lu,queries:Fr},{$id:"MonitorConfigurationMetric"}),gR=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Pd,noDataBehavior:r.Enum(fi,{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."}),...mu,queries:_n},{$id:"InputMonitorConfigurationMetric"}),hR=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Cd,noDataBehavior:r.Enum(fi,{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."}),...lu,queries:Fr},{$id:"MonitorConfigurationLog"}),yR=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Pd,noDataBehavior:r.Enum(fi,{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."}),...mu,queries:_n},{$id:"InputMonitorConfigurationLog"}),TR=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Cd,noDataBehavior:r.Enum(fi,{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."}),...lu,queries:Fr},{$id:"MonitorConfigurationTrace"}),jB=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Pd,noDataBehavior:r.Enum(fi,{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."}),...mu,queries:_n},{$id:"InputMonitorConfigurationTrace"}),ER=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Ud,noDataBehavior:r.Enum(gi,{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."}),...vd,queries:Fr},{$id:"MonitorConfigurationAnomalyLog"}),_R=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:wd,noDataBehavior:r.Enum(gi,{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."}),...Nd,queries:_n},{$id:"InputMonitorConfigurationAnomalyLog"}),IR=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Ud,noDataBehavior:r.Enum(gi,{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."}),...vd,queries:Fr},{$id:"MonitorConfigurationAnomalyMetric"}),bR=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:wd,noDataBehavior:r.Enum(gi,{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."}),...Nd,queries:_n},{$id:"InputMonitorConfigurationAnomalyMetric"}),SR=r.Object({type:r.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:Ud,noDataBehavior:r.Enum(gi,{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."}),...vd,queries:Fr},{$id:"MonitorConfigurationAnomalyTrace"}),FB=r.Object({type:r.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:wd,noDataBehavior:r.Enum(gi,{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."}),...Nd,queries:_n},{$id:"InputMonitorConfigurationAnomalyTrace"}),AR=r.Object({type:r.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:r.Integer({description:"Number of days before certificate expiry when the monitor should warn."}),cloudAccounts:r.Optional(r.Array(r.String(),{description:"Cloud account IDs whose certificates are checked. Omitted means certificates from all cloud accounts are checked."})),aggregationAlertLogic:r.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:r.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"MonitorConfigurationCertificateExpiry"}),qB=r.Object({type:r.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:r.Integer({minimum:1,maximum:365,description:"Number of days before certificate expiry when the monitor should warn. Valid values are 1 through 365."}),cloudAccounts:r.Optional(r.Array(r.String(),{minItems:1,description:"Cloud account IDs whose certificates are checked. Omit to check certificates from all cloud accounts."})),aggregationAlertLogic:r.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:r.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"InputMonitorConfigurationCertificateExpiry"}),BB=r.Object({type:r.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured team, environment, and optional service. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:r.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:r.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:r.Object({teamIds:r.Array(r.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:r.String({description:"Environment whose logs are searched for new error patterns."}),service:r.Optional(r.String({description:"Optional service name whose logs are searched for new error patterns. If omitted, the monitor searches all services matching the team and environment filter."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included."})},{$id:"MonitorConfigurationLogErrorPattern"}),HB=r.Object({type:r.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured team, environment, and optional service. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:r.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:r.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:r.Object({teamIds:r.Array(u(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets."}),env:u({description:"Environment whose logs are searched for new error patterns."}),service:r.Optional(u({description:"Optional service name whose logs are searched for new error patterns. If omitted, the monitor searches all services matching the team and environment filter."}))},{description:"Log selection used for new error pattern detection. All configured fields must match for logs to be included."})},{$id:"InputMonitorConfigurationLogErrorPattern"}),KB=C("type",[fR,hR,TR,ER,IR,BB,SR,AR],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),zB=C("type",[gR,yR,jB,_R,bR,FB,HB,qB],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var Br=r.Object({id:r.String({description:"Tsuga-generated monitor ID assigned when the monitor is created."}),name:r.String({description:"Display name of the monitor and alert source."}),owner:r.String({description:"Team ID that owns and manages the monitor."}),message:r.Optional(r.String({description:"Caller-supplied message included in notifications triggered by this monitor. Omitted when the monitor was created or last updated without one."})),tags:De,configuration:KB,priority:r.Enum(St,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:En,dashboardId:r.Optional(r.String({description:"ID of the dashboard linked to this monitor for context when investigating alerts. Caller-supplied. Omitted when no dashboard is linked."})),pauseUntil:r.Optional(A({description:"Timestamp until which the monitor is snoozed."})),creator:r.Optional(pe),updater:r.Optional(pe),createdAt:A({description:"Timestamp when Tsuga created the monitor."}),updatedAt:A({description:"Timestamp when Tsuga last updated the monitor."}),assetUpdatedAt:A({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."}),clusterIds:r.Array(r.String(),{description:"Cluster IDs where the monitor is deployed. Empty means all eligible clusters."})},{title:"Monitor"}),YB=C("type",[fR,hR,TR,ER,IR,SR,AR]),jLe=r.Object({...Br.properties,configuration:YB},{title:"Monitor"}),FLe=r.Object({...Br.properties,configuration:C("type",[gR,yR,_R,bR])},{title:"Monitor"}),is=r.Object({name:u({description:"Display name of the monitor and alert source."}),message:r.Optional(u({type:"long",description:"Message included in notifications triggered by this monitor. Optional on create. On update, omitting it keeps the existing message."})),tags:Xe,configuration:zB,priority:r.Enum(St,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the monitor."}),dashboardId:r.Optional(r.Union([r.Null(),u({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:r.Optional(u({allowEmpty:!1,type:"date-time",description:"ISO timestamp until which the monitor should be snoozed."})),permissions:En,clusterIds:r.Optional(r.Array(u({allowEmpty:!1}),{description:"Cluster IDs where the monitor should be deployed. Empty or omitted means all eligible clusters for cluster-deployed monitor types."}))}),lR=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],Sn={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var Ld=r.Object({owners:_e(u({allowEmpty:!1}),{description:"Restrict results to monitors owned by any of these team IDs",maxItems:50}),searchQuery:r.Object({value:u({allowEmpty:!1,description:"Case-insensitive substring matched against monitor ID, monitor name, query filters, and aggregate fields. Wildcard characters are treated literally."}),exclude:r.Optional(r.Boolean({description:"If true, exclude monitors matching this value instead of including them"}))},{description:"Search query filter for monitors."}),tags:_e(Bt.items,{description:"Restrict results to monitors that have at least one of the listed key/value tags",maxItems:50}),priorities:_e(r.Enum(St),{description:"Restrict results to monitors with one of these priorities",maxItems:St.length}),types:_e(r.Enum(lR),{description:"Restrict results to monitors with these types",maxItems:lR.length}),activity:r.Enum(["active","snoozed"],{description:"Restrict results by activity status: active monitors or currently snoozed monitors"}),clusterIds:_e(u({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"}),kd=r.Partial(r.Object({...fe,filters:r.Partial(Ld),sort:r.Object({by:r.Enum([Sn.PRIORITY,Sn.TYPE,Sn.NAME,Sn.OWNER,Sn.TAGS,Sn.CLUSTER_IDS,Sn.PAUSE_UNTIL,Sn.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:r.Enum(["asc","desc"],{description:"Sort direction. For `priority`, `desc` returns priority 1 first and `asc` returns priority 5 first."})},{description:"Optional sorting applied to the returned monitors. Ties are broken by creation time and monitor ID for stable pagination."})})),qLe=d({tags:["monitors"],url:`${At}/query`,method:"POST",paginated:!0,response:r.Array(Br),body:kd}),BLe=d({tags:["monitors"],url:`${At}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(Ld,["tags"])))}),response:qt}),HLe=d({tags:["monitors"],url:`${At}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(Ld,["activity"])))}),response:r.Object({all:r.Integer({description:"Total number of monitors matching the filters that the user can read."}),active:r.Integer({description:"Number of matching readable monitors that are not currently snoozed."}),snoozed:r.Integer({description:"Number of matching readable monitors that are currently snoozed."})})}),KLe=d({tags:["monitors"],url:`${At}/:id`,method:"GET",params:r.Object({id:u()}),response:Br}),zLe=d({tags:["monitors"],url:At,method:"POST",body:is,response:Br}),YLe=d({tags:["monitors"],url:`${At}/:id`,method:"PUT",params:r.Object({id:u()}),body:is,response:Br}),VLe=d({tags:["monitors"],url:`${At}/bulk-update`,method:"PUT",body:r.Object({monitorIds:r.Array(u({allowEmpty:!1}),{minItems:1}),owner:u({allowEmpty:!1})}),response:r.Object({})}),QLe=d({tags:["monitors"],url:`${At}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),WLe=d({tags:["monitors"],url:`${At}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),ZLe=d({tags:["monitors"],url:`${At}/:id/snooze`,method:"POST",params:r.Object({id:u()}),body:r.Object({pauseUntil:u({allowEmpty:!1,type:"date-time"})}),response:Br}),XLe=d({tags:["monitors"],url:`${At}/bulk-snooze`,method:"POST",body:r.Object({monitorIds:r.Array(u()),pauseUntil:u({allowEmpty:!1,type:"date-time"})}),response:r.Object({})}),VB=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],QB=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],WB=[...VB,...QB],uo=r.Enum(WB),ZB=C("type",[r.Object({type:r.Literal("each"),subStates:r.Record(r.String(),r.Object({stateValue:r.Union([uo,r.Null()]),lastChangedAt:A()}))}),r.Object({type:r.Literal("no_aggregation"),stateValue:r.Optional(uo)}),r.Object({type:r.Literal("any"),stateValue:r.Optional(uo)}),r.Object({type:r.Literal("all"),stateValue:r.Optional(uo)}),r.Object({type:r.Literal("proportion"),stateValue:r.Optional(uo)})]),XB=r.Object({monitorId:r.String(),currentState:ZB,lastChangedAt:r.Optional(A())}),JLe=d({tags:["monitors"],url:`${At}/states/:id`,method:"GET",params:r.Object({id:u()}),response:XB}),eke=d({tags:["monitors"],url:`${At}/:id/transitions`,method:"GET",params:r.Object({id:u()}),query:r.Object({from:r.Number(),to:r.Number()}),response:r.Array(r.Object({id:r.String(),createdAt:A(),fromState:r.Optional(uo),toState:r.Optional(uo),dimension:r.Optional(r.String())}))}),JB=["unprocessed","processed","failed-to-process"],tke=d({tags:["monitors"],url:`${At}/:id/results`,method:"GET",params:r.Object({id:u()}),query:r.Object({from:r.Number(),to:r.Number()}),response:r.Object({isTruncated:r.Boolean(),results:r.Array(r.Object({id:r.String(),evaluationAt:A(),formulaResult:r.Object({groups:r.Array(r.Object({groupKey:r.Record(r.String(),rs),results:r.Array(r.Union([r.Number(),r.Null()])),conditionMet:r.Enum(["true","false","nan-no-data"])}))}),createdAt:A(),status:r.Enum(JB)}))})});var Hr="/v0/slos",eH=[7,30,90],tH=["good","bad"],CR=r.Enum(tH,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),rH=["good","bad","ignore"],PR=r.Enum(rH,{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)"}),OR=30,xR=1440,UR=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],nH=["healthy","breached","no_data"],du=r.Enum(nH,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),RR={sli:r.Optional(r.Number({description:"Service level indicator for the latest evaluation; absent when there is no data"})),errorBudget:r.Optional(r.Number({description:"Remaining error budget at the latest evaluation; negative when exhausted, absent when there is no data"})),status:du},oH=r.Object({overall:r.Object(RR,{description:"Latest overall evaluation for the cluster"}),perGroup:r.Array(r.Object({groupKey:r.Record(r.String(),rs,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...RR}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),wR=r.Record(r.String(),oH,{description:"Latest evaluation results keyed by cluster ID."}),Md=r.Object({queries:Fr,formula:su},{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."}),Dd=r.Object({queries:Mx,formula:po},{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."}),iH=r.Object({type:r.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:r.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"}),aH=r.Object({type:r.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:r.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 sH=r.Object({type:r.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:r.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"}),cH=r.Object({type:r.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:r.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"}),pH=C("type",[iH,sH],{description:"Alert trigger configuration: burn-rate or threshold"}),vR=C("type",[aH,cH],{description:"Alert trigger configuration: burn-rate or threshold"}),Gd=r.Enum(St,{description:"Alert priority (1 is highest, 5 is lowest)"}),$d=r.Object({id:r.String({description:"Tsuga-generated SLO alert ID assigned when the alert is created."}),sloId:r.String({description:"Parent SLO ID for this alert."}),priority:Gd,configuration:pH,createdAt:A({description:"Timestamp when Tsuga created the alert."}),updatedAt:A({description:"Timestamp when Tsuga last updated the alert."}),assetUpdatedAt:A({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"SloAlert"}),uH=r.Object({priority:Gd,configuration:vR}),lH=r.Object({id:r.Optional(u({allowEmpty:!1,description:"Identifier of an existing alert to update. Omit to create a new alert on this SLO."})),priority:Gd,configuration:vR}),mH=C("type",[r.Object({type:r.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:ir,goodQuery:Md,totalQuery:Md,groupByFields:r.Optional(mi),noDataBehavior:CR},{title:"EventSloConfiguration"}),r.Object({type:r.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:ir,query:Md,sliceSizeMinutes:r.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:r.Object({operator:r.Enum(UR,{description:"Comparison operator between the query value and the threshold"}),value:r.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:r.Optional(mi),noDataBehavior:PR},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),dH=C("type",[r.Object({type:r.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:ir,goodQuery:Dd,totalQuery:Dd,groupByFields:r.Optional(qr),noDataBehavior:CR},{title:"EventSloConfiguration"}),r.Object({type:r.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:ir,query:Dd,sliceSizeMinutes:r.Integer({minimum:OR,maximum:xR,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${OR} through ${xR}.`}),threshold:r.Object({operator:r.Enum(UR,{description:"Comparison operator between the query value and the threshold"}),value:r.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:r.Optional(qr),noDataBehavior:PR},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),fH=r.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),NR=r.Enum(eH,{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."}),gH=r.Array(r.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."}),hH=r.Array(u({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."}),hi=r.Object({id:r.String({description:"Tsuga-generated SLO ID assigned when the SLO is created."}),name:r.String({description:"Display name of the SLO, set by the caller."}),description:r.Optional(r.String({description:"Free-form, caller-provided description of what the SLO measures. Absent when not set."})),tags:De,configuration:mH,target:r.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:NR,owner:r.String({description:"Team ID that owns the SLO"}),permissions:En,clusterIds:gH,creator:r.Optional(pe),updater:r.Optional(pe),alerts:r.Array($d,{description:"Alerts attached to this SLO"}),createdAt:A({description:"Timestamp when Tsuga created the SLO."}),updatedAt:A({description:"Timestamp when Tsuga last updated the SLO."}),assetUpdatedAt:A({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"Slo"}),yH=r.Object({...hi.properties,results:wR},{title:"SloWithResults"}),fu=r.Object({name:u({allowEmpty:!1,description:"Display name of the SLO."}),description:r.Optional(u({type:"long",description:"Free-form, caller-provided description of what the SLO measures. Optional."})),tags:Xe,configuration:dH,target:fH,timeframeDays:NR,owner:u({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:En,clusterIds:r.Optional(hH),alerts:r.Array(uH,{description:"Alerts to create on this SLO. Send an empty array for none."})}),jd=r.Object({...r.Omit(fu,["alerts"]).properties,alerts:r.Array(lH,{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."})}),LR=r.Object({owners:_e(u({allowEmpty:!1}),{description:"Restrict results to SLOs owned by any of these team IDs",maxItems:50}),searchQuery:r.Object({value:u({allowEmpty:!1,description:"Substring matched case-insensitively against the SLO name or SLO ID."}),exclude:r.Optional(r.Boolean({description:"If true, exclude SLOs matching this value instead of including them"}))},{description:"Text filter for SLO names or IDs. Optional; `exclude: true` removes matching SLOs."}),tags:_e(Bt.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:_e(u({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:_e(du,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),Fd=r.Partial(LR),qd=r.Partial(r.Object({...fe,filters:Fd,sort:r.Object({by:r.Enum(["name","owner","tags","updatedAt","sli","errorBudget","status"],{description:"Field to sort by"}),direction:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned SLOs"})})),dke=d({tags:["slos"],url:`${Hr}/query`,method:"POST",paginated:!0,response:r.Array(yH),body:qd}),fke=d({tags:["slos"],url:`${Hr}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(LR,["tags","statuses"])))}),response:qt}),gke=d({tags:["slos"],url:`${Hr}/:id`,method:"GET",params:r.Object({id:u()}),response:hi}),hke=d({tags:["slos"],url:`${Hr}/:id/results`,method:"GET",params:r.Object({id:u()}),response:wR}),yke=d({tags:["slos"],url:Hr,method:"POST",body:fu,response:hi}),Tke=d({tags:["slos"],url:`${Hr}/:id`,method:"PUT",params:r.Object({id:u()}),body:jd,response:hi}),Eke=d({tags:["slos"],url:`${Hr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),TH=qm(Fd),_ke=d({tags:["slos"],url:`${Hr}/bulk-delete`,method:"DELETE",body:r.Object({selection:TH}),response:r.Object({})}),EH=qm(Fd,{maxIds:100}),Ike=d({tags:["slos"],url:`${Hr}/bulk-update`,method:"PUT",body:r.Object({selection:EH,owner:u({allowEmpty:!1})}),response:r.Object({})});var yi="/v0/notifications",An=`${yi}/rules`,kR=`${yi}/slack/setup`,as=`${yi}/integrations`,lo=["triggered","resolved","no-data"],_H=["sent","stale","pending","rate-limited","failed","silenced"],IH=r.Optional(r.Object({maxMessages:r.Integer({description:"Maximum number of notifications this target can send during the rate-limiting window."}),minutes:r.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."})),Bd=r.Object({maxMessages:r.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:r.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."}),bH=r.Optional(Bd),Sr=r.Optional(r.Object({mode:r.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:r.Array(r.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:r.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."})),Ar=r.Optional(r.Object({mode:r.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:r.Array(r.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:r.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."})),ss=r.Object({id:r.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:IH,config:C("type",[r.Object({type:r.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:r.String({description:"Slack channel ID that receives the notification"}),integrationId:r.String({description:"Slack workspace ID that receives the notification"}),integrationName:r.String({description:"Human readable name of the Slack integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigSlack"}),r.Object({type:r.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:r.String({description:"Identifier of the incident.io integration to use"}),integrationName:r.String({description:"Human readable name of the incident.io integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigIncidentIo"}),r.Object({type:r.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:r.Array(r.String(),{description:"Email addresses that will receive the alert"}),renotifyConfig:Sr},{$id:"RuleTargetConfigEmail"}),r.Object({type:r.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:r.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:r.String({description:"Human readable name of the Grafana IRM integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigGrafanaIrm"}),r.Object({type:r.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:r.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:r.String({description:"Human readable name of the PagerDuty integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigPagerDuty"}),r.Object({type:r.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:r.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:r.String({description:"Human readable name of the Microsoft Teams integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigMicrosoftTeams"}),r.Object({type:r.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:r.String({description:"Identifier of the webhook integration to use"}),integrationName:r.String({description:"Human readable name of the webhook integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigWebhook"}),r.Object({type:r.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:r.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:r.String({description:"Human readable name of the ServiceNow integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigServiceNow"}),r.Object({type:r.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:r.String({description:"Identifier of the Google Chat integration to use"}),integrationName:r.String({description:"Human readable name of the Google Chat integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigGoogleChat"}),r.Object({type:r.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:r.String({description:"Identifier of the Squadcast integration to use"}),integrationName:r.String({description:"Human readable name of the Squadcast integration"}),renotifyConfig:Sr},{$id:"RuleTargetConfigSquadcast"}),r.Object({type:r.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:r.String({description:"Identifier of the Jira integration to use"}),integrationName:r.String({description:"Human readable name of the Jira integration"}),projectKey:r.String({description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:r.String({description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:r.Optional(r.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:r.Optional(r.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`."})}),Ti=r.Object({id:u({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:bH,config:C("type",[r.Object({type:r.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:u({allowEmpty:!1,description:"Slack channel ID that receives the notification"}),integrationId:u({allowEmpty:!1,description:"Slack workspace ID that receives the notification"}),renotifyConfig:Ar},{$id:"RuleTargetInputSlack"}),r.Object({type:r.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the incident.io integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputIncidentIo"}),r.Object({type:r.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the PagerDuty integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputPagerDuty"}),r.Object({type:r.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:r.Array(u({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"}),renotifyConfig:Ar},{$id:"RuleTargetInputEmail"}),r.Object({type:r.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the Grafana IRM integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputGrafanaIrm"}),r.Object({type:r.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the Microsoft Teams integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputMicrosoftTeams"}),r.Object({type:r.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the webhook integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputWebhook"}),r.Object({type:r.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the ServiceNow integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputServiceNow"}),r.Object({type:r.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the Google Chat integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputGoogleChat"}),r.Object({type:r.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:u({allowEmpty:!1,description:"Identifier of the Squadcast integration to use"}),renotifyConfig:Ar},{$id:"RuleTargetInputSquadcast"}),r.Object({type:r.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:u({allowEmpty:!1,description:"Identifier of the Jira integration to use"}),projectKey:u({allowEmpty:!1,description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:u({allowEmpty:!1,description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:r.Optional(u({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:r.Optional(u({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)."})}),Hd=C("type",[r.Object({type:r.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:r.Array(r.String(),{description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),r.Object({type:r.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"}),r.Object({type:r.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."}),Kd=C("type",[r.Object({type:r.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:r.Array(u(),{minItems:1,maxItems:100,description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),r.Object({type:r.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"}),r.Object({type:r.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."}),Ei=r.Object({id:r.String({description:"Tsuga-generated notification rule ID assigned when the rule is created."}),name:r.String({description:"Display name of the notification rule."}),queryString:r.Optional(r.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:Hd,prioritiesFilter:r.Array(r.Enum(St),{description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(lo),{description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:r.Array(r.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:r.String({description:"Team ID that owns and manages the rule."}),createdAt:A({description:"Timestamp when Tsuga created the rule."}),updatedAt:A({description:"Timestamp when Tsuga last updated the rule."}),isActive:r.Boolean({description:"Whether the rule currently sends notifications when its filters match."}),tags:De,targets:r.Array(ss,{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:r.Optional(pe),updater:r.Optional(pe)}),cs=r.Object({name:u({description:"Display name of the notification rule."}),queryString:r.Optional(u({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:Kd,prioritiesFilter:r.Array(r.Enum(St),{maxItems:St.length,description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.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:r.Optional(r.Array(u({allowEmpty:!1}),{description:"Cluster IDs that must match for this rule to fire. Omit it, or leave it empty, to match every cluster."})),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:Xe,isActive:r.Boolean({description:"Set to true for the rule to send notifications when its filters match."}),targets:r.Array(Ti,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),gu=r.Object({id:r.String({description:"Unique identifier of the adaptive notification rule. Generated by Tsuga."}),name:r.String({description:"Display name of the adaptive notification rule."}),owner:r.String({description:"Team ID that owns and manages the rule."}),createdAt:A({description:"Timestamp when Tsuga created the rule."}),updatedAt:A({description:"Timestamp when Tsuga last updated the rule."}),isActive:r.Boolean({description:"Whether the rule currently sends notifications when one of its monitors fires."}),shouldCreateInvestigation:r.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:De,monitorIds:r.Array(r.String(),{description:"Monitors this rule reacts to."}),sloIds:r.Array(r.String(),{description:"SLOs this rule reacts to."}),fallbackTarget:ss,creator:r.Optional(pe),updater:r.Optional(pe)}),MR=r.Object({name:u({description:"Display name of the adaptive notification rule."}),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:Xe,isActive:r.Boolean({description:"Set to true for the rule to send notifications when one of its monitors fires."}),shouldCreateInvestigation:r.Optional(r.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:r.Optional(r.Array(u({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:r.Optional(r.Array(u({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:Ti}),Uke=d({tags:["notification-rules"],url:An,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(Ei)}),wke=d({tags:["notification-rules"],url:`${An}/:id`,params:r.Object({id:u()}),method:"GET",response:Ei}),vke=d({tags:["notification-rules"],url:An,method:"POST",body:cs,response:Ei}),Nke=d({tags:["notification-rules"],url:`${An}/:id`,method:"PUT",params:r.Object({id:u()}),body:cs,response:Ei}),Lke=d({tags:["notification-rules"],url:`${An}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),kke=d({tags:["notification-rules"],url:`${An}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),_i=`${yi}/adaptive-rules`,Mke=d({tags:["notification-rules"],url:_i,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(gu)}),Dke=d({tags:["notification-rules"],url:`${_i}/:id`,params:r.Object({id:u()}),method:"GET",response:gu}),Gke=d({tags:["notification-rules"],url:_i,method:"POST",body:MR,response:gu}),$ke=d({tags:["notification-rules"],url:`${_i}/:id`,method:"PUT",params:r.Object({id:u()}),body:MR,response:gu}),jke=d({tags:["notification-rules"],url:`${_i}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),Fke=d({tags:["notification-rules"],url:`${_i}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),qke=d({tags:["notification-integrations"],url:`${kR}/start`,method:"POST",response:r.Object({redirectUrl:r.String()})}),SH=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],AH=r.Object({id:r.String(),name:r.String(),type:r.Enum(SH),createdAt:A(),ruleCount:r.Number(),creator:r.Optional(pe)}),Bke=d({tags:["notification-integrations"],url:`${An}/integrations`,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(AH)}),Hke=d({tags:["notification-integrations"],url:`${kR}/callback`,method:"GET",query:r.Object({code:u()}),response:r.Object({success:r.Boolean()})}),zd=["POST","PUT"],OH=r.Record(r.String(),r.String()),xH=r.Record(r.String(),r.Unknown()),RH=r.Record(r.String(),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))])),CH=C("type",[r.Object({type:r.Literal("json"),value:xH}),r.Object({type:r.Literal("form"),value:RH})]),PH=r.Object({ok:r.String(),alert:r.String()}),Yd=r.Object({id:r.String(),name:r.String(),setting:C("type",[r.Object({type:r.Literal("incident-io"),alertSourceConfigId:r.String(),tokenLastChars:r.String()}),r.Object({type:r.Literal("grafana-irm"),urlLastChars:r.String()}),r.Object({type:r.Literal("pagerduty"),integrationKeyLastChars:r.String()}),r.Object({type:r.Literal("microsoft-teams"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("webhook"),urlLastChars:r.String(),method:r.Enum(zd),authentication:C("type",[r.Object({type:r.Literal("bearer"),tokenLastChars:r.String()}),r.Object({type:r.Literal("basic"),username:r.String(),passwordLastChars:r.String()}),r.Object({type:r.Literal("custom-header"),key:r.String(),valueLastChars:r.String()}),r.Object({type:r.Literal("none")})]),customHeaders:r.Optional(OH),payloadTemplate:CH,eventNameMapping:r.Optional(PH)}),r.Object({type:r.Literal("servicenow"),instanceName:r.String(),username:r.String(),passwordLastChars:r.String()}),r.Object({type:r.Literal("google-chat"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("squadcast"),webhookUrlLastChars:r.String()}),r.Object({type:r.Literal("jira"),siteUrl:r.String(),email:r.String(),apiTokenLastChars:r.String()})]),tags:De}),UH=r.Object({type:r.Literal("webhook"),url:u({type:"uri"}),method:r.Enum(zd),authentication:C("type",[r.Object({type:r.Literal("bearer"),token:u({allowEmpty:!1})}),r.Object({type:r.Literal("basic"),username:u({allowEmpty:!1}),password:u({allowEmpty:!1})}),r.Object({type:r.Literal("custom-header"),key:u({allowEmpty:!1}),value:u({allowEmpty:!1})}),r.Object({type:r.Literal("none")})]),customHeaders:r.Record(u({allowEmpty:!1}),u()),payloadTemplate:C("type",[r.Object({type:r.Literal("json"),value:r.Record(u({allowEmpty:!1}),r.Unknown())}),r.Object({type:r.Literal("form"),value:r.Record(u({allowEmpty:!1}),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))]))})]),eventNameMapping:r.Optional(r.Object({ok:u({allowEmpty:!1}),alert:u({allowEmpty:!1})}))}),DR=r.Object({type:r.Literal("incident-io"),alertSourceConfigId:u(),token:u()}),GR=r.Object({type:r.Literal("grafana-irm"),url:u({type:"uri"})}),$R=r.Object({type:r.Literal("pagerduty"),integrationKey:u()}),jR=r.Object({type:r.Literal("microsoft-teams"),webhookUrl:u({type:"uri"})}),wH=r.Object({type:r.Literal("servicenow"),instanceName:u({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:u({allowEmpty:!1}),password:u({allowEmpty:!1})}),vH=r.Object({type:r.Literal("google-chat"),webhookUrl:u({type:"uri"})}),NH=r.Object({type:r.Literal("squadcast"),webhookUrl:u({type:"uri"})}),LH=r.Object({type:r.Literal("jira"),siteUrl:u({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:u({type:"email",allowEmpty:!1,description:"Atlassian account email used together with the API token for Basic authentication."}),apiToken:u({allowEmpty:!1,description:"Atlassian API token minted for the account, used as the Basic auth password."})}),kH=r.Object({name:u(),setting:C("type",[DR,GR,$R,jR,UH,wH,vH,NH,LH]),tags:Xe}),MH=r.Object({type:r.Literal("webhook"),url:r.Optional(u({type:"uri"})),method:r.Optional(r.Enum(zd)),authentication:r.Optional(C("type",[r.Object({type:r.Literal("bearer"),token:r.Optional(u({allowEmpty:!1}))}),r.Object({type:r.Literal("basic"),username:r.Optional(u({allowEmpty:!1})),password:r.Optional(u({allowEmpty:!1}))}),r.Object({type:r.Literal("custom-header"),key:r.Optional(u({allowEmpty:!1})),value:r.Optional(u({allowEmpty:!1}))}),r.Object({type:r.Literal("none")})])),customHeaders:r.Optional(r.Record(u({allowEmpty:!1}),u())),payloadTemplate:r.Optional(C("type",[r.Object({type:r.Literal("json"),value:r.Record(u({allowEmpty:!1}),r.Unknown())}),r.Object({type:r.Literal("form"),value:r.Record(u({allowEmpty:!1}),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))]))})])),eventNameMapping:r.Optional(r.Object({ok:r.Optional(u({allowEmpty:!1})),alert:r.Optional(u({allowEmpty:!1}))}))}),DH=r.Object({type:r.Literal("servicenow"),instanceName:r.Optional(u({allowEmpty:!1})),username:r.Optional(u({allowEmpty:!1})),password:r.Optional(u({allowEmpty:!1}))}),GH=r.Object({type:r.Literal("jira"),siteUrl:r.Optional(u({type:"uri",allowEmpty:!1})),email:r.Optional(u({allowEmpty:!1})),apiToken:r.Optional(u({allowEmpty:!1}))}),$H=r.Object({type:r.Literal("google-chat"),webhookUrl:u({type:"uri"})}),jH=r.Object({type:r.Literal("squadcast"),webhookUrl:u({type:"uri"})}),FH=r.Object({name:r.Optional(u()),setting:r.Optional(C("type",[DR,GR,$R,jR,MH,DH,$H,jH,GH]))}),Kke=d({tags:["notification-integrations"],url:as,method:"POST",body:kH,response:Yd}),zke=d({tags:["notification-integrations"],url:`${as}/:id`,method:"GET",params:r.Object({id:u()}),response:Yd}),Yke=d({tags:["notification-integrations"],url:`${as}/:id`,method:"PUT",params:r.Object({id:u()}),body:FH,response:Yd}),Vke=d({tags:["notification-integrations"],url:`${as}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),qH=C("status",[r.Object({status:r.Literal("ok",{description:"Tsuga reached Jira and listed the projects the credentials can file into."}),projects:r.Array(r.Object({key:r.String({description:'Jira project key, like "OPS".'}),name:r.String({description:"Human readable Jira project name."}),issueTypes:r.Array(r.String(),{description:"Issue type names available when creating an issue in this project."}),statuses:r.Optional(r.Array(r.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"}),r.Object({status:r.Literal("error",{description:"Tsuga could not load Jira metadata with the stored credentials."}),message:r.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."}),Qke=d({tags:["notification-integrations"],url:`${as}/:id/jira-metadata`,method:"GET",params:r.Object({id:u()}),response:qH}),Wke=d({tags:["notification-rules"],url:`${At}/:id/notifications`,method:"GET",params:r.Object({id:u()}),query:r.Optional(r.Object({from:r.Optional(r.Number()),to:r.Optional(r.Number())})),response:r.Object({notifications:r.Array(r.Object({id:r.String(),monitorId:r.String(),monitorResultId:r.String(),ruleId:r.Optional(r.String()),targetId:r.Optional(r.String()),status:r.Enum(_H),tryCount:r.Number(),nextTryAt:A(),createdAt:A(),updatedAt:A(),sentAt:r.Optional(A())})),isTruncated:r.Boolean()})}),BH=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],Zke=d({tags:["notification-rules"],url:`${An}/test`,method:"POST",body:r.Object({notificationRule:cs,targetIds:r.Optional(r.Array(u({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:r.Union([r.Object({success:r.Literal(!1),overallMessage:r.String({description:"Message when there is an overall error"})}),r.Object({success:r.Boolean(),results:r.Array(r.Object({targetId:r.String({description:"The ID of the target that was tested"}),targetType:r.Enum(BH,{description:"The type of the target (e.g., slack, webhook)"}),status:r.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:r.Optional(r.String({description:"Message if the notification failed for this specific target"}))}))})])});var Dt="/v0/service-catalog";var HH=r.Object({team:r.String({description:"Team name observed on telemetry for this service."}),lastSeenAt:A({description:"Most recent time this team was observed for the service."})},{description:"A team name observed on telemetry for this service, with the last time it was seen."}),KH=r.Object({ingestionApiKey:r.String({description:"Ingestion API key name or identifier observed on telemetry for this service."}),lastSeenAt:A({description:"Most recent time this ingestion key was observed for the service."})},{description:"An ingestion API key observed on telemetry for this service, with the last time it was seen."}),zH=r.Object({version:r.String({description:"Service version value observed in telemetry."}),firstSeenAt:A({description:"First time this version was observed for the service."}),lastSeenAt:A({description:"Most recent time this version was observed for the service."}),faulty:r.Optional(r.Boolean({description:"Whether Tsuga detected this version as associated with faulty behavior."})),faultyLatency:r.Optional(r.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:r.Optional(r.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."}),YH=r.Object({language:r.String({description:"Programming language observed for this service."}),lastSeenAt:A({description:"Most recent time this language was observed."})},{description:"A programming language observed for this service, with the last time it was seen."}),VH=r.Object({runtime:r.String({description:"Runtime observed for this service."}),lastSeenAt:A({description:"Most recent time this runtime was observed."})},{description:"A runtime observed for this service, with the last time it was seen."}),FR=r.Object({protocol:r.String({description:"Observed API protocol (e.g. 'http', 'grpc', 'graphql')"}),lastSeenAt:A({description:"Most recent observation timestamp"})},{description:"An API protocol observed for this service, with the last time it was seen."}),QH=r.Object({framework:r.String({description:"Observed application framework (e.g. 'express', 'fastify', 'django', 'rails')"}),lastSeenAt:A({description:"Most recent observation timestamp"})},{description:"An application framework detected from OpenTelemetry instrumentation scope, with the last time it was seen."}),WH=r.Object({platform:r.String({description:"Observed cloud or orchestration platform (e.g. 'aws_eks', 'kubernetes')"}),lastSeenAt:A({description:"Most recent observation timestamp"})},{description:"A cloud or orchestration platform this service runs on, with the last time it was seen."}),ZH=r.Object({provider:r.String({description:"Observed cloud provider (e.g. 'aws', 'gcp', 'azure')"}),lastSeenAt:A({description:"Most recent observation timestamp"})},{description:"A cloud provider this service runs on, with the last time it was seen."}),Ii=r.Object({id:r.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:r.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:ss.properties.config,rateLimit:ss.properties.rateLimit,createdAt:A({description:"Timestamp when the service notification target was created. Tsuga sets this value and returns it on private service-catalog responses."}),updatedAt:A({description:"Timestamp when the service notification target was last updated. Tsuga sets this value and returns it on private service-catalog responses."})}),Vd=r.Object({config:Ti.properties.config,rateLimit:Ti.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."}),Qd=r.Object({config:Ti.properties.config,rateLimit:r.Union([Bd,r.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."}),ps=r.Object({id:r.String({description:"Unique identifier of this service. Use it with service detail and graph endpoints."}),serviceName:r.String({description:"OpenTelemetry service name observed in telemetry."}),serviceNamespace:r.Optional(r.String({description:"OpenTelemetry service namespace observed in telemetry."})),env:r.Optional(r.String({description:"Environment value observed for this service."})),teams:r.Array(HH,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:r.Array(KH,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:r.Array(zH,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:r.Array(YH,{description:"Programming languages observed for this service."}),runtimes:r.Array(VH,{description:"Runtime values observed for this service."}),serverProtocols:r.Array(FR,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:r.Array(FR,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:r.Array(QH,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:r.Array(WH,{description:"Cloud platforms this service is running on"}),cloudProviders:r.Array(ZH,{description:"Cloud providers this service is running on"}),lastSeenAt:A({description:"Most recent time Tsuga observed telemetry for this service."}),firstSeenAt:A({description:"First time Tsuga observed telemetry for this service."}),sources:r.Array(r.String(),{description:"Telemetry sources that contributed evidence for this service entry."}),additionalUserFields:r.Optional(r.Unsafe({type:"object",additionalProperties:!0,description:"Additional user-defined service metadata, when configured."})),logsCount24h:r.Number({description:"Number of logs observed for this service in the last 24 hours."}),errorLogsCount24h:r.Number({description:"Number of error logs observed for this service in the last 24 hours."}),tracesCount24h:r.Number({description:"Number of traces observed for this service in the last 24 hours."}),errorTracesCount24h:r.Number({description:"Number of error traces observed for this service in the last 24 hours."}),notificationTargets:r.Array(Ii,{description:"Notification targets attached to this service, used by adaptive notification rules to page its owners."}),createdAt:A({description:"Timestamp when Tsuga created this service catalog entry."}),updatedAt:A({description:"Timestamp when Tsuga last updated this service catalog entry."})}),cMe=d({tags:["service-catalog"],query:r.Object({...fe,clusterId:r.Optional(u())}),method:"GET",paginated:!0,url:`${Dt}/services`,response:r.Array(ps)}),XH=r.Object({spanKind:r.Enum(lx),count:r.Number()}),Wd=r.Object({...ps.properties,spanKindCounts:r.Array(XH),envs:r.Object({primaryEnv:r.String(),allEnvs:r.Array(r.String())})}),pMe=d({tags:["service-catalog"],query:r.Object({...fe,clusterId:r.Optional(u()),env:r.Optional(u())}),method:"GET",paginated:!0,url:`${Dt}/v2/services`,response:r.Array(Wd)}),JH=["serviceName","envs","lastDeploy","traceErrorRate","traceRequestRate","logErrorRate","logRequestRate","teams","api","frameworks","languages","pagingDestination"],e2=r.Object({searchQuery:r.Object({value:u({allowEmpty:!1,description:"Substring matched case-insensitively against service names."})},{description:"Text filter for service names."}),teams:_e(u({allowEmpty:!1}),{description:"Restrict results to services observed under any of these team names",maxItems:50}),envs:_e(u({allowEmpty:!1}),{description:"Restrict results to services observed in any of these environments",maxItems:50}),versions:_e(u({allowEmpty:!1}),{description:"Restrict results to services whose latest observed version is one of these",maxItems:50}),languages:_e(u({allowEmpty:!1}),{description:"Restrict results to services written in any of these languages",maxItems:50}),hasRecentData:r.Boolean({description:"When true, only return services that received logs or traces in the last 24 hours"})}),t2=r.Partial(r.Object({...fe,clusterId:u(),filters:r.Partial(e2,{description:"Optional filters applied to narrow the returned services"}),sort:r.Object({by:r.Enum(JH,{description:"Field to sort the returned services by"}),direction:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned services"})})),uMe=d({tags:["service-catalog"],url:`${Dt}/v2/services/query`,method:"POST",paginated:!0,body:t2,response:r.Array(Wd)}),lMe=d({tags:["service-catalog"],query:r.Object({serviceName:u({allowEmpty:!1}),serviceNamespace:r.Optional(u({allowEmpty:!1})),env:u({allowEmpty:!1}),clusterId:r.Optional(u())}),method:"GET",url:`${Dt}/v2/service`,response:Wd}),mMe=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId`,params:r.Object({serviceId:u()}),response:ps}),dMe=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId/targets`,params:r.Object({serviceId:u()}),response:r.Array(Ii)}),fMe=d({tags:["service-catalog"],method:"POST",url:`${Dt}/services/:serviceId/targets`,params:r.Object({serviceId:u()}),body:Vd,response:Ii}),gMe=d({tags:["service-catalog"],method:"PUT",url:`${Dt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:u(),targetId:u()}),body:Qd,response:Ii}),hMe=d({tags:["service-catalog"],method:"DELETE",url:`${Dt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:u(),targetId:u()}),response:N}),r2=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var qR=r.Object({id:r.String(),hostName:r.String(),env:r.Optional(r.String()),cpuUtilizationAverage:r.Number(),hostType:r.Enum(r2),teams:r.Array(r.String()),tags:r.Array(r.String()),firstSeenAt:A(),lastSeenAt:A(),clusterId:r.String()}),yMe=d({tags:["service-catalog"],method:"GET",url:`${Dt}/hosts`,response:r.Array(qR)}),TMe=d({tags:["service-catalog"],method:"GET",url:`${Dt}/hosts/:hostId`,params:r.Object({hostId:u()}),response:qR}),n2=["http","rpc","messaging","genai","object_store"],BR={name:r.String({description:"Service or inferred dependency name shown in the graph."}),env:r.Optional(r.String({description:"Environment observed from spans."}))},Zd=r.Object({...BR,nodeType:r.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:r.Union([r.String(),r.Null()],{description:"Service ID, or null when multiple namespaces match the observed service name."}),namespace:r.Union([r.String(),r.Null()],{description:"Service namespace, or null when multiple namespaces match the observed service name."}),errorRate:r.Optional(r.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."})),entryErrorRequestCount:r.Number({description:"Number of entry requests on this service where at least one entry span had error status."}),entryRequestCount:r.Number({description:"Number of entry requests observed on this service, counted 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."})}),HR={...BR,endpoint:r.Optional(r.String({description:"Inferred service endpoint address"})),resourceName:r.Optional(r.String({description:"Inferred resource name, e.g. table or queue name"}))},Xd=r.Object({...HR,nodeType:r.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:r.Literal("db",{description:"Inferred dependency type. Always `db` for this node variant."}),databaseName:r.Optional(r.String({description:"Database name from span_attributes db.namespace (falling back to legacy db.name). Matches the database catalog `name`."})),databaseSystem:r.String({description:"Database system from span_attributes db.system.name (falling back to legacy db.system). Matches the database catalog `databaseSystem`."})}),Jd=r.Object({...HR,nodeType:r.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:r.Enum(n2,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),o2=C("nodeType",[Zd,Xd,Jd]),ef=r.Object({from:r.Object({env:r.Optional(r.String({description:"Environment of the source node"})),name:r.String({description:"Name of the source node"})},{description:"Reference to the caller node, i.e. the service or dependency that issued the request."}),to:r.Object({env:r.Optional(r.String({description:"Environment of the target node"})),name:r.String({description:"Name of the target node"}),databaseSystem:r.Optional(r.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:r.Number({description:"Number of cross-service transitions observed on this directed edge in the graph query window."}),errorRate:r.Optional(r.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."})),errorCount:r.Number({description:"Number of client spans with error status observed on this edge"}),clientSpanCount:r.Number({description:"Number of client spans observed on this edge"})},{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."}),EMe=d({tags:["service-catalog"],url:`${Dt}/services/:serviceId/graph`,method:"GET",params:r.Object({serviceId:u()}),query:r.Object({...at.properties,query:r.Optional(u({type:"tsuga-query"}))}),response:r.Object({clusterId:r.String(),nodes:r.Array(o2),edges:r.Array(ef)})}),i2=r.Object({monitors:r.Array(r.Object({id:r.String({description:"Identifier of the monitor"}),name:r.String({description:"Display name of the monitor"}),owner:r.String({description:"Team ID that owns the monitor"}),priority:r.Enum(St,{description:"Priority of the monitor"})})),slos:r.Array(r.Object({id:r.String({description:"Identifier of the SLO"}),name:r.String({description:"Display name of the SLO"}),owner:r.String({description:"Team ID that owns the SLO"}),statusCount:r.Partial(r.Record(du,r.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"})}))}),_Me=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId/related-resources`,params:r.Object({serviceId:u()}),response:i2}),IMe=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/by-api-keys`,response:r.Record(r.String(),r.Array(r.Object({serviceName:r.String(),serviceNamespace:r.Optional(r.String())})))});var hu=`/${"v1"}/services`,tf=r.Pick(ps,["id","serviceName","serviceNamespace","env","teams","versions","languages","runtimes","serverProtocols","clientProtocols","frameworks","cloudPlatforms","cloudProviders","lastSeenAt","firstSeenAt","sources","logsCount24h","errorLogsCount24h","tracesCount24h","errorTracesCount24h"],{$id:"Service",description:"Service inferred from telemetry, with observed metadata, activity counts, and version signals. See [Services](/documentation/categorize/services/index)."}),a2={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",sources:["logs","metrics","traces"],logsCount24h:12e3,errorLogsCount24h:42,tracesCount24h:8500,errorTracesCount24h:17};Object.assign(tf,{examples:[a2]});var KR=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:hu,method:"GET",paginated:!0,query:r.Object({...Ze,clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Omit to use the first cluster in the organization; this does not query all clusters."}))},{description:"Service list query. Use pagination and optional cluster scope."}),response:r.Array(tf)}),zR=d({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${hu}/:serviceId`,method:"GET",params:r.Object({serviceId:u({allowEmpty:!1,description:"Identifier of the service to retrieve. Use the `id` returned by service list responses."})}),response:tf}),s2=r.Pick(Zd,["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."}),c2=r.Pick(Jd,["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."}),p2=r.Pick(Xd,["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."}),u2=C("nodeType",[s2,p2,c2]),l2=r.Pick(ef,["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."}),m2=r.Optional(r.Integer({...at.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."})),d2=r.Optional(r.Integer({...at.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."})),f2=u({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."}),YR=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:`${hu}/:serviceId/graph`,method:"GET",params:r.Object({serviceId:u({allowEmpty:!1,description:"Identifier of the service to use as the graph root. Use the `id` returned by service list or get responses."})}),query:r.Object({from:m2,to:d2,query:r.Optional(f2)},{description:"Service graph query. Use time range and optional span query filters."}),response:r.Object({clusterId:r.String({description:"Cluster ID the graph was built from"}),nodes:r.Array(u2,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:r.Array(l2,{description:"Directed dependency edges between graph nodes."})})}),yu=`${hu}/:serviceId/notification-targets`,Tu=r.Pick(Ii,["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)."}),rf={rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}},g2={id:"789-abc-def",serviceId:"123-456-abc",...rf};Object.assign(Tu,{examples:[g2]});var Eu=u({allowEmpty:!1,description:"Identifier of the service the notification target belongs to. Use the `id` returned by service list or get responses."}),UMe=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:yu,method:"GET",params:r.Object({serviceId:Eu}),response:r.Array(Tu)}),h2=r.Pick(Vd,["config","rateLimit"],{description:"Service notification target create request. Provide the delivery destination and an optional per-target rate limit.",examples:[rf]}),y2=r.Pick(Qd,["config","rateLimit"],{description:"Service notification target update request. The submitted destination and rate limit overwrite the stored ones.",examples:[rf]}),wMe=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:yu,method:"POST",params:r.Object({serviceId:Eu}),body:h2,response:Tu}),vMe=d({description:"Updates one notification target attached to a service.",operationId:"updateServiceNotificationTarget",tags:["services"],url:`${yu}/:targetId`,method:"PUT",params:r.Object({serviceId:Eu,targetId:u({allowEmpty:!1,description:"Identifier of the notification target to update. Use the `id` returned by service notification target list or create responses."})}),body:y2,response:Tu}),NMe=d({description:"Detaches a notification target from a service. Notification rules stop paging this destination for the service.",operationId:"deleteServiceNotificationTarget",tags:["services"],url:`${yu}/:targetId`,method:"DELETE",params:r.Object({serviceId:Eu,targetId:u({allowEmpty:!1,description:"Identifier of the notification target to delete. Use the `id` returned by service notification target list or create responses."})}),response:N});var Ge=" (unix seconds, ISO 8601, or relative like -1h/-30m/now)";function VR(e,t){let n=t??jr(e);return n===void 0?void 0:Ic(n)}function nf(e){let t=jr(e);return t===void 0?"":` (default: ${t})`}function QR(e,t){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${Ge}${nf("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${nf("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${nf("query")}`).action(async(o,i)=>{let a={},c=VR("from",i.from),l=VR("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 t()(YR,{params:{serviceId:o},query:a});ee(m)})}var T2=`/${"v1"}/grok`,E2=25,_2=100,WR=r.Object({rules:r.Array(u({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:E2,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:r.Array(u({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:_2,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."}),I2={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(WR,{examples:[I2]});var ZR=r.Object({results:r.Array(r.Object({sample:r.String({description:"Echo of the submitted log line, so results can be matched to the samples in the request."}),matched:r.Boolean({description:"Whether any submitted rule matched this sample. `true` means `extracted` contains the captured fields; `false` means no rule matched."}),extracted:r.Union([r.Record(r.String(),r.Unknown()),r.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."}),b2={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(ZR,{examples:[b2]});var XR=d({url:`${T2}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:WR,response:ZR,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`."});var JR=rn(require("node:fs"));function bi(e){if(e.file){let t=JR.default.readFileSync(e.file==="-"?0:e.file,"utf-8");return JSON.parse(t)}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 of(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>s.IsObject(t)&&s.HasPropertyKey(t,"check")&&s.HasPropertyKey(t,"error")&&s.IsFunction(t.check)&&s.IsFunction(t.error))}function ar(e){return s.IsObject(e)&&!s.IsArray(e)}function _u(e){return s.IsBoolean(e)}function F(e){return ar(e)||_u(e)}function af(e){return s.HasPropertyKey(e,"additionalItems")&&F(e.additionalItems)}function Kr(e){return s.HasPropertyKey(e,"additionalProperties")&&F(e.additionalProperties)}function sf(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(t=>F(t))}function us(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function cf(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>F(t))}function pf(e){return s.HasPropertyKey(e,"const")}function mo(e){return s.HasPropertyKey(e,"contains")&&F(e.contains)}function Ht(e){return s.HasPropertyKey(e,"default")}function uf(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(t=>F(t)||s.IsArray(t)&&t.every(n=>s.IsString(n)))}function lf(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>s.IsArray(t)&&t.every(n=>s.IsString(n)))}function mf(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>F(t))}function On(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function df(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function ff(e){return s.HasPropertyKey(e,"else")&&F(e.else)}function gf(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function hf(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function zr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function ls(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Yr(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function yf(e){return s.HasPropertyKey(e,"if")&&F(e.if)}function Si(e){return s.HasPropertyKey(e,"items")&&(F(e.items)||s.IsArray(e.items)&&e.items.every(t=>F(t)))}function Tf(e){return Si(e)&&s.IsArray(e.items)}function Ef(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function _f(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function Iu(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function If(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function bf(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function Vr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function fo(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function Ai(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function ms(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function ds(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 Af(e){return s.HasPropertyKey(e,"not")&&F(e.not)}function Of(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>F(t))}function fs(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function gs(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>F(t))}function Oi(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>F(t))}function hs(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>F(t))}function xf(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||F(e.propertyNames))}function S2(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function bu(e){return S2(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function Rf(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function Cf(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function go(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function Pf(e){return s.HasPropertyKey(e,"then")&&F(e.then)}function Uf(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function xi(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Su(e){return s.HasPropertyKey(e,"unevaluatedItems")&&F(e.unevaluatedItems)}function Au(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&F(e.unevaluatedProperties)}var xt=class{constructor(){let t=new Set,n=new Set;this.stack=[{indices:t,keys:n}]}Push(){let t=new Set,n=new Set;return this.stack.push({indices:t,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(t){return this.GetIndices().add(t),!0}AddKey(t){return this.GetKeys().add(t),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(t){for(let n of t)n.GetIndices().forEach(o=>this.GetIndices().add(o)),n.GetKeys().forEach(o=>this.GetKeys().add(o));return!0}},ys=class extends xt{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}},st=class extends ys{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}};function eC(e,t,n,o){return s.Every(n["~refine"],0,(i,a)=>i.check(o))}function tC(e,t,n,o,i,a){return s.EveryAll(i["~refine"],0,(c,l)=>c.check(a)||t.AddError({keyword:"~refine",schemaPath:n,instancePath:o,params:{index:l,message:c.error(a)}}))}function rC(e){return Si(e)&&s.IsArray(e.items)}function nC(e,t,n,o){return rC(n)?s.Every(o,0,(a,c)=>s.IsLessThan(c,n.items.length)||Kt(e,t,n.additionalItems,a)&&t.AddIndex(c)):!0}function oC(e,t,n,o,i,a){return rC(i)?s.Every(a,0,(l,m)=>{let f=`${n}/additionalItems`,h=`${o}/${m}`;return s.IsLessThan(m,i.items.length)||zt(e,t,f,h,i.additionalItems,l)&&t.AddIndex(m)}):!0}function A2(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function iC(e){let t=[];return gs(e)&&t.push(...s.Keys(e.patternProperties)),hs(e)&&t.push(...s.Keys(e.properties).map(A2)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function aC(e,t,n,o){let i=new RegExp(iC(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||Kt(e,t,n.additionalProperties,o[c])&&t.AddKey(c))}function sC(e,t,n,o,i,a){let c=new RegExp(iC(i)),l=[];return s.EveryAll(s.Keys(a),0,(f,h)=>{let E=`${n}/additionalProperties`,I=`${o}/${f}`,g=new st,T=c.test(f)||zt(e,g,E,I,i.additionalProperties,a[f])&&t.AddKey(f);return T||l.push(f),T})||t.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:o,params:{additionalProperties:l}})}function cC(e,t,n,o){let i=n.allOf.reduce((a,c)=>{let l=new xt;return ne(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,n.allOf.length)&&t.Merge(i)}function pC(e,t,n,o,i,a){let c=[],l=i.allOf.reduce((f,h,E)=>{let I=`${n}/allOf/${E}`,g=new st,T=Ie(e,g,I,o,h,a);return T||c.push(g),T?[...f,g]:f},[]),m=s.IsEqual(l.length,i.allOf.length)&&t.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>t.AddError(h))),m}function uC(e,t,n,o){let i=n.anyOf.reduce((a,c)=>{let l=new xt;return ne(e,l,c,o)?[...a,l]:a},[]);return s.IsGreaterThan(i.length,0)&&t.Merge(i)}function lC(e,t,n,o,i,a){let c=[],l=i.anyOf.reduce((f,h,E)=>{let I=new st,g=`${n}/anyOf/${E}`,T=Ie(e,I,g,o,h,a);return T||c.push(I),T?[...f,I]:f},[]),m=s.IsGreaterThan(l.length,0)&&t.Merge(l);return m||c.forEach(f=>f.GetErrors().forEach(h=>t.AddError(h))),m||t.AddError({keyword:"anyOf",schemaPath:n,instancePath:o,params:{}})}function vf(e,t,n,o){return n}function mC(e,t,n,o,i,a){return vf(e,t,i,a)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function Nf(e,t,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function dC(e,t,n,o,i,a){return Nf(e,t,i,a)||t.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function O2(e){return!(fo(e)&&s.IsEqual(e.minContains,0))}function Lf(e,t,n,o){return O2(n)?!s.IsEqual(o.length,0)&&s.SomeAll(o,(i,a)=>ne(e,t,n.contains,i)&&t.AddIndex(a)):!0}function fC(e,t,n,o,i,a){return Lf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function gC(e,t,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)):ne(e,t,l,o)));return i||a}function hC(e,t,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)||t.AddError({keyword:"dependencies",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})):Ie(e,t,h,o,f,a))});return c||l}function yC(e,t,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 TC(e,t,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)||t.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:o,params:{property:m,dependencies:f}})));return c||l}function EC(e,t,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)||ne(e,t,l,o));return i||a}function _C(e,t,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)||Ie(e,t,h,o,f,a)});return c||l}function IC(e,t,n,o){let i=e.DynamicRef(n)??!1;return F(i)&&ne(e,t,i,o)}function bC(e,t,n,o,i,a){let c=e.DynamicRef(i)??!1;return F(c)&&Ie(e,t,"#",o,c,a)}function Df(e,t,n,o){return s.Some(n.enum,i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function SC(e,t,n,o,i,a){return Df(e,t,i,a)||t.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function Gf(e,t,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function AC(e,t,n,o,i,a){return Gf(e,t,i,a)||t.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function $f(e,t,n,o){return s.IsGreaterThan(o,n.exclusiveMinimum)}function OC(e,t,n,o,i,a){return $f(e,t,i,a)||t.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var Ui={};Yt(Ui,{Clear:()=>MC,Entries:()=>uK,Get:()=>dK,Has:()=>mK,IsDate:()=>Ci,IsDateTime:()=>Ou,IsDuration:()=>xu,IsEmail:()=>Ru,IsHostname:()=>Pu,IsIPv4:()=>vu,IsIPv6:()=>Nu,IsIdnEmail:()=>Uu,IsIdnHostname:()=>wu,IsIri:()=>ku,IsIriReference:()=>Lu,IsJsonPointer:()=>Du,IsJsonPointerUriFragment:()=>Mu,IsRegex:()=>Gu,IsRelativeJsonPointer:()=>$u,IsTime:()=>Pi,IsUri:()=>Bu,IsUriReference:()=>ju,IsUriTemplate:()=>Fu,IsUrl:()=>Hu,IsUuid:()=>Ku,Reset:()=>DC,Set:()=>lK,Test:()=>fK});var x2=[0,31,28,31,30,31,30,31,31,30,31,30,31],R2=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function C2(e){return e%4===0&&(e%100!==0||e%400===0)}function Ci(e){let t=R2.exec(e);if(!t)return!1;let n=+t[1],o=+t[2],i=+t[3];return o>=1&&o<=12&&i>=1&&i<=(o===2&&C2(n)?29:x2[o])}var P2=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Pi(e,t=!0){let n=P2.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||t&&!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 Ou(e,t=!0){let n=e.split(/T/i);return n.length===2&&Ci(n[0])&&Pi(n[1],t)}var U2=/^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 xu(e){return U2.test(e)}var w2=/^(?!.*\.\.)[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 Ru(e){return w2.test(e)}var ho=36,Cu=1,jf=26,v2=38,N2=700,L2=72,k2=128;function M2(e,t,n){e=n?Math.floor(e/N2):e>>1,e+=Math.floor(e/t);let o=0;for(;e>(ho-Cu)*jf>>1;)e=Math.floor(e/(ho-Cu)),o+=ho;return o+Math.floor((ho-Cu+1)*e/(e+v2))}function xC(e){let t=[],n=k2,o=0,i=L2,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");t.push(m)}let c=a<0?0:a+1;for(;c<e.length;){let l=o,m=1,f=ho;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)ge();else throw new Error("Invalid punycode: bad digit character");o+=I*m;let g=f<=i?Cu:f>=i+jf?jf:f-i;if(I<g)break;m*=ho-g,f+=ho}let h=t.length+1;i=M2(o-l,h,l===0),n+=Math.floor(o/h),o%=h,t.splice(o,0,n),o++}return globalThis.String.fromCodePoint(...t)}function G2(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function $2(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function j2(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function F2(e){return G2(e)||$2(e)||j2(e)}var q2=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),B2=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 H2(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function K2(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function z2(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function Y2(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function V2(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function Q2(e){return e>=1632&&e<=1641}function W2(e){return e>=1776&&e<=1785}function RC(e){return B2.has(e)}function CC(e){if(e.length===0)return ge();let t=[...e].map(c=>c.codePointAt(0)),n=t.length;if(t[0]===45||t[n-1]===45||n>=4&&t[2]===45&&t[3]===45||F2(t[0]))return!1;let o=!1,i=!1,a=!1;for(let c=0;c<n;c++){let l=t[c];if(q2.has(l))return!1;(z2(l)||Y2(l)||V2(l))&&(o=!0),Q2(l)&&(i=!0),W2(l)&&(a=!0);let m=t[c-1],f=t[c+1];switch(l){case 183:if(m!==108||f!==108)return!1;break;case 885:if(f===void 0||!H2(f))return!1;break;case 1523:case 1524:if(m===void 0||!K2(m))return!1;break;case 8204:if(m===void 0||m<128&&!RC(m))return!1;break;case 8205:if(m===void 0||!RC(m))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o||i&&a)}function Z2(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 t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45))return!1}return!0}function PC(e){return e.toLowerCase().startsWith("xn--")}function UC(e){try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let o=xC(t);return o?CC(o):!1}catch{return!1}}function wC(e){return e.length===0||e.length>63?!1:PC(e)?UC(e):CC(e)}function vC(e){return e.length===0||e.length>63?!1:PC(e)?UC(e):Z2(e)}function Pu(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(let t of e.split("."))if(!vC(t))return!1;return!0}var J2=/^(?!.*\.\.)[\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 Uu(e){return J2.test(e)}function wu(e){if(e.length===0||e.includes(" "))return!1;let t=e.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".");if(t.length>253)return!1;for(let n of t.split("."))if(!wC(n))return!1;return!0}function Ff(e,t,n){let o=0,i=0,a=0,c=0;for(let l=t;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 vu(e){return Ff(e,0,e.length)}function eK(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Nu(e){let t=e.length;if(t===0)return!1;let n=0,o=!1,i=0;if(e.charCodeAt(0)===58&&e.charCodeAt(1)===58){if(t===2)return!0;o=!0,i=2}for(;i<t;){let a=0,c=i;for(;i<t&&eK(e.charCodeAt(i));)i++,a++;if(a===0)return!1;let l=e.charCodeAt(i);if(l===46){if(!Ff(e,c,t))return!1;n+=2,i=t;break}if(a>4)return!1;if(n++,i===t)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===t)break}}return o?n<=7:n===8}function NC(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function Lu(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 t=e.indexOf(":");return t>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,t))?NC(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:NC(e)}function ku(e){try{return new URL(e),!0}catch{return!1}}var tK=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Mu(e){return tK.test(e)}var rK=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function Du(e){return rK.test(e)}function Gu(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var nK=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function $u(e){return nK.test(e)}var oK=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function ju(e){return oK.test(e)}var iK=/^(?:(?:[^\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 Fu(e){return iK.test(e)}function LC(e){return e>=97&&e<=122||e>=65&&e<=90}function kC(e){return LC(e)||e>=48&&e<=57}function qu(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function aK(e){return kC(e)||e===43||e===45||e===46}function qf(e){return kC(e)||e===45||e===46||e===95||e===126}function Bf(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 sK(e){return qf(e)||Bf(e)||e===58||e===64}function Bu(e){let t=e.length;if(t===0||!LC(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){let o=e.charCodeAt(n);if(o===58)break;if(!aK(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<t;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||!qu(e.charCodeAt(a+1))||!qu(e.charCodeAt(a+2)))return!1;a+=2}else if(!qf(c)&&!Bf(c)&&c!==58)return!1}n=i+1}if(e.charCodeAt(n)===91){for(n++;n<t&&e.charCodeAt(n)!==93;)n++;if(e.charCodeAt(n)!==93)return!1;n++}else for(;n<t;){let a=e.charCodeAt(n);if(a===47||a===63||a===35||a===58)break;if(a<128&&!qf(a)&&!Bf(a))return!1;n++}if(e.charCodeAt(n)===58)for(n++;n<t;){let a=e.charCodeAt(n);if(a===47||a===63||a===35)break;if(a<48||a>57)return!1;n++}}for(;n<t;){let o=e.charCodeAt(n);if(o===37){if(n+2>=t||!qu(e.charCodeAt(n+1))||!qu(e.charCodeAt(n+2)))return!1;n+=2}else{if(o>127)return!1;if(!(sK(o)||o===47||o===63||o===35))return!1}n++}return!0}var cK=/^(?: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 Hu(e){return cK.test(e)}var pK=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Ku(e){return pK.test(e)}var Oe=new Map;function MC(){Oe.clear()}function uK(){return[...Oe.entries()]}function lK(e,t){Oe.set(e,t)}function mK(e){return Oe.has(e)}function dK(e){return Oe.get(e)}function fK(e,t){return Oe.get(e)?.(t)??!0}function DC(){MC(),Oe.set("date-time",Ou),Oe.set("date",Ci),Oe.set("duration",xu),Oe.set("email",Ru),Oe.set("hostname",Pu),Oe.set("idn-email",Uu),Oe.set("idn-hostname",wu),Oe.set("ipv4",vu),Oe.set("ipv6",Nu),Oe.set("iri-reference",Lu),Oe.set("iri",ku),Oe.set("json-pointer-uri-fragment",Mu),Oe.set("json-pointer",Du),Oe.set("regex",Gu),Oe.set("relative-json-pointer",$u),Oe.set("time",Pi),Oe.set("uri-reference",ju),Oe.set("uri-template",Fu),Oe.set("uri",Bu),Oe.set("url",Hu),Oe.set("uuid",Ku)}DC();function Hf(e,t,n,o){return Ui.Test(n.format,o)}function GC(e,t,n,o,i,a){return Hf(e,t,i,a)||t.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function $C(e,t,n,o){let i=Pf(n)?n.then:!0,a=ff(n)?n.else:!0;return ne(e,t,n.if,o)?ne(e,t,i,o):ne(e,t,a,o)}function jC(e,t,n,o,i,a){let c=Pf(i)?i.then:!0,l=ff(i)?i.else:!0,m=new st,f=Ie(e,m,`${n}/if`,o,i.if,a)?Ie(e,m,`${n}/then`,o,c,a)||t.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"then"}}):Ie(e,t,`${n}/else`,o,l,a)||t.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"else"}});return f&&t.Merge([m]),f}function gK(e,t,n,o){return s.Every(n.items,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Kt(e,t,i,o[a])&&t.AddIndex(a))}function hK(e,t,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,t,m,f,c,a[l])&&t.AddIndex(l)})}function yK(e,t,n,o){let i=Oi(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>Kt(e,t,n.items,a)&&t.AddIndex(c))}function TK(e,t,n,o,i,a){let c=Oi(i)?i.prefixItems.length:0;return s.EveryAll(a,c,(l,m)=>{let f=`${n}/items`,h=`${o}/${m}`;return zt(e,t,f,h,i.items,l)&&t.AddIndex(m)})}function FC(e,t,n,o){return Tf(n)?gK(e,t,n,o):yK(e,t,n,o)}function qC(e,t,n,o,i,a){return Tf(i)?hK(e,t,n,o,i,a):TK(e,t,n,o,i,a)}function EK(e){return mo(e)}function Kf(e,t,n,o){if(!EK(n))return!0;let i=s.Counted(o,a=>ne(e,t,n.contains,a));return s.IsLessEqualThan(i,n.maxContains)}function BC(e,t,n,o,i,a){let c=fo(i)?i.minContains:1;return Kf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function zf(e,t,n,o){return s.IsLessEqualThan(o,n.maximum)}function HC(e,t,n,o,i,a){return zf(e,t,i,a)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function Yf(e,t,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function KC(e,t,n,o,i,a){return Yf(e,t,i,a)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function Vf(e,t,n,o){return s.IsMaxLength(o,n.maxLength)}function zC(e,t,n,o,i,a){return Vf(e,t,i,a)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function Qf(e,t,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function YC(e,t,n,o,i,a){return Qf(e,t,i,a)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function _K(e){return mo(e)}function Wf(e,t,n,o){if(!_K(n))return!0;let i=s.Counted(o,(a,c)=>ne(e,t,n.contains,a)&&t.AddIndex(c));return s.IsGreaterEqualThan(i,n.minContains)}function VC(e,t,n,o,i,a){return Wf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function Zf(e,t,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function QC(e,t,n,o,i,a){return Zf(e,t,i,a)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function Xf(e,t,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function WC(e,t,n,o,i,a){return Xf(e,t,i,a)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function Jf(e,t,n,o){return s.IsMinLength(o,n.minLength)}function ZC(e,t,n,o,i,a){return Jf(e,t,i,a)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function eg(e,t,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function XC(e,t,n,o,i,a){return eg(e,t,i,a)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function tg(e,t,n,o){return s.IsMultipleOf(o,n.multipleOf)}function JC(e,t,n,o,i,a){return tg(e,t,i,a)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function rg(e,t,n,o){let i=new xt;return!ne(e,i,n.not,o)&&t.Merge([i])}function eP(e,t,n,o,i,a){return rg(e,t,i,a)||t.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function tP(e,t,n,o){let i=n.oneOf.reduce((a,c)=>{let l=new xt;return ne(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,1)&&t.Merge(i)}function rP(e,t,n,o,i,a){let c=[],l=[],m=i.oneOf.reduce((h,E,I)=>{let g=new st,T=`${n}/oneOf/${I}`,S=Ie(e,g,T,o,E,a);return S&&l.push(I),S||c.push(g),S?[...h,g]:h},[]),f=s.IsEqual(m.length,1)&&t.Merge(m);return!f&&s.IsEqual(l.length,0)&&c.forEach(h=>h.GetErrors().forEach(E=>t.AddError(E))),f||t.AddError({keyword:"oneOf",schemaPath:n,instancePath:o,params:{passingSchemas:l}})}function ng(e,t,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(o)}function nP(e,t,n,o,i,a){return ng(e,t,i,a)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function oP(e,t,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)||Kt(e,t,a,m)&&t.AddKey(l))})}function iP(e,t,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,t,m,I,l,E)&&t.AddKey(h)})})}function aP(e,t,n,o){return s.IsEqual(o.length,0)||s.Every(n.prefixItems,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Kt(e,t,i,o[a])&&t.AddIndex(a))}function sP(e,t,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,t,m,f,c,a[l])&&t.AddIndex(l)})}function og(e,t){return e.includes(t)||rt.Get().exactOptionalPropertyTypes}function ig(e,t){return s.IsUndefined(e[t])}function cP(e,t,n,o){let i=go(n)?n.required:[];return s.Every(s.Entries(n.properties),0,([c,l])=>{let m=!s.HasPropertyKey(o,c)||Kt(e,t,l,o[c])&&t.AddKey(c);return og(i,c)?m:ig(o,c)||m})}function pP(e,t,n,o,i,a){let c=go(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,t,h,E,f,a[m])&&t.AddKey(m);return og(c,m)?I():ig(a,m)||I()})}function uP(e,t,n,o){return s.Every(s.Keys(o),0,(i,a)=>ne(e,t,n.propertyNames,i))}function lP(e,t,n,o,i,a){let c=[];return s.EveryAll(s.Keys(a),0,(m,f)=>{let h=`${o}/${m}`,E=`${n}/propertyNames`,I=new st,g=Ie(e,I,E,h,i.propertyNames,m);return g||c.push(m),g})||t.AddError({keyword:"propertyNames",schemaPath:n,instancePath:o,params:{propertyNames:c}})}function mP(e,t,n,o){let i=e.RecursiveRef(n)??!1;return F(i)&&ne(e,t,i,o)}function dP(e,t,n,o,i,a){let c=e.RecursiveRef(i)??!1;return F(c)&&Ie(e,t,"#",o,c,a)}function fP(e,t,n,o){let i=e.Ref(n)??!1,a=new xt,c=F(i)&&ne(e,a,i,o);return c&&t.Merge([a]),c}function gP(e,t,n,o,i,a){let c=e.Ref(i)??!1,l=new st,m=F(c)&&Ie(e,l,"#",o,c,a);return m&&t.Merge([l]),m||l.GetErrors().forEach(f=>t.AddError(f)),m}function hP(e,t,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function yP(e,t,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})||t.AddError({keyword:"required",schemaPath:n,instancePath:o,params:{requiredProperties:c}})}function ag(e,t,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 TP(e,t,n,o,i){return s.Some(n,a=>ag(e,t,a,o,i))}function EP(e,t,n,o){return s.IsArray(n.type)?TP(e,t,n.type,n,o):ag(e,t,n.type,n,o)}function _P(e,t,n,o,i,a){return(s.IsArray(i.type)?TP(e,t,i.type,i,a):ag(e,t,i.type,i,a))||t.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function IP(e,t,n,o){let i=t.GetIndices();return s.Every(o,0,(a,c)=>(i.has(c)||ne(e,t,n.unevaluatedItems,a))&&t.AddIndex(c))}function bP(e,t,n,o,i,a){let c=t.GetIndices(),l=[];return s.EveryAll(a,0,(f,h)=>{let E=new st,I=(c.has(h)||Ie(e,E,n,o,i.unevaluatedItems,f))&&t.AddIndex(h);return I||l.push(h),I})||t.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:o,params:{unevaluatedItems:l}})}function SP(e,t,n,o){let i=t.GetKeys();return s.Every(s.Entries(o),0,([a,c])=>i.has(a)||ne(e,t,n.unevaluatedProperties,c)&&t.AddKey(a))}function AP(e,t,n,o,i,a){let c=t.GetKeys(),l=[];return s.EveryAll(s.Entries(a),0,([f,h])=>{let E=new st,I=c.has(f)||Ie(e,E,n,o,i.unevaluatedProperties,h)&&t.AddKey(f);return I||l.push(f),I})||t.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function OP(e){return!s.IsEqual(e.uniqueItems,!1)}function xP(e,t,n,o){if(!OP(n))return!0;let i=new Set(o.map(Hn.Hash)).size,a=o.length;return s.IsEqual(i,a)}function RP(e,t,n,o,i,a){if(!OP(i))return!0;let c=new Set,l=a.reduce((f,h,E)=>{let I=Hn.Hash(h);return c.has(I)?[...f,E]:(c.add(I),f)},[]);return s.IsEqual(l.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:o,params:{duplicateItems:l}})}function Kt(e,t,n,o){return t.Push()&&ne(e,t,n,o)&&t.Pop()}function ne(e,t,n,o){e.Push(n);let i=_u(n)?vf(e,t,n,o):(!Uf(n)||EP(e,t,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!go(n)||hP(e,t,n,o))&&(!Kr(n)||aC(e,t,n,o))&&(!uf(n)||gC(e,t,n,o))&&(!lf(n)||yC(e,t,n,o))&&(!mf(n)||EC(e,t,n,o))&&(!gs(n)||oP(e,t,n,o))&&(!hs(n)||cP(e,t,n,o))&&(!xf(n)||uP(e,t,n,o))&&(!ds(n)||eg(e,t,n,o))&&(!bf(n)||Qf(e,t,n,o)))&&(!s.IsArray(o)||(!af(n)||nC(e,t,n,o))&&(!mo(n)||Lf(e,t,n,o))&&(!Si(n)||FC(e,t,n,o))&&(!_f(n)||Kf(e,t,n,o))&&(!Iu(n)||Yf(e,t,n,o))&&(!fo(n)||Wf(e,t,n,o))&&(!Ai(n)||Xf(e,t,n,o))&&(!Oi(n)||aP(e,t,n,o))&&(!xi(n)||xP(e,t,n,o)))&&(!s.IsString(o)||(!If(n)||Vf(e,t,n,o))&&(!ms(n)||Jf(e,t,n,o))&&(!ls(n)||Hf(e,t,n,o))&&(!fs(n)||ng(e,t,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!hf(n)||Gf(e,t,n,o))&&(!zr(n)||$f(e,t,n,o))&&(!Ef(n)||zf(e,t,n,o))&&(!Vr(n)||Zf(e,t,n,o))&&(!Sf(n)||tg(e,t,n,o)))&&(!Cf(n)||fP(e,t,n,o))&&(!Rf(n)||mP(e,t,n,o))&&(!df(n)||IC(e,t,n,o))&&(!pf(n)||Nf(e,t,n,o))&&(!gf(n)||Df(e,t,n,o))&&(!yf(n)||$C(e,t,n,o))&&(!Af(n)||rg(e,t,n,o))&&(!sf(n)||cC(e,t,n,o))&&(!cf(n)||uC(e,t,n,o))&&(!Of(n)||tP(e,t,n,o))&&(!Su(n)||!s.IsArray(o)||IP(e,t,n,o))&&(!Au(n)||!s.IsObject(o)||SP(e,t,n,o))&&(!of(n)||eC(e,t,n,o));return e.Pop(n),i}function zt(e,t,n,o,i,a){return t.Push()&&Ie(e,t,n,o,i,a)&&t.Pop()}function Ie(e,t,n,o,i,a){e.Push(i);let c=_u(i)?mC(e,t,n,o,i,a):!!(+(!Uf(i)||_P(e,t,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!go(i)||yP(e,t,n,o,i,a))&+(!Kr(i)||sC(e,t,n,o,i,a))&+(!uf(i)||hC(e,t,n,o,i,a))&+(!lf(i)||TC(e,t,n,o,i,a))&+(!mf(i)||_C(e,t,n,o,i,a))&+(!gs(i)||iP(e,t,n,o,i,a))&+(!hs(i)||pP(e,t,n,o,i,a))&+(!xf(i)||lP(e,t,n,o,i,a))&+(!ds(i)||XC(e,t,n,o,i,a))&+(!bf(i)||YC(e,t,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!af(i)||oC(e,t,n,o,i,a))&+(!mo(i)||fC(e,t,n,o,i,a))&+(!Si(i)||qC(e,t,n,o,i,a))&+(!_f(i)||BC(e,t,n,o,i,a))&+(!Iu(i)||KC(e,t,n,o,i,a))&+(!fo(i)||VC(e,t,n,o,i,a))&+(!Ai(i)||WC(e,t,n,o,i,a))&+(!Oi(i)||sP(e,t,n,o,i,a))&+(!xi(i)||RP(e,t,n,o,i,a))))&+(!s.IsString(a)||!!(+(!If(i)||zC(e,t,n,o,i,a))&+(!ms(i)||ZC(e,t,n,o,i,a))&+(!ls(i)||GC(e,t,n,o,i,a))&+(!fs(i)||nP(e,t,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!hf(i)||AC(e,t,n,o,i,a))&+(!zr(i)||OC(e,t,n,o,i,a))&+(!Ef(i)||HC(e,t,n,o,i,a))&+(!Vr(i)||QC(e,t,n,o,i,a))&+(!Sf(i)||JC(e,t,n,o,i,a))))&+(!Cf(i)||gP(e,t,n,o,i,a))&+(!Rf(i)||dP(e,t,n,o,i,a))&+(!df(i)||bC(e,t,n,o,i,a))&+(!pf(i)||dC(e,t,n,o,i,a))&+(!gf(i)||SC(e,t,n,o,i,a))&+(!yf(i)||jC(e,t,n,o,i,a))&+(!Af(i)||eP(e,t,n,o,i,a))&+(!sf(i)||pC(e,t,n,o,i,a))&+(!cf(i)||lC(e,t,n,o,i,a))&+(!Of(i)||rP(e,t,n,o,i,a))&+(!Su(i)||!s.IsArray(a)||bP(e,t,n,o,i,a))&+(!Au(i)||!s.IsObject(a)||AP(e,t,n,o,i,a)))&&(!of(i)||tC(e,t,n,o,i,a));return e.Pop(i),c}var xn={};Yt(xn,{DynamicRef:()=>kK,Ref:()=>cg});var wi={};Yt(wi,{Delete:()=>CK,Get:()=>xK,Has:()=>OK,Indices:()=>_s,Set:()=>RK});function CP(e){if(e.length===0)throw Error("Cannot set root")}function PP(e){if(!s.IsObject(e))throw Error("Cannot set value")}function IK(e){if(s.IsUnsafePropertyKey(e))throw Error("Pointer contains unsafe property key")}function UP(e){for(let t of e)IK(t)}function bK(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 SK(e,t){return s.IsObject(t)&&s.HasPropertyKey(t,e)}function AK(e,t){return s.IsObject(t)&&!s.IsUnsafePropertyKey(e)?t[e]:void 0}function sg(e,t){return e.reduce((n,o)=>AK(o,n),t)}function _s(e){if(s.IsEqual(e.length,0))return[];let t=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return t.length>0&&t[0]===""?t.slice(1):t}function OK(e,t){let n=e;return _s(t).every(o=>SK(o,n)?(n=n[o],!0):!1)}function xK(e,t){let n=_s(t);return sg(n,e)}function RK(e,t,n){let o=_s(t);CP(o),UP(o);let[i,a]=wP(o),c=sg(i,e);return PP(c),c[a]=n,e}function CK(e,t){let n=_s(t);CP(n),UP(n);let[o,i]=wP(n),a=sg(o,e);return PP(a),s.IsArray(a)&&bK(i)?a.splice(+i,1):delete a[i],e}function PK(e,t,n){if(e.$id===n.hash)return e;let o=new URL(e.$id,t.href),i=new URL(n.href,t.href);if(s.IsEqual(o.pathname,i.pathname))return n.hash.startsWith("#")?vP(e,t,n):e}function UK(e,t,n){let o=new URL(`#${e.$anchor}`,t.href),i=new URL(n.href,t.href);return s.IsEqual(o.href,i.href)?e:void 0}function wK(e,t,n){let o=new URL(`#${e.$dynamicAnchor}`,t.href),i=new URL(n.href,t.href);return s.IsEqual(o.href,i.href)?e:void 0}function vP(e,t,n){if(n.href.endsWith("#"))return e;if(!n.hash.startsWith("#"))return;let o=decodeURIComponent(n.hash.slice(1));if(o.startsWith("/"))return wi.Get(e,o)}function vK(e,t,n){if(Yr(e)){let o=PK(e,t,n);if(!s.IsUndefined(o))return o}if(us(e)){let o=UK(e,t,n);if(!s.IsUndefined(o))return o}if(On(e)){let o=wK(e,t,n);if(!s.IsUndefined(o))return o}return vP(e,t,n)}function NK(e,t,n){return e.reduce((o,i)=>{let a=pg(i,t,n);return s.IsUndefined(a)?o:a},void 0)}function LK(e,t,n){return s.Keys(e).reduce((o,i)=>{let a=pg(e[i],t,n);return s.IsUndefined(a)?o:a},void 0)}function pg(e,t,n){let o=ar(e)&&Yr(e)?new URL(e.$id,t.href):t;if(ar(e)){let i=vK(e,o,n);if(!s.IsUndefined(i))return i}if(s.IsArray(e))return NK(e,o,n);if(s.IsObject(e))return LK(e,o,n)}function cg(e,t){let n=new URL("http://unknown/"),o=Yr(e)?new URL(e.$id,n.href):n,i=new URL(t,o.href);return pg(e,o,i)}function kK(e,t,n,o){let i=n.$dynamicRef.startsWith("#")?cg(t,n.$dynamicRef):cg(e,n.$dynamicRef);return s.IsUndefined(i)?void 0:!ar(i)||!On(i)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?i:o.find(l=>l.$dynamicAnchor===i.$dynamicAnchor)??i}var vi=function(e,t,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.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:t.get(e)},Rn,NP,LP,kP,MP,yo=class{constructor(t,n){Rn.add(this),this.context=t,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((t,n)=>new URL(n.$id,t),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(t){ar(t)&&(Yr(t)&&(this.ids.push(t),vi(this,Rn,"m",NP).call(this,t)),us(t)&&this.anchors.push(t),bu(t)&&this.recursiveAnchors.push(t),On(t)&&this.dynamicAnchors.push(t))}Pop(t){ar(t)&&(Yr(t)&&(this.ids.pop(),vi(this,Rn,"m",LP).call(this,t)),us(t)&&this.anchors.pop(),bu(t)&&this.recursiveAnchors.pop(),On(t)&&this.dynamicAnchors.pop())}Ref(t){return vi(this,Rn,"m",kP).call(this,t)??vi(this,Rn,"m",MP).call(this,t)}RecursiveRef(t){return bu(this.Base())?xn.Ref(this.recursiveAnchors[0],t.$recursiveRef):xn.Ref(this.Base(),t.$recursiveRef)}DynamicRef(t){let n=this.schema;return xn.DynamicRef(n,this.Base(),t,this.dynamicAnchors)}};Rn=new WeakSet,NP=function e(t,n=!0){if(!ar(t))return;let o=t;if(!(!n&&Yr(o))){!n&&On(o)&&this.dynamicAnchors.push(o);for(let i of s.Keys(o))vi(this,Rn,"m",e).call(this,o[i],!1)}},LP=function e(t,n=!0){if(!ar(t))return;let o=t;if(!(!n&&Yr(o))){!n&&On(o)&&this.dynamicAnchors.pop();for(let i of s.Keys(o))vi(this,Rn,"m",e).call(this,o[i],!1)}},kP=function(t){return s.HasPropertyKey(this.context,t.$ref)?this.context[t.$ref]:void 0},MP=function(t){let n=this.schema;return t.$ref.startsWith("#")?xn.Ref(this.Base(),t.$ref):xn.Ref(n,t.$ref)};function zu(...e){let[t,n,o]=oe.Match(e,{3:(h,E,I)=>[h,E,I],2:(h,E)=>[{},h,E]}),i=rt.Get(),a=rT(),c=[],l=new yo(t,n),m=new ys(h=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...h,message:a(h)})});return[Ie(l,m,"#","",n,o),c]}function lg(...e){let[t,n,o]=oe.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),i=new yo(t,n),a=new xt;return ne(i,a,n,o)}function he(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return lg(t,n,o)}function Cn(...e){let[t,n,o]=oe.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),[i,a]=zu(t,n,o);return a}var Pn=class extends Error{constructor(t,n,o){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:o,value:n},writable:!1,configurable:!1,enumerable:!1})}};function DP(e,t,n){return s.IsArray(n)?n.map(o=>ct(e,t.items,o)):n}function GP(e,t,n){return ct({...e,...t.$defs},nt(t.$ref),n)}function GK(e,t){let n=s.HasPropertyKey(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},o=Qt(e,t),i=ft(o);return D(i)?Np(i,n):i}function $P(e,t,n){let o=GK(e,t);return ct(e,o,n)}function Yu(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function jP(e,t,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=Yu(t);for(let i of s.Keys(n)){if(s.HasPropertyKey(t.properties,i)){n[i]=ct(e,t.properties[i],n[i]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Ue(o)&&he(e,o,n[i])){n[i]=ct(e,o,n[i]);continue}delete n[i]}return n}function FP(e,t,n){if(!s.IsObject(n))return n;let o=Yu(t),[i,a]=[new RegExp(it(t)),Se(t)];for(let c of s.Keys(n)){if(i.test(c)){n[c]=ct(e,a,n[c]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Ue(o)&&he(e,o,n[c])){n[c]=ct(e,o,n[c]);continue}delete n[c]}return n}function qP(e,t,n){return s.HasPropertyKey(e,t.$ref)?ct(e,e[t.$ref],n):n}function BP(e,t,n){if(!s.IsArray(n))return n;let o=Math.min(n.length,t.items.length);for(let i=0;i<o;i++)n[i]=ct(e,t.items[i],n[i]);return s.IsGreaterThan(n.length,o)?n.slice(0,o):n}function $e(e){return Fn(e)}function HP(e,t,n){for(let o of t.anyOf){let i=ct(e,o,$e(n));if(he(e,o,i))return i}return n}function ct(e,t,n){return Z(t)?DP(e,t,n):Te(t)?GP(e,t,n):M(t)?$P(e,t,n):D(t)?jP(e,t,n):de(t)?FP(e,t,n):ce(t)?qP(e,t,n):Y(t)?BP(e,t,n):R(t)?HP(e,t,n):n}function $K(e,t){for(let n of Cc.Keys(e))Cc.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function jK(e){let t={};for(let n of Cc.Keys(e))t[n]=Is(e[n]);return t}function FK(e){return mg(zA(e))}function mg(e){return e.map(t=>Is(t))}function Is(e){let t=Z(e)?Pt(Is(e.items),Lo(e)):M(e)?ut(mg(e.allOf)):R(e)?q(FK(e.anyOf)):D(e)?k(jK(e.properties)):de(e)?Bo(un(e),Is(Se(e))):Y(e)?ke(mg(e.items)):e;return $K(e,t)}function Ni(e){return Is(e)}function Or(...e){let[t,n,o]=oe.Match(e,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]}),i=rt.Get().unionPrioritySort?Ni(n):n;return ct(t,i,o)}var ie={};Yt(ie,{Fail:()=>Eo,IsOk:()=>dg,Ok:()=>L,TryArray:()=>qK,TryBigInt:()=>fg,TryBoolean:()=>ez,TryNull:()=>iz,TryNumber:()=>pz,TryString:()=>uz,TryUndefined:()=>gz});function dg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function L(e){return{value:e}}function Eo(){}function qK(e){return s.IsArray(e)?L(e):L([e])}function BK(e){return s.IsEqual(e,!0)?L(BigInt(1)):L(BigInt(0))}var HK=/^-?(0|[1-9]\d*)n$/,KK=/^-?(0|[1-9]\d*)\.\d+$/,zK=/^-?(0|[1-9]\d*)$/;function YK(e){return HK.test(e)}function VK(e){return KK.test(e)}function QK(e){return zK.test(e)}function WK(e){let t=e.toLowerCase();return YK(e)?L(BigInt(e.slice(0,e.length-1))):VK(e)?L(BigInt(e.split(".")[0])):QK(e)?L(BigInt(e)):s.IsEqual(t,"false")?L(BigInt(0)):s.IsEqual(t,"true")?L(BigInt(1)):void 0}function fg(e){return s.IsBigInt(e)?L(e):s.IsBoolean(e)?BK(e):s.IsNumber(e)?L(BigInt(Math.trunc(e))):s.IsNull(e)?L(BigInt(0)):s.IsString(e)?WK(e):s.IsUndefined(e)?L(BigInt(0)):void 0}function ZK(e){return s.IsEqual(e,BigInt(0))?L(!1):s.IsEqual(e,BigInt(1))?L(!0):void 0}function XK(e){return s.IsEqual(e,0)?L(!1):s.IsEqual(e,1)?L(!0):void 0}function JK(e){return s.IsEqual(e.toLowerCase(),"false")?L(!1):s.IsEqual(e.toLowerCase(),"true")?L(!0):s.IsEqual(e,"0")?L(!1):s.IsEqual(e,"1")?L(!0):void 0}function ez(e){return s.IsBigInt(e)?ZK(e):s.IsBoolean(e)?L(e):s.IsNumber(e)?XK(e):s.IsNull(e)?L(!1):s.IsString(e)?JK(e):s.IsUndefined(e)?L(!1):void 0}function tz(e){return s.IsEqual(e,BigInt(0))?L(null):void 0}function rz(e){return s.IsEqual(e,!1)?L(null):void 0}function nz(e){return s.IsEqual(e,0)?L(null):void 0}function oz(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?L(null):void 0}function iz(e){return s.IsBigInt(e)?tz(e):s.IsBoolean(e)?rz(e):s.IsNumber(e)?nz(e):s.IsNull(e)?L(null):s.IsString(e)?oz(e):s.IsUndefined(e)?L(null):void 0}var KP=BigInt(Number.MAX_SAFE_INTEGER),zP=BigInt(Number.MIN_SAFE_INTEGER);function az(e){return e<=KP&&e>=zP?L(Number(e)):void 0}function sz(e){return L(e?1:0)}function cz(e){let t=+e;if(s.IsNumber(t))return L(t);let n=e.toLowerCase();if(s.IsEqual(n,"false"))return L(0);if(s.IsEqual(n,"true"))return L(1);let o=fg(e);return dg(o)?o.value<=KP&&o.value>=zP?L(Number(o.value)):void 0:void 0}function pz(e){return s.IsBigInt(e)?az(e):s.IsBoolean(e)?sz(e):s.IsNumber(e)?L(e):s.IsNull(e)?L(0):s.IsString(e)?cz(e):s.IsUndefined(e)?L(0):void 0}function uz(e){return s.IsBigInt(e)?L(e.toString()):s.IsBoolean(e)?L(e.toString()):s.IsNumber(e)?L(e.toString()):s.IsNull(e)?L("null"):s.IsString(e)?L(e):s.IsUndefined(e)?L(""):void 0}function lz(e){return s.IsEqual(e,BigInt(0))?L(void 0):void 0}function mz(e){return s.IsEqual(e,!1)?L(void 0):void 0}function dz(e){return s.IsEqual(e,0)?L(void 0):void 0}function fz(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?L(void 0):void 0}function gz(e){return s.IsBigInt(e)?lz(e):s.IsBoolean(e)?mz(e):s.IsNumber(e)?dz(e):s.IsNull(e)?L(void 0):s.IsString(e)?fz(e):s.IsUndefined(e)?L(e):void 0}function YP(e,t,n){return ie.TryArray(n).value.map(i=>je(e,t.items,i))}function VP(e,t,n){let o=ie.TryBigInt(n);return ie.IsOk(o)?o.value:n}function QP(e,t,n){let o=ie.TryBoolean(n);return ie.IsOk(o)?o.value:n}function WP(e,t,n){return je({...e,...t.$defs},nt(t.$ref),n)}function ZP(e,t,n){return je(e,ft(t),n)}function XP(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)?Math.trunc(o.value):n}function JP(e,t,n){let o=Qt(e,t),i=ft(o);return je(e,i,n)}function hz(e,t,n){let o=ie.TryBigInt(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function yz(e,t,n){let o=ie.TryBoolean(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function Tz(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function Ez(e,t,n){let o=ie.TryString(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function eU(e,t,n){return s.IsEqual(t.const,n)?n:lT(t)?hz(e,t,n):mT(t)?yz(e,t,n):Dc(t)?Tz(e,t,n):Gc(t)?Ez(e,t,n):ge()}function tU(e,t,n){let o=ie.TryNull(n);return ie.IsOk(o)?o.value:n}function rU(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)?o.value:n}function Vu(e,t,n,o){let i=s.Keys(o);for(let[a,c]of t)for(let l of i)a.test(l)||(o[l]=je(e,n,o[l]));return o}function bs(e,t,n){return et(e)&&s.IsUndefined(n[t])}function _z(e,t,n){let o=s.EntriesRegExp(t.properties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)!a.test(l)||bs(c,l,n)||(n[l]=je(e,c,n[l]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?Vu(e,o,t.additionalProperties,n):n}function nU(e,t,n){return s.IsObjectNotArray(n)?_z(e,t,n):n}function Iz(e,t,n){let o=s.EntriesRegExp(t.patternProperties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)a.test(l)&&(n[l]=je(e,c,n[l]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?Vu(e,o,t.additionalProperties,n):n}function oU(e,t,n){return s.IsObjectNotArray(n)?Iz(e,t,n):n}function iU(e,t,n){return s.HasPropertyKey(e,t.$ref)?je(e,e[t.$ref],n):n}function aU(e,t,n){let o=ie.TryString(n);return ie.IsOk(o)?o.value:n}function sU(e,t,n){return je(e,ft(t),n)}function cU(e,t,n){if(!s.IsArray(n))return n;for(let o=0;o<Math.min(t.items.length,n.length);o++)n[o]=je(e,t.items[o],n[o]);return n}function pU(e,t,n){let o=ie.TryUndefined(n);return ie.IsOk(o)?o.value:n}function uU(e,t,n){if(t.anyOf.some(c=>he(e,c,n)))return n;let a=t.anyOf.map(c=>je(e,c,$e(n))).find(c=>he(e,t,c));return s.IsUndefined(a)?n:a}function lU(e,t,n){let o=ie.TryUndefined(n);return ie.IsOk(o)?void 0:n}function je(e,t,n){return Z(t)?YP(e,t,n):vt(t)?VP(e,t,n):_t(t)?QP(e,t,n):Te(t)?WP(e,t,n):ze(t)?ZP(e,t,n):ot(t)?XP(e,t,n):M(t)?JP(e,t,n):Q(t)?eU(e,t,n):hr(t)?tU(e,t,n):Ce(t)?rU(e,t,n):D(t)?nU(e,t,n):de(t)?oU(e,t,n):ce(t)?iU(e,t,n):We(t)?aU(e,t,n):Ee(t)?sU(e,t,n):Y(t)?cU(e,t,n):or(t)?pU(e,t,n):R(t)?uU(e,t,n):kt(t)?lU(e,t,n):n}function Un(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return je(t,n,o)}function mU(e,t,n){if(!s.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=pt(e,t.items,n[o]);return n}function dU(e,t,n){return pt({...e,...t.$defs},nt(t.$ref),n)}function fU(e,t){return s.IsUndefined(t)?s.IsFunction(e.default)?e.default():$e(e.default):t}function gU(e,t,n){let o=Qt(e,t),i=ft(o);return pt(e,i,n)}function hU(e,t,n){if(!s.IsObject(n))return n;let o=s.Keys(t.properties);for(let i of o){let a=pt(e,t.properties[i],n[i]);s.IsUndefined(a)&&(et(t.properties[i])||!s.HasPropertyKey(t.properties[i],"default"))||(n[i]=a)}if(!Kr(t)||s.IsBoolean(t.additionalProperties))return n;for(let i of s.Keys(n))o.includes(i)||(n[i]=pt(e,t.additionalProperties,n[i]));return n}function yU(e,t,n){if(!s.IsObject(n))return n;let[o,i]=[new RegExp(it(t)),Se(t)];for(let a of s.Keys(n))o.test(a)&&Ht(i)&&(n[a]=pt(e,i,n[a]));if(!Kr(t))return n;for(let a of s.Keys(n))o.test(a)||(n[a]=pt(e,t.additionalProperties,n[a]));return n}function TU(e,t,n){return s.HasPropertyKey(e,t.$ref)?pt(e,e[t.$ref],n):n}function EU(e,t,n){if(!s.IsArray(n))return n;let[o,i]=[t.items,Math.max(t.items.length,n.length)];for(let a=0;a<i;a++)a<o.length&&(n[a]=pt(e,o[a],n[a]));return n}function _U(e,t,n){for(let o of t.anyOf){let i=pt(e,o,$e(n));if(he(e,o,i))return i}return n}function pt(e,t,n){let o=Ht(t)?fU(t,n):n;return Z(t)?mU(e,t,o):Te(t)?dU(e,t,o):M(t)?gU(e,t,o):D(t)?hU(e,t,o):de(t)?yU(e,t,o):ce(t)?TU(e,t,o):Y(t)?EU(e,t,o):R(t)?_U(e,t,o):o}function _o(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return pt(t,n,o)}function Li(e){return(...t)=>{let[n,o,i]=oe.Match(t,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]});return e.reduce((a,c)=>c(n,o,a),i)}}function bz(e,t,n){return t["~codec"].decode(n)}function Sz(e,t,n){return t["~codec"].encode(n)}function xe(e,t,n,o){return Kn(n)?s.IsEqual(e,"Decode")?bz(t,n,o):Sz(t,n,o):o}function Az(e,t,n,o){if(!s.IsArray(o))return o;for(let i=0;i<o.length;i++)o[i]=Pe(e,t,n.items,o[i]);return xe(e,t,n,o)}function Oz(e,t,n,o){let i=xe(e,t,n,o);if(!s.IsArray(i))return i;for(let a=0;a<i.length;a++)i[a]=Pe(e,t,n.items,i[a]);return i}function IU(e,t,n,o){return s.IsEqual(e,"Decode")?Az(e,t,n,o):Oz(e,t,n,o)}function bU(e,t,n,o){return o=Pe(e,{...t,...n.$defs},nt(n.$ref),o),xe(e,t,n,o)}function SU(e){return e.reduce((t,n)=>({...t,...n}),{})}function AU(e,t){for(let n of t)if(!s.IsDeepEqual(e,n))return n;return e}function xz(e,t,n,o){if(s.IsEqual(n.allOf.length,0))return xe(e,t,n,o);let i=n.allOf.map(l=>Pe(e,t,l,Or(l,$e(o)))),c=i.every(l=>s.IsObject(l))?SU(i):AU(o,i);return xe(e,t,n,c)}function Rz(e,t,n,o){if(s.IsEqual(n.allOf.length,0))return xe(e,t,n,o);let i=xe(e,t,n,o),a=n.allOf.map(l=>Pe(e,t,l,Or(l,$e(i))));return a.every(l=>s.IsObject(l))?SU(a):AU(i,a)}function OU(e,t,n,o){return s.IsEqual(e,"Decode")?xz(e,t,n,o):Rz(e,t,n,o)}function Cz(e,t,n,o){if(!s.IsObjectNotArray(o))return o;for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||bs(n.properties[i],i,o)||(o[i]=Pe(e,t,n.properties[i],o[i]));return xe(e,t,n,o)}function Pz(e,t,n,o){let i=xe(e,t,n,o);if(!s.IsObjectNotArray(i))return i;for(let a of s.Keys(n.properties))!s.HasPropertyKey(i,a)||bs(n.properties[a],a,i)||(i[a]=Pe(e,t,n.properties[a],i[a]));return i}function xU(e,t,n,o){return s.IsEqual(e,"Decode")?Cz(e,t,n,o):Pz(e,t,n,o)}function Uz(e,t,n,o){if(!s.IsObjectNotArray(o))return o;let i=new RegExp(it(n));for(let a of s.Keys(o))i.test(a)&&(o[a]=Pe(e,t,Se(n),o[a]));return xe(e,t,n,o)}function wz(e,t,n,o){let i=xe(e,t,n,o);if(!s.IsObjectNotArray(i))return i;let a=new RegExp(it(n));for(let c of s.Keys(i))a.test(c)&&(i[c]=Pe(e,t,Se(n),i[c]));return i}function RU(e,t,n,o){return s.IsEqual(e,"Decode")?Uz(e,t,n,o):wz(e,t,n,o)}function CU(e,t,n,o){return s.HasPropertyKey(t,n.$ref)?Pe(e,t,t[n.$ref],o):o}function PU(e,t,n,o){return s.IsEqual(e,"Decode")?xe(e,t,n,CU(e,t,n,o)):CU(e,t,n,xe(e,t,n,o))}function vz(e,t,n,o){if(!s.IsArray(o))return o;for(let i=0;i<Math.min(n.items.length,o.length);i++)o[i]=Pe(e,t,n.items[i],o[i]);return xe(e,t,n,o)}function Nz(e,t,n,o){let i=xe(e,t,n,o);if(!s.IsArray(i))return o;for(let a=0;a<Math.min(n.items.length,i.length);a++)i[a]=Pe(e,t,n.items[a],i[a]);return i}function UU(e,t,n,o){return s.IsEqual(e,"Decode")?vz(e,t,n,o):Nz(e,t,n,o)}function Lz(e,t,n,o){for(let i of n.anyOf){if(!he(t,i,o))continue;let a=Pe(e,t,i,o);return xe(e,t,n,a)}return o}function kz(e,t,n,o){let i=xe(e,t,n,o);for(let a of n.anyOf){let c=Pe(e,t,a,$e(i));if(he(t,a,c))return c}return i}function wU(e,t,n,o){return s.IsEqual(e,"Decode")?Lz(e,t,n,o):kz(e,t,n,o)}function Pe(e,t,n,o){return Z(n)?IU(e,t,n,o):Te(n)?bU(e,t,n,o):M(n)?OU(e,t,n,o):D(n)?xU(e,t,n,o):de(n)?RU(e,t,n,o):ce(n)?PU(e,t,n,o):Y(n)?UU(e,t,n,o):R(n)?wU(e,t,n,o):xe(e,t,n,o)}var gg=class extends Pn{constructor(t,n){super("Decode",t,n)}};function Mz(e,t,n){if(!he(e,t,n))throw new gg(n,Cn(e,t,n));return n}function Dz(e,t,n){let o=rt.Get().unionPrioritySort?Ni(t):t;return Pe("Decode",e,o,n)}var w9e=Li([(e,t,n)=>$e(n),(e,t,n)=>_o(e,t,n),(e,t,n)=>Un(e,t,n),(e,t,n)=>Or(e,t,n),(e,t,n)=>Mz(e,t,n),(e,t,n)=>Dz(e,t,n)]);var hg=class extends Pn{constructor(t,n){super("Encode",t,n)}};function Gz(e,t,n){if(!he(e,t,n))throw new hg(n,Cn(e,t,n));return n}function $z(e,t,n){let o=rt.Get().unionPrioritySort?Ni(t):t;return Pe("Encode",e,o,n)}var H9e=Li([(e,t,n)=>$e(n),(e,t,n)=>$z(e,t,n),(e,t,n)=>_o(e,t,n),(e,t,n)=>Un(e,t,n),(e,t,n)=>Or(e,t,n),(e,t,n)=>Gz(e,t,n)]);var Zt=class extends Error{constructor(t,n){super(n),this.type=t}};function vU(e,t){return s.IsFunction(t.default)?t.default(t):s.IsObject(t.default)?$e(t.default):t.default}function NU(e,t){if(xi(t)&&!Ht(t))throw new Zt(t,"Arrays with uniqueItems constraints must specify a default annotation");let n=Ai(t)?t.minItems:0;return Array.from({length:n},()=>Fe(e,t.items))}function LU(e,t){return zr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Vr(t)?BigInt(t.minimum):BigInt(0)}function kU(e,t){return!1}function MU(e,t){let n=Fe(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function DU(e,t){return Fe({...e,...t.$defs},nt(t.$ref))}function GU(e,t){return Fe(e,ft(t))}function $U(e,t){let n=Fe(e,t.returnType);return()=>n}function jU(e,t){return zr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Vr(t)?t.minimum:0}function FU(e,t){let n=Qt(e,t),o=ft(n);return Fe(e,o)}function qU(e,t){return t.const}function BU(e,t){throw new Zt(t,"Cannot create TNever types")}function HU(e,t){return null}function KU(e,t){return zr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Vr(t)?t.minimum:0}function zU(e,t){return(s.IsUndefined(t.required)?[]:t.required).reduce((o,i)=>({...o,[i]:Fe(e,t.properties[i])}),{})}function YU(e,t){if(ds(t)&&!Ht(t))throw new Zt(t,"Record with the minProperties constraint must have a default annotation");return{}}function VU(e,t){return s.HasPropertyKey(e,t.$ref)?Fe(e,e[t.$ref]):(()=>{throw new Zt(t,"Unable to deref Ref")})()}function QU(e,t){if((fs(t)||ls(t))&&!Ht(t))throw Error("Strings with format or pattern constraints must specify default");let o=ms(t)?t.minLength:0;return"".padEnd(o)}function WU(e,t){return Symbol()}function ZU(e,t){let n=Ia(t.pattern);if(We(n))throw new Zt(t,"Unable to create TemplateLiteral due to infinite type expansion");return Fe(e,n)}function XU(e,t){return Array.from({length:t.minItems},(n,o)=>Fe(e,t.items[o]))}function JU(e,t){if(s.IsEqual(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return Fe(e,t.anyOf[0])}function Fe(e,t){return Ht(t)?vU(e,t):Z(t)?NU(e,t):vt(t)?LU(e,t):_t(t)?kU(e,t):Be(t)?MU(e,t):Te(t)?DU(e,t):ze(t)?GU(e,t):He(t)?$U(e,t):ot(t)?jU(e,t):M(t)?FU(e,t):Q(t)?qU(e,t):rr(t)?BU(e,t):hr(t)?HU(e,t):Ce(t)?KU(e,t):D(t)?zU(e,t):de(t)?YU(e,t):ce(t)?VU(e,t):We(t)?QU(e,t):yr(t)?WU(e,t):Ee(t)?ZU(e,t):Y(t)?XU(e,t):or(t)?void 0:R(t)?JU(e,t):kt(t)?void 0:void 0}function xr(...e){let[t,n]=oe.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return Fe(t,n)}var yg=class extends Pn{constructor(t,n){super("Parse",t,n)}};function jz(e,t,n){if(!he(e,t,n))throw new yg(n,Cn(e,t,n));return n}var l5e=Li([(e,t,n)=>$e(n),(e,t,n)=>_o(e,t,n),(e,t,n)=>Un(e,t,n),(e,t,n)=>Or(e,t,n),(e,t,n)=>jz(e,t,n)]);var qz=k({type:z("insert"),path:It(),value:Qe()}),Bz=Object({type:z("update"),path:It(),value:Qe()}),Hz=k({type:z("delete"),path:It()}),T5e=q([qz,Bz,Hz]);function ki(e){if(!e.body)throw new Error("This command does not accept a request body");let t=e.body;return t.examples?.length?t.examples[0]:xr(t)}function Zr(e,t,n,o,i){e.command(t).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){ee(ki(o));return}let c=bi(a),l=await i()(o,{body:c});ee(l)})}function rw(e,t){let n=e.command("grok").description("Test and preview grok parsing rules");Zr(n,"parse","Parse sample log lines with grok rules and return the extracted fields",XR,t)}var nw=require("node:child_process"),ow=require("node:fs"),iw=require("node:os"),Zu=require("node:path");var Io=require("node:fs");function Ss(e,t){let n=`${e}.tmp.${process.pid}`;(0,Io.writeFileSync)(n,t),(0,Io.renameSync)(n,e)}function As(e){try{return(0,Io.readFileSync)(e,"utf8")}catch(t){if(t.code==="ENOENT")return;throw t}}function Os(e,t){if(t===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,Io.writeFileSync)(n,t),n}function bo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Tg="tsuga-dev/agent-plugins",Qu="tsuga";function Wu(e,t){V(` $ ${e} ${t.join(" ")}`);try{(0,nw.execFileSync)(e,t,{stdio:["ignore","inherit","inherit"]})}catch(n){let o=n.status??1;throw new Error(`${e} ${t.join(" ")} exited ${o}`,{cause:n})}}function Yz(e,t){V("Claude Code \u2192 installing Tsuga plugin"),Wu("claude",["plugin","marketplace","add",Tg]),Wu("claude",["plugin","install",`tsuga@${Qu}`]),t.autoUpdate&&Vz(e)}function Vz(e){let t=(0,Zu.join)(e,".claude","settings.json");V(`Claude Code \u2192 ${t} (autoUpdate)`),(0,ow.mkdirSync)((0,Zu.dirname)(t),{recursive:!0});let n=As(t),o=JSON.parse(n??"{}");if(!bo(o))throw new Error(`${t} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!bo(i))throw new Error(`${t} "extraKnownMarketplaces" must be a JSON object`);let a=i[Qu],c=bo(a)?a:{};o.extraKnownMarketplaces={...i,[Qu]:{source:{source:"github",repo:Tg},...c,autoUpdate:!0}};let l=Os(t,n);Ss(t,`${JSON.stringify(o,null,2)}
|
|
142
|
+
`),V(l===void 0?" created":` patched (backup: ${l})`)}function Qz(){V("Codex \u2192 installing Tsuga plugin"),Wu("codex",["plugin","marketplace","add",Tg]),Wu("codex",["plugin","add",`tsuga@${Qu}`])}function aw(e){let t=e.command("install").description("Install Tsuga plugins into local LLM CLIs").command("plugin").description("Install the Tsuga plugin into a specific LLM CLI");t.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=>{Yz((0,iw.homedir)(),n),V("Restart your claude session to load the new plugins.")}),t.command("codex").description("Install the Tsuga plugin into Codex (requires the codex CLI in PATH)").action(()=>{Qz(),V("Restart your codex session to load the new plugins.")})}var Wz=10,Zz=r.Object({key:u({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:r.Optional(u({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:r.Optional(r.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`."}))}),Eg=r.Object({field:r.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:r.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:r.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:r.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:r.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:r.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:r.Object({groupBy:r.Number({description:"Number of distinct readable matching artifacts that use this field as a group-by or split dimension."}),filter:r.Number({description:"Number of distinct readable matching artifacts that filter on this field in widget queries, monitor queries, or dashboard-wide filters."}),measure:r.Number({description:"Number of distinct readable matching artifacts that aggregate this field as `aggregate.field`."}),column:r.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."})}),_g=r.Object({logs:r.Array(Eg,{description:"Top log fields for the requested scope, ranked by score and mined from readable logs-sourced dashboards and monitors."}),traces:r.Array(Eg,{description:"Top trace fields for the requested scope, ranked by score and mined from readable traces-sourced dashboards and monitors."}),metrics:r.Array(Eg,{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:r.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:r.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."})}),Ig=r.Object({scope:r.Array(Zz,{minItems:1,maxItems:Wz,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."})}),hWe=d({tags:["interesting-fields"],url:"/v0/interesting-fields",method:"POST",body:Ig,response:_g});var Xz=`/${"v1"}/interesting-fields`,Jz={scope:[{key:"context.service.name",value:"payments"},{key:"context.env",value:"prod",valueMustMatch:!0}]},e4=r.Object(Ig.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:[Jz]}),sw=d({url:Xz,method:"POST",operationId:"getInterestingFields",tags:["public","interesting-fields"],body:e4,response:_g,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 cw(e,t){let n=e.command("interesting-fields").description("Discover the telemetry fields an org already uses for a scope");Zr(n,"list","Rank the log, trace and metric fields most relevant to a scope, mined from dashboards and monitors",sw,t)}var Xt="/v0/kubernetes-explorer",t4="^[a-z0-9.-]+$",r4="^[A-Za-z0-9._-]+$",pw=256,uw=r.Optional(u({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 sr=e=>r.Optional(r.Array(u({allowEmpty:!1}),{description:e})),bg={clusterId:uw,search:r.Optional(r.String({pattern:t4,minLength:1,maxLength:pw,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."}))},lw={clusterId:uw,search:r.Optional(r.String({pattern:r4,minLength:1,maxLength:pw,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."}))},mw=r.Object(bg),dw=r.Object(lw),xs={...bg,includeInternalNamespaces:r.Optional(r.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:sr("Restrict results to these Kubernetes cluster names."),namespaces:sr("Restrict results to these namespaces."),teams:sr("Restrict results to these team names."),envs:sr("Restrict results to these environments."),...fe},fw=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],n4={...xs,nodes:sr("Restrict results to pods scheduled on these nodes."),deployments:sr("Restrict results to pods owned by these Deployments."),statefulsets:sr("Restrict results to pods owned by these StatefulSets."),daemonsets:sr("Restrict results to pods owned by these DaemonSets."),podStatus:r.Optional(r.Array(r.Enum(fw),{description:"Restrict results to pods whose resolved status matches any of these values. Includes 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."}))},So=r.Enum(["asc","desc"],{description:"Sort direction. Defaults to ascending."}),o4=["deployment","statefulset","daemonset"],gw=r.Object({kind:r.Enum(o4,{description:"Kind of Kubernetes workload associated with the pod. Derived from workload attributes in pod telemetry."}),name:r.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."}),hw=r.Object({podName:r.String({description:"Name of the Kubernetes pod. Set when the pod is created."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the pod. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that reported the pod. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the pod. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the pod, such as production or staging. Present when an environment label or mapping is observed."})),node:r.Optional(r.String({description:"Kubernetes node currently or most recently running the pod. Present when node telemetry is observed."})),phase:r.Enum(fw,{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:r.Integer({description:"Number of containers in the pod that are currently ready. From container readiness telemetry. Zero or greater."}),totalContainers:r.Integer({description:"Number of observed containers for the pod based on container readiness telemetry. Zero or greater."}),restarts:r.Integer({description:"Total restart count across containers in the pod. From container restart telemetry. Zero or greater."}),createdAt:r.Optional(A({description:"Timestamp from pod start time telemetry for the selected pod instance. Present when pod start time telemetry is observed."}))}),Sg=r.Object({...hw.properties,workload:r.Optional(gw),cpuUsageMilli:r.Optional(r.Number({description:"Recent pod CPU usage in millicores. Present when CPU usage telemetry is observed."})),cpuLimitMilli:r.Optional(r.Number({description:"Configured pod CPU limit in millicores, summed across observed containers. Present when a CPU limit is configured and observed."})),cpuRequestMilli:r.Optional(r.Number({description:"Configured pod CPU request in millicores, summed across observed containers. Present when a CPU request is configured and observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent pod memory usage in bytes. Present when memory usage telemetry is observed."})),memoryLimitBytes:r.Optional(r.Number({description:"Configured pod memory limit in bytes, summed across observed containers. Present when a memory limit is configured and observed."})),memoryRequestBytes:r.Optional(r.Number({description:"Configured pod memory request in bytes, summed across observed containers. Present when a memory request is configured and observed."})),cpuUtilization:r.Optional(r.Number({description:"Recent CPU usage divided by the configured CPU limit. Present when both usage and limit are observed."})),memoryUtilization:r.Optional(r.Number({description:"Recent memory usage divided by the configured memory limit. Present when both usage and limit are observed."})),cpuRequestUtilization:r.Optional(r.Number({description:"Recent CPU usage divided by the configured CPU request. Present when both usage and request are observed."})),memoryRequestUtilization:r.Optional(r.Number({description:"Recent memory usage divided by the configured memory request. Present when both usage and request are observed."}))}),i4=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],PWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/pods`,query:r.Object({...n4,sortBy:r.Optional(r.Enum(i4,{description:"Field to sort pods by."})),sortDirection:r.Optional(So)}),paginated:!0,response:r.Array(Sg)}),Ag=r.Object({cluster:r.String({description:"Kubernetes cluster name from cluster telemetry."}),teams:r.Optional(r.Array(r.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:r.Optional(r.Array(r.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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.Integer({description:"Number of Kubernetes nodes in the cluster that are ready. Present when node readiness telemetry is observed."})),podPhaseCounts:r.Optional(r.Object({Pending:r.Integer({description:"Number of observed pods currently in the Pending phase."}),Running:r.Integer({description:"Number of observed pods currently in the Running phase."}),Succeeded:r.Integer({description:"Number of observed pods currently in the Succeeded phase."}),Failed:r.Integer({description:"Number of observed pods currently in the Failed phase."}),Unknown:r.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."}))}),a4=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],UWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/clusters`,query:r.Object({...lw,teams:sr("Restrict to clusters that host workloads from these team names."),envs:sr("Restrict to clusters that host workloads in these environments."),sortBy:r.Optional(r.Enum(a4,{description:"Field to sort clusters by."})),sortDirection:r.Optional(So),...fe}),paginated:!0,response:r.Array(Ag)}),s4=["Ready","NotReady","Unknown"],Og=r.Object({node:r.String({description:"Kubernetes node name from node telemetry."}),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the node. Present when cluster telemetry is observed."})),status:r.Optional(r.Enum(s4,{description:"Readiness of the node, derived from its Ready condition. Present when node condition telemetry is observed."})),instanceType:r.Optional(r.String({description:"Cloud instance type backing the node (for example `r7g.2xlarge`). Present when host telemetry is observed."})),pods:r.Optional(r.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:r.Optional(r.Integer({description:"Maximum number of pods the node can run. Present when node allocatable telemetry is observed."})),cpuUsageMilli:r.Optional(r.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:r.Optional(r.Number({description:"CPU available to pods on the node, in millicores. Present when node allocatable telemetry is observed."})),cpuUtilization:r.Optional(r.Number({description:"Node CPU usage divided by allocatable CPU. Present when both usage and allocatable telemetry are observed."})),memoryUsageBytes:r.Optional(r.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:r.Optional(r.Number({description:"Memory available to pods on the node, in bytes. Present when node allocatable telemetry is observed."})),memoryUtilization:r.Optional(r.Number({description:"Node memory usage divided by allocatable memory. Present when both usage and allocatable telemetry are observed."}))}),c4=["node","cluster","status","instanceType","pods","allocatablePods","cpuUsageMilli","cpuAllocatableMilli","cpuUtilization","memoryUsageBytes","memoryAllocatableBytes","memoryUtilization"],wWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/nodes`,query:r.Object({...bg,clusters:sr("Restrict results to these Kubernetes cluster names."),sortBy:r.Optional(r.Enum(c4,{description:"Field to sort nodes by."})),sortDirection:r.Optional(So),...fe}),paginated:!0,response:r.Array(Og)}),xg=r.Object({namespace:r.String({description:"Kubernetes namespace name from namespace telemetry. Includes namespaces with no observed pods when namespace telemetry is observed."}),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the namespace. Present when cluster telemetry is observed."})),teams:r.Optional(r.Array(r.String(),{description:"Team metadata values observed in workloads in the namespace. Present when team labels or mappings are observed."})),envs:r.Optional(r.Array(r.String(),{description:"Environment metadata values observed in workloads in the namespace. Present when environment labels or mappings are observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods in the namespace. Present when pod telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Aggregate recent CPU usage for observed pods in the namespace, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Aggregate recent memory usage for observed pods in the namespace, in bytes. Present when memory usage telemetry is observed."}))}),p4=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],vWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/namespaces`,query:r.Object({...xs,sortBy:r.Optional(r.Enum(p4,{description:"Field to sort namespaces by."})),sortDirection:r.Optional(So)}),paginated:!0,response:r.Array(xg)}),Rg=r.Object({deployment:r.String({description:"Kubernetes Deployment name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the Deployment. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the Deployment. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the Deployment. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the Deployment. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the Deployment. Present when pod telemetry and workload attributes are observed."})),availableReplicas:r.Optional(r.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed Deployment pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed Deployment pods, in bytes. Present when memory usage telemetry is observed."}))}),u4=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],NWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/deployments`,query:r.Object({...xs,sortBy:r.Optional(r.Enum(u4,{description:"Field to sort deployments by."})),sortDirection:r.Optional(So)}),paginated:!0,response:r.Array(Rg)}),Cg=r.Object({statefulSet:r.String({description:"Kubernetes StatefulSet name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the StatefulSet. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the StatefulSet. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the StatefulSet. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the StatefulSet. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the StatefulSet. Present when pod telemetry and workload attributes are observed."})),readyReplicas:r.Optional(r.Integer({description:"Number of ready StatefulSet replicas from StatefulSet status telemetry. Present when StatefulSet status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the StatefulSet. Present when StatefulSet spec telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed StatefulSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed StatefulSet pods, in bytes. Present when memory usage telemetry is observed."}))}),l4=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],LWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/statefulsets`,query:r.Object({...xs,sortBy:r.Optional(r.Enum(l4,{description:"Field to sort StatefulSets by."})),sortDirection:r.Optional(So)}),paginated:!0,response:r.Array(Cg)}),Pg=r.Object({daemonSet:r.String({description:"Kubernetes DaemonSet name from workload telemetry."}),namespace:r.Optional(r.String({description:"Kubernetes namespace that contains the DaemonSet. Present when namespace telemetry is observed."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name that contains the DaemonSet. Present when cluster telemetry is observed."})),team:r.Optional(r.String({description:"Team metadata associated with the DaemonSet. Present when a team label or mapping is observed."})),env:r.Optional(r.String({description:"Environment metadata associated with the DaemonSet. Present when an environment label or mapping is observed."})),pods:r.Optional(r.Integer({description:"Number of observed pods associated with the DaemonSet. Present when pod telemetry and workload attributes are observed."})),readyNodes:r.Optional(r.Integer({description:"Number of eligible nodes with a ready DaemonSet pod. Present when DaemonSet status telemetry is observed."})),desiredNodes:r.Optional(r.Integer({description:"Number of eligible nodes where the DaemonSet should run a pod. Present when DaemonSet status telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent aggregate CPU usage for observed DaemonSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.Number({description:"Recent aggregate memory usage for observed DaemonSet pods, in bytes. Present when memory usage telemetry is observed."}))}),m4=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],kWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/daemonsets`,query:r.Object({...xs,sortBy:r.Optional(r.Enum(m4,{description:"Field to sort DaemonSets by."})),sortDirection:r.Optional(So)}),paginated:!0,response:r.Array(Pg)}),Ug=r.Object({overview:r.Object({...hw.properties,workload:r.Optional(gw)},{description:"Pod identity, status, and owning workload, derived from recent pod metrics."}),healthMetrics:r.Object({cpu:r.Object({usage:r.String({description:"Metric name callers can use to query pod CPU usage. This is not the current CPU value."}),limit:r.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:r.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:r.Object({usage:r.String({description:"Metric name callers can use to query pod memory usage. This is not the current memory value."}),limit:r.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:r.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:r.Object({logs:r.String({description:"TQL log search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."}),traces:r.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."})}),yw=r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),podName:u({allowEmpty:!1})}),MWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/pod-details`,query:yw,response:Ug}),wg=r.Object({configuration:r.Optional(r.Object({spec:r.Record(r.String(),r.Unknown(),{description:"Kubernetes PodSpec from the latest observed pod manifest. Fields outside `object.spec` are stripped."}),lastObservedAt:A({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:r.Record(r.String(),r.String(),{description:"Kubernetes labels on the pod from the latest observed pod manifest. Key-value strings."}),annotations:r.Record(r.String(),r.String(),{description:"Kubernetes annotations on the pod from the latest observed pod manifest. Key-value strings."}),deletedAt:r.Optional(A({description:"Timestamp when Tsuga last observed the pod deletion event. Present when the latest observed pod event is deleted."}))}),DWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/pod-manifest`,query:yw,response:wg}),vg=r.Object({podName:r.String({description:"Name of a pod instance associated with the workload. Resolved from recent pod usage telemetry and workload attributes."}),podUid:r.Optional(r.String({description:"Kubernetes UID for the pod replica. Present when UID telemetry is observed."})),cpuUsageMilli:r.Optional(r.Number({description:"Recent CPU usage for the pod replica, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:r.Optional(r.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."}),Ng=r.Object({overview:r.Object({deploymentName:r.String({description:"Kubernetes Deployment name for this detail response."}),namespace:r.Optional(r.String({description:"Kubernetes namespace for this detail response. Present when any deployment signal is found."})),cluster:r.Optional(r.String({description:"Kubernetes cluster name for this detail response. Present when any deployment signal is found."})),team:r.Optional(r.String({description:"Team metadata from the Deployment available-replica metric. Present when the metric includes team metadata."})),env:r.Optional(r.String({description:"Environment metadata from the Deployment available-replica metric. Present when the metric includes environment metadata."})),availableReplicas:r.Optional(r.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:r.Optional(r.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),latestRevisionAt:r.Optional(A({description:"Latest ReplicaSet metadata.creationTimestamp observed for the Deployment. Present when ReplicaSet object telemetry is observed."}))}),podReplicas:r.Array(vg,{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:r.Array(r.Object({replicaSetName:r.String({description:"ReplicaSet name for a Deployment revision from workload telemetry."}),revision:r.Integer({description:"Deployment revision number from ReplicaSet annotations. Integer greater than or equal to zero."}),firstSeen:r.Optional(A({description:"ReplicaSet metadata.creationTimestamp from the latest observed ReplicaSet object. Present when creation time is observed."})),observedGeneration:r.Optional(r.Integer({description:"Latest generation observed for the ReplicaSet revision. Present when generation telemetry is observed."})),readyReplicas:r.Optional(r.Integer({description:"Number of ready replicas for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),replicas:r.Optional(r.Integer({description:"Total replica count for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),logsSearchFilter:r.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."})}),GWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/deployment-details`,query:r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),deploymentName:u({allowEmpty:!1})}),response:Ng}),d4=r.Object({overview:r.Object({statefulSetName:r.String(),namespace:r.Optional(r.String()),cluster:r.Optional(r.String()),team:r.Optional(r.String()),env:r.Optional(r.String()),readyReplicas:r.Optional(r.Integer()),desiredReplicas:r.Optional(r.Integer()),latestRevisionAt:r.Optional(A())}),podReplicas:r.Array(vg,{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:r.Array(r.Object({revisionName:r.String(),firstSeen:r.Optional(A())}))}),$We=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/statefulset-details`,query:r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),statefulSetName:u({allowEmpty:!1})}),response:d4}),f4=r.Object({overview:r.Object({daemonSetName:r.String(),namespace:r.Optional(r.String()),cluster:r.Optional(r.String()),team:r.Optional(r.String()),env:r.Optional(r.String()),readyNodes:r.Optional(r.Integer()),desiredNodes:r.Optional(r.Integer()),latestRevisionAt:r.Optional(A())}),podReplicas:r.Array(vg,{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:r.Array(r.Object({observedGeneration:r.Integer(),firstSeen:r.Optional(A())}))}),jWe=d({tags:["kubernetes-explorer"],method:"GET",url:`${Xt}/daemonset-details`,query:r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),daemonSetName:u({allowEmpty:!1})}),response:f4});var Rr=`/${"v1"}/kubernetes-explorer`,Tw=r.Pick(Sg,["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."}),g4={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(Tw,{examples:[g4]});var Ew=r.Pick(Ag,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),h4={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(Ew,{examples:[h4]});var _w=r.Pick(xg,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),y4={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(_w,{examples:[y4]});var Iw=r.Pick(Og,["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."}),T4={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(Iw,{examples:[T4]});var bw=r.Pick(Rg,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),E4={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:[E4]});var Sw=r.Pick(Cg,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),_4={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(Sw,{examples:[_4]});var Aw=r.Pick(Pg,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),I4={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(Aw,{examples:[I4]});var Ow=r.Pick(Ug,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),b4={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(Ow,{examples:[b4]});var xw=r.Pick(wg,["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."}),S4={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(xw,{examples:[S4]});var Rw=r.Pick(Ng,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),A4={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(Rw,{examples:[A4]});var Cw=r.Object({clusterId:r.Optional(u({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."}))}),Mi=r.Pick(mw,["clusterId","search"]),O4=r.Pick(dw,["clusterId","search"]),Pw=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:`${Rr}/pods`,query:Mi,response:r.Array(Tw)}),Uw=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:`${Rr}/clusters`,query:O4,response:r.Array(Ew)}),ww=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:`${Rr}/namespaces`,query:Mi,response:r.Array(_w)}),vw=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:`${Rr}/nodes`,query:Mi,response:r.Array(Iw)}),Nw=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:`${Rr}/deployments`,query:Mi,response:r.Array(bw)}),Lw=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:`${Rr}/statefulsets`,query:Mi,response:r.Array(Sw)}),kw=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:`${Rr}/daemonsets`,query:Mi,response:r.Array(Aw)}),Mw=r.Object({...Cw.properties,k8sCluster:u({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:u({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:u({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."})}),Dw=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:`${Rr}/pod-details`,query:Mw,response:Ow}),Gw=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:`${Rr}/pod-manifest`,query:Mw,response:xw}),$w=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:`${Rr}/deployment-details`,query:r.Object({...Cw.properties,k8sCluster:u({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:u({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:u({allowEmpty:!1,description:"Kubernetes Deployment name to retrieve. From workload telemetry. Required to fetch deployment details for the selected cluster and namespace."})}),response:Rw});var x4="clusterId";function jw(e,t,n){let o=t.query.properties??{},i=Object.keys(o).filter(a=>a!==x4);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 Ao(e,t,n,o){let i=e.command(t).description(n.description??`List Kubernetes ${t}`),a=jw(i,n,!1);i.action(async c=>{let l={};for(let m of a)c[m]!==void 0&&(l[m]=c[m]);ee(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function Lg(e,t,n,o){let i=e.command(t).description(n.description??`Get Kubernetes ${t}`),a=jw(i,n,!0);i.action(async c=>{let l={};for(let m of a)l[m]=c[m];ee(await o()(n,{query:l}))})}function Fw(e,t){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");Ao(n,"pods",Pw,t),Ao(n,"clusters",Uw,t),Ao(n,"namespaces",ww,t),Ao(n,"nodes",vw,t),Ao(n,"deployments",Nw,t),Ao(n,"statefulsets",Lw,t),Ao(n,"daemonsets",kw,t),Lg(n,"pod-details",Dw,t),Lg(n,"pod-manifest",Gw,t),Lg(n,"deployment-details",$w,t)}var R4=r.Union([r.Literal("scalar"),r.Literal("timeseries")]),C4="/v0/promql",Xu=r.Object({query:u({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:li,step:u({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:r.Optional(R4),executionOptions:Ed,shouldStreamResults:r.Optional(r.Boolean()),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),P4={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(Xu,{examples:[P4]});var n7e=d({tags:["promql"],url:C4,method:"POST",body:Xu,response:nu});var qw=`/${"v1"}/aggregation`,Bw=r.Object({id:r.String({description:"Result identifier. Query results use `q1`, `q2`, and so on; formula results use `formula`."}),group:r.Record(r.String(),r.Union([r.String(),r.Number()]),{description:"Group-by field values for this result. Empty when no group-by is requested."})}),Hw=r.Object({results:r.Array(r.Object({...Bw.properties,value:r.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."}),U4={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(Hw,{examples:[U4]});var Ju=r.Object({series:r.Array(r.Object({...Bw.properties,points:r.Array(r.Object({timestamp:r.Integer({description:"Unix timestamp in milliseconds for this point, spaced by `aggregationWindow`."}),value:r.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."}),w4={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign(Ju,{examples:[w4]});var v4=r.Omit(os.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),N4=r.Optional(qr),Kw={timeRange:bt,queries:r.Array(v4,{maxItems:ns,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 ${ns} 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:N4,dataSource:Ix,formula:r.Optional(po)},zw=r.Object({clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),Yw=r.Object(Kw,{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."}),L4={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(Yw,{examples:[L4]});var Vw=d({description:"Runs one or more aggregation queries over logs, metrics, or traces 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:`${qw}/multi-query/scalar`,method:"POST",body:Yw,query:zw,response:Hw}),Qw=r.Object({...Kw,aggregationWindow:u({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."}),k4={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(Qw,{examples:[k4]});var Ww=d({description:"Runs one or more aggregation queries over logs, metrics, or traces 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:`${qw}/multi-query/timeseries`,method:"POST",body:Qw,query:zw,response:Ju});var M4=`/${"v1"}/promql`,D4=r.Object({...r.Pick(Xu,["query","step"]).properties,timeRange:bt},{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"}]}),G4=r.Object({clusterId:r.Optional(u({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."}))}),Zw=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:M4,method:"POST",body:D4,query:G4,response:Ju});function Xw(e,t){let n=e.command("promql").description("Run PromQL queries over metric data");Zr(n,"query","Run a PromQL range query over metric data",Zw,t)}var Gi="/v0/dashboard-folders",$i=r.Object({id:r.String({description:"Tsuga-generated dashboard folder ID assigned when the folder is created. Use it as dashboard `folderId` or child-folder `parentFolderId`."}),name:r.String({description:"Display name of the dashboard folder. Set by the caller on create or update."}),owner:r.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:r.Optional(r.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:De,creator:r.Optional(pe),updater:r.Optional(pe),createdAt:A(),updatedAt:A()},{title:"DashboardFolder"}),kg=r.Object({...$i.properties,dashboardCount:r.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."})}),el=r.Object({name:u({allowEmpty:!1,description:"Display name of the dashboard folder. Required and non-empty."}),owner:u({allowEmpty:!1,description:"ID of the team that owns the dashboard folder. Required and used for folder access control."}),parentFolderId:r.Optional(r.Union([r.Null(),u({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:Xe}),tl=r.Partial(r.Object({owners:_e(u({allowEmpty:!1}),{description:"Restrict results to dashboard folders owned by any of these team IDs",maxItems:50}),searchQuery:r.Object({value:u({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard folder names or folder IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:r.Optional(r.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:_e(Bt.items,{description:"Restrict results to dashboard folders that have at least one of the listed key/value tags",maxItems:50}),parentFolderId:r.Union([r.Null(),u({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"})),Di={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},Mg=[Di.OWNER,Di.TAGS,Di.DASHBOARD_COUNT,Di.UPDATED_AT,Di.NAME],$4=r.Partial(r.Object({...fe,filters:tl,sort:r.Object({by:r.Enum([...Mg,Di.IS_FAVORITE],{description:"Field to sort the returned dashboard folders by"}),direction:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboard folders"})})),P7e=d({tags:["dashboard-folders"],url:`${Gi}/query`,method:"POST",paginated:!0,body:$4,response:r.Array(kg)}),U7e=d({tags:["dashboard-folders"],url:`${Gi}/:id`,method:"GET",params:r.Object({id:u()}),response:$i}),w7e=d({tags:["dashboard-folders"],url:Gi,method:"POST",body:el,response:$i}),v7e=d({tags:["dashboard-folders"],url:`${Gi}/:id`,method:"PUT",params:r.Object({id:u()}),body:el,response:$i}),N7e=d({tags:["dashboard-folders"],url:`${Gi}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),L7e=d({tags:["dashboard-folders"],url:`${Gi}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(tl,["tags"]))}),response:qt});var Rs=`/${"v1"}/dashboard-folders`,rl=r.Pick($i,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),Jw={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(rl,{examples:[Jw]});var ev=r.Pick(kg,["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."}),j4={...Jw,dashboardCount:10};Object.assign(ev,{examples:[j4]});var Dg=r.Pick(el,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),F4={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(Dg,{examples:[F4]});var q4=r.Object({by:r.Enum(Mg,{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:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboard folders"}),tv=r.Object({...Ze,filters:r.Optional(r.Pick(tl,["owners","searchQuery","tags","parentFolderId"])),sort:r.Optional(q4)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),B4={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(tv,{examples:[B4]});var rv=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:`${Rs}/query`,method:"POST",paginated:!0,body:tv,response:r.Array(ev)}),nv=d({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${Rs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the dashboard folder to retrieve. Use the `id` returned by folder list, get, create, or update responses."})}),response:rl}),ov=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:Rs,method:"POST",body:Dg,response:rl}),iv=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:`${Rs}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the dashboard folder to update. Use the `id` returned by folder list, get, create, or update responses."})}),body:Dg,response:rl}),av=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:`${Rs}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the dashboard folder to delete. Use the `id` returned by folder list, get, create, or update responses."})}),response:N});var Cr="/v0/dashboards",cv=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],H4=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],eZe=[...H4,"note"];var K4=["ns","us","ms","s","m","h","days"];var z4=["B","KB","MB","GB","TB","PB"];var Y4=20;var pv=r.Object({type:r.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),uv=r.Object({type:r.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:r.Enum(K4,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),lv=r.Object({type:r.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:r.Enum(z4,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),mv=r.Object({type:r.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"}),dv=r.Object({type:r.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"}),fv=r.Object({type:r.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),gv=r.Object({type:r.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),hv=r.Object({type:r.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"}),V4=r.Object({type:r.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:r.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"}),Q4=r.Object({type:r.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:r.String({description:"Text label describing the custom unit. Must not be empty.",minLength:1,maxLength:Y4})},{$id:"InputDataNormalizerCustom",title:"Custom"}),Rt=C("type",[uv,lv,mv,dv,fv,gv,pv,hv,V4],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Ct=C("type",[uv,lv,mv,dv,fv,gv,pv,hv,Q4],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Gg=r.Object({attribute:r.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:r.Optional(Rt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),$g=r.Object({attribute:r.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:r.Optional(Ct)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),ji=["background","no-background"],W4=["table","legend-only","no-legend"];var Z4=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],yv=["alert","warning","success"],Pr=r.Object({operator:r.Enum(Z4,{description:"Comparator used to evaluate the metric value"}),value:r.Number({description:"Threshold value used when evaluating the operator"}),color:r.Enum(yv,{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."}),X4=r.Object({value:r.Number({description:"Y-axis value where the threshold marker is placed"}),level:r.Enum(yv,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),J4=["sec","min","hour","day"],vn=r.Object({time:r.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:r.Enum(J4,{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 wn=r.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),Fi=r.Object({formula:r.Optional(r.String({description:"Optional alias for formula (only used for display in the UI)"})),queries:r.Optional(r.Record(r.String(),r.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."}),qi=r.Object({formula:r.Optional(u({type:"short",description:"Optional alias for formula (only used for display in the UI)"})),queries:r.Optional(r.Record(r.String(),u({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."}),ol={source:ir,queries:kx,formula:r.Optional(su),aliases:r.Optional(Fi),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},il={source:ir,queries:os,formula:r.Optional(po),aliases:r.Optional(qi),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},Ur=r.Optional(r.Enum(["relative","absolute"],{description:"Whether each group holds its own value or its percentage of the ungrouped total (defaults to absolute)"})),Bi={...ol,groupBy:r.Optional(mi)},Hi={...il,groupBy:r.Optional(qr)},qe=r.Enum(W4,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),ye=r.Optional(r.Union([r.Number(),r.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."})),Jt=r.Optional(r.Array(X4,{description:"Threshold markers displayed on the chart"})),e3=r.Object({name:r.String({description:"Display name of the table column"}),...ol,source:ir,normalizer:r.Optional(Rt),precision:ye},{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`."}),t3=r.Object({name:u({description:"Display name of the table column"}),...il,source:ir,normalizer:r.Optional(Ct),precision:ye},{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`."}),r3=r.Array(r.Object({id:r.String({description:"ID of the column to sort by"}),desc:r.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."}),n3=r.Array(r.Object({id:u({description:"ID of the column to sort by"}),desc:r.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."}),jg=r.Array(r.Object({id:r.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:r.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."}),Fg=r.Array(r.Object({id:u({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:r.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."}),Tv=["horizontal","vertical"],o3=r.Object({type:r.Literal("list",{description:"Displays matching logs in a tabular list"}),query:r.String({description:"Query that selects logs for the list"}),listColumns:r.Optional(r.Array(Gg,{description:"Custom columns to display for each log"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets."})),defaultSorting:r.Optional(jg)},{$id:"GraphVisualizationList",title:"List"}),i3=r.Object({type:r.Literal("list",{description:"Displays matching logs in a tabular list"}),query:u({type:"tsuga-query",description:"Query that selects logs for the list"}),listColumns:r.Optional(r.Array($g,{description:"Custom columns to display for each log"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional(Fg)},{$id:"InputGraphVisualizationList",title:"List"}),nl=C("type",[r.Object({type:r.Literal("auto",{description:"Automatically choose this axis bound"})}),r.Object({type:r.Literal("number",{description:"Use a fixed numeric axis bound"}),value:r.Number({description:"Fixed numeric axis bound value"})})],{description:"Axis bound mode: automatic or fixed numeric value"}),Ki=r.Object({min:nl,max:nl,scale:C("type",[r.Object({type:r.Literal("pow",{description:"Power scale"}),exponent:r.Number({description:"Exponent used by the power scale"})}),r.Object({type:r.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:r.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets."}),zi=r.Object({min:nl,max:nl,scale:C("type",[r.Object({type:r.Literal("pow",{description:"Power scale"}),exponent:r.Number({minimum:0,description:"Exponent used by the power scale"})}),r.Object({type:r.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:r.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."}),a3=r.Array(r.Integer({description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"}),s3=r.Array(r.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 c3=r.Object({type:r.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(qe),thresholds:Jt,yAxisSettings:r.Optional(Ki)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),p3=r.Object({type:r.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(qe),thresholds:Jt,yAxisSettings:r.Optional(zi)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),u3=r.Object({type:r.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),query:r.String({description:"The read-only SQL query to execute against the connection."}),listColumns:r.Optional(r.Array(Gg,{description:"Custom columns to display for each database row"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets."})),defaultSorting:r.Optional(jg)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),l3=r.Object({type:r.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),query:u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),listColumns:r.Optional(r.Array($g,{description:"Custom columns to display for each database row"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional(Fg)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),m3=r.Object({type:r.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."}))},{$id:"GraphVisualizationTopListConnection",title:"TopListConnection"}),d3=r.Object({type:r.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1})},{$id:"InputGraphVisualizationTopListConnection",title:"TopListConnection"}),f3=r.Object({type:r.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(qe)},{$id:"GraphVisualizationPieConnection",title:"PieConnection"}),g3=r.Object({type:r.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(qe)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),h3=r.Object({type:r.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(qe),thresholds:Jt,yAxisSettings:r.Optional(Ki)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),y3=r.Object({type:r.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(qe),thresholds:Jt,yAxisSettings:r.Optional(zi)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),T3=r.Object({type:r.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),backgroundMode:r.Optional(r.Enum(ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Rt),legendMode:r.Optional(qe)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),E3=r.Object({type:r.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),backgroundMode:r.Optional(r.Enum(ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Ct),legendMode:r.Optional(qe)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),_3=r.Object({type:r.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:r.String({description:"Tsuga query that selects logs to cluster into patterns"}),layout:r.Optional(r.Enum(Tv,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),I3=r.Object({type:r.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:u({type:"tsuga-query",description:"Tsuga query that selects logs to cluster into patterns"}),layout:r.Optional(r.Enum(Tv,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),b3=r.Object({type:r.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:r.String({description:"Query that selects trace spans for the list"}),listColumns:r.Optional(r.Array(Gg,{description:"Custom columns to display for each span"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets."})),defaultSorting:r.Optional(jg)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),S3=r.Object({type:r.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:u({type:"tsuga-query",description:"Query that selects trace spans for the list"}),listColumns:r.Optional(r.Array($g,{description:"Custom columns to display for each span"})),listColumnsSize:r.Optional(r.Record(r.String(),r.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:r.Optional(r.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:r.Optional(Fg)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),Cs=r.Array(r.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."}),Ps=r.Array(u({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),A3=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Cs,aliases:r.Optional(Fi),timeBucket:r.Optional(vn),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(qe),thresholds:Jt,yAxisSettings:r.Optional(Ki),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),O3=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Ps,aliases:r.Optional(qi),timeBucket:r.Optional(vn),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(qe),thresholds:Jt,yAxisSettings:r.Optional(zi),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),x3=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Cs,aliases:r.Optional(Fi),backgroundMode:r.Optional(r.Enum(ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Rt),legendMode:r.Optional(qe)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),R3=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Ps,aliases:r.Optional(qi),backgroundMode:r.Optional(r.Enum(ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Ct),legendMode:r.Optional(qe)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),C3=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Cs,aliases:r.Optional(Fi),normalizer:r.Optional(Rt),precision:ye,conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),P3=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Ps,aliases:r.Optional(qi),normalizer:r.Optional(Ct),precision:ye,conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),U3=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Cs,aliases:r.Optional(Fi),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(qe)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),w3=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Ps,aliases:r.Optional(qi),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(qe)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),v3=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Cs,aliases:r.Optional(Fi),timeBucket:r.Optional(vn),precision:ye,normalizer:r.Optional(Rt),thresholds:Jt,legendMode:r.Optional(qe),yAxisSettings:r.Optional(Ki)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),N3=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Ps,aliases:r.Optional(qi),timeBucket:r.Optional(vn),precision:ye,normalizer:r.Optional(Ct),thresholds:Jt,legendMode:r.Optional(qe),yAxisSettings:r.Optional(zi)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),L3=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...Bi,groupByMode:Ur,timeBucket:r.Optional(vn),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(qe),thresholds:Jt,yAxisSettings:r.Optional(Ki),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),k3=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...Hi,groupByMode:Ur,timeBucket:r.Optional(vn),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(qe),thresholds:Jt,yAxisSettings:r.Optional(zi),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),Ev="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.",M3=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...Bi,groupByMode:Ur,normalizer:r.Optional(Rt),precision:ye,conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:r.Optional(r.Boolean({description:Ev}))},{$id:"GraphVisualizationTopList",title:"TopList"}),D3=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...Hi,groupByMode:Ur,normalizer:r.Optional(Ct),precision:ye,conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:r.Optional(r.Boolean({description:Ev}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),G3=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...Bi,groupByMode:Ur,normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(qe)},{$id:"GraphVisualizationPie",title:"Pie"}),$3=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...Hi,groupByMode:Ur,normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(qe)},{$id:"InputGraphVisualizationPie",title:"Pie"}),j3=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...ol,backgroundMode:r.Optional(r.Enum(ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Rt),legendMode:r.Optional(qe)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),F3=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...il,backgroundMode:r.Optional(r.Enum(ji,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Pr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Ct),legendMode:r.Optional(qe)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),q3=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...Bi,groupByMode:Ur,timeBucket:r.Optional(vn),precision:ye,normalizer:r.Optional(Rt),thresholds:Jt,legendMode:r.Optional(qe),yAxisSettings:r.Optional(Ki)},{$id:"GraphVisualizationBar",title:"Bar"}),B3=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...Hi,groupByMode:Ur,timeBucket:r.Optional(vn),precision:ye,normalizer:r.Optional(Ct),thresholds:Jt,legendMode:r.Optional(qe),yAxisSettings:r.Optional(zi)},{$id:"InputGraphVisualizationBar",title:"Bar"}),_v='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.',Iv=r.String({description:_v}),bv=u({description:_v}),H3=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...Bi,group:r.Optional(Iv),precision:ye,normalizer:r.Optional(Rt),percentileMarkers:r.Optional(a3),boundsScale:r.Optional(au)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),K3=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...Hi,group:r.Optional(bv),precision:ye,normalizer:r.Optional(Ct),percentileMarkers:r.Optional(s3),boundsScale:r.Optional(au)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),Sv=["red","pink","violet","blue","cyan","green","yellow","orange"],Av=r.Enum(Sv,{description:"Color palette used to render the heatmap intensity gradient"}),z3=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...Bi,group:r.Optional(Iv),precision:ye,normalizer:r.Optional(Rt),palette:r.Optional(Av)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),Y3=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...Hi,group:r.Optional(bv),precision:ye,normalizer:r.Optional(Ct),palette:r.Optional(Av)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),Ov=r.Object({from:r.Number({description:"Lower bound of the Gauge color threshold; runs up to the next threshold or the max"}),color:r.Enum(Sv,{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."}),V3=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...ol,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(Ov,{description:"Color thresholds inside the gauge range"})),precision:ye,normalizer:r.Optional(Rt)},{$id:"GraphVisualizationGauge",title:"Gauge"}),Q3=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...il,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(Ov,{description:"Color thresholds inside the gauge range"})),precision:ye,normalizer:r.Optional(Ct)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),W3=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(e3,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(mi),groupByMode:Ur,defaultSorting:r.Optional(r3),columnSizes:r.Optional(r.Record(r.String(),r.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"}),Z3=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(t3,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(qr),groupByMode:Ur,defaultSorting:r.Optional(n3),columnSizes:r.Optional(r.Record(r.String(),r.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"}),X3=r.Object({type:r.Literal("note",{description:"Displays static text on the dashboard"}),note:r.Optional(r.String({description:"Markdown-compatible text shown in the note"})),noteColor:r.Optional(r.Enum(cv,{description:"Background color used to render the note"})),noteAlign:r.Optional(wn),noteJustifyContent:r.Optional(wn)},{$id:"GraphVisualizationNote",title:"Note"}),J3=r.Object({type:r.Literal("note",{description:"Displays static text on the dashboard"}),note:r.Optional(u({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:r.Optional(r.Enum(cv,{description:"Background color used to render the note"})),noteAlign:r.Optional(wn),noteJustifyContent:r.Optional(wn)},{$id:"InputGraphVisualizationNote",title:"Note"}),eY=C("type",[c3,u3,m3,f3,h3,T3,A3,x3,C3,U3,v3,L3,M3,G3,j3,V3,q3,H3,z3,W3,o3,X3,_3,b3],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),tY=C("type",[p3,l3,d3,g3,y3,E3,O3,R3,P3,w3,N3,k3,D3,$3,F3,Q3,B3,K3,Y3,Z3,i3,J3,I3,S3],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),al=r.Object({id:r.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:r.Optional(r.String({description:"Display name of the graph widget."})),description:r.Optional(r.String({description:"Optional text shown with the graph widget."})),descriptionAlign:r.Optional(wn),descriptionJustifyContent:r.Optional(wn),visualization:eY,layout:r.Optional(r.Object({x:r.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:r.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:r.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:r.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 ${Sd}\xD7${Ad} (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."}),sl=r.Object({id:u({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:r.Optional(u({description:"Display name of the graph widget."})),description:r.Optional(r.String({minLength:1,maxLength:800,description:"Text shown with the graph widget."})),descriptionAlign:r.Optional(wn),descriptionJustifyContent:r.Optional(wn),visualization:tY,layout:r.Optional(r.Object({x:r.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:r.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:r.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:r.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 ${Sd}\xD7${Ad} (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."}),sv=10,rY=r.Array(r.Object({key:r.String({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:r.Array(r.String({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:r.Optional(r.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."}),nY=r.Array(r.Object({key:u({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:r.Array(u({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:r.Optional(r.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{maxItems:sv,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${sv} filters are allowed.`}),Yi=r.Object({id:r.String({description:"Tsuga-generated dashboard ID assigned when the dashboard is created."}),name:r.String({description:"Display name of the dashboard. Set by the caller on create or update."}),owner:r.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:r.Array(al,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(rY),createdAt:A({description:"Timestamp when Tsuga created the dashboard."}),updatedAt:A({description:"Timestamp when Tsuga last updated the dashboard."}),creator:r.Optional(pe),updater:r.Optional(pe),tags:De,timePreset:r.Optional(r.Enum(vl,{description:"Relative time preset used when opening the dashboard."})),folderId:r.Optional(r.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."}))}),cl=r.Object({name:u({description:"Display name of the dashboard."}),owner:u({allowEmpty:!1,description:"ID of the team that owns the dashboard. Required and used for dashboard access control."}),graphs:r.Array(sl,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(nY),tags:Xe,timePreset:r.Optional(r.Enum(vl,{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:r.Optional(r.Union([r.Null(),u({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."}))}),cr={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},xv=[cr.OWNER,cr.TAGS,cr.WIDGET_COUNT,cr.UPDATED_AT,cr.NAME],Us=r.Partial(r.Object({owners:_e(u({allowEmpty:!1}),{description:"Restrict results to dashboards owned by any of these team IDs",maxItems:50}),searchQuery:r.Object({value:u({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard names or dashboard IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:r.Optional(r.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:_e(Bt.items,{description:"Restrict results to dashboards that have at least one of the listed key/value tags",maxItems:50}),folderId:r.Union([r.Null(),u({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"})),oY=r.Partial(r.Object({...fe,filters:Us,sort:r.Object({by:r.Enum([cr.IS_FAVORITE,cr.OWNER,cr.TAGS,cr.WIDGET_COUNT,cr.UPDATED_AT,cr.NAME],{description:"Field to sort the returned dashboards by"}),direction:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"})})),tZe=d({tags:["dashboards"],url:`${Cr}/query`,method:"POST",paginated:!0,response:r.Array(Yi),body:oY}),rZe=d({tags:["dashboards"],url:`${Cr}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(Us,["tags"]))}),response:qt}),nZe=d({tags:["dashboards"],url:`${Cr}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(Us))}),response:r.Object({all:r.Integer({description:"Total number of dashboards matching the filters that the user can read."})})}),oZe=d({tags:["dashboards"],url:`${Cr}/:id`,method:"GET",params:r.Object({id:u()}),response:Yi}),iZe=d({tags:["dashboards"],url:Cr,method:"POST",body:cl,response:Yi}),aZe=d({tags:["dashboards"],url:`${Cr}/:id`,method:"PUT",params:r.Object({id:u()}),body:r.Partial(cl),response:Yi}),sZe=d({tags:["dashboards"],url:`${Cr}/bulk-update`,method:"PUT",body:r.Object({dashboardIds:r.Array(u(),{description:"Dashboard IDs to update. At least one dashboard ID is required."}),owner:r.Optional(u({allowEmpty:!1,description:"Owning team ID to apply to every dashboard. Optional when folderId is provided; omit to keep the current owner."})),folderId:r.Optional(r.Union([r.Null(),u({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:r.Object({})}),cZe=d({tags:["dashboards"],url:`${Cr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),pZe=d({tags:["dashboards"],url:`${Cr}/:id/graphs/:graphId`,method:"PUT",params:r.Object({id:u({allowEmpty:!1}),graphId:u({allowEmpty:!1})}),body:r.Omit(sl,["id"]),response:al}),uZe=d({tags:["dashboards"],url:`${Cr}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})});var Vi=`/${"v1"}/dashboards`,ws=r.Pick(Yi,["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)."}),iY={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(ws,{examples:[iY]});var aY=r.Object({by:r.Enum([...xv],{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:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"}),Rv=r.Object({...Ze,filters:r.Optional(r.Pick(Us,["owners","searchQuery","tags","folderId"])),sort:r.Optional(aY)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),sY={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(Rv,{examples:[sY]});var Cv=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:`${Vi}/query`,method:"POST",paginated:!0,body:Rv,response:r.Array(ws)}),Pv=d({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${Vi}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the saved dashboard to retrieve. Use the `id` returned by dashboard query, create, or update responses."})}),response:ws}),qg=r.Pick(cl,["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."}),cY={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(qg,{examples:[cY]});var pY=r.Omit(sl,["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."}),Uv=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:Vi,method:"POST",body:qg,response:ws}),wv=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:`${Vi}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the saved dashboard to update. Use the `id` returned by dashboard query, get, or create responses."})}),body:r.Partial(qg),response:ws}),uY=r.Object({id:u({allowEmpty:!1,description:"Identifier of the saved dashboard to delete. Use the `id` returned by dashboard query, get, create, or update responses."})}),vv=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:`${Vi}/:id`,method:"DELETE",params:uY,response:N}),TZe=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:`${Vi}/:id/graphs/:graphId`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the dashboard that contains the graph to update. Use the `id` returned by dashboard responses."}),graphId:u({allowEmpty:!1,description:"Identifier of the graph to update within the dashboard. Use graph IDs from the dashboard response."})}),body:pY,response:al});var Nv=100,Lv=3,Qi=r.Object({id:r.String({description:"Tsuga-generated ingestion API key ID assigned when the key is created."}),name:r.String({description:"Human-readable key name. Names must be kebab-case when creating or updating keys."}),keyLastCharacters:r.String({description:"Last visible characters of the secret key. Use this to identify a key without exposing the full secret."}),owner:r.String({description:"Team ID that owns and manages the ingestion API key."}),tags:qt,teamOverrideFields:r.Optional(r.Array(r.String(),{description:"Telemetry attribute names used to override ownership for data sent with this key."})),updatedAt:A({description:"Timestamp when Tsuga last updated the key metadata."}),createdAt:A({description:"Timestamp when Tsuga created the key."}),creator:r.Optional(pe),updater:r.Optional(pe),assetUpdatedAt:A({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})}),vs=r.Object({name:r.String({format:ri,minLength:1,maxLength:Nv,description:`Kebab-case name for the ingestion API key. Maximum length is ${Nv} characters.`}),owner:u({allowEmpty:!1,description:"Team ID that will own and manage the ingestion API key."}),tags:Bt,teamOverrideFields:r.Union([r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:Lv,description:`Array form. Up to ${Lv} fields are allowed.`}),r.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."})}),Wi="/v0/ingestion-api-keys",RZe=d({tags:["ingestion-api-keys"],url:Wi,method:"POST",body:vs,response:r.Intersect([Qi,r.Object({key:r.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."})})])}),CZe=d({tags:["ingestion-api-keys"],url:Wi,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(Qi)}),PZe=d({tags:["ingestion-api-keys"],url:`${Wi}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1})}),response:Qi}),UZe=d({tags:["ingestion-api-keys"],url:`${Wi}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1})}),body:vs,response:Qi}),wZe=d({tags:["ingestion-api-keys"],url:`${Wi}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1})}),response:N}),vZe=d({tags:["ingestion-api-keys"],url:`${Wi}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u({allowEmpty:!1}))}),response:r.Object({})});var Ns=`/${"v1"}/ingestion-api-keys`,Ls=r.Pick(Qi,["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)."}),kv={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(Ls,{examples:[kv]});var Mv=r.Pick(vs,["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."}),Dv=r.Pick(vs,["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."}),Gv={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(Mv,{examples:[Gv]});Object.assign(Dv,{examples:[Gv]});var lY={...kv,key:"tsuga_in:v1:abc123xyx7Qm"},$v=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:Ns,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Ls)}),jZe=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:`${Ns}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the ingestion API key to retrieve. Use the `id` returned by ingestion API key list or create responses."})}),response:Ls}),mY=r.Intersect([r.Pick(Ls,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),r.Object({key:r.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:lY}),jv=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:Ns,method:"POST",body:Mv,response:mY}),Fv=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:`${Ns}/:id`,method:"PUT",params:r.Object({id:u({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:Dv,response:Ls}),qv=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:`${Ns}/:id`,method:"DELETE",params:r.Object({id:u({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:N});var dY={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"]}},[HZe,pl,ks]=fY(dY),KZe=Object.fromEntries(pl.map(e=>[e,e]));function fY(e){let t=[],n=[],o=[],i=Object.keys(e);for(let a of i){t.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[Bg(t),Bg(n),Bg(o)]}function Bg(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var Hg=r.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),gY=r.Object({versioningStatus:r.Optional(r.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),hY=r.Object({domainName:r.Optional(r.String()),origins:r.Optional(r.Array(r.String()))}),yY=r.Object({allocatedStorageGib:r.Optional(r.Number()),encryptedAtRest:r.Optional(r.Boolean()),engine:r.Optional(r.String()),dynamoDbItemCount:r.Optional(r.Number()),dynamoDbActualSizeGib:r.Optional(r.Number())}),TY=r.Object({version:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),subnets:r.Optional(r.Array(r.String()))}),EY=r.Object({artifactRegistryFormat:r.Optional(r.Enum(["FORMAT_UNSPECIFIED","DOCKER","MAVEN","NPM","APT","YUM","PYTHON","KFP","GO","GENERIC"])),uri:r.Optional(r.String()),tagMutability:r.Optional(r.Enum(["MUTABLE","IMMUTABLE"])),scanOnPush:r.Optional(r.Boolean()),encryptionType:r.Optional(r.String())}),_Y=r.Object({status:r.Optional(r.String()),activeServices:r.Optional(r.Number()),pendingTasks:r.Optional(r.Number()),runningTasks:r.Optional(r.Number()),registeredContainerInstances:r.Optional(r.Number()),capacityProviders:r.Optional(r.Array(r.String()))}),IY=r.Object({status:r.Optional(r.String()),desiredStatus:r.Optional(r.String()),healthStatus:r.Optional(r.String()),availabilityZone:r.Optional(r.String()),startedAt:r.Optional(A())}),bY=r.Object({isEncrypted:r.Optional(r.Boolean()),ownerId:r.Optional(r.String()),state:r.Optional(r.Enum(["creating","available","deleting","deleted","error","updating"]))}),SY=r.Object({type:r.Optional(r.String()),osType:r.Optional(r.String()),subnetIds:r.Optional(r.Array(r.String())),nbContainers:r.Optional(r.Number())}),AY=r.Object({digest:r.String(),imageTags:r.Array(r.String()),imageSizeBytes:r.Optional(r.Number()),imagePushedAt:r.Optional(A()),mediaType:r.Optional(r.String()),repositoryName:r.String(),repositoryId:r.Optional(r.String()),scanStatus:r.Optional(r.String())}),OY=r.Object({url:r.Optional(r.String()),maxMessageSizeBytes:r.Optional(r.Number()),messageRetentionHours:r.Optional(r.Number())}),xY=r.Object({runtime:r.Optional(r.String()),memoryAllocationMib:r.Optional(r.Number()),timeoutMs:r.Optional(r.Number()),codeSha256:r.Optional(r.String())}),RY=r.Object({kind:r.Optional(r.String())}),CY=r.Object({instanceId:r.String(),architecture:r.Optional(r.String()),instanceType:r.Optional(r.String()),operatingSystem:r.Optional(r.String()),memoryMib:r.Optional(r.Number()),vCpus:r.Optional(r.Number()),vpcId:r.Optional(r.String()),k8sClusterId:r.Optional(r.String())}),PY=r.Object({id:r.Optional(r.String()),ipCidrBlocks:r.Array(r.String())}),UY=r.Object({protocol:r.Optional(Hg),port:r.Optional(r.Number()),instanceProtocol:r.Optional(Hg),instancePort:r.Optional(r.Number())}),wY=r.Object({protocol:r.Optional(r.String()),ports:r.Optional(r.Array(r.String())),portRange:r.Optional(r.String()),allPorts:r.Optional(r.Boolean())}),vY=r.Object({name:r.String(),ip:r.Optional(r.String()),type:r.Enum(["public","private"])}),NY=r.Object({type:r.String(),name:r.String()}),LY=r.Object({frontendIp:r.Optional(vY),backendIpPools:r.Array(NY)}),kY=r.Object({targetId:r.String(),targetPort:r.Optional(r.Number()),targetType:r.Optional(r.Enum(["instance","ip","lambda","alb"])),healthState:r.Optional(r.String()),healthReason:r.Optional(r.String()),healthDescription:r.Optional(r.String()),availabilityZone:r.Optional(r.String())}),MY=r.Object({protocol:r.Optional(Hg),port:r.Optional(r.Number()),type:r.Optional(r.Enum(["alb","lambda","instance","ip"])),name:r.Optional(r.String()),targetGroupArn:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),healthCheckProtocol:r.Optional(r.String()),healthCheckPort:r.Optional(r.String()),healthCheckPath:r.Optional(r.String()),healthCheckIntervalSeconds:r.Optional(r.Number()),healthCheckTimeoutSeconds:r.Optional(r.Number()),healthyThresholdCount:r.Optional(r.Number()),unhealthyThresholdCount:r.Optional(r.Number()),targets:r.Optional(r.Array(kY)),targetCount:r.Optional(r.Number()),healthyTargetCount:r.Optional(r.Number()),loadBalancerArns:r.Optional(r.Array(r.String()))}),DY=r.Object({first:r.Optional(r.String()),last:r.Optional(r.String()),scope:r.Optional(r.Number())}),GY=r.Object({type:r.Optional(r.String()),name:r.Optional(r.String()),alwaysServe:r.Optional(r.Boolean()),subnets:r.Optional(r.Array(r.Union([r.Number(),DY]))),target:r.Optional(r.String()),weight:r.Optional(r.Number()),priority:r.Optional(r.Number()),status:r.Optional(r.String())}),$Y=r.Object({instanceId:r.Optional(r.String()),state:r.Optional(r.String()),reasonCode:r.Optional(r.String()),description:r.Optional(r.String())}),jY=r.Object({loadBalancerType:r.Optional(r.String()),dnsName:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),subnetIds:r.Array(r.String()),scheme:r.Optional(r.String()),listeners:r.Optional(r.Union([r.Array(UY),r.Array(wY)])),targets:r.Optional(r.Union([r.Array(r.String()),r.Array($Y),r.Array(GY)])),azureLoadBalancingRules:r.Optional(r.Array(LY))}),FY=r.Object({domainName:r.Optional(r.String()),expiresAt:r.Optional(A()),inUseBy:r.Optional(r.Array(r.String())),renewalEligibility:r.Optional(r.String()),revokedAt:r.Optional(A()),status:r.Optional(r.String()),type:r.Optional(r.String())}),qY=r.Object({state:r.Optional(r.Enum(["creating","available","deleting","deleted","error","in-use"])),volumeType:r.Optional(r.Enum(["gp2","gp3","io1","io2","st1","sc1","standard"]))}),BY=r.Object({osType:r.Optional(r.Enum(["Windows","Linux"]))}),HY=r.Object({state:r.Optional(r.String()),volumeType:r.Optional(r.String())}),KY=r.Intersect([r.Object({isEncrypted:r.Optional(r.Boolean()),sizeGib:r.Optional(r.Number())}),r.Union([qY,HY,BY])]),zY=r.Object({instanceCount:r.Optional(r.Number()),hostnames:r.Optional(r.Array(r.String())),runtime:r.Optional(r.String())}),ul=r.Union([r.Object({category:r.Literal("application"),resourceType:r.Literal("webService"),attributes:r.Optional(zY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("bucket"),attributes:r.Optional(gY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("messagingService"),attributes:r.Optional(OY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("fileSystem"),attributes:r.Optional(bY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("contentDeliveryNetwork"),attributes:r.Optional(hY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("database"),attributes:r.Optional(yY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("storageAccount"),attributes:r.Optional(RY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("volume"),attributes:r.Optional(KY)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("virtualMachine"),attributes:r.Optional(CY)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("serverless"),attributes:r.Optional(xY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("kubernetesCluster"),attributes:r.Optional(TY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerRepository"),attributes:r.Optional(EY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerCluster"),attributes:r.Optional(_Y)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerServiceTask"),attributes:r.Optional(IY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerService"),attributes:r.Optional(SY)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerImage"),attributes:r.Optional(AY)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("virtualNetwork"),attributes:r.Optional(PY)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("loadBalancer"),attributes:jY}),r.Object({category:r.Literal("network"),resourceType:r.Literal("targetGroup"),attributes:r.Optional(MY)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("certificate"),attributes:r.Optional(FY)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var Oo="/v0/inventory",Bv=["scan_in_progress","success","failure","partial"],zg=r.Object({id:r.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:r.Enum(In,{description:"Cloud platform where Tsuga discovered this resource."}),cloudAccount:r.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:r.Optional(r.String({description:"Cloud region where Tsuga discovered this resource, when the resource is regional."})),fullyQualifiedResourceId:r.String({description:"Cloud-native unique identifier for this resource, such as an AWS ARN, GCP resource name, or Azure resource ID."}),displayName:r.String({description:"Human-readable resource name shown in Tsuga. Derived from cloud provider metadata when available."}),nativeResourceType:r.String({description:"Cloud-native resource type reported by the inventory integration, for example `aws_ec2_instance` or `gcp_bucket`."}),resourceCreatedAt:r.Optional(A({description:"Timestamp when the resource was created in the cloud, when known."})),resourceUpdatedAt:r.Optional(A({description:"Timestamp when the resource was last updated in the cloud, when known."})),resourceLastSeenAt:A({description:"Timestamp when Tsuga last observed this resource during an inventory scan."}),tags:De,nativeAttributes:r.Optional(r.Unsafe({type:"object",additionalProperties:!0})),covered:r.Optional(r.Boolean({description:"Whether the resource is covered by the configured infrastructure-as-code identifiers"}))}),Zi={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},Hv=r.Object({cloudPlatforms:_e(r.Enum(In),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:In.length}),cloudAccounts:_e(u({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud accounts",maxItems:500}),cloudRegions:_e(u({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud regions",maxItems:500}),nativeResourceTypes:_e(r.Enum(ks),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:ks.length}),resourceTypes:_e(r.Enum(pl),{description:"Restrict results to resources of any of these normalized resource types",maxItems:pl.length}),tags:_e(Bt.items,{description:"Restrict results to resources that have at least one of the listed key/value tags",maxItems:50}),isIacManaged:r.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:r.Object({value:u({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:r.Optional(r.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"}),Yg=r.Partial(r.Object({...fe,filters:r.Partial(Hv,{description:"Filters applied to narrow the returned resources."}),sort:r.Object({by:r.Enum([Zi.DISPLAY_NAME,Zi.CLOUD_ACCOUNT,Zi.NATIVE_RESOURCE_TYPE,Zi.CLOUD_REGION,Zi.RESOURCE_TYPE,Zi.RESOURCE_CREATED_AT],{description:"Field to sort the returned resources by"}),direction:r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned resources. Ties are broken by resource ID for stable pagination."})})),eXe=d({tags:["inventory"],method:"POST",url:`${Oo}/resources/query`,paginated:!0,body:Yg,response:r.Array(r.Intersect([zg,ul]))}),YY=["resourceType","cloudAccount","isIacManaged"],tXe=d({tags:["inventory"],method:"POST",url:`${Oo}/resources/counts`,body:r.Object({filters:r.Optional(r.Partial(Hv)),groupBy:r.Enum(YY,{description:"Dimension to group the resource counts by."})}),response:r.Array(r.Object({value:r.String({description:'The group value the count belongs to: a resource type, a cloud account id, or "true"/"false" for IaC coverage.'}),count:r.Integer({description:"Number of resources in this group matching the requested filters."})}))}),rXe=d({tags:["inventory"],method:"GET",url:`${Oo}/resources/filter-options`,response:r.Object({cloudRegions:r.Array(r.String(),{description:"Distinct cloud regions present across the tenant's resources."}),nativeResourceTypes:r.Array(r.String(),{description:"Distinct cloud-native resource types present across the tenant's resources."}),tags:qt})}),nXe=C("type",[r.Object({type:r.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:r.String({description:"AWS account ID that Tsuga scans."}),externalId:r.String({description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:r.String({description:"ARN of the IAM role Tsuga assumes to read inventory in the account."})}),r.Object({type:r.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:r.String({description:"GCP project ID that Tsuga scans."}),serviceAccountId:r.String({description:"Service account Tsuga impersonates to read inventory."}),workloadIdentityProvider:r.String({description:"Workload identity provider resource name used for federated authentication."})}),r.Object({type:r.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:r.String({description:"Client ID of the Azure application Tsuga authenticates as."}),subscriptionId:r.String({description:"Azure subscription ID that Tsuga scans."}),tenantId:r.String({description:"Azure tenant ID that owns the subscription."})})]),VY="^[0-9]{12}$",QY="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",WY="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",ZY="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",XY="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",Kg="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",JY=r.Object({type:r.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:r.String({pattern:VY,description:"AWS account ID that Tsuga scans.",errorMessage:{pattern:"Must be a 12-digit AWS account ID."}}),externalId:u({allowEmpty:!1,description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:r.String({pattern:QY,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"}),e9=r.Object({type:r.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:r.String({pattern:WY,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:r.String({pattern:ZY,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:r.String({pattern:XY,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"}),t9=r.Object({type:r.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:r.String({pattern:Kg,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:r.String({pattern:Kg,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:r.String({pattern:Kg,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),Kv=C("type",[JY,e9,t9],{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`."}),Xi=r.Object({id:r.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:r.Enum(In,{description:"Cloud provider of the account."}),cloudAccountId:r.String({description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:r.Optional(r.String({description:"Human-readable name for the account shown in Tsuga."})),organizationId:r.Optional(r.String({description:"Cloud organization identifier, when known."})),createdBy:r.Optional(r.String({description:"Identifier of the user who created the account, when created by a user."})),createdAt:A({description:"Timestamp when the account was registered in Tsuga."}),lastScanStartedAt:r.Optional(A({description:"Timestamp when the most recent inventory scan started."})),lastScanFinishedAt:r.Optional(A({description:"Timestamp when the most recent inventory scan finished."})),lastScanStatus:r.Optional(r.Enum(Bv,{description:"Status of the most recent inventory scan."}))}),Vg=r.Object({cloudType:r.Enum(In,{description:"Cloud provider of the account."}),cloudAccountId:u({allowEmpty:!1,description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:r.Optional(u({description:"Human-readable name for the account shown in Tsuga."})),organizationId:r.Optional(u({description:"Cloud organization identifier, when known."})),connectionSettings:Kv,lastScanStatus:r.Optional(r.Enum(Bv,{description:"Status of the most recent inventory scan."}))}),xo=`${Oo}/cloud-accounts`,oXe=d({tags:["inventory"],url:xo,method:"GET",response:r.Array(Xi)}),iXe=d({tags:["inventory"],url:`${xo}/:id`,method:"GET",params:r.Object({id:u()}),response:Xi}),aXe=d({tags:["inventory"],url:xo,method:"POST",body:Vg,response:Xi}),Qg=r.Object({accountFriendlyName:u({description:"Human-readable name for the account shown in Tsuga."})}),sXe=d({tags:["inventory"],url:`${xo}/:id`,method:"PUT",params:r.Object({id:u()}),body:Qg,response:Xi}),cXe=d({tags:["inventory"],url:`${xo}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),pXe=d({tags:["inventory"],url:`${Oo}/trigger-scan`,method:"POST",body:r.Object({}),response:r.Object({success:r.Literal(!0)})}),uXe=d({tags:["inventory"],url:`${xo}/azure/onboarding`,method:"POST",body:r.Object({tenantId:u()}),response:r.Object({subjectId:r.String(),audience:r.String()})}),lXe=d({tags:["inventory"],method:"POST",url:`${xo}/validate/:type`,params:r.Object({type:u()}),body:r.Object({data:Kv,id:r.Optional(u())}),response:r.Object({areAccountSettingsValid:r.Boolean(),message:r.Optional(r.String())})}),zv=`${Oo}/settings`,mXe=d({tags:["inventory"],url:zv,method:"GET",response:r.Object({settings:r.Optional(r.Object({id:r.String(),infrastructureIdentifiers:r.Array(r.Object({name:r.String(),value:r.Optional(r.String())}))}))})}),r9=50,dXe=d({tags:["inventory"],url:zv,method:"POST",body:r.Object({infrastructureIdentifiers:r.Array(r.Object({name:u({allowEmpty:!1}),value:r.Optional(u({allowEmpty:!1}))}),{maxItems:r9})}),response:r.Object({})}),fXe=d({tags:["inventory"],url:`${Oo}/iac-tags-proposal`,method:"GET",response:r.Array(r.Object({name:r.String(),value:r.Optional(r.String())}))});var Yv=`/${"v1"}/inventory`,n9=r.Omit(zg,["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)."}),Vv=r.Intersect([n9,ul],{$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)."}),o9={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(Vv,{examples:[o9]});var Qv=r.Object({...Yg.properties,...Ze},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),i9={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(Qv,{examples:[i9]});var Wv=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:`${Yv}/resources/query`,method:"POST",paginated:!0,body:Qv,response:r.Array(Vv)}),Ms=`${Yv}/cloud-accounts`,Ds=r.Pick(Xi,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),a9={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(Ds,{examples:[a9]});var Zv=r.Pick(Vg,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),s9={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(Zv,{examples:[s9]});var c9=r.Pick(Qg,["accountFriendlyName"]),SXe=d({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:Ms,method:"GET",response:r.Array(Ds)}),AXe=d({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${Ms}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the cloud account to retrieve. Use the `id` returned by the cloud account list or create operations."})}),response:Ds}),OXe=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:Ms,method:"POST",body:Zv,response:Ds}),xXe=d({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${Ms}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the cloud account to update. Use the `id` returned by the cloud account list or create operations."})}),body:c9,response:Ds}),RXe=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:`${Ms}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the cloud account to delete. Use the `id` returned by the cloud account list or create operations."})}),response:N});var Gs="/v0/investigations",p9=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],u9=r.Object({type:r.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:r.String({description:"Identifier of the linked asset"})}),l9=r.Object({type:r.Enum(p9,{description:"Kind of linked asset"}),id:u({allowEmpty:!1,description:"Identifier of the linked asset"})}),Xr=r.Object({id:r.String({description:"Identifier of the investigation"}),name:r.String({description:"Human readable name shown for the investigation"}),slug:r.Optional(r.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:r.Optional(r.String({description:"Markdown content capturing the investigation notes and findings"})),tags:De,owner:r.String({description:"Team ID owning the investigation"}),env:r.Optional(r.String({description:'Environment the investigation relates to, e.g. "prod"'})),linkedAssets:r.Array(u9,{description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}),creator:r.Optional(pe),updater:r.Optional(pe),createdAt:A({description:"Timestamp the investigation was created at."}),updatedAt:A({description:"Timestamp the investigation was last updated at."})},{title:"Investigation"}),ll=r.Object({name:u({allowEmpty:!1,description:"Human readable name shown for the investigation"}),slug:u({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:r.Optional(u({type:"long",description:"Markdown content capturing the investigation notes and findings"})),tags:Xe,owner:u({allowEmpty:!1,description:"Team ID owning the investigation"}),env:r.Optional(u({allowEmpty:!0,description:"Environment the investigation relates to"})),linkedAssets:r.Optional(r.Array(l9,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),Wg=r.Object(r.Omit(ll,["slug"]).properties),kXe=d({tags:["investigations"],url:Gs,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(Xr)}),MXe=d({tags:["investigations"],url:`${Gs}/:id`,params:r.Object({id:u()}),method:"GET",response:Xr}),DXe=d({tags:["investigations"],url:Gs,method:"POST",body:ll,response:Xr}),GXe=d({tags:["investigations"],url:`${Gs}/:id`,method:"PUT",body:Wg,params:r.Object({id:u()}),response:Xr}),$Xe=d({tags:["investigations"],url:`${Gs}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N});var $s=`/${"v1"}/investigations`,Xv=d({description:"Retrieve all investigations",tags:["private"],url:$s,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Xr)}),Jv=d({description:"Retrieve an investigation by its id",tags:["private"],url:`${$s}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1})}),response:Xr}),eN=d({description:"Create a new investigation",tags:["private"],url:$s,method:"POST",body:ll,response:Xr}),tN=d({description:"Update an investigation by its id",tags:["private"],url:`${$s}/:id`,method:"PUT",body:Wg,params:r.Object({id:u({allowEmpty:!1})}),response:Xr}),rN=d({description:"Delete an investigation by its id",tags:["private"],url:`${$s}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1})}),response:N});var nN=15,ml={id:r.String({description:"Unique identifier of the processor within the route. Used to preserve processor identity during updates."}),description:r.Optional(r.String({description:"Optional user-provided processor note."})),tags:De,updatedAt:r.Optional(A({description:"Timestamp when Tsuga last updated the processor."}))},dl={id:u({allowEmpty:!1,description:"Unique identifier of the processor within the route. Preserve it across updates for existing processors."}),description:r.Optional(u({type:"long",description:"Optional processor note."})),tags:Xe,updatedAt:r.Optional(A({description:"Backend-maintained timestamp for this processor. Omit this field on create and update requests; Tsuga sets or preserves it based on processor changes."}))},oN={...ml,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},iN={...dl,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},m9=C("subtype",[r.Object({targetAttribute:r.String({description:"Attribute that will receive the formatted value"}),formatString:r.String({description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:r.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Whether missing referenced attributes render as empty strings. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorFormatString"}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the computed value"}),formula:r.String({description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:r.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:r.Optional(r.Boolean({description:"Whether missing referenced attributes evaluate as zero. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorMathFormula"}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:r.String({description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:r.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:r.Optional(r.String({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:r.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."}),d9=C("subtype",[r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:u({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))},{$id:"InputProcessorParamsCreatorFormatString"}),r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the computed value"}),formula:u({allowEmpty:!1,type:"long",description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to evaluate as zero. Defaults to true."}))},{$id:"InputProcessorParamsCreatorMathFormula"}),r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:u({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:u({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:nN,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:r.Optional(u({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:r.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."}),f9=r.Object({...oN,params:m9}),g9=r.Object({...iN,params:d9}),aN={...ml,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},sN={...dl,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},h9=C("subtype",[r.Object({attributes:r.Array(r.Object({originAttribute:r.String({description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Whether the source attribute is preserved after mapping. If omitted, route processing treats this as false."})),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),targetAttribute:r.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:r.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"ProcessorParamsMapperMapAttributes"}),r.Object({attributeName:r.String({description:"Attribute whose value will determine the log level"}),subtype:r.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"ProcessorParamsMapperMapLevel"}),r.Object({attributeName:r.String({description:"Attribute whose value will determine the log timestamp"}),subtype:r.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."}),y9=C("subtype",[r.Object({attributes:r.Array(r.Object({originAttribute:u({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:r.Optional(r.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:u({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:r.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"InputProcessorParamsMapperMapAttributes"}),r.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:r.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"InputProcessorParamsMapperMapLevel"}),r.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:r.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."}),T9=r.Object({...sN,params:y9}),E9=r.Object({...aN,params:h9}),cN={...ml,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},pN={...dl,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},uN=5,_9=C("subtype",[r.Object({attributeName:r.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(r.String({description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:r.Optional(r.Array(r.String(),{description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:r.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the URL to parse"}),subtype:r.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the user agent string to parse"}),subtype:r.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),r.Object({sourceAttribute:r.String({description:"Attribute containing the key/value string segment to parse"}),targetAttribute:r.String({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:r.String({description:"Delimiter separating keys from values in the source string"}),pairsSplitter:r.String({description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:r.Boolean({description:"Whether keys without explicit values are accepted by the parser."}),subtype:r.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."}),I9=C("subtype",[r.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(u({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:r.Optional(r.Array(u({type:"long"}),{maxItems:uN,description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:r.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),r.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:r.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),r.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:r.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),r.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the key/value string segment to parse"}),targetAttribute:u({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:u({allowEmpty:!1,description:"Delimiter separating keys from values in the source string"}),pairsSplitter:u({allowEmpty:!0,description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:r.Boolean({description:"Set to true to accept keys without explicit values."}),subtype:r.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."}),b9=r.Object({...cN,params:_9}),S9=r.Object({...pN,params:I9}),A9=r.Object({...iN,params:C("subtype",[r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:u({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("format-string"),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))}),r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:u({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:u({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:nN,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:r.Optional(u({description:"String category value used when no clause matches."})),subtype:r.Literal("category")})])}),O9=r.Object({...sN,params:r.Object({attributes:r.Array(r.Object({originAttribute:u({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:r.Optional(r.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:u({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:r.Literal("map-attributes")})}),x9=r.Object({...pN,params:r.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(u({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:r.Optional(r.Array(u({type:"long"}),{maxItems:uN,description:"Example log lines for validating the Grok rules."})),subtype:r.Literal("grok")})}),XXe=C("type",[O9,x9,A9]),R9=r.Object({...oN,params:C("subtype",[r.Object({targetAttribute:r.String({description:"Attribute that will receive the formatted value"}),formatString:r.String({description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),subtype:r.Literal("format-string"),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Whether missing referenced attributes render as empty strings."}))}),r.Object({targetAttribute:r.String({description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:r.String({description:"Query that selects logs for this category clause."}),value:r.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value."}),defaultValue:r.Optional(r.String({description:"String category value used when no clause matches."})),subtype:r.Literal("category")})])}),C9=r.Object({...aN,params:r.Object({attributes:r.Array(r.Object({originAttribute:r.String({description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Whether the source attribute is preserved after mapping."})),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),targetAttribute:r.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:r.Literal("map-attributes")})}),P9=r.Object({...cN,params:r.Object({attributeName:r.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:r.Array(r.String({description:"Grok rule applied to parse text."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:r.Optional(r.Array(r.String(),{description:"Example log lines for validating the Grok rules."})),subtype:r.Literal("grok")})}),JXe=C("type",[C9,P9,R9]),U9=11,lN=r.Cyclic({OutputProcessor:r.Union([E9,b9,f9,r.Object({...ml,params:r.Object({items:r.Array(r.Object({query:r.String({description:"Query that determines whether logs enter this branch"}),processors:r.Array(r.Ref("OutputProcessor"),{description:"Processors executed when the branch query matches"})}),{description:"Conditional branches evaluated in order before falling back to the default"})}),type:r.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"OutputProcessor",{description:"Processing step executed sequentially on route logs"}),mN=r.Cyclic({InputProcessor:r.Union([T9,S9,g9,r.Object({...dl,params:r.Object({items:r.Array(r.Object({query:u({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:r.Array(r.Ref("InputProcessor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:U9,description:"Conditional branches evaluated in order before falling back to the default"})}),type:r.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 w9="/v0/logs",Nn=`${w9}/routes`,Ln=r.Object({id:r.String({description:"Tsuga-generated log route ID assigned when the route is created."}),name:r.String({description:"Human-readable route name shown in Tsuga."}),description:r.Optional(r.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:r.Boolean({description:"Whether this route is active for newly ingested logs. Disabled routes remain saved but do not process logs."}),query:r.String({description:"Tsuga query that selects which newly ingested logs enter the route processor chain."}),rank:r.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:De,owner:r.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 the `query` field or delete the route."}),processors:r.Array(lN,{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:r.Optional(pe),updater:r.Optional(pe),updatedAt:A({description:"Timestamp when Tsuga last updated the route."}),createdAt:A({description:"Timestamp when Tsuga created the route."}),assetUpdatedAt:A({description:"Timestamp when Tsuga last changed route behavior. This can differ from `updatedAt` when only metadata such as `description` or `tags` changed."})},{title:"LogRoute"}),js=r.Object({name:u({allowEmpty:!1,description:"Human-readable log route name shown in Tsuga."}),description:r.Optional(u({type:"long",description:"Optional free-text note about the log route's purpose. This metadata is not evaluated when matching or processing logs."})),isEnabled:r.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:u({type:"tsuga-query",description:"Tsuga query that selects which newly ingested logs enter the log route processor chain."}),tags:Xe,owner:u({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 the `query` field or delete the log route."}),processors:r.Array(mN,{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 cJe=d({tags:["routes"],url:Nn,method:"GET",paginated:!0,query:r.Object(fe),response:r.Array(Ln)}),pJe=d({tags:["routes"],url:`${Nn}/:id`,params:r.Object({id:u()}),method:"GET",response:Ln}),uJe=d({tags:["routes"],url:Nn,method:"POST",body:js,response:Ln}),lJe=d({tags:["routes"],url:`${Nn}/:id`,method:"PUT",body:js,params:r.Object({id:u()}),response:Ln}),mJe=d({tags:["routes"],url:`${Nn}/:id/clone`,method:"POST",params:r.Object({id:u()}),body:js,response:Ln}),dJe=d({tags:["routes"],url:`${Nn}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),fJe=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:`${Nn}/:id/modify-ranking`,method:"PUT",params:r.Object({id:u()}),body:r.Object({rank:r.Integer({minimum:1,description:"Target rank for the route, from 1 to the total number of routes. Requests outside that range are rejected."})}),response:r.Object({})}),gJe=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:`${Nn}/:id/enable`,method:"PUT",params:r.Object({id:u()}),body:r.Object({enable:r.Boolean({description:"Set to true to enable the route, or false to disable it."})}),response:Ln});var Fs=`/${"v1"}/routes`,dN={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}"]}}]},fN={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}}]},qs=r.Pick(Ln,["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)."}),v9={id:"123-456-abc",...dN},N9={id:"456-789-def",...fN};Object.assign(qs,{examples:[v9,N9]});var gN=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:Fs,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(qs)}),hN=d({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${Fs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the log route to retrieve. Use the `id` returned by route list or create responses."})}),response:qs}),Zg=r.Pick(js,["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(Zg,{examples:[dN,fN]});var yN=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:Fs,method:"POST",body:Zg,response:qs}),TN=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:`${Fs}/:id`,method:"PUT",body:Zg,params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the log route to update. Use the `id` returned by route list, get, or create responses."})}),response:qs}),EN=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:`${Fs}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the log route to delete. Use the `id` returned by route list, create, or update responses."})}),response:N});var Bs=`/${"v1"}/monitors`,Hs=r.Pick(Br,["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)."}),IN={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:[]},bN={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:[]},SN={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:[]},AN={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",service:"api-gateway"}},priority:2,owner:"team-123-abc",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},L9={id:"123-456-abc",...IN},k9={id:"234-567-bcd",...bN},M9={id:"345-678-cde",...SN},D9={id:"456-789-def",...AN};Object.assign(Hs,{examples:[L9,k9,M9,D9]});var _N=r.Pick(kd,["filters","sort","limit","offset"]),ON=r.Object({..._N.properties,...Ze,filters:_N.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),G9={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(ON,{examples:[G9]});var xN=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:`${Bs}/query`,method:"POST",paginated:!0,body:ON,response:r.Array(Hs)}),RN=d({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${Bs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:Hs}),CN=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],PN=r.Pick(is,CN,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),UN=r.Pick(is,CN,{$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."}),wN=IN,vN=bN,NN=SN,LN=AN;Object.assign(PN,{examples:[wN,vN,NN,LN]});Object.assign(UN,{examples:[wN,vN,NN,LN]});var kN=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:Bs,method:"POST",body:PN,response:Hs}),MN=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:`${Bs}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the saved monitor to update. Use the `id` returned by monitor query or create responses."})}),body:UN,response:Hs}),$9=r.Object({id:u({allowEmpty:!1,description:"Identifier of the saved monitor to delete. Use the `id` returned by monitor query, create, or update responses."})}),DN=d({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${Bs}/:id`,method:"DELETE",params:$9,response:N});var Ks=`/${"v1"}/notification-rules`,zs=r.Pick(Ei,["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)."}),GN={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}}}]},j9={id:"123-456-abc",...GN};Object.assign(zs,{examples:[j9]});var $N=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:Ks,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(zs)}),jN=d({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${Ks}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification rule to retrieve. Use the `id` returned by notification rule list or create responses."})}),response:zs}),Xg=r.Pick(cs,["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."}),F9=GN;Object.assign(Xg,{examples:[F9]});var FN=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:Ks,method:"POST",body:Xg,response:zs}),qN=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:`${Ks}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification rule to update. Use the `id` returned by notification rule list, get, or create responses."})}),body:Xg,response:zs}),q9=r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification rule to delete. Use the `id` returned by notification rule list, get, create, or update responses."})}),BN=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:`${Ks}/:id`,method:"DELETE",params:q9,response:N});var Ji=`${yi}/silences`,HN=r.Union([r.Literal("monday"),r.Literal("tuesday"),r.Literal("wednesday"),r.Literal("thursday"),r.Literal("friday"),r.Literal("saturday"),r.Literal("sunday")]),B9=r.Partial(r.Record(HN,r.Array(r.Object({startTime:r.String({format:jm,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:r.String({format:jm,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`."}),H9=r.Partial(r.Record(HN,r.Array(r.Object({startTime:r.String({description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:r.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`."}),fl='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',KN="One-time silence schedule with specific start and end times",zN="Recurring weekly silence schedule",K9=C("type",[r.Object({type:r.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:r.String({format:Fm,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:r.String({format:Fm,description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future."}),timeZone:r.Optional(r.String({format:$m,description:fl}))},{$id:"InputSilenceScheduleOneTime",description:KN}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:B9,timeZone:r.Optional(r.String({format:$m,description:fl}))},{$id:"InputSilenceScheduleRecurring",description:zN})],{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."}),z9=C("type",[r.Object({type:r.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:r.String({description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:r.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:r.Optional(r.String({description:fl}))},{$id:"OutputSilenceScheduleOneTime",description:KN}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:H9,timeZone:r.Optional(r.String({description:fl}))},{$id:"OutputSilenceScheduleRecurring",description:zN})],{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."}),Y9="monitor_id",YN=`Query on the alerting monitor tags and group-by dimensions, e.g. \`env:prod AND service:bridge\`. The monitor itself can be targeted with \`${Y9}:<monitor id>\`.`,gl=r.Object({name:u({description:"Display name of the silence"}),reason:u({allowEmpty:!1,type:"long",description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the silence"}),tags:Xe,isActive:r.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:K9,notificationRuleIds:r.Optional(r.Array(u(),{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:r.Optional(u({type:"tags-query",description:YN})),teamsFilter:Kd,prioritiesFilter:r.Array(r.Enum(St),{maxItems:St.length,description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(lo),{maxItems:lo.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),ea=r.Object({id:r.String({description:"Tsuga-generated notification silence ID assigned when the silence is created."}),name:r.String({description:"Display name of the silence"}),reason:r.String({description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:r.String({description:"Team ID that owns and manages the silence"}),tags:De,isActive:r.Boolean({description:"Whether the silence suppresses matching notifications while its schedule is active. When false, the silence is kept but never suppresses anything."}),schedule:z9,notificationRuleIds:r.Optional(r.Array(r.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:r.Optional(r.String({description:YN})),teamsFilter:Hd,prioritiesFilter:r.Array(r.Enum(St),{description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:r.Array(r.Enum(lo),{description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."}),createdAt:A(),updatedAt:A(),creator:r.Optional(pe),updater:r.Optional(pe)}),YJe=d({tags:["notification-silences"],url:Ji,method:"GET",response:r.Array(ea)}),VJe=d({tags:["notification-silences"],url:`${Ji}/:id`,params:r.Object({id:u()}),method:"GET",response:ea}),QJe=d({tags:["notification-silences"],url:Ji,method:"POST",body:gl,response:ea}),WJe=d({tags:["notification-silences"],url:`${Ji}/:id`,method:"PUT",params:r.Object({id:u()}),body:gl,response:ea}),ZJe=d({tags:["notification-silences"],url:`${Ji}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),XJe=d({tags:["notification-silences"],url:`${Ji}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})});var Ys=`/${"v1"}/notification-silences`,Vs=r.Pick(ea,["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)."}),V9={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"]},Q9={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(Vs,{examples:[V9,Q9]});var VN=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:Ys,method:"GET",response:r.Array(Vs)}),QN=d({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${Ys}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification silence to retrieve. Use the `id` returned by notification silence list or create responses."})}),response:Vs}),Jg=r.Pick(gl,["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."}),W9={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"]},Z9={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(Jg,{examples:[W9,Z9]});var WN=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:Ys,method:"POST",body:Jg,response:Vs}),ZN=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:`${Ys}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification silence to update. Use the `id` returned by notification silence list, get, or create responses."})}),body:Jg,response:Vs}),X9=r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification silence to delete. Use the `id` returned by notification silence list, get, create, or update responses."})}),XN=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:`${Ys}/:id`,method:"DELETE",params:X9,response:N});var J9={critical:3,important:2,normal:1},se=e=>({label:e,weight:J9[e]}),eV={"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:se("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:se("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:se("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:`${hd} matches ${Zp}`,summary:`Detects logs and spans whose ${hd} resource attribute names a different team than the ${Zp} resolved at ingestion.`,rationale:`${Zp} 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:se("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:`${Xp} present`,summary:`Logs and spans must populate ${Xp} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:se("critical"),recommendation:`Populate ${Xp} 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:se("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:se("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:`${es} presence`,summary:`Logs and spans must populate ${es} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:se("important"),recommendation:`Populate ${es} 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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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:se("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 ${ux} 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:se("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"}},JN={"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_"]}},tV=Object.fromEntries(Object.keys(JN).map(e=>{let{label:t,receiver:n}=JN[e];return[e,{key:e,title:`${t} server metrics collected`,summary:`${t} 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:se("important"),recommendation:n?`Configure the ${n} OpenTelemetry receiver so ${t} server metrics are collected.`:`Collect ${t} server metrics, for example via its Prometheus exporter.`,scope:"global"}]})),rV=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),nV=ks.filter(e=>e.startsWith("azure_")&&!rV.has(e)),eL={"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:nV,metricPrefixes:["azure_"]}},oV=Object.fromEntries(Object.keys(eL).map(e=>{let{label:t,source:n}=eL[e];return[e,{key:e,title:`${t} metrics collected`,summary:`${t} 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:se("important"),recommendation:`Enable the ${n} metrics integration so ${t} metrics are ingested.`,scope:"global"}]})),iV={...eV,...tV,...oV},tL=Object.values(iV);var rL=["passed","failed","ignored"],aV=10,sV=r.Enum(rL,{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."}),cV=["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"],pV=["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"],th=["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",...pV,...cV],uV=r.Enum(th),lV=["log","metric","resource","span","api-key","dashboard","monitor","route"],mV=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],dV=["critical","important","normal"],fV=["team","global"],rh=r.Object({key:r.Enum(th),title:r.String(),summary:r.String(),rationale:r.String(),objectType:r.Enum(lV),category:r.Enum(mV),impact:r.Object({label:r.Enum(dV),weight:r.Number()}),recommendation:r.String(),scope:r.Optional(r.Enum(fV))}),Qs=r.Object({type:r.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:r.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:r.Object({to:r.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:r.Optional(r.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:r.Optional(r.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."})}),eh=r.Intersect([rh,r.Object({id:r.Optional(r.String()),status:sV,normalizedScore:r.Number(),details:r.Optional(r.Record(r.String(),r.Unknown())),recommendation:r.Optional(r.String()),examples:r.Optional(r.Array(Qs)),exampleCount:r.Optional(r.Integer())})]),gV=r.Object({generatedAt:r.String(),overallScore:r.Optional(r.Number()),rules:r.Array(rh),teamResults:r.Array(r.Object({teamId:r.String(),teamName:r.String(),teamWeight:r.Number(),score:r.Number(),weightedScore:r.Number(),totalWeight:r.Number(),ruleResults:r.Array(eh)})),globalResults:r.Optional(r.Object({score:r.Optional(r.Number()),ruleResults:r.Array(eh)}))}),nh=r.Object({id:r.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:r.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:r.Enum(th,{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:r.Optional(r.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:r.Enum(rL,{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:r.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:r.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:r.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:r.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:r.Optional(r.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:r.Optional(r.Array(Qs,{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 ${aV}; compare against exampleCount to detect truncation.`})),exampleCount:r.Optional(r.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:r.String({description:"ISO timestamp the row was generated at"})}),get=d({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:gV}),oh=r.Optional(u({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."})),het=d({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:r.Object({clusterId:oh,team:r.Optional(u({allowEmpty:!1}))}),response:r.Array(nh,{description:"Latest persisted rule evaluation rows for the cluster"})}),yet=d({tags:["quality-reports"],url:"/v0/quality-reports/:id/examples",method:"GET",params:r.Object({id:u({allowEmpty:!1})}),response:r.Object({examples:r.Array(Qs)})}),Tet=d({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:r.Object({ruleKey:uV,teamId:r.Optional(u({allowEmpty:!1})),lookbackMinutes:r.Optional(r.Integer({minimum:1,maximum:60})),clusterId:r.Optional(u({allowEmpty:!1}))}),response:r.Object({rule:rh,result:eh,teamId:r.Optional(r.String()),teamName:r.Optional(r.String())})}),Eet=new Map(tL.map(e=>[e.key,e]));var nL=`/${"v1"}/quality-reports`,oL=r.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)."}),hV={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(oL,{examples:[hV]});var yV=r.Object({clusterId:oh,team:r.Optional(u({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."}),iL=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:`${nL}/latest`,method:"GET",query:yV,response:r.Array(oL)}),Ret=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:`${nL}/:id/examples`,method:"GET",params:r.Object({id:u({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:r.Object({examples:r.Array(Qs,{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 Ws="/v0/admin-center";var wr=`${Ws}/retention-policies`,aL=3650,TV=r.Integer({description:"Number of days Tsuga retains matching telemetry."}),sL=r.Integer({minimum:1,maximum:aL,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${aL}.`}),Jr=r.Object({id:r.String({description:"Unique identifier of the retention policy. Generated by Tsuga."}),env:r.Optional(r.String({description:"Environment tag value this policy applies to. Omitted policies apply across environments unless a more specific policy exists."})),teamId:r.Optional(r.String({description:"Team ID this policy applies to. Omitted policies apply globally unless a team-specific policy exists."})),dataSource:r.Enum(br,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:TV,isEnabled:r.Boolean({description:"Whether this policy participates in retention resolution."}),createdAt:A({description:"Timestamp when Tsuga created the retention policy."}),updatedAt:A({description:"Timestamp when Tsuga last updated the retention policy."})}),hl=r.Object({env:r.Optional(u({description:"Environment tag value this policy applies to. Omit for a policy that is not environment-specific."})),teamId:r.Optional(u({description:"Team ID this policy applies to. Omit for a policy that is not team-specific."})),dataSource:r.Enum(br,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:sL,isEnabled:r.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),cL=r.Array(r.Object({env:u(),dataSource:r.Enum(br),durationDays:r.Union([sL,r.Null()]),isEnabled:r.Boolean()})),pL=r.Object({inserted:r.Array(Jr),updated:r.Array(Jr),deleted:r.Array(Jr)}),Met=d({tags:["retention-policies"],url:wr,method:"POST",body:hl,response:Jr}),Det=d({tags:["retention-policies"],url:wr,method:"GET",response:r.Array(Jr)}),Get=d({tags:["retention-policies"],url:`${wr}/:id`,method:"GET",params:r.Object({id:u()}),response:Jr}),$et=d({tags:["retention-policies"],url:`${wr}/:id`,method:"PUT",params:r.Object({id:u()}),body:hl,response:Jr}),jet=d({tags:["retention-policies"],url:`${wr}/bulk-update`,method:"POST",body:cL,response:pL}),Fet=d({tags:["retention-policies"],url:`${wr}/bulk-update-for-team`,method:"POST",body:r.Object({teamId:u(),policies:cL}),response:pL}),qet=d({tags:["retention-policies"],url:`${wr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),Zs=["past-24-hours","past-7-days","past-30-days"],Bet=d({tags:["retention-policies"],url:`${wr}/requested-history-percentile/:teamId`,method:"POST",params:r.Object({teamId:u()}),body:r.Object({percentile:r.Number({minimum:0,maximum:1}),observationWindow:r.Enum(Zs),dataSource:r.Enum(br)}),response:r.Object({percentile:r.Number(),observationWindow:r.Enum(Zs),dataSource:r.Enum(br),teamId:r.String(),requestedHistoryDays:r.Number()})}),EV=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var _V=r.Array(r.Object({bucket:r.Enum(EV),count:r.Number()})),Het=d({tags:["retention-policies"],url:`${wr}/requested-history-histogram/:teamId`,method:"POST",params:r.Object({teamId:u()}),body:r.Object({observationWindow:r.Enum(Zs),dataSource:r.Enum(br)}),response:r.Object({observationWindow:r.Enum(Zs),dataSource:r.Enum(br),teamId:r.String(),histogram:_V})}),Ket=d({tags:["retention-policies"],url:`${wr}/top-teams-with-retention-surplus`,method:"POST",body:r.Object({dataSource:r.Enum(br),observationWindow:r.Enum(Zs),percentile:r.Number({minimum:0,maximum:1}),topN:r.Optional(r.Number({minimum:1,maximum:20}))}),response:r.Array(r.Object({teamId:r.String(),retentionSurplusDays:r.Number()}))});var Xs=`/${"v1"}/retention-policies`,Js=r.Pick(Jr,["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)."}),IV={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Js,{examples:[IV]});var uL=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:Xs,method:"GET",response:r.Array(Js)}),lL=d({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${Xs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the retention policy to retrieve. Use the `id` returned by retention policy list or create responses."})}),response:Js}),ih=r.Pick(hl,["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."}),bV={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(ih,{examples:[bV]});var mL=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:Xs,method:"POST",body:ih,response:Js}),dL=d({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${Xs}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the retention policy to update. Use the `id` returned by retention policy list, get, or create responses."})}),body:ih,response:Js}),fL=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:`${Xs}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the retention policy to delete. Use the `id` returned by retention policy list, create, or update responses."})}),response:N});var ec=`/${"v1"}/slos`,SV=r.Pick($d,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),tc=r.Object({...r.Pick(hi,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:r.Array(SV,{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"}),AV={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(tc,{examples:[AV]});var gL=r.Pick(qd,["filters","sort","limit","offset"]),hL=r.Object({...gL.properties,...Ze,filters:gL.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),OV={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(hL,{examples:[OV]});var yL=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:`${ec}/query`,method:"POST",paginated:!0,body:hL,response:r.Array(tc)}),TL=d({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${ec}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:tc}),EL=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],_L=r.Pick(fu,EL,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),IL=r.Pick(jd,EL,{$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."}),bL={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(_L,{examples:[bL]});Object.assign(IL,{examples:[bL]});var SL=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:ec,method:"POST",body:_L,response:tc}),AL=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:`${ec}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the SLO to update. Use the `id` returned by SLO query or create."})}),body:IL,response:tc}),OL=d({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${ec}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the SLO to delete. Use the `id` returned by SLO query or create."})}),response:N});var Ro=`${Ws}/tag-policies`;var xV=["logs","metrics","traces"],ah=r.Array(r.Enum(xV,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),RV=r.Union([Mp,ah]),CV=r.Object({teamIds:r.Array(r.String(),{description:"Team IDs used by this policy scope."}),mode:r.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."}),PV=C("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:ah,shouldInsertWarning:r.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:r.Optional(r.Number({description:"Percentage of non-compliant telemetry datapoints to drop. Omitted means no sampling drop is configured."}))},{title:"TelemetryTagPolicy"}),r.Object({type:r.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:Mp},{title:"TsugaAssetTagPolicy"})]),UV=C("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:ah,shouldInsertWarning:r.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:r.Optional(r.Number({minimum:0,maximum:100,description:"Percentage of non-compliant telemetry datapoints to drop. Valid values are 0 through 100."}))},{title:"TelemetryTagPolicy"}),r.Object({type:r.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:Mp},{title:"TsugaAssetTagPolicy"})]),xL="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",wV=r.Unsafe({...PV,description:xL}),vV=r.Unsafe({...UV,description:xL}),ta=r.Object({id:r.String({description:"Tsuga-generated tag policy ID assigned when the policy is created."}),name:r.String({description:"Human-readable tag policy name."}),description:r.Optional(r.String({description:"Optional user-provided policy description."})),isActive:r.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:r.String({description:"Tag key enforced by this policy."}),allowedTagValues:r.Array(r.String(),{description:"Allowed values for `tagKey`. An empty array means any value is accepted when the tag exists."}),isRequired:r.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:r.Optional(CV),configuration:wV,creator:r.Optional(pe),updater:r.Optional(pe),owner:r.Optional(r.String({description:"Team ID that owns and manages the policy."})),createdAt:A({description:"Timestamp when Tsuga created the tag policy."}),updatedAt:A({description:"Timestamp when Tsuga last updated the tag policy."}),assetUpdatedAt:A({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})});var rc=r.Object({name:u({description:"Human-readable tag policy name."}),description:r.Optional(u({description:"Optional policy description."})),isActive:r.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:u({allowEmpty:!1,description:"Tag key enforced by this policy. Tsuga trims surrounding whitespace before storing the policy."}),allowedTagValues:r.Array(u({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:r.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:r.Optional(r.Object({teamIds:r.Array(u(),{minItems:1,maxItems:100,description:"Team IDs used by this policy scope."}),mode:r.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:vV,owner:u({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),ftt=d({tags:["tag-policies"],url:Ro,method:"GET",query:r.Object({teamIds:r.Optional(r.Array(u(),{maxItems:100})),assetTypes:r.Optional(RV),searchQuery:r.Optional(u())}),response:r.Array(ta)}),gtt=d({tags:["tag-policies"],url:`${Ro}/:id`,method:"GET",params:r.Object({id:u()}),response:ta}),htt=d({tags:["tag-policies"],url:Ro,method:"POST",body:rc,response:ta}),ytt=d({tags:["tag-policies"],url:`${Ro}/:id`,method:"PUT",params:r.Object({id:u()}),body:rc,response:ta}),Ttt=d({tags:["tag-policies"],url:`${Ro}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),Ett=d({tags:["tag-policies"],url:`${Ws}/applicable-tag-rules`,method:"GET",query:r.Object({assetType:r.Enum(Ka),teamId:u()}),response:r.Array(r.Object({tagKey:r.String(),allowedTagValues:r.Array(r.String()),isRequired:r.Boolean(),tagPolicyId:r.String()}))}),RL=r.Object({total:r.Number(),totalNonCompliant:r.Number(),idsNonCompliant:r.Array(r.String())}),CL=r.Union([r.Literal("ingestion-api-key"),r.Literal("operation-api-key"),r.Literal("rum-public-token"),r.Literal("dashboard"),r.Literal("log-route"),r.Literal("metric-route"),r.Literal("monitor"),r.Literal("notification-rule"),r.Literal("notification-silence"),r.Literal("slo")]),NV=r.Object({total:r.Number(),totalNonCompliant:r.Number(),byAssetType:r.Record(CL,RL)}),LV=r.Omit(RL,["total"]),kV=r.Object({totalNonCompliant:r.Number(),byAssetType:r.Record(CL,LV)}),PL=r.Object({totals:NV,byTeam:r.Record(r.String(),kV)}),_tt=d({tags:["tag-policies"],url:`${Ro}/:id/stats`,method:"GET",params:r.Object({id:u()}),response:PL}),Itt=d({tags:["tag-policies"],url:`${Ro}/new-policy-stats`,method:"POST",body:rc,response:PL});var nc=`/${"v1"}/tag-policies`,UL={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"},wL={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"},MV={id:"123-456-abc",...UL},DV={id:"456-789-def",...wL},oc=r.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)."}),GV=MV,$V=DV;Object.assign(oc,{examples:[GV,$V]});var sh=r.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."}),jV=UL,FV=wL;Object.assign(sh,{examples:[jV,FV]});var vL=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:nc,method:"GET",response:r.Array(oc)}),NL=d({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${nc}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the tag policy to retrieve. Use the `id` returned by tag policy list or create responses."})}),response:oc}),LL=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:nc,method:"POST",body:sh,response:oc}),kL=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:`${nc}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the tag policy to update. Use the `id` returned by tag policy list, get, or create responses."})}),body:sh,response:oc}),ML=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:`${nc}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the tag policy to delete. Use the `id` returned by tag policy list, create, or update responses."})}),response:N});var ic=`/${"v1"}/teams`,ac=r.Pick(di,["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)."}),qV={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(ac,{examples:[qV]});var DL=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:ic,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(ac)}),GL=d({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${ic}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the team to retrieve. Use the `id` returned by team list or create responses."})}),response:ac}),ch=r.Pick(uu,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),BV={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(ch,{examples:[BV]});var $L=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:ic,method:"POST",body:ch,response:ac}),jL=d({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${ic}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the team to update. Use the `id` returned by team list, get, or create responses."})}),body:ch,response:ac}),FL=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:`${ic}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the team to delete. Use the `id` returned by team list, create, or update responses."})}),response:N});function HV(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function qL(e,t){let n=Number(t);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${t})`);return n}function BL(e){let t={};return e.limit!==void 0&&(t.limit=qL("limit",e.limit)),e.offset!==void 0&&(t.offset=qL("offset",e.offset)),t}function ph(e){let t=e.params;if(t?.properties){let n=Object.keys(t.properties);if(n.length===1&&n[0])return n[0]}return"id"}function HL(e,t,n){let o=e.command(t.commandName).description(t.description),i=t.singularOverride??jx(t.commandName).replace(/-/g," "),a=t.pluralOverride??t.commandName.replace(/-/g," "),c=HV(i),l=o.command("list").description(t.listDescription??`List all ${a}`);if(t.listOptions)for(let m of t.listOptions)l.option(m.flag,m.description);if(t.endpoints.list.paginated===!0&&l.option("--limit <n>",`Maximum number of items to return, up to ${oi} (default: ${kp})`).option("--offset <n>","Number of items to skip, to request a later page"),t.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){ee(ki(t.endpoints.list));return}let f=m.data?bi({data:m.data}):{},h=await n()(t.endpoints.list,{body:{...f,...BL(m)}});ee(h)}):l.action(async m=>{let f=BL(m);if(t.listOptions)for(let E of t.listOptions){let I=m[E.queryParam];I!==void 0&&(f[E.queryParam]=I)}let h=await n()(t.endpoints.list,Object.keys(f).length>0?{query:f}:void 0);ee(h)}),t.endpoints.get){let m=t.endpoints.get,f=ph(m);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});ee(E)})}if(t.endpoints.create){let m=t.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){ee(ki(m));return}let h=bi(f),E=await n()(m,{body:h});ee(E)})}if(t.endpoints.update){let m=t.endpoints.update,f=ph(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){ee(ki(m));return}let I=bi(E),g=await n()(m,{params:{[f]:h},body:I});ee(g)})}if(t.endpoints.delete){let m=t.endpoints.delete,f=ph(m);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});ee(E)})}}var KV=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:Wv},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:rv,get:nv,create:ov,update:iv,delete:av},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:Cv,get:Pv,create:Uv,update:wv,delete:vv},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:$v,create:jv,update:Fv,delete:qv}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:Xv,get:Jv,create:eN,update:tN,delete:rN}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:xN,get:RN,create:kN,update:MN,delete:DN},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:$N,get:jN,create:FN,update:qN,delete:BN}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:VN,get:QN,create:WN,update:ZN,delete:XN}},{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:iL},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:uL,get:lL,create:mL,update:dL,delete:fL}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:gN,get:hN,create:yN,update:TN,delete:EN}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:KR,get:zR}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:yL,get:TL,create:SL,update:AL,delete:OL},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:vL,get:NL,create:LL,update:kL,delete:ML}},{commandName:"teams",description:"Manage teams",endpoints:{list:DL,get:GL,create:$L,update:jL,delete:FL}}];function KL(e,t){for(let n of KV)HL(e,n,t)}var zL=require("node:child_process");var yl="@tsuga/cli@latest";function zV(){V(`Updating ${yl}`),V(` $ npm install -g ${yl}`);try{(0,zL.execFileSync)("npm",["install","-g",yl],{stdio:["ignore","inherit","inherit"]})}catch(e){let t=e.status??1;throw new Error(`npm install -g ${yl} exited ${t}`,{cause:e})}V("Updated. Run `tsuga --version` to confirm the new version.")}function YL(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{zV()})}var hh=require("node:fs"),gh=require("node:os"),na=require("node:path");var YV=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,sc=class e extends Date{#t=!1;#r=!1;#e=null;constructor(t){let n=!0,o=!0,i="Z";if(typeof t=="string"){let a=t.match(YV);a?(a[1]||(n=!1,t=`0000-01-01T${t}`),o=!!a[2],o&&t[10]===" "&&(t=t.replace(" ","T")),a[2]&&+a[2]>23?t="":(i=a[3]||null,t=t.toUpperCase(),!i&&o&&(t+="Z"))):t=""}super(t),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 t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;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(t,n="Z"){let o=new e(t);return o.#e=n,o}static wrapAsLocalDateTime(t){let n=new e(t);return n.#e=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#t=!1,n.#e=null,n}};function VV(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function QV(e,t,n){let o=e.split(/\r\n|\n|\r/g),i="",a=(Math.log10(t+1)|0)+1;for(let c=t-1;c<=t+1;c++){let l=o[c-1];l&&(i+=c.toString().padEnd(a," "),i+=": ",i+=l,i+=`
|
|
142
143
|
`,c===t&&(i+=" ".repeat(a+n+2),i+=`^
|
|
143
|
-
`))}return i}var X=class extends Error{line;column;codeblock;constructor(t,n){let[o,i]=
|
|
144
|
+
`))}return i}var X=class extends Error{line;column;codeblock;constructor(t,n){let[o,i]=VV(n.toml,n.ptr),a=QV(n.toml,o,i);super(`Invalid TOML document: ${t}
|
|
144
145
|
|
|
145
|
-
${a}`,n),this.line=o,this.column=i,this.codeblock=a}};var
|
|
146
|
+
${a}`,n),this.line=o,this.column=i,this.codeblock=a}};var WV=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,ZV=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,XV=/^[+-]?0[0-9_]/;function Tl(e,t){let n=e[t++],o=n,i=n==="'",a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
|
|
146
147
|
`?t++:e[t]==="\r"&&e[t+1]===`
|
|
147
148
|
`&&(t+=2));let c="",l=t,m=0;for(let f=t;f<e.length;f++)if(n=e[f],a&&(n===`
|
|
148
149
|
`||n==="\r"&&e[f+1]===`
|
|
149
150
|
`))m=m&&3;else{if(n<" "&&n!==" "||n==="\x7F")throw new X("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 X("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 X("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+=`
|
|
150
|
-
`;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 X("unrecognized escape sequence",{toml:e,ptr:f});l=f+1,m=0}else if(n!==" "&&n!==" "){if(m===2)throw new X("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:l});m=!i&&n==="\\"?1:0,l=f}}throw new X("unfinished string",{toml:e,ptr:t})}function
|
|
151
|
-
`,t);return e[o-1]==="\r"&&o--,o<=n?o:-1}function
|
|
151
|
+
`;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 X("unrecognized escape sequence",{toml:e,ptr:f});l=f+1,m=0}else if(n!==" "&&n!==" "){if(m===2)throw new X("invalid escape: only line-ending whitespace may be escaped",{toml:e,ptr:l});m=!i&&n==="\\"?1:0,l=f}}throw new X("unfinished string",{toml:e,ptr:t})}function VL(e,t,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=WV.test(e);if(i||ZV.test(e)){if(XV.test(e))throw new X("leading zeroes are not allowed",{toml:t,ptr:n});e=e.replace(/_/g,"");let c=+e;if(isNaN(c))throw new X("invalid number",{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(c))&&!o)throw new X("integer value cannot be represented losslessly",{toml:t,ptr:n});(i||o===!0)&&(c=BigInt(e))}return c}let a=new sc(e);if(!a.isValid())throw new X("invalid value",{toml:t,ptr:n});return a}function El(e,t=0,n=e.length){let o=e.indexOf(`
|
|
152
|
+
`,t);return e[o-1]==="\r"&&o--,o<=n?o:-1}function ra(e,t){for(let n=t;n<e.length;n++){let o=e[n];if(o===`
|
|
152
153
|
`)return n;if(o==="\r"&&e[n+1]===`
|
|
153
154
|
`)return n+1;if(o<" "&&o!==" "||o==="\x7F")throw new X("control characters are not allowed in comments",{toml:e,ptr:t})}return e.length}function vr(e,t,n,o){let i;for(;;){for(;(i=e[t])===" "||i===" "||!n&&(i===`
|
|
154
155
|
`||i==="\r"&&e[t+1]===`
|
|
155
|
-
`);)t++;if(o||i!=="#")break;t=
|
|
156
|
+
`);)t++;if(o||i!=="#")break;t=ra(e,t)}return t}function QL(e,t,n,o,i=!1){if(!o)return t=El(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let c=e[a];if(c==="#"){if(a=El(e,a),a<0)break}else{if(c===n)return a+1;if(c===o||i&&(c===`
|
|
156
157
|
`||c==="\r"&&e[a+1]===`
|
|
157
|
-
`))return a}}throw new X("cannot find end of structure",{toml:e,ptr:t})}function
|
|
158
|
-
`&&e[f]!=="\r")throw new X("unexpected character encountered",{toml:e,ptr:f});e[f]===","&&f++}return[m,f]}let c=
|
|
159
|
-
`&&c!=="\r"){let l,m=i,f=!1,[h,E]=
|
|
160
|
-
`&&a!=="\r"){let c=cc(e,t-1,"]",n-1,o);i.push(c[0]),t=c[1]}}if(!a)throw new X("unfinished array encountered",{toml:e,ptr:t});return[i,t]}function
|
|
161
|
-
`&&e[l]!=="\r")throw new X("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=vr(e,l)}return o}var
|
|
158
|
+
`))return a}}throw new X("cannot find end of structure",{toml:e,ptr:t})}function JV(e,t,n){let o=e.slice(t,n),i=o.indexOf("#");return i>-1&&(ra(e,i),o=o.slice(0,i)),[o.trimEnd(),i]}function cc(e,t,n,o,i){if(o===0)throw new X("document contains excessively nested structures. aborting.",{toml:e,ptr:t});let a=e[t];if(a==="["||a==="{"){let[m,f]=a==="["?ZL(e,t,o,i):WL(e,t,o,i);if(n){if(f=vr(e,f),e[f]===",")f++;else if(e[f]!==n)throw new X("expected comma or end of structure",{toml:e,ptr:f})}return[m,f]}if(a==='"'||a==="'"){let[m,f]=Tl(e,t);if(n){if(f=vr(e,f),e[f]&&e[f]!==","&&e[f]!==n&&e[f]!==`
|
|
159
|
+
`&&e[f]!=="\r")throw new X("unexpected character encountered",{toml:e,ptr:f});e[f]===","&&f++}return[m,f]}let c=QL(e,t,",",n),l=JV(e,t,c-(e[c-1]===","?1:0));if(!l[0])throw new X("incomplete key-value declaration: no value specified",{toml:e,ptr:t});return n&&l[1]>-1&&(c=vr(e,t+l[1]),e[c]===","&&c++),[VL(l[0],e,t,i),c]}var e6=/^[a-zA-Z0-9-_]+[ \t]*$/;function _l(e,t,n="="){let o=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new X("incomplete key-value: cannot find end of key",{toml:e,ptr:t});do{let c=e[t=++o];if(c!==" "&&c!==" ")if(c==='"'||c==="'"){if(c===e[t+1]&&c===e[t+2])throw new X("multiline strings are not allowed in keys",{toml:e,ptr:t});let[l,m]=Tl(e,t);o=e.indexOf(".",m);let f=e.slice(m,o<0||o>a?a:o),h=El(f);if(h>-1)throw new X("newlines are not allowed in keys",{toml:e,ptr:t+o+h});if(f.trimStart())throw new X("found extra tokens after the string part",{toml:e,ptr:m});if(a<m&&(a=e.indexOf(n,m),a<0))throw new X("incomplete key-value: cannot find end of key",{toml:e,ptr:t});i.push(l)}else{o=e.indexOf(".",t);let l=e.slice(t,o<0||o>a?a:o);if(!e6.test(l))throw new X("only letter, numbers, dashes and underscores are allowed in keys",{toml:e,ptr:t});i.push(l.trimEnd())}}while(o+1&&o<a);return[i,vr(e,a+1,!0,!0)]}function WL(e,t,n,o){let i={},a=new Set,c;for(t++;(c=e[t++])!=="}"&&c;){if(c===",")throw new X("expected value, found comma",{toml:e,ptr:t-1});if(c==="#")t=ra(e,t);else if(c!==" "&&c!==" "&&c!==`
|
|
160
|
+
`&&c!=="\r"){let l,m=i,f=!1,[h,E]=_l(e,t-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 X("trying to redefine an already defined value",{toml:e,ptr:t});!f&&l==="__proto__"&&Object.defineProperty(m,l,{enumerable:!0,configurable:!0,writable:!0})}if(f)throw new X("trying to redefine an already defined value",{toml:e,ptr:t});let[I,g]=cc(e,E,"}",n-1,o);a.add(I),m[l]=I,t=g}}if(!c)throw new X("unfinished table encountered",{toml:e,ptr:t});return[i,t]}function ZL(e,t,n,o){let i=[],a;for(t++;(a=e[t++])!=="]"&&a;){if(a===",")throw new X("expected value, found comma",{toml:e,ptr:t-1});if(a==="#")t=ra(e,t);else if(a!==" "&&a!==" "&&a!==`
|
|
161
|
+
`&&a!=="\r"){let c=cc(e,t-1,"]",n-1,o);i.push(c[0]),t=c[1]}}if(!a)throw new X("unfinished array encountered",{toml:e,ptr:t});return[i,t]}function XL(e,t,n,o){let i=t,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 uh(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let o={},i={},a=o,c=i;for(let l=vr(e,0);l<e.length;){if(e[l]==="["){let m=e[++l]==="[",f=_l(e,l+=+m,"]");if(m){if(e[f[1]-1]!=="]")throw new X("expected end of table declaration",{toml:e,ptr:f[1]-1});f[1]++}let h=XL(f[0],o,i,m?2:1);if(!h)throw new X("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=_l(e,l),f=XL(m[0],a,c,0);if(!f)throw new X("trying to redefine an already defined table or value",{toml:e,ptr:l});let h=cc(e,m[1],void 0,t,n);f[1][f[0]]=h[0],l=h[1]}if(l=vr(e,l,!0),e[l]&&e[l]!==`
|
|
162
|
+
`&&e[l]!=="\r")throw new X("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=vr(e,l)}return o}var JL=/^[a-z0-9-_]+$/i;function pc(e){let t=typeof e;if(t==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return t}function t6(e){for(let t=0;t<e.length;t++)if(pc(e[t])!=="object")return!1;return e.length!=0}function lh(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function mh(e,t,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(t==="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(t==="bigint"||t==="boolean")return e.toString();if(t==="string")return lh(e);if(t==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(t==="object")return r6(e,n,o);if(t==="array")return n6(e,n,o)}function r6(e,t,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+=JL.test(c)?c:lh(c),i+=" = ",i+=mh(e[c],pc(e[c]),t-1,n)}return i+" }"}function n6(e,t,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+=mh(e[i],pc(e[i]),t-1,n)}return o+" ]"}function o6(e,t,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&&`
|
|
162
163
|
`}[[${t}]]
|
|
163
|
-
`,i+=
|
|
164
|
-
`)+
|
|
165
|
-
`)+
|
|
164
|
+
`,i+=dh(0,e[a],t,n,o);return i}function dh(e,t,n,o,i){if(o===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let a="",c="",l=Object.keys(t);for(let m=0;m<l.length;m++){let f=l[m];if(t[f]!==null&&t[f]!==void 0){let h=pc(t[f]);if(h==="symbol"||h==="function")throw new TypeError(`cannot serialize values of type '${h}'`);let E=JL.test(f)?f:lh(f);if(h==="array"&&t6(t[f]))c+=(c&&`
|
|
165
|
+
`)+o6(t[f],n?`${n}.${E}`:E,o-1,i);else if(h==="object"){let I=n?`${n}.${E}`:E;c+=(c&&`
|
|
166
|
+
`)+dh(I,t[f],I,o-1,i)}else a+=E,a+=" = ",a+=mh(t[f],h,o,i),a+=`
|
|
166
167
|
`}}return e&&(a||!c)&&(a=a?`[${e}]
|
|
167
168
|
${a}`:`[${e}]`),a&&c?`${a}
|
|
168
|
-
${c}`:a||c}function
|
|
169
|
+
${c}`:a||c}function fh(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(pc(e)!=="object")throw new TypeError("stringify can only be called with an object");let o=dh(0,e,"",t,n);return o[o.length-1]!==`
|
|
169
170
|
`?o+`
|
|
170
|
-
`:o}var
|
|
171
|
-
`),V(f===void 0?" created":` patched (backup: ${f})`)}function HV(e,t,n){return{environment:"dev",log_user_prompt:n,exporter:{"otlp-http":{endpoint:`${e}/v1/logs`,protocol:"binary",headers:{Authorization:`Bearer ${t}`}}},trace_exporter:{"otlp-http":{endpoint:`${e}/v1/traces`,protocol:"binary",headers:{Authorization:`Bearer ${t}`}}}}}function KV(e,t,n,o){let i=(0,ra.join)(e,".codex"),a=(0,ra.join)(i,"config.toml");V(`Codex \u2192 ${a}`),(0,fh.mkdirSync)(i,{recursive:!0});let c=As(a),l=c===void 0?{}:ch(c),m="otel"in l;delete l.otel,l.otel=HV(t,n,o);let f=Os(a,c);Ss(a,mh(l)),V(f===void 0?" created":m?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function FL(){return new Mr("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function BL(){return new Mr("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var HL="Restart your claude / codex session to load the new config.";function KL(e){let t=e.command("setup").description("Configure local LLM CLIs to ship OTEL telemetry to Tsuga");t.command("claude-code").description("Patch ~/.claude/settings.json with Tsuga OTEL env").addOption(FL()).addOption(BL()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{BV((0,dh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),V(HL)}),t.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(FL()).addOption(BL()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{KV((0,dh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),V(HL)})}var Ro="/v0/logs";var gh=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var uc=0,hh=r.Object({__tsuga_metadata__:r.Object({id:r.String(),source:r.Optional(r.String())},{additionalProperties:!0}),context:r.Optional(r.Object({team:r.Optional(r.String({description:"Team name associated with this log."})),tag_policy_warnings:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Unknown({description:"Log message after ingestion and route processing. It can be any JSON value because processors may map arbitrary data into `message`."})),timestamp:r.Number({description:"Log timestamp as a Unix timestamp in milliseconds."}),level:r.Enum(gh,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[ex]:r.Optional(r.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),zL=100,zV="timestamp",YV=r.Union([r.Literal(zV)]),Ln=r.Partial(r.Object({...at.properties,query:u({type:"tsuga-query",description:"Tsuga query used to filter logs in the selected time range."}),maxResults:r.Integer({minimum:1,maximum:1e3,description:"Maximum number of logs to return. Valid values are 1 through 1000."}),shouldRecommendAttributes:r.Boolean({description:"Whether Tsuga should return suggested attributes to highlight in results."}),triggeredBy:r.Literal("refresh",{description:"Indicates the query was triggered by a refresh action."}),startOffset:r.Number({minimum:uc,description:"Result offset used when fetching additional log rows."}),startOffsets:r.Array(r.Number({minimum:uc}),{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 ${uc} for every cluster.`}),clusterId:u({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:ts,sortBy:YV,sortDirection:r.Union([r.Literal("asc"),r.Literal("desc")],{description:"Timestamp sort direction for log results."})})),_rt=d({tags:["logs"],url:`${Ro}/count`,method:"GET",query:r.Pick(Ln,["from","to","query","clusterId","clusterIds"]),response:r.Object({count:r.Number(),clusterResponses:r.Optional(pi())})}),lc=r.Object({value:r.String(),priority:r.Number()}),Irt=d({tags:["logs"],url:`${Ro}/search`,method:"GET",query:Ln,response:r.Object({logs:r.Optional(r.Array(hh)),attributesToHighlight:r.Optional(r.Array(lc)),clusterResponses:r.Optional(pi(r.Object({nextStartOffset:r.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})}),VV=r.Cyclic({TokenOutput:r.Union([r.Object({type:r.Literal("top"),values:r.Array(r.String())}),r.Object({type:r.Literal("ip"),value:r.String()}),r.Object({type:r.Literal("range"),min:r.Number(),max:r.Number()}),r.Object({type:r.Literal("variable"),value:r.String()}),r.Object({type:r.Literal("text"),value:r.String()}),r.Object({type:r.Literal("date"),value:r.String()}),r.Object({type:r.Literal("url"),value:r.String()}),r.Object({type:r.Literal("structure"),key:r.Array(r.String()),value:r.Array(r.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),QV=r.Object({id:r.String(),pattern:r.Array(VV),size:r.Integer({description:"Number of logs that matched the pattern"}),examples:r.Array(r.Object({id:r.String(),timestampUnix:r.Number()})),timeDistribution:r.Array(r.Number()),staticFeatures:r.Array(r.Object({key:r.String(),value:r.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),brt=d({tags:["logs"],url:`${Ro}/patterns`,method:"GET",query:r.Object({...at.properties,query:u({type:"tsuga-query"}),clusteringThreshold:r.Optional(r.Number()),clusterId:r.Optional(u({allowEmpty:!1}))}),response:r.Object({patterns:r.Array(QV),sampleSize:r.Number()})}),Srt=d({tags:["logs"],url:`${Ro}/attributes`,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),clusterIds:r.Optional(ts)}),response:r.Object({attributes:r.Array(r.String()),clusterResponses:r.Optional(pi())})});var WV=["pending","running","completed","incomplete","failed"],YL=r.Object({id:r.String({description:"ID of the export."}),status:r.Enum(WV,{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:r.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:r.Number({description:"Logs this export will write, already clamped to the export maximum. Use it as the denominator for progress."}),isTruncated:r.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:r.Optional(r.String({description:"Why the export is incomplete or failed."}))}),Art=d({tags:["logs"],url:`${Ro}/exports`,method:"POST",body:r.Object({...r.Pick(Ln,["from","to","query","clusterId","clusterIds","sortBy","sortDirection"]).properties,columns:r.Array(u({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."})}),response:r.Object({...YL.properties,downloadUrl:r.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."})})}),Ort=d({tags:["logs"],url:`${Ro}/exports/:exportId`,method:"GET",params:r.Object({exportId:r.String()}),response:YL}),xrt=d({tags:["logs"],url:`${Ro}/exports/:exportId/download`,method:"GET",params:r.Object({exportId:r.String()}),query:r.Object({token:u({allowEmpty:!1,description:"Single-use token minted when the export was created."})}),response:r.String({description:"CSV file, streamed as it is produced."})});var mc=`/${"v1"}/logs`,yh=r.Object({context:r.Optional(r.Object({team:r.Optional(r.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."})),...r.Pick(hh,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),ZV={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(yh,{examples:[ZV]});var VL=r.Object({query:r.Optional(u({type:"tsuga-query",default:"*",description:"Tsuga query selecting logs to return. Omit to search all logs with `*`."})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e3,default:zL,description:"Maximum number of logs to return. Defaults to 100. Valid values are 1 through 1000."})),clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),...bt.properties},{description:"Log search query. Provide a time range, optional Tsuga query, and optional limit."}),XV={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(VL,{examples:[XV]});var QL=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:`${mc}/search`,method:"GET",query:VL,response:r.Object({logs:r.Array(yh,{description:"Log events matching the query and time range."})})}),JV=r.Object({pattern:r.String({description:"Clustered log pattern formatted as a readable string."}),size:r.Integer({description:"Number of logs that matched the pattern"}),groups:r.Array(r.Object({key:r.String({description:"Attribute dot-path shared by all logs in the pattern."}),value:r.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`."}))}),WL=r.Object({patterns:r.Array(JV,{description:"Log patterns clustered from logs matching the query."}),sampleSize:r.Number({description:"Number of logs sampled while computing patterns."})},{}),e6={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(WL,{examples:[e6]});var ZL=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:`${mc}/patterns`,method:"GET",query:r.Object({...bt.properties,query:u({type:"tsuga-query",description:"Tsuga query selecting logs to cluster into patterns."}),clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:WL}),t6=r.Object({exampleLog:r.Optional(yh),team:r.String({description:"Team associated with the new error pattern."}),env:r.String({description:"Environment associated with the new error pattern."}),service:r.String({description:"Service associated with the new error pattern."}),firstSeen:r.Number({description:"Unix timestamp in seconds when this pattern was first seen."}),lastSeen:r.Number({description:"Unix timestamp in seconds when this pattern was last seen."})}),XL=r.Object({newErrorPatterns:r.Array(t6,{description:"Error patterns first seen in the requested time range."})},{}),r6={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(XL,{examples:[r6]});var JL=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:`${mc}/patterns/new`,method:"GET",query:r.Object({...bt.properties,team:r.Optional(u({description:"Team name to restrict pattern detection to."})),env:r.Optional(u({description:"Environment to restrict pattern detection to."})),service:r.Optional(u({description:"Service name to restrict pattern detection to."})),clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:XL}),n6=r.Object({team:r.String({description:"Team associated with the error pattern."}),env:r.String({description:"Environment associated with the error pattern."}),pattern:r.String({description:"Error pattern formatted as a readable string."}),increaseTimestamps:r.Array(r.Number({description:"Unix timestamp in milliseconds of a detected spike in occurrence of this pattern. One entry per spike detected in the requested time range."}))}),ek=r.Object({errorPatternIncreases:r.Array(n6,{description:"Error patterns with increased occurrence in the requested time range."})},{}),o6={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(ek,{examples:[o6]});var tk=d({description:"Finds error patterns whose occurrence increased for a team in the requested time range. Use this to identify growing failure modes. See [Logs](/documentation/explore/logs).",operationId:"getErrorPatternIncrease",tags:["public","logs"],url:`${mc}/patterns/increase`,method:"GET",query:r.Object({...bt.properties,team:u({description:"Team name to analyze for pattern increases."}),env:r.Optional(u({description:"Environment to restrict the analysis to."})),clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:ek}),rk=r.Object({attributes:r.Array(r.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),i6={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(rk,{examples:[i6]});var a6=r.Object({...bt.properties,clusterId:r.Optional(u({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."}),nk=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:`${mc}/attributes`,method:"GET",query:a6,response:rk});var en="/v0/metrics",s6=r.Object({__tsuga_metadata__:r.Object({},{additionalProperties:!0}),context:r.Optional(r.Object({},{additionalProperties:!0})),message:r.Optional(r.String()),timestamp:r.Number(),level:r.Enum(gh)},{additionalProperties:!0}),jrt=d({tags:["metrics"],url:`${en}/count`,method:"GET",query:r.Pick(Ln,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),qrt=d({tags:["metrics"],url:`${en}/search`,method:"GET",query:Ln,response:r.Object({logs:r.Optional(r.Array(s6)),totalHits:r.Optional(r.Number()),attributesToHighlight:r.Optional(r.Array(lc))},{additionalProperties:!0})}),El=r.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."}),Th=r.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."}),ok=r.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."}),c6=r.Object({capabilities:r.Optional(r.Array(r.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:r.Optional(r.String({description:"Human-readable description of the metric"})),tags:r.Optional(r.Array(r.String(),{description:"Attribute names available as dimensions for filtering or grouping this metric. Exposed publicly as `attributes`."})),temporality:r.Optional(Th),type:r.Optional(El),unit:r.Optional(r.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:r.Optional(ok)}),Frt=d({url:`${en}/metadata`,method:"GET",query:r.Object({...at.properties,metricName:u({allowEmpty:!1}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:c6}),Brt=d({tags:["metrics"],url:en,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Array(r.String())}),_l=r.Array(r.Object({name:r.String({description:"Metric name observed by Tsuga."}),type:El,lastSeen:r.Optional(ok)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),p6=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(_l,{examples:[p6]});var Hrt=d({tags:["metrics"],url:`${en}/names-and-types`,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:_l}),dc=r.Array(r.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),u6=["service","env","host","method","status_code"];Object.assign(dc,{examples:[u6]});var Krt=d({tags:["metrics"],url:`${en}/attributes`,method:"GET",query:r.Object({...at.properties,metricName:u({allowEmpty:!1}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:dc}),zrt=d({tags:["metrics"],url:`${en}/attributes/batch`,method:"GET",query:r.Object({...at.properties,metricNames:r.Array(u({allowEmpty:!1}),{minItems:1,description:"Metric names to fetch attributes for"}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:dc}),Eh=r.Object({assets:r.Array(r.Object({type:r.Enum(["dashboard","monitor"],{description:"Kind of asset referencing the metric."}),id:r.String({description:"Dashboard or monitor ID for the asset that queries this metric."}),name:r.String({description:"Display name of the referencing dashboard or monitor."}),owner:r.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."})}),Yrt=d({tags:["metrics"],url:`${en}/assets-usage`,method:"GET",query:r.Object({metricName:u({allowEmpty:!1})}),response:Eh}),Vrt=d({url:`${en}/per-attribute`,method:"GET",query:r.Object({from:r.Optional(r.Number()),to:r.Optional(r.Number()),attribute:u(),clusterId:r.Optional(u({allowEmpty:!1}))}),response:r.Array(r.String())});var _h=`/${"v1"}/metrics`,l6=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(_l,{examples:[l6]});var Ih=r.Object({name:r.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:El,description:r.Optional(r.String({description:"Human-readable description of what the metric measures, set by the reporting instrumentation. Omitted when the instrumentation did not provide one."})),unit:r.Optional(r.String({description:"Metric unit reported by instrumentation or inferred metadata."})),temporality:r.Optional(Th),capabilities:r.Optional(r.Array(r.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:r.Optional(r.Array(r.String(),{description:"Metric attribute names available as dimensions for filtering or grouping."}))}),m6={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(Ih,{examples:[m6]});var ik=r.Object({...bt.properties,clusterId:r.Optional(u({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."}),ak=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:_h,method:"GET",query:ik,response:r.Array(Ih)}),sk=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:`${_h}/:name`,method:"GET",params:r.Object({name:u({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:ik,response:Ih}),d6=["service","env","host","method","status_code"];Object.assign(dc,{examples:[d6]});var ck=r.Pick(Eh,["assets"]),f6={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(ck,{examples:[f6]});var pk=d({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${_h}/assets-usage`,method:"GET",query:r.Object({metricName:u({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:ck});var na="/v0/traces",cnt=d({tags:["traces"],url:`${na}/count`,method:"GET",query:r.Pick(Ln,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),g6=["unset","ok","error"],h6=r.Enum(g6),y6=["unspecified","internal","server","client","producer","consumer"],T6=r.Enum(y6),lk=r.Object({__tsuga_metadata__:r.Optional(r.Object({},{additionalProperties:!0})),context:r.Optional(r.Object({telemetry:r.Optional(r.Object({sdk:r.Optional(r.Object({language:r.Optional(r.String())},{additionalProperties:!0}))},{additionalProperties:!0})),tag_policy_warnings:r.Optional(r.Record(r.String(),r.String())),service:r.Optional(r.Object({name:r.Optional(r.String()),version:r.Optional(r.String())},{additionalProperties:!0})),env:r.Optional(r.String())},{additionalProperties:!0})),parent_span_id:r.Optional(r.String()),resource_attributes:r.Object({},{additionalProperties:!0}),span_attributes:r.Object({},{additionalProperties:!0}),duration:r.Number({description:"In milliseconds."}),duration_ns:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),start_time:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),end_time:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:r.Optional(r.Object({message:r.String()})),events:r.Optional(r.Array(r.Object({event_attributes:r.Object({},{additionalProperties:!0}),event_name:r.String(),event_timestamp_nanos:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."})}))),links:r.Optional(r.Array(r.Object({},{additionalProperties:!0}))),span_id:r.String(),span:r.Object({kind:T6,name:r.String()}),status_code:r.Optional(h6),trace_id:r.String()}),mk=100,E6="start_time",_6="duration_ns",I6=r.Union([r.Literal(E6),r.Literal(_6)]),b6={...at.properties,query:r.Optional(u({type:"tsuga-query"})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e4})),shouldRecommendAttributes:r.Optional(r.Boolean()),startOffset:r.Optional(r.Number({minimum:uc})),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),sortBy:r.Optional(I6),sortDirection:r.Optional(r.Union([r.Literal("asc"),r.Literal("desc")]))},pnt=d({tags:["traces"],url:`${na}/search`,method:"GET",query:r.Object(b6),response:r.Object({spans:r.Optional(r.Array(lk)),attributesToHighlight:r.Optional(r.Array(lc))})});var S6=r.Object({groupByAttributes:r.Array(u({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:r.Integer({minimum:2,description:"Minimum leaf-group size before aggregation occurs. Default 5."}),maxParentDepth:r.Integer({minimum:-1,description:"Max depth of recursive parent aggregation. 0 = leaves only, -1 = unlimited (default)."}),aggregationHistogramBucketsSeconds:r.Array(r.Number({minimum:0}),{description:"Upper bounds for the latency histogram in seconds. Empty array disables the histogram attributes."}),sortSpans:r.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."})}),A6=r.Object({...at.properties,traceId:u({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),...r.Partial(S6).properties}),unt=d({tags:["traces"],url:`${na}/summarize`,method:"GET",query:A6,response:r.Object({spans:r.Array(lk)})}),lnt=d({tags:["traces"],url:`${na}/attributes`,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Object({attributes:r.Array(r.String())})}),O6=r.Object({key:r.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:r.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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.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."}))}),x6=r.Object({fromNs:r.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:r.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:r.String({description:"Range duration in nanoseconds, computed as `toNs - fromNs`. Transmitted as a string to avoid losing precision."}),contributions:r.Array(r.Object({serviceKey:r.String({description:"Contributing service key for this range. References `services[].key` in the same response."}),weight:r.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:r.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:r.Array(r.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."})}),R6=r.Object({serviceKey:r.String({description:"Contributing service key for this aggregate total. References `services[].key` in the same response."}),durationNs:r.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:r.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."})}),bh=r.Optional(r.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."})),Sh=r.Optional(r.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."})),Il=r.Object({traceId:r.String({description:"Trace ID summarized by the response. Echoes the required `traceId` query parameter."}),startTimeNs:r.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:r.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:r.String({description:"Total fetched trace duration in nanoseconds, computed as `endTimeNs - startTimeNs`. Transmitted as a string to avoid losing precision."}),truncated:r.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:r.Array(O6,{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:r.Array(x6,{description:"Sequential trace timeline split into ranges wherever the active leaf-span set changes. Empty when the request sets `includeRanges` to false."}),serviceTotals:r.Array(R6,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),C6={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(Il,{examples:[C6]});var mnt=d({tags:["traces"],url:`${na}/latency-summary`,method:"GET",query:r.Object({...at.properties,traceId:u({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),minRangeDurationMs:bh,includeRanges:Sh}),response:Il}),uk=r.Object({filter:u({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:ui}),P6=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number()}),U6=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number(),lift:r.Union([r.Number(),r.Null()]),pValue:r.Number()}),w6=r.Object({attr:r.String(),values:r.Array(U6),otherValues:r.Array(P6)}),dnt=d({tags:["traces"],url:`${na}/contrast-sets`,method:"POST",body:r.Object({groupA:uk,groupB:uk,candidateAttrs:r.Optional(r.Array(u({allowEmpty:!1}))),topK:r.Optional(r.Integer({minimum:1,maximum:100})),minLift:r.Optional(r.Number({minimum:1})),minSupport:r.Optional(r.Number({minimum:0,maximum:100})),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Object({contrastSets:r.Array(w6),groupACount:r.Number(),groupBCount:r.Number()})});var Ah=`/${"v1"}/traces`,Oh=r.Object({context:r.Optional(r.Object({service:r.Optional(r.Object({name:r.Optional(r.String({description:"Service name associated with the span."})),version:r.Optional(r.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:r.Optional(r.String({description:"`spanId` of this span's parent within the same trace. Absent for the root span."})),resourceAttributes:r.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:r.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:r.Number({description:"Span duration in milliseconds, derived from the nanosecond `startTime` and `endTime` values."}),startTime:r.String({description:"Span start time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),endTime:r.String({description:"Span end time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),error:r.Optional(r.Object({message:r.String({description:"Error message associated with the span."})},{description:"Error details associated with the span, separate from the OpenTelemetry `statusCode` field."})),events:r.Optional(r.Array(r.Object({event_attributes:r.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:r.String({description:"Name of the span event."}),event_timestamp_nanos:r.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:r.String({description:"Unique span ID within the trace."}),span:r.Object({kind:r.String({description:"OpenTelemetry span kind describing the relationship to remote calls: `unspecified`, `internal`, `server`, `client`, `producer`, or `consumer`."}),name:r.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:r.Optional(r.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:r.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."}),v6={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(Oh,{examples:[v6]});var N6={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},dk=r.Object({...bt.properties,query:r.Optional(u({type:"tsuga-query",default:"*",description:"Tsuga query selecting spans to return. Omit to search all spans in the range with `*`."})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e4,default:mk,description:"Maximum number of spans to return. Defaults to 100. Valid values are 1 through 10000."})),clusterId:r.Optional(u({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(dk,{examples:[N6]});var fk=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:`${Ah}/search`,method:"GET",query:dk,response:r.Object({spans:r.Array(Oh,{description:"Spans matching the query and time range."})})}),L6={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},gk=r.Object({...bt.properties,traceId:u({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:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),groupByAttributes:r.Optional(r.Array(u({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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.Array(r.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:r.Optional(r.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(gk,{examples:[L6]});var hk=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:`${Ah}/summarize`,method:"GET",query:gk,response:r.Object({spans:r.Array(Oh,{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`."})})}),k6={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},yk=r.Object({...bt.properties,traceId:u({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:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),minRangeDurationMs:bh,includeRanges:Sh},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(yk,{examples:[k6]});var Tk=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:`${Ah}/latency-summary`,method:"GET",query:yk,response:Il});var Ik=["timestamp","level","message"],bk=["count","ratio","team","level","pattern"];function gt(e,t){let n=t??jr(e);if(!n)throw new Error(`--${e} is required`);return Ic(n)}function Ek(e){let t={from:gt("from",e.from),to:gt("to",e.to)},n=e.query??jr("query");n!==void 0&&(t.query=n);let o=e.maxResults??jr("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})`);t.maxResults=i}return t}function Ne(e){let t=jr(e);return t===void 0?"":` (default: ${t})`}function M6(e){let t=Qm(e.output),n=e.fields===void 0?void 0:Wm(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??Ik}}function D6(e){let t=Qm(e.output),n=e.fields===void 0?void 0:Wm(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??bk}}function _k(e,t){let n={count:e.size,ratio:t>0?e.size/t: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 G6(e,t){if(t.format==="json"){if(t.fields===void 0){ee(e);return}let{fields:i}=t;ee({patterns:e.patterns.map(a=>_k(a,e.sampleSize)).map(a=>Zm(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>_k(i,e.sampleSize)),o=Xm(t.format,n,t.fields);o.length>0&&V(o)}function $6(e,t){if(t.format==="json"){if(t.fields===void 0){ee(e);return}let{fields:o}=t;ee({logs:e.logs.map(i=>Zm(i,o))});return}let n=Xm(t.format,e.logs,t.fields);n.length>0&&V(n)}function Sk(e,t){let n=e.command("logs").description("Search and analyze logs");n.command("search").description("Search logs").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs${Ne("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-1000${Ne("max-results")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each log (default for --output=tsv|csv: ${Ik.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=M6(c),m=await t()(QL,{query:Ek(c)});$6(m,l)}),n.command("attributes").description("List log attribute dot-paths observed in the time range").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).action(async c=>{let l=await t()(nk,{query:{from:gt("from",c.from),to:gt("to",c.to)}});ee(l)}),n.command("patterns").description("List log patterns").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs before clustering into patterns${Ne("query")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each pattern (default for --output=tsv|csv: ${bk.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=D6(c),m={from:gt("from",c.from),to:gt("to",c.to)},f=c.query??jr("query");f!==void 0&&(m.query=f);let h=await t()(ZL,{query:m});G6(h,l)}),n.command("new-error-patterns").description("List error patterns first seen in this time range").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("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:gt("from",c.from),to:gt("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 t()(JL,{query:l});ee(m)}),n.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).requiredOption("--team <TEAM_NAME>","Team to query").option("--env <ENV_NAME>","Filter by environment").action(async c=>{let l={from:gt("from",c.from),to:gt("to",c.to),team:c.team};c.env!==void 0&&(l.env=c.env);let m=await t()(tk,{query:l});ee(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${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).action(async c=>{let l=await t()(ak,{query:{from:gt("from",c.from),to:gt("to",c.to)}});ee(l)}),o.command("get <METRIC_NAME>").description("Retrieve a metric by name with its metadata").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).action(async(c,l)=>{let m=await t()(sk,{params:{name:c},query:{from:gt("from",l.from),to:gt("to",l.to)}});ee(m)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await t()(pk,{query:{metricName:c}});ee(l)});let i=e.command("traces").description("Search and summarize traces");i.command("search").description("Search spans").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter spans${Ne("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-10000${Ne("max-results")}`).action(async c=>{let l=await t()(fk,{query:Ek(c)});ee(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${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).action(async c=>{let l=await t()(hk,{query:{traceId:c.traceId,from:gt("from",c.from),to:gt("to",c.to)}});ee(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${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("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:gt("from",c.from),to:gt("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 t()(Tk,{query:l});ee(m)});let a=e.command("aggregation").description("Run aggregation queries");Zr(a,"scalar","Run aggregation queries and return scalar results",Mw,t),Zr(a,"timeseries","Run aggregation queries and return timeseries results",Gw,t)}var j6="x-tsuga-session-id",xh="x-tsuga-source",Rh="x-tsuga-source-version",Ch="x-tsuga-source-commit",Ph="x-tsuga-source-date",Uh="x-tsuga-rationale",q6="x-tsuga-dashboard-id",F6="x-tsuga-widget-id",B6="x-request-id",vnt={[j6]:"Session identifier for request correlation",[xh]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[Rh]:"SDK version",[Ch]:"SDK commit hash",[Ph]:"SDK commit date",[Uh]:"Optional caller-supplied rationale for this request, recorded for telemetry",[q6]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[F6]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[B6]:"Unique identifier for this API request, useful for debugging and support"};var kn=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 Ak(e){if(e instanceof kn){let t=[`Error: ${e.message}`];return e.code&&t.push(`Code: ${e.code}`),e.statusCode&&t.push(`Status: ${e.statusCode}`),e.requestId&&t.push(`Request ID: ${e.requestId}`),e.details&&t.push(`Details: ${JSON.stringify(e.details,null,2)}`),t.join(`
|
|
172
|
-
`)}return e instanceof Error?`Error: ${e.message}`:String(e)}function
|
|
171
|
+
`:o}var i6={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 a6(e,t,n,o){let i=(0,na.join)(e,".claude","settings.json");V(`Claude Code \u2192 ${i}`),(0,hh.mkdirSync)((0,na.dirname)(i),{recursive:!0});let a=As(i),c;try{c=JSON.parse(a??"{}")}catch{throw new Error(`${i} is not valid JSON. Fix or remove it before re-running.`)}if(!bo(c))throw new Error(`${i} must contain a JSON object at the top level.`);let l=c.env??{};if(!bo(l))throw new Error(`${i} "env" must be a JSON object.`);let m=o?"1":"0";c.env={...l,...i6,OTEL_EXPORTER_OTLP_ENDPOINT:t,OTEL_LOG_USER_PROMPTS:m,OTEL_LOG_TOOL_DETAILS:m,OTEL_LOG_TOOL_CONTENT:m,OTEL_EXPORTER_OTLP_HEADERS:`Authorization=Bearer ${n}`};let f=Os(i,a);Ss(i,`${JSON.stringify(c,null,2)}
|
|
172
|
+
`),V(f===void 0?" created":` patched (backup: ${f})`)}function s6(e,t,n){return{environment:"dev",log_user_prompt:n,exporter:{"otlp-http":{endpoint:`${e}/v1/logs`,protocol:"binary",headers:{Authorization:`Bearer ${t}`}}},trace_exporter:{"otlp-http":{endpoint:`${e}/v1/traces`,protocol:"binary",headers:{Authorization:`Bearer ${t}`}}}}}function c6(e,t,n,o){let i=(0,na.join)(e,".codex"),a=(0,na.join)(i,"config.toml");V(`Codex \u2192 ${a}`),(0,hh.mkdirSync)(i,{recursive:!0});let c=As(a),l=c===void 0?{}:uh(c),m="otel"in l;delete l.otel,l.otel=s6(t,n,o);let f=Os(a,c);Ss(a,fh(l)),V(f===void 0?" created":m?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function ek(){return new Mr("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function tk(){return new Mr("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var rk="Restart your claude / codex session to load the new config.";function nk(e){let t=e.command("setup").description("Configure local LLM CLIs to ship OTEL telemetry to Tsuga");t.command("claude-code").description("Patch ~/.claude/settings.json with Tsuga OTEL env").addOption(ek()).addOption(tk()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{a6((0,gh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),V(rk)}),t.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(ek()).addOption(tk()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{c6((0,gh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),V(rk)})}var Co="/v0/logs";var yh=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var uc=0,Th=r.Object({__tsuga_metadata__:r.Object({id:r.String(),source:r.Optional(r.String())},{additionalProperties:!0}),context:r.Optional(r.Object({team:r.Optional(r.String({description:"Team name associated with this log."})),tag_policy_warnings:r.Optional(r.Record(r.String(),r.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:r.Optional(r.Unknown({description:"Log message after ingestion and route processing. It can be any JSON value because processors may map arbitrary data into `message`."})),timestamp:r.Number({description:"Log timestamp as a Unix timestamp in milliseconds."}),level:r.Enum(yh,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[mx]:r.Optional(r.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),ok=100,p6="timestamp",u6=r.Union([r.Literal(p6)]),kn=r.Partial(r.Object({...at.properties,query:u({type:"tsuga-query",description:"Tsuga query used to filter logs in the selected time range."}),maxResults:r.Integer({minimum:1,maximum:1e3,description:"Maximum number of logs to return. Valid values are 1 through 1000."}),shouldRecommendAttributes:r.Boolean({description:"Whether Tsuga should return suggested attributes to highlight in results."}),triggeredBy:r.Literal("refresh",{description:"Indicates the query was triggered by a refresh action."}),startOffset:r.Number({minimum:uc,description:"Result offset used when fetching additional log rows."}),startOffsets:r.Array(r.Number({minimum:uc}),{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 ${uc} for every cluster.`}),clusterId:u({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:ts,sortBy:u6,sortDirection:r.Union([r.Literal("asc"),r.Literal("desc")],{description:"Timestamp sort direction for log results."})})),zrt=d({tags:["logs"],url:`${Co}/count`,method:"GET",query:r.Pick(kn,["from","to","query","clusterId","clusterIds"]),response:r.Object({count:r.Number(),clusterResponses:r.Optional(ui())})}),lc=r.Object({value:r.String(),priority:r.Number()}),Yrt=d({tags:["logs"],url:`${Co}/search`,method:"GET",query:kn,response:r.Object({logs:r.Optional(r.Array(Th)),attributesToHighlight:r.Optional(r.Array(lc)),clusterResponses:r.Optional(ui(r.Object({nextStartOffset:r.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})}),l6=r.Cyclic({TokenOutput:r.Union([r.Object({type:r.Literal("top"),values:r.Array(r.String())}),r.Object({type:r.Literal("ip"),value:r.String()}),r.Object({type:r.Literal("range"),min:r.Number(),max:r.Number()}),r.Object({type:r.Literal("variable"),value:r.String()}),r.Object({type:r.Literal("text"),value:r.String()}),r.Object({type:r.Literal("date"),value:r.String()}),r.Object({type:r.Literal("url"),value:r.String()}),r.Object({type:r.Literal("structure"),key:r.Array(r.String()),value:r.Array(r.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),m6=r.Object({id:r.String(),pattern:r.Array(l6),size:r.Integer({description:"Number of logs that matched the pattern"}),examples:r.Array(r.Object({id:r.String(),timestampUnix:r.Number()})),timeDistribution:r.Array(r.Number()),staticFeatures:r.Array(r.Object({key:r.String(),value:r.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),Vrt=d({tags:["logs"],url:`${Co}/patterns`,method:"GET",query:r.Object({...at.properties,query:u({type:"tsuga-query"}),clusteringThreshold:r.Optional(r.Number()),clusterId:r.Optional(u({allowEmpty:!1}))}),response:r.Object({patterns:r.Array(m6),sampleSize:r.Number()})}),Qrt=d({tags:["logs"],url:`${Co}/attributes`,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),clusterIds:r.Optional(ts)}),response:r.Object({attributes:r.Array(r.String()),clusterResponses:r.Optional(ui())})});var d6=["pending","running","completed","incomplete","failed"],ik=r.Object({id:r.String({description:"ID of the export."}),status:r.Enum(d6,{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:r.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:r.Number({description:"Logs this export will write, already clamped to the export maximum. Use it as the denominator for progress."}),isTruncated:r.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:r.Optional(r.String({description:"Why the export is incomplete or failed."}))}),Wrt=d({tags:["logs"],url:`${Co}/exports`,method:"POST",body:r.Object({...r.Pick(kn,["from","to","query","clusterId","clusterIds","sortBy","sortDirection"]).properties,columns:r.Array(u({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."})}),response:r.Object({...ik.properties,downloadUrl:r.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."})})}),Zrt=d({tags:["logs"],url:`${Co}/exports/:exportId`,method:"GET",params:r.Object({exportId:r.String()}),response:ik}),Xrt=d({tags:["logs"],url:`${Co}/exports/:exportId/download`,method:"GET",params:r.Object({exportId:r.String()}),query:r.Object({token:u({allowEmpty:!1,description:"Single-use token minted when the export was created."})}),response:r.String({description:"CSV file, streamed as it is produced."})});var mc=`/${"v1"}/logs`,Eh=r.Object({context:r.Optional(r.Object({team:r.Optional(r.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."})),...r.Pick(Th,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),f6={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(Eh,{examples:[f6]});var ak=r.Object({query:r.Optional(u({type:"tsuga-query",default:"*",description:"Tsuga query selecting logs to return. Omit to search all logs with `*`."})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e3,default:ok,description:"Maximum number of logs to return. Defaults to 100. Valid values are 1 through 1000."})),clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),...bt.properties},{description:"Log search query. Provide a time range, optional Tsuga query, and optional limit."}),g6={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(ak,{examples:[g6]});var sk=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:`${mc}/search`,method:"GET",query:ak,response:r.Object({logs:r.Array(Eh,{description:"Log events matching the query and time range."})})}),h6=r.Object({pattern:r.String({description:"Clustered log pattern formatted as a readable string."}),size:r.Integer({description:"Number of logs that matched the pattern"}),groups:r.Array(r.Object({key:r.String({description:"Attribute dot-path shared by all logs in the pattern."}),value:r.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`."}))}),ck=r.Object({patterns:r.Array(h6,{description:"Log patterns clustered from logs matching the query."}),sampleSize:r.Number({description:"Number of logs sampled while computing patterns."})},{}),y6={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(ck,{examples:[y6]});var pk=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:`${mc}/patterns`,method:"GET",query:r.Object({...bt.properties,query:u({type:"tsuga-query",description:"Tsuga query selecting logs to cluster into patterns."}),clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:ck}),T6=r.Object({exampleLog:r.Optional(Eh),team:r.String({description:"Team associated with the new error pattern."}),env:r.String({description:"Environment associated with the new error pattern."}),service:r.String({description:"Service associated with the new error pattern."}),firstSeen:r.Number({description:"Unix timestamp in seconds when this pattern was first seen."}),lastSeen:r.Number({description:"Unix timestamp in seconds when this pattern was last seen."})}),uk=r.Object({newErrorPatterns:r.Array(T6,{description:"Error patterns first seen in the requested time range."})},{}),E6={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(uk,{examples:[E6]});var lk=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:`${mc}/patterns/new`,method:"GET",query:r.Object({...bt.properties,team:r.Optional(u({description:"Team name to restrict pattern detection to."})),env:r.Optional(u({description:"Environment to restrict pattern detection to."})),service:r.Optional(u({description:"Service name to restrict pattern detection to."})),clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:uk}),_6=r.Object({team:r.String({description:"Team associated with the error pattern."}),env:r.String({description:"Environment associated with the error pattern."}),pattern:r.String({description:"Error pattern formatted as a readable string."}),increaseTimestamps:r.Array(r.Number({description:"Unix timestamp in milliseconds of a detected spike in occurrence of this pattern. One entry per spike detected in the requested time range."}))}),mk=r.Object({errorPatternIncreases:r.Array(_6,{description:"Error patterns with increased occurrence in the requested time range."})},{}),I6={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(mk,{examples:[I6]});var dk=d({description:"Finds error patterns whose occurrence increased for a team in the requested time range. Use this to identify growing failure modes. See [Logs](/documentation/explore/logs).",operationId:"getErrorPatternIncrease",tags:["public","logs"],url:`${mc}/patterns/increase`,method:"GET",query:r.Object({...bt.properties,team:u({description:"Team name to analyze for pattern increases."}),env:r.Optional(u({description:"Environment to restrict the analysis to."})),clusterId:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:mk}),fk=r.Object({attributes:r.Array(r.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),b6={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(fk,{examples:[b6]});var S6=r.Object({...bt.properties,clusterId:r.Optional(u({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."}),gk=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:`${mc}/attributes`,method:"GET",query:S6,response:fk});var en="/v0/metrics",A6=r.Object({__tsuga_metadata__:r.Object({},{additionalProperties:!0}),context:r.Optional(r.Object({},{additionalProperties:!0})),message:r.Optional(r.String()),timestamp:r.Number(),level:r.Enum(yh)},{additionalProperties:!0}),mnt=d({tags:["metrics"],url:`${en}/count`,method:"GET",query:r.Pick(kn,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),dnt=d({tags:["metrics"],url:`${en}/search`,method:"GET",query:kn,response:r.Object({logs:r.Optional(r.Array(A6)),totalHits:r.Optional(r.Number()),attributesToHighlight:r.Optional(r.Array(lc))},{additionalProperties:!0})}),Il=r.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."}),_h=r.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."}),hk=r.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."}),O6=r.Object({capabilities:r.Optional(r.Array(r.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:r.Optional(r.String({description:"Human-readable description of the metric"})),tags:r.Optional(r.Array(r.String(),{description:"Attribute names available as dimensions for filtering or grouping this metric. Exposed publicly as `attributes`."})),temporality:r.Optional(_h),type:r.Optional(Il),unit:r.Optional(r.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:r.Optional(hk)}),fnt=d({url:`${en}/metadata`,method:"GET",query:r.Object({...at.properties,metricName:u({allowEmpty:!1}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:O6}),gnt=d({tags:["metrics"],url:en,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Array(r.String())}),bl=r.Array(r.Object({name:r.String({description:"Metric name observed by Tsuga."}),type:Il,lastSeen:r.Optional(hk)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),x6=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(bl,{examples:[x6]});var hnt=d({tags:["metrics"],url:`${en}/names-and-types`,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:bl}),dc=r.Array(r.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),R6=["service","env","host","method","status_code"];Object.assign(dc,{examples:[R6]});var ynt=d({tags:["metrics"],url:`${en}/attributes`,method:"GET",query:r.Object({...at.properties,metricName:u({allowEmpty:!1}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:dc}),Tnt=d({tags:["metrics"],url:`${en}/attributes/batch`,method:"GET",query:r.Object({...at.properties,metricNames:r.Array(u({allowEmpty:!1}),{minItems:1,description:"Metric names to fetch attributes for"}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:dc}),Ih=r.Object({assets:r.Array(r.Object({type:r.Enum(["dashboard","monitor"],{description:"Kind of asset referencing the metric."}),id:r.String({description:"Dashboard or monitor ID for the asset that queries this metric."}),name:r.String({description:"Display name of the referencing dashboard or monitor."}),owner:r.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."})}),Ent=d({tags:["metrics"],url:`${en}/assets-usage`,method:"GET",query:r.Object({metricName:u({allowEmpty:!1})}),response:Ih}),_nt=d({url:`${en}/per-attribute`,method:"GET",query:r.Object({from:r.Optional(r.Number()),to:r.Optional(r.Number()),attribute:u(),clusterId:r.Optional(u({allowEmpty:!1}))}),response:r.Array(r.String())});var bh=`/${"v1"}/metrics`,C6=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(bl,{examples:[C6]});var Sh=r.Object({name:r.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:Il,description:r.Optional(r.String({description:"Human-readable description of what the metric measures, set by the reporting instrumentation. Omitted when the instrumentation did not provide one."})),unit:r.Optional(r.String({description:"Metric unit reported by instrumentation or inferred metadata."})),temporality:r.Optional(_h),capabilities:r.Optional(r.Array(r.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:r.Optional(r.Array(r.String(),{description:"Metric attribute names available as dimensions for filtering or grouping."}))}),P6={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(Sh,{examples:[P6]});var yk=r.Object({...bt.properties,clusterId:r.Optional(u({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."}),Tk=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:bh,method:"GET",query:yk,response:r.Array(Sh)}),Ek=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:`${bh}/:name`,method:"GET",params:r.Object({name:u({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:yk,response:Sh}),U6=["service","env","host","method","status_code"];Object.assign(dc,{examples:[U6]});var _k=r.Pick(Ih,["assets"]),w6={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(_k,{examples:[w6]});var Ik=d({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${bh}/assets-usage`,method:"GET",query:r.Object({metricName:u({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:_k});var oa="/v0/traces",Lnt=d({tags:["traces"],url:`${oa}/count`,method:"GET",query:r.Pick(kn,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),v6=["unset","ok","error"],N6=r.Enum(v6),L6=["unspecified","internal","server","client","producer","consumer"],k6=r.Enum(L6),Sk=r.Object({__tsuga_metadata__:r.Optional(r.Object({},{additionalProperties:!0})),context:r.Optional(r.Object({telemetry:r.Optional(r.Object({sdk:r.Optional(r.Object({language:r.Optional(r.String())},{additionalProperties:!0}))},{additionalProperties:!0})),tag_policy_warnings:r.Optional(r.Record(r.String(),r.String())),service:r.Optional(r.Object({name:r.Optional(r.String()),version:r.Optional(r.String())},{additionalProperties:!0})),env:r.Optional(r.String())},{additionalProperties:!0})),parent_span_id:r.Optional(r.String()),resource_attributes:r.Object({},{additionalProperties:!0}),span_attributes:r.Object({},{additionalProperties:!0}),duration:r.Number({description:"In milliseconds."}),duration_ns:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),start_time:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),end_time:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:r.Optional(r.Object({message:r.String()})),events:r.Optional(r.Array(r.Object({event_attributes:r.Object({},{additionalProperties:!0}),event_name:r.String(),event_timestamp_nanos:r.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."})}))),links:r.Optional(r.Array(r.Object({},{additionalProperties:!0}))),span_id:r.String(),span:r.Object({kind:k6,name:r.String()}),status_code:r.Optional(N6),trace_id:r.String()}),Ak=100,M6="start_time",D6="duration_ns",G6=r.Union([r.Literal(M6),r.Literal(D6)]),$6={...at.properties,query:r.Optional(u({type:"tsuga-query"})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e4})),shouldRecommendAttributes:r.Optional(r.Boolean()),startOffset:r.Optional(r.Number({minimum:uc})),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),sortBy:r.Optional(G6),sortDirection:r.Optional(r.Union([r.Literal("asc"),r.Literal("desc")]))},knt=d({tags:["traces"],url:`${oa}/search`,method:"GET",query:r.Object($6),response:r.Object({spans:r.Optional(r.Array(Sk)),attributesToHighlight:r.Optional(r.Array(lc))})});var j6=r.Object({groupByAttributes:r.Array(u({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:r.Integer({minimum:2,description:"Minimum leaf-group size before aggregation occurs. Default 5."}),maxParentDepth:r.Integer({minimum:-1,description:"Max depth of recursive parent aggregation. 0 = leaves only, -1 = unlimited (default)."}),aggregationHistogramBucketsSeconds:r.Array(r.Number({minimum:0}),{description:"Upper bounds for the latency histogram in seconds. Empty array disables the histogram attributes."}),sortSpans:r.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."})}),F6=r.Object({...at.properties,traceId:u({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),...r.Partial(j6).properties}),Mnt=d({tags:["traces"],url:`${oa}/summarize`,method:"GET",query:F6,response:r.Object({spans:r.Array(Sk)})}),Dnt=d({tags:["traces"],url:`${oa}/attributes`,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Object({attributes:r.Array(r.String())})}),q6=r.Object({key:r.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:r.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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.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."}))}),B6=r.Object({fromNs:r.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:r.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:r.String({description:"Range duration in nanoseconds, computed as `toNs - fromNs`. Transmitted as a string to avoid losing precision."}),contributions:r.Array(r.Object({serviceKey:r.String({description:"Contributing service key for this range. References `services[].key` in the same response."}),weight:r.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:r.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:r.Array(r.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."})}),H6=r.Object({serviceKey:r.String({description:"Contributing service key for this aggregate total. References `services[].key` in the same response."}),durationNs:r.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:r.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."})}),Ah=r.Optional(r.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."})),Oh=r.Optional(r.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."})),Sl=r.Object({traceId:r.String({description:"Trace ID summarized by the response. Echoes the required `traceId` query parameter."}),startTimeNs:r.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:r.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:r.String({description:"Total fetched trace duration in nanoseconds, computed as `endTimeNs - startTimeNs`. Transmitted as a string to avoid losing precision."}),truncated:r.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:r.Array(q6,{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:r.Array(B6,{description:"Sequential trace timeline split into ranges wherever the active leaf-span set changes. Empty when the request sets `includeRanges` to false."}),serviceTotals:r.Array(H6,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),K6={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(Sl,{examples:[K6]});var Gnt=d({tags:["traces"],url:`${oa}/latency-summary`,method:"GET",query:r.Object({...at.properties,traceId:u({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),minRangeDurationMs:Ah,includeRanges:Oh}),response:Sl}),bk=r.Object({filter:u({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:li}),z6=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number()}),Y6=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number(),lift:r.Union([r.Number(),r.Null()]),pValue:r.Number()}),V6=r.Object({attr:r.String(),values:r.Array(Y6),otherValues:r.Array(z6)}),$nt=d({tags:["traces"],url:`${oa}/contrast-sets`,method:"POST",body:r.Object({groupA:bk,groupB:bk,candidateAttrs:r.Optional(r.Array(u({allowEmpty:!1}))),topK:r.Optional(r.Integer({minimum:1,maximum:100})),minLift:r.Optional(r.Number({minimum:1})),minSupport:r.Optional(r.Number({minimum:0,maximum:100})),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Object({contrastSets:r.Array(V6),groupACount:r.Number(),groupBCount:r.Number()})});var xh=`/${"v1"}/traces`,Rh=r.Object({context:r.Optional(r.Object({service:r.Optional(r.Object({name:r.Optional(r.String({description:"Service name associated with the span."})),version:r.Optional(r.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:r.Optional(r.String({description:"`spanId` of this span's parent within the same trace. Absent for the root span."})),resourceAttributes:r.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:r.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:r.Number({description:"Span duration in milliseconds, derived from the nanosecond `startTime` and `endTime` values."}),startTime:r.String({description:"Span start time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),endTime:r.String({description:"Span end time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),error:r.Optional(r.Object({message:r.String({description:"Error message associated with the span."})},{description:"Error details associated with the span, separate from the OpenTelemetry `statusCode` field."})),events:r.Optional(r.Array(r.Object({event_attributes:r.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:r.String({description:"Name of the span event."}),event_timestamp_nanos:r.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:r.String({description:"Unique span ID within the trace."}),span:r.Object({kind:r.String({description:"OpenTelemetry span kind describing the relationship to remote calls: `unspecified`, `internal`, `server`, `client`, `producer`, or `consumer`."}),name:r.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:r.Optional(r.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:r.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."}),Q6={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(Rh,{examples:[Q6]});var W6={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},Ok=r.Object({...bt.properties,query:r.Optional(u({type:"tsuga-query",default:"*",description:"Tsuga query selecting spans to return. Omit to search all spans in the range with `*`."})),maxResults:r.Optional(r.Integer({minimum:1,maximum:1e4,default:Ak,description:"Maximum number of spans to return. Defaults to 100. Valid values are 1 through 10000."})),clusterId:r.Optional(u({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(Ok,{examples:[W6]});var xk=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:`${xh}/search`,method:"GET",query:Ok,response:r.Object({spans:r.Array(Rh,{description:"Spans matching the query and time range."})})}),Z6={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},Rk=r.Object({...bt.properties,traceId:u({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:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),groupByAttributes:r.Optional(r.Array(u({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:r.Optional(r.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:r.Optional(r.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:r.Optional(r.Array(r.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:r.Optional(r.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(Rk,{examples:[Z6]});var Ck=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:`${xh}/summarize`,method:"GET",query:Rk,response:r.Object({spans:r.Array(Rh,{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`."})})}),X6={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},Pk=r.Object({...bt.properties,traceId:u({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:r.Optional(u({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),minRangeDurationMs:Ah,includeRanges:Oh},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(Pk,{examples:[X6]});var Uk=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:`${xh}/latency-summary`,method:"GET",query:Pk,response:Sl});var Nk=["timestamp","level","message"],Lk=["count","ratio","team","level","pattern"];function gt(e,t){let n=t??jr(e);if(!n)throw new Error(`--${e} is required`);return Ic(n)}function wk(e){let t={from:gt("from",e.from),to:gt("to",e.to)},n=e.query??jr("query");n!==void 0&&(t.query=n);let o=e.maxResults??jr("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})`);t.maxResults=i}return t}function Ne(e){let t=jr(e);return t===void 0?"":` (default: ${t})`}function J6(e){let t=Zm(e.output),n=e.fields===void 0?void 0:Xm(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??Nk}}function e5(e){let t=Zm(e.output),n=e.fields===void 0?void 0:Xm(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??Lk}}function vk(e,t){let n={count:e.size,ratio:t>0?e.size/t: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 t5(e,t){if(t.format==="json"){if(t.fields===void 0){ee(e);return}let{fields:i}=t;ee({patterns:e.patterns.map(a=>vk(a,e.sampleSize)).map(a=>Jm(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>vk(i,e.sampleSize)),o=ed(t.format,n,t.fields);o.length>0&&V(o)}function r5(e,t){if(t.format==="json"){if(t.fields===void 0){ee(e);return}let{fields:o}=t;ee({logs:e.logs.map(i=>Jm(i,o))});return}let n=ed(t.format,e.logs,t.fields);n.length>0&&V(n)}function kk(e,t){let n=e.command("logs").description("Search and analyze logs");n.command("search").description("Search logs").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs${Ne("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-1000${Ne("max-results")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each log (default for --output=tsv|csv: ${Nk.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=J6(c),m=await t()(sk,{query:wk(c)});r5(m,l)}),n.command("attributes").description("List log attribute dot-paths observed in the time range").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).action(async c=>{let l=await t()(gk,{query:{from:gt("from",c.from),to:gt("to",c.to)}});ee(l)}),n.command("patterns").description("List log patterns").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs before clustering into patterns${Ne("query")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each pattern (default for --output=tsv|csv: ${Lk.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=e5(c),m={from:gt("from",c.from),to:gt("to",c.to)},f=c.query??jr("query");f!==void 0&&(m.query=f);let h=await t()(pk,{query:m});t5(h,l)}),n.command("new-error-patterns").description("List error patterns first seen in this time range").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("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:gt("from",c.from),to:gt("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 t()(lk,{query:l});ee(m)}),n.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).requiredOption("--team <TEAM_NAME>","Team to query").option("--env <ENV_NAME>","Filter by environment").action(async c=>{let l={from:gt("from",c.from),to:gt("to",c.to),team:c.team};c.env!==void 0&&(l.env=c.env);let m=await t()(dk,{query:l});ee(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${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).action(async c=>{let l=await t()(Tk,{query:{from:gt("from",c.from),to:gt("to",c.to)}});ee(l)}),o.command("get <METRIC_NAME>").description("Retrieve a metric by name with its metadata").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).action(async(c,l)=>{let m=await t()(Ek,{params:{name:c},query:{from:gt("from",l.from),to:gt("to",l.to)}});ee(m)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await t()(Ik,{query:{metricName:c}});ee(l)});let i=e.command("traces").description("Search and summarize traces");i.command("search").description("Search spans").option("--from <TIMESTAMP>",`Start of time range${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter spans${Ne("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-10000${Ne("max-results")}`).action(async c=>{let l=await t()(xk,{query:wk(c)});ee(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${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("to")}`).action(async c=>{let l=await t()(Ck,{query:{traceId:c.traceId,from:gt("from",c.from),to:gt("to",c.to)}});ee(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${Ge}${Ne("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ne("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:gt("from",c.from),to:gt("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 t()(Uk,{query:l});ee(m)});let a=e.command("aggregation").description("Run aggregation queries");Zr(a,"scalar","Run aggregation queries and return scalar results",Vw,t),Zr(a,"timeseries","Run aggregation queries and return timeseries results",Ww,t)}var n5="x-tsuga-session-id",Ch="x-tsuga-source",Ph="x-tsuga-source-version",Uh="x-tsuga-source-commit",wh="x-tsuga-source-date",vh="x-tsuga-rationale",o5="x-tsuga-dashboard-id",i5="x-tsuga-widget-id",a5="x-request-id",oot={[n5]:"Session identifier for request correlation",[Ch]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[Ph]:"SDK version",[Uh]:"SDK commit hash",[wh]:"SDK commit date",[vh]:"Optional caller-supplied rationale for this request, recorded for telemetry",[o5]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[i5]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[a5]:"Unique identifier for this API request, useful for debugging and support"};var Mn=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 Mk(e){if(e instanceof Mn){let t=[`Error: ${e.message}`];return e.code&&t.push(`Code: ${e.code}`),e.statusCode&&t.push(`Status: ${e.statusCode}`),e.requestId&&t.push(`Request ID: ${e.requestId}`),e.details&&t.push(`Details: ${JSON.stringify(e.details,null,2)}`),t.join(`
|
|
173
|
+
`)}return e instanceof Error?`Error: ${e.message}`:String(e)}function s5(e){return e.replace(/\s+/g," ").replace(/[^\x20-\x7e\x80-\xff]/g,"").trim()}function Dk(e,t,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 Mn("Internal error: params required for this endpoint");h=a.buildUrl(m)}else throw new Mn("Internal error: endpoint has neither url nor buildUrl");let E=n===void 0?f:{clusterId:n,...f},I=oO(`${e}${h}`,E),g={Accept:"application/json",Authorization:`Bearer ${t}`,[Ch]:"cli",[Ph]:"1.27.0",[Uh]:"196d5a9ff",[wh]:"2026-08-31T09:48:56.629Z"};l&&(g["Content-Type"]="application/json");let T=o?.(),S=T?s5(T):"";S&&(g[vh]=S);let b=await fetch(I,{method:a.method,headers:g,body:l?JSON.stringify(l):null}),x;try{x=await b.json()}catch{throw new Mn(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(x.error)throw Mn.fromErrorResponse(x.error,x.requestId);return p5(x,c5(c)),x.data}}function c5({body:e,query:t}){let n=t?.offset??e?.offset;return typeof n=="number"?n:0}function p5(e,t){let n=e.metadata?.pagination;if(n===void 0||!Array.isArray(e.data))return;let o=t+e.data.length;o>=n.totalCount||hO(`Showing ${e.data.length} of ${n.totalCount} (offset ${t}). Use --limit (max ${oi}) and --offset ${o} for the next page.`)}function Nh(e,t=n=>{process.exit(n)}){e.on("error",n=>{if(n.code==="EPIPE"){t(process.exitCode);return}throw n})}var u5=3e3,l5="https://registry.npmjs.org/@tsuga/cli/latest";function m5(e,t){let n=e.split(".").map(Number),o=t.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 Gk(e){try{let t=JO();if(t&&Date.now()-new Date(t).getTime()<_c)return;let n=await fetch(l5,{signal:AbortSignal.timeout(u5)});if(!n.ok)return;let i=(await n.json()).version;m5(i,e)&&(process.stderr.write(`
|
|
173
174
|
Update available: ${e} \u2192 ${i}
|
|
174
|
-
`),process.stderr.write("Run `tsuga self-update` to update\n")),
|
|
175
|
-
`).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)"),
|
|
175
|
+
`),process.stderr.write("Run `tsuga self-update` to update\n")),ex(new Date().toISOString())}catch{}}Nh(process.stdout);Nh(process.stderr);var Re=new Po().name("tsuga").description("Manage Tsuga resources, telemetry, and configuration from the command line").version("1.27.0").addHelpText("before",()=>`${dO()}
|
|
176
|
+
`).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,$k;function Nr(){if(ia)return ia;let e=Re.opts(),t=si({clusterId:e.cluster}),n=HO(t);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=>Dk(t.apiUrl,l,t.clusterId,()=>$k),{credential:i}=t;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 Fp({userAuth:a,now:new Date,reload:Ja,refresh:h=>$p(t.apiUrl,h),persist:Yp});return f!==a&&(a=f,c=o(a.accessToken)),c(l,m)},ia}var jk="Setup & config:",Fk="Documentation, help & feedback:";Re.commandsGroup(jk);rx(Re);Wx(Re);var d5=new Set(Re.commands);Re.commandsGroup("Resources:");KL(Re,Nr);Re.commandsGroup("Query & explore:");kk(Re,Nr);QR(Re,Nr);rw(Re,Nr);cw(Re,Nr);Fw(Re,Nr);Xw(Re,Nr);Re.commandsGroup(Fk);rR(Re,Nr);aR(Re,Nr);Re.commandsGroup(jk);zx(Re,Nr);nk(Re);aw(Re);YL(Re);Qx(Re);Re.commandsGroup(Fk).helpCommand("help [command]");function qk(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 t of e.commands)qk(t)}var f5=new Set(["completion","self-update","install","setup","feedback"]);for(let e of Re.commands)!d5.has(e)&&!f5.has(e.name())&&qk(e);Re.hook("preAction",(e,t)=>{let{rationale:n}=t.opts();$k=n});Re.parseAsync().then(()=>Gk("1.27.0")).catch(e=>{console.error(Mk(e)),process.exitCode=1});
|
|
176
177
|
/**
|
|
177
178
|
* The following is a list of HTTP status codes and their meanings.
|
|
178
179
|
*
|