@tsuga/cli 1.17.0 → 1.19.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 +1 -1
- package/dist/cli.js +79 -80
- package/package.json +3 -1
package/dist/cli.js
CHANGED
|
@@ -1,54 +1,57 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var YN=Object.create;var ru=Object.defineProperty;var VN=Object.getOwnPropertyDescriptor;var QN=Object.getOwnPropertyNames;var WN=Object.getPrototypeOf,ZN=Object.prototype.hasOwnProperty;var Gt=(e,r)=>{for(var n in r)ru(e,n,{get:r[n],enumerable:!0})},XN=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of QN(r))!ZN.call(e,i)&&i!==n&&ru(e,i,{get:()=>r[i],enumerable:!(o=VN(r,i))||o.enumerable});return e};var Sn=(e,r,n)=>(n=e!=null?YN(WN(e)):{},XN(r||!e||!e.__esModule?ru(n,"default",{value:e,enumerable:!0}):n,e));var qr=class extends Error{constructor(r,n,o){super(o),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=r,this.nestedError=void 0}},On=class extends qr{constructor(r){super(1,"commander.invalidArgument",r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var ki=class{constructor(r,n){switch(this.description=n||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,r[0]){case"<":this.required=!0,this._name=r.slice(1,-1);break;case"[":this.required=!1,this._name=r.slice(1,-1);break;default:this.required=!0,this._name=r;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(r,n){return n===this.defaultValue||!Array.isArray(n)?[r]:(n.push(r),n)}default(r,n){return this.defaultValue=r,this.defaultValueDescription=n,this}argParser(r){return this.parseArg=r,this}choices(r){return this.argChoices=r.slice(),this.parseArg=(n,o)=>{if(!this.argChoices.includes(n))throw new On(`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 zs(e){let r=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+r+">":"["+r+"]"}var Jf=require("node:events"),Vs=Sn(require("node:child_process"),1),Zt=Sn(require("node:path"),1),Di=Sn(require("node:fs"),1),ce=Sn(require("node:process"),1),eg=require("node:util");var Qf=require("node:util"),Mi=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(r){this.helpWidth=this.helpWidth??r.helpWidth??80}visibleCommands(r){let n=r.commands.filter(i=>!i._hidden),o=r._getHelpCommand();return o&&!o._hidden&&n.push(o),this.sortSubcommands&&n.sort((i,a)=>i.name().localeCompare(a.name())),n}compareOptions(r,n){let o=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return o(r).localeCompare(o(n))}visibleOptions(r){let n=r.options.filter(i=>!i.hidden),o=r._getHelpOption();if(o&&!o.hidden){let i=o.short&&r._findOption(o.short),a=o.long&&r._findOption(o.long);!i&&!a?n.push(o):o.long&&!a?n.push(r.createOption(o.long,o.description)):o.short&&!i&&n.push(r.createOption(o.short,o.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(r){if(!this.showGlobalOptions)return[];let n=[];for(let o=r.parent;o;o=o.parent){let i=o.options.filter(a=>!a.hidden);n.push(...i)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(r){return r._argsDescription&&r.registeredArguments.forEach(n=>{n.description=n.description||r._argsDescription[n.name()]||""}),r.registeredArguments.find(n=>n.description)?r.registeredArguments:[]}subcommandTerm(r){let n=r.registeredArguments.map(o=>zs(o)).join(" ");return r._name+(r._aliases[0]?"|"+r._aliases[0]:"")+(r.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(r){return r.flags}argumentTerm(r){return r.name()}longestSubcommandTermLength(r,n){return n.visibleCommands(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(i)))),0)}longestOptionTermLength(r,n){return n.visibleOptions(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestGlobalOptionTermLength(r,n){return n.visibleGlobalOptions(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestArgumentTermLength(r,n){return n.visibleArguments(r).reduce((o,i)=>Math.max(o,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(i)))),0)}commandUsage(r){let n=r._name;r._aliases[0]&&(n=n+"|"+r._aliases[0]);let o="";for(let i=r.parent;i;i=i.parent)o=i.name()+" "+o;return o+n+" "+r.usage()}commandDescription(r){return r.description()}subcommandDescription(r){return r.summary()||r.description()}optionDescription(r){let n=[];if(r.argChoices&&n.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&(r.required||r.optional||r.isBoolean()&&typeof r.defaultValue=="boolean")&&n.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),r.presetArg!==void 0&&r.optional&&n.push(`preset: ${JSON.stringify(r.presetArg)}`),r.envVar!==void 0&&n.push(`env: ${r.envVar}`),n.length>0){let o=`(${n.join(", ")})`;return r.description?`${r.description} ${o}`:o}return r.description}argumentDescription(r){let n=[];if(r.argChoices&&n.push(`choices: ${r.argChoices.map(o=>JSON.stringify(o)).join(", ")}`),r.defaultValue!==void 0&&n.push(`default: ${r.defaultValueDescription||JSON.stringify(r.defaultValue)}`),n.length>0){let o=`(${n.join(", ")})`;return r.description?`${r.description} ${o}`:o}return r.description}formatItemList(r,n,o){return n.length===0?[]:[o.styleTitle(r),...n,""]}groupItems(r,n,o){let i=new Map;return r.forEach(a=>{let c=o(a);i.has(c)||i.set(c,[])}),n.forEach(a=>{let c=o(a);i.has(c)||i.set(c,[]),i.get(c).push(a)}),i}formatHelp(r,n){let o=n.padWidth(r,n),i=n.helpWidth??80;function a(T,_){return n.formatItem(T,o,_,n)}let c=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(r))}`,""],l=n.commandDescription(r);l.length>0&&(c=c.concat([n.boxWrap(n.styleCommandDescription(l),i),""]));let d=n.visibleArguments(r).map(T=>a(n.styleArgumentTerm(n.argumentTerm(T)),n.styleArgumentDescription(n.argumentDescription(T))));if(c=c.concat(this.formatItemList("Arguments:",d,n)),this.groupItems(r.options,n.visibleOptions(r),T=>T.helpGroupHeading??"Options:").forEach((T,_)=>{let se=T.map(ge=>a(n.styleOptionTerm(n.optionTerm(ge)),n.styleOptionDescription(n.optionDescription(ge))));c=c.concat(this.formatItemList(_,se,n))}),n.showGlobalOptions){let T=n.visibleGlobalOptions(r).map(_=>a(n.styleOptionTerm(n.optionTerm(_)),n.styleOptionDescription(n.optionDescription(_))));c=c.concat(this.formatItemList("Global Options:",T,n))}return this.groupItems(r.commands,n.visibleCommands(r),T=>T.helpGroup()||"Commands:").forEach((T,_)=>{let se=T.map(ge=>a(n.styleSubcommandTerm(n.subcommandTerm(ge)),n.styleSubcommandDescription(n.subcommandDescription(ge))));c=c.concat(this.formatItemList(_,se,n))}),c.join(`
|
|
3
|
-
`)}displayWidth(
|
|
4
|
-
`+" ".repeat(n+
|
|
5
|
-
${c}`)}boxWrap(
|
|
6
|
-
`)}};var
|
|
2
|
+
"use strict";var lk=Object.create;var ll=Object.defineProperty;var mk=Object.getOwnPropertyDescriptor;var dk=Object.getOwnPropertyNames;var fk=Object.getPrototypeOf,gk=Object.prototype.hasOwnProperty;var hk=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yt=(e,t)=>{for(var n in t)ll(e,n,{get:t[n],enumerable:!0})},yk=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dk(t))!gk.call(e,i)&&i!==n&&ll(e,i,{get:()=>t[i],enumerable:!(o=mk(t,i))||o.enumerable});return e};var tn=(e,t,n)=>(n=e!=null?lk(fk(e)):{},yk(t||!e||!e.__esModule?ll(n,"default",{value:e,enumerable:!0}):n,e));var BA=hk((FA,wp)=>{(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 en=g.split(":"),vr=[];for(let Nr=0;Nr<en.length;Nr++)vr.push(en[Nr].length>4?NaN:parseInt(en[Nr],16));return vr})(),{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,en=-1,vr;for(;vr=T.exec(x);){let Nr=(vr[0].match(/0/g)||[]).length;Nr>en&&(en=Nr,P=vr.index,ue=vr[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 wp<"u"&&wp.exports?wp.exports=I:e.ipaddr=I})(FA)});var rn=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}},Ln=class extends rn{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var ea=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 Ln(`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 cc(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}var yh=require("node:events"),uc=tn(require("node:child_process"),1),cr=tn(require("node:path"),1),ra=tn(require("node:fs"),1),le=tn(require("node:process"),1),Th=require("node:util");var dh=require("node:util"),ta=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=>cc(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,dh.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
|
+
`+" ".repeat(n+m)),c+l+" ".repeat(m)+E.replace(/\n/g,`
|
|
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 Lr=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=Tk(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 Ln(`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?fh(this.name().replace(/^no-/,"")):fh(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}},pc=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 fh(e){return e.split("-").reduce((t,n)=>t+n[0].toUpperCase()+n.slice(1))}function Tk(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(
|
|
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 Ek(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 ml(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=Ek(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=
|
|
16
|
-
Expecting one of '${o.join("', '")}'`);return this._lifeCycleHooks[
|
|
17
|
-
- already used by option '${n.flags}'`)}this._initOptionGroup(
|
|
18
|
-
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(
|
|
14
|
+
(Did you mean ${o[0]}?)`:""}var Ao=class e extends yh.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:()=>hh()??(le.default.stdout.isTTY&&le.default.stdout.hasColors?.()),getErrHasColors:()=>hh()??(le.default.stderr.isTTY&&le.default.stderr.hasColors?.()),stripColor:n=>(0,Th.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 ta,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 ea(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
|
+
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 rn(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 Lr(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
|
+
- 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 Lr)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(ra.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(
|
|
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=cr.default.resolve(h,E);if(ra.default.existsSync(I))return I;if(o.includes(cr.default.extname(E)))return;let g=o.find(T=>ra.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=ra.default.realpathSync(this._scriptPath)}catch{h=this._scriptPath}c=cr.default.resolve(cr.default.dirname(h),c)}if(c){let h=i(c,a);if(!h&&!t._executableFile&&this._scriptPath){let E=cr.default.basename(this._scriptPath,cr.default.extname(this._scriptPath));E!==this._name&&(h=i(c,`${E}-${t._name}`))}a=h||a}let l=o.includes(cr.default.extname(a)),m;le.default.platform!=="win32"?l?(n.unshift(a),n=gh(le.default.execArgv).concat(n),m=uc.default.spawn(le.default.argv[0],n,{stdio:"inherit"})):m=uc.default.spawn(a,n,{stdio:"inherit"}):(this._checkForMissingExecutable(a,c,t._name),n.unshift(a),n=gh(le.default.execArgv).concat(n),m=uc.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 rn(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 rn(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,
|
|
25
|
-
`),this._exit(0,"commander.version",
|
|
26
|
-
Expecting one of '${o.join("', '")}'`);let i=`${
|
|
27
|
-
`)}),this}_outputHelpIfRequested(
|
|
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 pc(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=ml(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=ml(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
|
+
`),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=>cc(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=cr.default.basename(t,cr.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
|
+
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 gh(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 hh(){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 B6=new Ao;function tt(e){throw new Error(`assertUnreachable: ${JSON.stringify(e,null,2)}`)}function na(e){return`\u2022\u2022\u2022\u2022${e.slice(-4)}`}function Eh(e){return{accessToken:e.accessToken,accessExpiresAt:e.expiresAt.toISOString()}}function _h(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 Ih(e){if(e)switch(e.kind){case"operation-api-key":return e.token;case"user-session":return e.userAuth.accessToken;default:tt(e)}}function lc(e,t){return e?.kind==="user-session"&&new Date(e.userAuth.accessExpiresAt)<=t}var dl={r:8,g:203,b:0},fl={r:0,g:130,b:0},gl=["\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 hl(e,t,n){return Math.round(e+(t-e)*n)}function _k(e,t){let n=hl(dl.r,fl.r,t),o=hl(dl.g,fl.g,t),i=hl(dl.b,fl.b,t);return`\x1B[38;2;${n};${o};${i}m${e}\x1B[0m`}function Ik(e){if(!e)return`
|
|
28
28
|
|
|
29
|
-
${
|
|
30
|
-
`)}`;let
|
|
29
|
+
${gl.join(`
|
|
30
|
+
`)}`;let t=gl.length-1;return`
|
|
31
31
|
|
|
32
|
-
${
|
|
33
|
-
`)}`}function og(){return rL(process.stdout.isTTY&&!process.env.NO_COLOR)}var Xb=require("node:crypto");var $i=require("node:crypto");function nL(e){return(0,$i.createHash)("sha256").update(e).digest("base64url")}function ig(){let e=(0,$i.randomBytes)(32).toString("base64url");return{verifier:e,challenge:nL(e)}}var fg=require("node:child_process"),gg=require("node:http"),Tu=require("node:os");var oL={"&":"&","<":"<",">":">",'"':""","'":"'"};function cu(e){return e.replace(/[&<>"']/g,r=>oL[r]??r)}var iL=[":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(""),aL=['<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 pu(e,r){let n=cu(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>${iL}</style></head><body><main>`,`<span class="tile">${aL}</span>`,`<div class="copy"><h1>${n}</h1><p>${cu(r)}</p></div>`,"</main></body></html>"].join("")}var rY=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 mY=60*1e3;var VY=1/1e6,lu=1e3,mu=60*lu,mL=60*mu,Zs=24*mL,QY=7*Zs,WY=30*Zs;var du=["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 dL={s:1,m:60,h:3600,d:86400};function sg(e){for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<48||n>57)return!1}return!0}function cg(){return Math.floor(Date.now()/1e3)}function Xs(e){if(typeof e=="number")return e;if(e==="now")return cg();if(e.startsWith("-")&&e.length>=3){let n=e.at(-1),o=n?dL[n]:void 0;if(o){let i=e.slice(1,-1);if(i.length>0&&sg(i))return cg()-parseInt(i,10)*o}}if(sg(e)&&e.length>0)return parseInt(e,10);let r=Date.parse(e);if(!Number.isNaN(r))return Math.floor(r/1e3);throw new Error(`Invalid time value: ${e}. Use unix seconds, relative (-30m, -1h), 'now', or ISO 8601.`)}function q(e){process.stdout.write(`${e}
|
|
34
|
-
`)}function
|
|
35
|
-
`)}var
|
|
36
|
-
`)}var yg="/oauth/callback",TL=5*mu,EL=pu("Login complete","You can close this tab and return to the terminal."),Js=pu("Login failed","Return to the terminal for details.");function _L(e){return(0,Tu.platform)()==="darwin"?["open",[e]]:(0,Tu.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function IL(e){let[r,n]=_L(e),o=(0,fg.spawnSync)(r,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function bL(e,r,n){return new Promise((o,i)=>{let a=setTimeout(()=>{i(new Error("Timed out waiting for the browser to complete login (5 minutes)."))},TL),c=(l,d,f,g)=>{l.writeHead(d,{"Content-Type":"text/html"}),l.end(f),clearTimeout(a),g()};e.on("request",(l,d)=>{let f=new URL(l.url??"/",n);if(f.pathname!==yg){d.writeHead(404,{"Content-Type":"text/html"}),d.end(Js);return}let g=f.searchParams.get("error");if(g){let _=f.searchParams.get("error_description")??"";c(d,400,Js,()=>i(new Error(`Authorization failed: ${g}${_?` (${_})`:""}`)));return}if(f.searchParams.get("state")!==r){c(d,400,Js,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let T=f.searchParams.get("code");if(!T){c(d,400,Js,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(d,200,EL,()=>o(T))})})}async function hg(e){let r=(0,gg.createServer)();r.on("connection",a=>a.unref()),await new Promise((a,c)=>{r.once("error",c),r.listen(0,"127.0.0.1",()=>{r.off("error",c),a()})});let{port:n}=r.address(),o=`http://127.0.0.1:${n}`,i=`${o}${yg}`;try{let a=e.buildAuthorizeUrl(i);return IL(a)?q("Opening your browser to complete login..."):(q("Visit this URL in your browser to complete login:"),q(` ${a}`)),{code:await bL(r,e.state,o),redirectUri:i}}finally{r.close()}}var y={};Gt(y,{Assign:()=>SL,Clone:()=>Bi,Create:()=>Av,Discard:()=>xv,Metrics:()=>Ft,Update:()=>Rv});var Ft={assign:0,create:0,clone:0,discard:0,update:0};function SL(e,r){return Ft.assign+=1,{...e,...r}}var s={};Gt(s,{Entries:()=>zL,EntriesRegExp:()=>KL,Every:()=>qL,EveryAll:()=>FL,GraphemeCount:()=>$L,HasPropertyKey:()=>HL,IsArray:()=>An,IsAsyncIterator:()=>PL,IsBigInt:()=>ji,IsBoolean:()=>Og,IsClassInstance:()=>DL,IsConstructor:()=>UL,IsDeepEqual:()=>bu,IsEqual:()=>ee,IsFunction:()=>Ag,IsGreaterEqualThan:()=>Rg,IsGreaterThan:()=>vL,IsInteger:()=>_u,IsIterator:()=>wL,IsLessEqualThan:()=>xg,IsLessThan:()=>kL,IsMaxLength:()=>jL,IsMinLength:()=>BL,IsMultipleOf:()=>ML,IsNull:()=>nc,IsNumber:()=>oc,IsObject:()=>xn,IsObjectNotArray:()=>NL,IsString:()=>Hr,IsSymbol:()=>LL,IsUndefined:()=>Iu,IsValueLike:()=>GL,Keys:()=>rc,Symbols:()=>YL,Values:()=>VL});function Fr(e,r,n){return e>=r&&e<=n}function Tg(e){return Fr(e,127462,127487)}function OL(e){return Fr(e,65024,65039)}function AL(e){return Fr(e,768,879)||Fr(e,6832,6911)||Fr(e,7616,7679)||Fr(e,65056,65071)}function tc(e){return e>65535?2:1}function Eg(e,r){for(;r<e.length;){let n=e.codePointAt(r);if(AL(n)||OL(n))r+=tc(n);else break}return r}function Eu(e,r){let n=e.codePointAt(r),o=r+tc(n);for(o=Eg(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+tc(i),o=Eg(e,o)}return Tg(n)&&o<e.length&&Tg(e.codePointAt(o))&&(o+=tc(e.codePointAt(o))),o}function _g(e){return Fr(e,55296,56319)||Fr(e,768,879)||e===8205}function Ig(e){let r=0,n=0;for(;n<e.length;)n=Eu(e,n),r++;return r}function xL(e,r){let n=0,o=0;for(;o<e.length;)if(o=Eu(e,o),n++,n>=r)return!0;return!1}function RL(e,r){let n=0,o=0;for(;o<e.length;)if(o=Eu(e,o),n++,n>r)return!1;return!0}function bg(e,r){let n=0;for(;n<e.length;){if(_g(e.charCodeAt(n)))return xL(e,r);if(n++,n>=r)return!0}return!1}function Sg(e,r){let n=0;for(;n<e.length;){if(_g(e.charCodeAt(n)))return RL(e,r);if(n++,n>r)return!1}return!0}function An(e){return Array.isArray(e)}function PL(e){return xn(e)&&Symbol.asyncIterator in e}function ji(e){return ee(typeof e,"bigint")}function Og(e){return ee(typeof e,"boolean")}function UL(e){if(Iu(e)||!Ag(e))return!1;let r=Function.prototype.toString.call(e);return!!(/^class\s/.test(r)||/\[native code\]/.test(r))}function Ag(e){return ee(typeof e,"function")}function _u(e){return Number.isInteger(e)}function wL(e){return xn(e)&&Symbol.iterator in e}function nc(e){return ee(e,null)}function oc(e){return Number.isFinite(e)}function NL(e){return xn(e)&&!An(e)}function xn(e){return ee(typeof e,"object")&&!nc(e)}function Hr(e){return ee(typeof e,"string")}function LL(e){return ee(typeof e,"symbol")}function Iu(e){return ee(e,void 0)}function ee(e,r){return e===r}function vL(e,r){return e>r}function kL(e,r){return e<r}function xg(e,r){return e<=r}function Rg(e,r){return e>=r}function ML(e,r){if(ji(e)||ji(r))return BigInt(e)%BigInt(r)===0n;let n=1e-10;if(!oc(e)||_u(e)&&1/r%1===0)return!0;let o=e%r;return Math.min(Math.abs(o),Math.abs(o-r))<n}function DL(e){if(!xn(e))return!1;let r=globalThis.Object.getPrototypeOf(e);return nc(r)?!1:ee(typeof r.constructor,"function")&&!(ee(r.constructor,globalThis.Object)||ee(r.constructor.name,"Object"))}function GL(e){return ji(e)||Og(e)||nc(e)||oc(e)||Hr(e)||Iu(e)}function $L(e){return Ig(e)}function jL(e,r){return Sg(e,r)}function BL(e,r){return bg(e,r)}function qL(e,r,n){for(let o=r;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function FL(e,r,n){let o=!0;for(let i=r;i<e.length;i++)n(e[i],i)||(o=!1);return o}function HL(e,r){return ee(r,"__proto__")||ee(r,"constructor")?Object.prototype.hasOwnProperty.call(e,r):r in e}function KL(e){return rc(e).map(r=>[new RegExp(`^${r}$`),e[r]])}function zL(e){return Object.entries(e)}function rc(e){return Object.getOwnPropertyNames(e)}function YL(e){return Object.getOwnPropertySymbols(e)}function VL(e){return Object.values(e)}function QL(e,r){if(!xn(r))return!1;let n=rc(e);return ee(n.length,rc(r).length)&&n.every(o=>bu(e[o],r[o]))}function WL(e,r){return An(r)&&ee(e.length,r.length)&&e.every((n,o)=>bu(e[o],r[o]))}function bu(e,r){return An(e)?WL(e,r):xn(e)?QL(e,r):ee(e,r)}var ct={};Gt(ct,{IsBigInt64Array:()=>uv,IsBigUint64Array:()=>lv,IsBoolean:()=>ZL,IsDate:()=>dv,IsFloat32Array:()=>cv,IsFloat64Array:()=>pv,IsInt16Array:()=>ov,IsInt32Array:()=>av,IsInt8Array:()=>tv,IsMap:()=>gv,IsNumber:()=>XL,IsRegExp:()=>mv,IsSet:()=>fv,IsString:()=>JL,IsTypeArray:()=>ev,IsUint16Array:()=>iv,IsUint32Array:()=>sv,IsUint8Array:()=>rv,IsUint8ClampedArray:()=>nv});function ZL(e){return e instanceof Boolean}function XL(e){return e instanceof Number}function JL(e){return e instanceof String}function ev(e){return globalThis.ArrayBuffer.isView(e)}function tv(e){return e instanceof globalThis.Int8Array}function rv(e){return e instanceof globalThis.Uint8Array}function nv(e){return e instanceof globalThis.Uint8ClampedArray}function ov(e){return e instanceof globalThis.Int16Array}function iv(e){return e instanceof globalThis.Uint16Array}function av(e){return e instanceof globalThis.Int32Array}function sv(e){return e instanceof globalThis.Uint32Array}function cv(e){return e instanceof globalThis.Float32Array}function pv(e){return e instanceof globalThis.Float64Array}function uv(e){return e instanceof globalThis.BigInt64Array}function lv(e){return e instanceof globalThis.BigUint64Array}function mv(e){return e instanceof globalThis.RegExp}function dv(e){return e instanceof globalThis.Date}function fv(e){return e instanceof globalThis.Set}function gv(e){return e instanceof globalThis.Map}function hv(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~guard")}function Tv(e){return e.map(r=>Su(r))}function Ev(e){let r={},n=Object.getOwnPropertyDescriptors(e);for(let o of Object.keys(n)){let i=n[o];s.HasPropertyKey(i,"value")&&Object.defineProperty(r,o,{...i,value:Su(i.value)})}return r}function _v(e){return new RegExp(e.source,e.flags)}function Su(e){return e instanceof RegExp?_v(e):hv(e)?e:s.IsArray(e)?Tv(e):s.IsObject(e)?Ev(e):e}function Bi(e){return Ft.clone+=1,Su(e)}var Pt={};Gt(Pt,{Get:()=>Sv,Reset:()=>Iv,Set:()=>bv});var Rn={immutableTypes:!1,maxErrors:8,useEval:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1};function Iv(){Rn.immutableTypes=!1,Rn.maxErrors=8,Rn.useEval=!0,Rn.exactOptionalPropertyTypes=!1,Rn.enumerableKind=!1}function bv(e){for(let r of s.Keys(e)){let n=e[r];n!==void 0&&Object.defineProperty(Rn,r,{value:n})}}function Sv(){return Rn}function Ov(e,r,n={}){for(let o of Object.keys(r))Object.defineProperty(e,o,{configurable:!0,writable:!0,enumerable:!1,value:r[o]});return e}function Cg(e,r){return{...e,...r}}function Av(e,r,n={}){Ft.create+=1;let o=Pt.Get(),i=Cg(r,n),a=o.enumerableKind?Cg(i,e):Ov(i,e);return o.immutableTypes?Object.freeze(a):a}function xv(e,r){Ft.discard+=1;let n={},o=Object.getOwnPropertyDescriptors(Bi(e)),i=new Set(r);for(let a of Object.keys(o))i.has(a)||Object.defineProperty(n,a,o[a]);return n}function Rv(e,r,n){Ft.update+=1;let o=Pt.Get(),i=Bi(e);for(let a of Object.keys(r))Object.defineProperty(i,a,{configurable:!0,writable:!0,enumerable:o.enumerableKind,value:r[a]});for(let a of Object.keys(n))Object.defineProperty(i,a,{configurable:!0,enumerable:!0,writable:!0,value:n[a]});return i}function S(e,r){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],r)}function A(e){return s.IsObject(e)}function Pg(e){return y.Create({"~kind":"OptionalAddAction"},{type:e},{})}function Ug(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"OptionalAddAction")&&A(e.type)}function wg(e){return y.Create({"~kind":"OptionalRemoveAction"},{type:e},{})}function Ng(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"OptionalRemoveAction")&&A(e.type)}function Lg(e){return y.Create({"~kind":"ReadonlyAddAction"},{type:e},{})}function vg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"ReadonlyAddAction")&&A(e.type)}function kg(e){return y.Create({"~kind":"ReadonlyRemoveAction"},{type:e},{})}function Mg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"ReadonlyRemoveAction")&&A(e.type)}function P(e,r,n){return y.Create({"~kind":"Deferred"},{action:e,parameters:r,options:n},{})}function Dg(e){return S(e,"Deferred")}function Ou(e){return y.Update(e,{"~immutable":!0},{})}function Kr(e){return Ou(e)}function Cn(e){return A(e)&&s.HasPropertyKey(e,"~immutable")}function go(e){return y.Discard(e,["~optional"])}function Et(e){return y.Update(e,{"~optional":!0},{})}function ic(e){return Et(e)}function Be(e){return A(e)&&s.HasPropertyKey(e,"~optional")}function ac(e){return y.Discard(e,["~readonly"])}function _t(e){return y.Update(e,{"~readonly":!0},{})}function sc(e){return _t(e)}function Pn(e){return A(e)&&s.HasPropertyKey(e,"~readonly")}function Ht(e,r){return y.Create({"~kind":"Array"},{type:"array",items:e},r)}function te(e){return S(e,"Array")}function cc(e){return y.Discard(e,["~kind","type","items"])}function Xt(e,r){return y.Create({"~kind":"AsyncIterator"},{type:"asyncIterator",iteratorItems:e},r)}function at(e){return S(e,"AsyncIterator")}function Gg(e){return y.Discard(e,["~kind","type","iteratorItems"])}function $g(e){return{enumerable:Pt.Get().enumerableKind,writable:!1,configurable:!1,value:e}}var pc=class{constructor(){globalThis.Object.defineProperty(this,"~kind",$g("Base")),globalThis.Object.defineProperty(this,"~guard",$g({check:r=>this.Check(r),errors:r=>this.Errors(r)}))}Check(r){return!0}Errors(r){return[]}Convert(r){return r}Clean(r){return r}Default(r){return r}Create(){throw new Error("Create not implemented")}Clone(){throw Error("Clone not implemented")}};function Ut(e){return S(e,"Base")}function zr(e,r,n={}){return y.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:r},n)}function qe(e){return S(e,"Constructor")}function jg(e){return y.Discard(e,["~kind","type","parameters","instanceType"])}function Yr(e,r,n={}){return y.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:r},n)}function Fe(e){return S(e,"Function")}function Bg(e){return y.Discard(e,["~kind","type","parameters","returnType"])}function ke(e,r){return y.Create({"~kind":"Ref"},{$ref:e},r)}function ue(e){return S(e,"Ref")}function Vr(e,r){return y.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:r})}function yo(e){return S(e,"Generic")}var qg="(?!)";function Z(e){return y.Create({"~kind":"Never"},{not:{}},e)}function hr(e){return S(e,"Never")}function Cv(){return["(not-resolvable)",Z()]}function Pv(){return["(not-generic)",Z()]}function Uv(e,r,n){return[e,Vr(r,n)]}function wv(e,r,n){return r in e?Fg(e,r,e[r],n):Cv()}function Fg(e,r,n,o){return yo(n)?Uv(r,n.parameters,n.expression):ue(n)?wv(e,n.$ref,o):Pv()}function Hg(e,r,n){return Fg(e,"(anonymous)",r,n)}function Jt(e,r,n){let o=s.Keys(e).reduce((i,a)=>({...i,[a]:y.Update(e[a],{},{$id:a})}),{});return y.Create({"~kind":"Cyclic"},{$defs:o,$ref:r},n)}function me(e){return S(e,"Cyclic")}var ie={};Gt(ie,{Match:()=>Nv});function Nv(e,r){return r[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Je(e){return y.Create({"~kind":"Unknown"},{},e)}function It(e){return S(e,"Unknown")}function qi(...e){let[r,n]=ie.Match(e,{2:(o,i)=>[o,i,i],1:o=>[o,Je(),Je()]});return y.Create({"~kind":"Infer"},{type:"infer",name:r,extends:n},{})}function we(e){return S(e,"Infer")}function ho(e){return y.Create({"~kind":"Any"},{},e)}function pt(e){return S(e,"Any")}function Kg(e){return s.IsObjectNotArray(e)}function zg(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function Yg(e,r){let n=Kg(e)?zg(e):e;return y.Create({"~kind":"Enum"},{enum:n},r)}function Ne(e){return S(e,"Enum")}function wt(e,r={}){return y.Create({"~kind":"Intersect"},{allOf:e},r)}function w(e){return S(e,"Intersect")}function Vg(e){return y.Discard(e,["~kind","allOf"])}function H(){throw new Error("Unreachable")}var Wr={};Gt(Wr,{Hash:()=>Wv,HashCode:()=>ty});function Lv(e){let r=new Set,n=e;for(;n&&n!==Object.prototype;){for(let o of Reflect.ownKeys(n))o!=="constructor"&&typeof o!="symbol"&&r.add(o);n=Object.getPrototypeOf(n)}return[...r]}function vv(e){return typeof e=="number"}var ut;(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"})(ut||(ut={}));var To=BigInt("14695981039346656037"),[kv,Mv]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Dv=Array.from({length:256}).map((e,r)=>BigInt(r)),Xg=new Float64Array(1),Jg=new DataView(Xg.buffer),ey=new Uint8Array(Xg.buffer);function et(e){To=To^Dv[e],To=To*kv%Mv}function Gv(e){et(ut.Array);for(let r of e)Qr(r)}function $v(e){et(ut.BigInt),Jg.setBigInt64(0,e);for(let r of ey)et(r)}function Wg(e){et(ut.Boolean),et(e?1:0)}function jv(e){et(ut.Constructor),Qr(e.toString())}function Bv(e){et(ut.Date),Qr(e.getTime())}function qv(e){et(ut.Function),Qr(e.toString())}function Fv(e){et(ut.Null)}function Zg(e){et(ut.Number),Jg.setFloat64(0,e,!0);for(let r of ey)et(r)}function Hv(e){et(ut.Object);for(let r of Lv(e).sort())Qr(r),Qr(e[r])}function Kv(e){et(ut.RegExp),Au(e.toString())}var zv=new TextEncoder;function Au(e){et(ut.String);for(let r of zv.encode(e))et(r)}function Yv(e){et(ut.Symbol),Qr(e.toString())}function Vv(e){et(ut.TypeArray);let r=new Uint8Array(e.buffer);for(let n=0;n<r.length;n++)et(r[n])}function Qv(e){return et(ut.Undefined)}function Qr(e){return ct.IsTypeArray(e)?Vv(e):ct.IsDate(e)?Bv(e):ct.IsRegExp(e)?Kv(e):ct.IsBoolean(e)?Wg(e.valueOf()):ct.IsString(e)?Au(e.valueOf()):ct.IsNumber(e)?Zg(e.valueOf()):vv(e)?Zg(e):s.IsArray(e)?Gv(e):s.IsBoolean(e)?Wg(e):s.IsBigInt(e)?$v(e):s.IsConstructor(e)?jv(e):s.IsNull(e)?Fv(e):s.IsObject(e)?Hv(e):s.IsString(e)?Au(e):s.IsSymbol(e)?Yv(e):s.IsUndefined(e)?Qv(e):s.IsFunction(e)?qv(e):H()}function ty(e){return To=BigInt("14695981039346656037"),Qr(e),To}function Wv(e){return ty(e).toString(16).padStart(16,"0")}function ry(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"~guard":return"must match check function";case"~refine":return e.params.message;default:return"an unknown validation error occurred"}}var Zv=ry;function ny(){return Zv}var Fi=class{constructor(r,n){this.type=r,this.decode=n}Encode(r){let n=this.type,o=Un(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=Un(n)?c=>n["~codec"].encode(r(c)):r,a={decode:o,encode:i};return y.Update(this.type,{"~codec":a},{})}},Hi=class{constructor(r){this.type=r}Decode(r){return new Fi(this.type,r)}};function uc(e){return new Hi(e)}function iy(e,r){return uc(e).Decode(r).Encode(()=>{throw Error("Encode not implemented")})}function ay(e,r){return uc(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(r)}function Un(e){return A(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function Jv(e,r){let n=lc(e)?[...e["~refine"],r]:[r];return y.Update(e,{"~refine":n},{})}function sy(e,r,n="error"){return Jv(e,{refine:r,message:n})}function lc(e){return A(e)&&s.HasPropertyKey(e,"~refine")}var cy="-?(?:0|[1-9][0-9]*)n";function Ki(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function At(e){return S(e,"BigInt")}function mc(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function lt(e){return S(e,"Boolean")}function zi(e){return y.Create({"~kind":"Identifier"},{name:e})}function py(e){return S(e,"Identifier")}var dc="-?(?:0|[1-9][0-9]*)";function wn(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function ze(e){return S(e,"Integer")}function er(e,r){return y.Create({"~kind":"Iterator"},{type:"iterator",iteratorItems:e},r)}function st(e){return S(e,"Iterator")}function uy(e){return y.Discard(e,["~kind","type","iteratorItems"])}var xu=class extends Error{constructor(r){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:r},writable:!1,configurable:!1,enumerable:!1})}};function ek(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new xu(e)})()}function Y(e,r){return y.Create({"~kind":"Literal"},{type:ek(e),const:e},r)}function fc(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function ly(e){return X(e)&&s.IsBigInt(e.const)}function my(e){return X(e)&&s.IsBoolean(e.const)}function Eo(e){return X(e)&&s.IsNumber(e.const)}function _o(e){return X(e)&&s.IsString(e.const)}function X(e){return S(e,"Literal")}function Zr(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function tr(e){return S(e,"Null")}var gc="-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?";function Nt(e){return y.Create({"~kind":"Number"},{type:"number"},e)}function be(e){return S(e,"Number")}function Io(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function rr(e){return S(e,"Symbol")}function dy(e){return s.Keys(e).filter(r=>!Be(e[r]))}function fy(e){return s.Keys(e)}function yc(e){return s.Values(e)}function tk(e,r={}){let n=dy(e),o=n.length>0?{required:n}:{};return y.Create({"~kind":"Object"},{type:"object",...o,properties:e},r)}var N=tk;function k(e){return S(e,"Object")}function gy(e){return y.Discard(e,["~kind","type","properties","required"])}function Nn(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,a],1:i=>[i,Je(),Je()]});return y.Create({"~kind":"Parameter"},{name:r,extends:n,equals:o},{})}function yy(e){return S(e,"Parameter")}function nr(e,r){return y.Create({"~kind":"Promise"},{type:"promise",item:e},r)}function tt(e){return S(e,"Promise")}function hy(e){return y.Discard(e,["~kind","type","item"])}var hc=".*";function bt(e){return y.Create({"~kind":"String"},{type:"string"},e)}function Me(e){return S(e,"String")}function St(e,r){let n="object",o={[e]:r};return y.Create({"~kind":"Record"},{type:n,patternProperties:o})}var bo=`^${dc}$`,So=`^${gc}$`,$t=`^${hc}$`;function Yi(e,r,n={}){return P("Record",[e,r],n)}function rk(e,r,n={}){return C({},Yi(e,r,n))}function Tc(e,r,n={}){return rk(e,r,n)}function Ec(e,r){return St(e,r)}function xt(e){return s.Keys(e.patternProperties)[0]}function Oo(e){let r=xt(e);return s.IsEqual(r,bo)?wn():s.IsEqual(r,So)?Nt():bt()}function rt(e){return e.patternProperties[xt(e)]}function Se(e){return S(e,"Record")}function Ln(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function Xr(e){return S(e,"Rest")}function _c(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function Ty(e){return S(e,"This")}function Ye(e,r={}){let[n,o,i]=[e,e.length,!1];return y.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:o},r)}function V(e){return S(e,"Tuple")}function Ey(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Ao(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function or(e){return S(e,"Undefined")}function B(e,r={}){return y.Create({"~kind":"Union"},{anyOf:e},r)}function O(e){return S(e,"Union")}function _y(e){return y.Discard(e,["~kind","anyOf"])}function Iy(e){return y.Create({"~kind":"Unsafe"},{},e)}function by(e){return S(e,"Unsafe")}function Ic(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function Rt(e){return S(e,"Void")}function ok(e,r){return s.IsEqual(e,"Array")?Ht(r[0]):s.IsEqual(e,"AsyncIterator")?Xt(r[0]):s.IsEqual(e,"Iterator")?er(r[0]):s.IsEqual(e,"Promise")?nr(r[0]):s.IsEqual(e,"Awaited")?ma(r[0]):s.IsEqual(e,"Capitalize")?Qi(r[0]):s.IsEqual(e,"ConstructorParameters")?ea(r[0]):s.IsEqual(e,"Evaluate")?Cu(r[0]):s.IsEqual(e,"Exclude")?ta(r[0],r[1]):s.IsEqual(e,"Extract")?ra(r[0],r[1]):s.IsEqual(e,"Index")?Co(r[0],r[1]):s.IsEqual(e,"InstanceType")?na(r[0]):s.IsEqual(e,"Lowercase")?Wi(r[0]):s.IsEqual(e,"NonNullable")?oa(r[0]):s.IsEqual(e,"Omit")?ia(r[0],r[1]):s.IsEqual(e,"Options")?Uo(r[0],r[1]):s.IsEqual(e,"Parameters")?aa(r[0]):s.IsEqual(e,"Partial")?sa(r[0]):s.IsEqual(e,"Pick")?ca(r[0],r[1]):s.IsEqual(e,"Readonly")?pa(r[0]):s.IsEqual(e,"KeyOf")?Po(r[0]):s.IsEqual(e,"Record")?Yi(r[0],r[1]):s.IsEqual(e,"Required")?ua(r[0]):s.IsEqual(e,"ReturnType")?la(r[0]):s.IsEqual(e,"Uncapitalize")?Zi(r[0]):s.IsEqual(e,"Uppercase")?Xi(r[0]):bc(ke(e),r)}function vn(){throw Error("Unreachable")}var ik=(e,r=[])=>e.reduce((n,o)=>s.IsArray(o)&&s.IsEqual(o.length,2)?[...n,o[0]]:[...n,o],[]),Tr=e=>{let[r,n]=e;return ik([...r,...n])};function Ry(e){return Nn(e[0],e[2],e[4])}function Cy(e){return Nn(e[0],e[2],e[2])}function Py(e){return Nn(e[0],Je(),e[2])}function Uy(e){return Nn(e,Je(),Je())}function wy(e){return Tr(e)}function Ny(e){return e[1]}function Ly(e){return Tr(e)}function vy(e){return e[1]}function ky(e){return ok(e[0],e[1])}function My(e){return null}function Dy(e){return bt()}function Gy(e){return Nt()}function $y(e){return mc()}function jy(e){return Ao()}function By(e){return Zr()}function qy(e){return wn()}function Fy(e){return Ki()}function Hy(e){return Je()}function Ky(e){return ho()}function zy(e){return N({})}function Yy(e){return Z()}function Vy(e){return Io()}function Qy(e){return Ic()}function Wy(e){return _c()}function Zy(e){return e[1]}function Xy(e){return Y(e)}function Jy(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function eh(e){return e[1]}function th(e){return Vi(e)}function rh(e){return Y(BigInt(e))}function nh(e){return Y(s.IsEqual(e,"true"))}function oh(e){return Y(parseFloat(e))}function ih(e){return Y(e)}function ah(e){return e.length>0}function sh(e){return e.reduce((r,n)=>s.IsEqual(n.length,3)?[...r,[n[1]]]:[...r,[]],[])}function ch(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function ph(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}var Sy=(e,r)=>r.reduceRight((n,o)=>{let i=o;return s.IsEqual(i.length,1)?Co(n,i[0]):s.IsEqual(i.length,0)?Ht(n):vn()},e),Oy=(e,r)=>s.IsEqual(r.length,3)?Ji(e,r[0],r[1],r[2]):e;function uh(e){let[r,n,o,i]=e;return Oy(r?Po(Sy(n,o)):Sy(n,o),i)}function Ru(e,r){return s.IsEqual(r.length,3)?(()=>{let[n,o,i]=r,a=Ru(o,i);if(s.IsEqual(n,"&"))return w(a)?wt([e,...a.allOf]):wt([e,a]);if(s.IsEqual(n,"|"))return O(a)?B([e,...a.anyOf]):B([e,a]);vn()})():e}function lh(e){let[r,n]=e;return Ru(r,n)}function mh(e){let[r,n]=e;return Ru(r,n)}function dh(e){return Ou(e[1])}function fh(e){return e[1]}function gh(e){return Vr(e[0],e[2])}function yh(e){return s.IsEqual(e.length,4)?qi(e[1],e[3]):s.IsEqual(e.length,2)?qi(e[1],Je()):vn()}function hh(e){return`${e}`}function Th(e){return ze(e[3])?bo:be(e[3])?So:rr(e[3])?$t:Me(e[3])?$t:vn()}function Eh(e){return e.length>0}function _h(e){return e.length>0}function Ih(e){let[r,n,o,i,a]=e;return{[n]:r&&o?_t(Et(a)):r&&!o?_t(a):!r&&o?Et(a):a}}function bh(e){return Tr(e)}function Sh(e){return e.reduce((r,n)=>s.HasPropertyKey(n,bo)||s.HasPropertyKey(n,So)||s.HasPropertyKey(n,$t)?[r[0],y.Assign(r[1],n)]:[y.Assign(r[0],n),r[1]],[{},{}])}function Oh(e){return Sh(e[1])}function Ah(e){let[r,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return N(r,o)}function xh(e){return s.IsEqual(e.length,5)?_t(Et(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?_t(e[3]):Et(e[3]):vn()}function Rh(e){return _t(Et(e[1]))}function Ch(e){return _t(e[1])}function Ph(e){return Et(e[0])}function Uh(e){return s.IsEqual(e.length,2)?Ln(e[1]):s.IsEqual(e.length,1)?e[0]:vn()}function wh(e){return Tr(e)}function Nh(e){return Ye(e[1])}function Lh(e){return _t(Et(e[4]))}function vh(e){return _t(e[3])}function kh(e){return Et(e[3])}function Mh(e){return e[2]}function Dh(e){return s.IsEqual(e.length,2)?Ln(e[1]):s.IsEqual(e.length,1)?e[0]:vn()}function Gh(e){return Tr(e)}function $h(e){return Yr(e[1],e[4])}function jh(e){return zr(e[2],e[5])}function Ay(e,r){return s.IsEqual(e,"remove")?kg(r):s.IsEqual(e,"add")?Lg(r):r}function Bh(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 xy(e,r){return s.IsEqual(e,"remove")?wg(r):s.IsEqual(e,"add")?Pg(r):r}function qh(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 Fh(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function Hh(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?xo(zi(e[3]),e[5],e[6][0],Ay(e[1],xy(e[8],e[10]))):xo(zi(e[3]),e[5],ke(e[3]),Ay(e[1],xy(e[8],e[10])))}function Kh(e){return ke(e)}function zh(e){return Uo(e[2],e[4])}function Yh(e){return parseFloat(e)}function Vh(e){return s.IsEqual(e,"true")}function Qh(e){return null}function Wh(e){return{[e[0]]:e[2]}}function Zh(e){return Tr(e)}function ak(e){return e.reduce((r,n)=>y.Assign(r,n),{})}function Xh(e){return ak(e[1])}function Jh(e){return Tr(e)}function eT(e){return e[1]}function tT(e){return Ki()}function rT(e){return bt()}function nT(e){return Nt()}function oT(e){return wn()}function iT(e){return Z()}function aT(e){return Y(e)}function sT(e){return B(e[1])}function cT(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function pT(e){return[e[0],...e[1]]}function uT(e){return e[1]}function lT(e){return Tr(e)}function mT(e){return s.IsEqual(e.length,2)?e[1]:[]}function dT(e){let r=e[2],n=e[3],[o,i]=e[4],a=s.IsEqual(s.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:Vr(r,Ro(n,o,a))}}function fT(e){let r=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Ro(r,n,i)}}function gT(e){return{[e[1]]:Vr(e[2],e[4])}}function yT(e){return{[e[1]]:e[3]}}function hT(e){return null}function TT(e){return Sh(Tr(e))}function ET(e){return e[1]}function _T(e){let r=e[0],n=e[1];return Pu(y.Assign(r,n[0]))}function pe(e){return An(e)&&ee(e.length,2)}function pk(e,r){return ee(r.indexOf(e),0)?[e,r.slice(e.length)]:[]}function He(e,r){let[n,...o]=e;return Hr(n)?(()=>{let i=pk(n,r);return ee(i.length,2)?i:He(o,r)})():[]}function Uu(e,r){return Array.from({length:r-e+1},(n,o)=>String.fromCharCode(e+o))}var IT=[...Uu(97,122),...Uu(65,90)],wu="0",Nu=Uu(49,57),wo=[wu,...Nu],bT=" ",No=`
|
|
37
|
-
`;var
|
|
38
|
-
`,n),([o,i])=>[[
|
|
39
|
-
`,n),([o,i])=>[[
|
|
40
|
-
`,e),([
|
|
41
|
-
`,n),([o,i])=>[[
|
|
42
|
-
`,e),([r,n])=>[[r],n]),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]),fE=(e,r=[])=>u(u(Bu(e),([n,o])=>u(c0(o),([i,a])=>[[n,i],a])),([n,o])=>fE(o,[...r,n]),()=>[r,e]),p0=e=>u(u(fE(e),([r,n])=>u(u(u(Bu(n),([o,i])=>[[o],i]),([o,i])=>[o,i],()=>u([[],n],([o,i])=>[o,i],()=>[])),([o,i])=>[[r,o],i])),([r,n])=>[TT(r),n]),Bu=e=>u(u(s0(e),([r,n])=>u(u(n0(n),([o,i])=>[o,i],()=>u(o0(n),([o,i])=>[o,i],()=>u(i0(n),([o,i])=>[o,i],()=>u(a0(n),([o,i])=>[o,i],()=>[])))),([o,i])=>u(jT(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[ET(r),n]),u0=e=>u(u(Bu(e),([r,n])=>u(p0(n),([o,i])=>[[r,o],i])),([r,n])=>[_T(r),n]),gE=e=>u(u(u0(e),([r,n])=>[r,n],()=>u(dM(e),([r,n])=>[r,n],()=>u(J(e),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]);function yE(e){let r=Du(`\`${e}\``);return s.IsEqual(r.length,2)?r[0]:H()}function Vi(e,r={}){return P("TemplateLiteral",[e],r)}function hE(e){return C({},Vi(e,{}))}function m0(e){let r=yE(e);return hE(r)}function TE(e,r={}){let n=s.IsString(e)?m0(e):hE(e);return y.Update(n,{},r)}function Le(e){return S(e,"TemplateLiteral")}var L={};Gt(L,{ExtendsFalse:()=>F,ExtendsTrue:()=>R,ExtendsUnion:()=>qu,IsExtendsFalse:()=>d0,IsExtendsTrue:()=>_E,IsExtendsTrueLike:()=>Ae,IsExtendsUnion:()=>EE});function qu(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function EE(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function R(e){return y.Create({"~kind":"ExtendsTrue"},{inferred:e})}function _E(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function F(){return y.Create({"~kind":"ExtendsFalse"},{})}function d0(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function Ae(e){return EE(e)||_E(e)}function wc(e){let r=lE(e);return s.IsEqual(r.length,2)?r[0]:H()}function f0(e){return!0}function IE(e){let[r,...n]=e;return A(r)?g0(r)?IE(n):!1:!0}function bE(e){return s.IsEqual(e.length,0)?!1:IE(e)}function g0(e){return O(e)?bE(e.anyOf):X(e)?f0(e.const):!1}function Nc(e){return bE(e)}function SE(e,r,n=[]){let[o,...i]=e;return s.IsString(o)?SE(i,r,[...n,`${o}${r}`]):n}function y0(e,r){return s.IsEqual(e.length,0)?[`${r}`]:SE(e,r)}function OE(e,r,n=[]){let[o,...i]=r;return A(o)?OE(e,i,[...n,...AE(e,o)]):n}function AE(e,r){return O(r)?OE(e,r.anyOf):X(r)?y0(e,r.const):H()}function xE(e,r){let[n,...o]=r;return A(n)?xE(AE(e,n),o):e}function h0(e){return e.map(r=>Y(r))}function T0(e){let r=xE([],e),n=h0(r);return B(n)}function E0(e){return s.IsEqual(e.length,0)?H():s.IsEqual(e.length,1)&&X(e[0])?e[0]:T0(e)}function nt(e){let r=wc(e);return Nc(r)?E0(r):bt()}function _0(e){return s.IsString(e)||s.IsNumber(e)?Y(e):s.IsNull(e)?Zr():Z()}function Kt(e){return e.map(n=>_0(n))}function da(e){let r=Kt(e);return B(r)}function kn(e){return da(e.enum)}function I0(e,r,n,o){let i=re(e,n,o);return Ae(i)?R(y.Assign(y.Assign(e,i.inferred),{[r]:n})):F()}function b0(e,r){return R(e)}function S0(e,r,n){let o=da(n);return re(e,r,o)}function RE(e,r,n){let[o,...i]=n;return A(o)?(()=>{let a=re(e,r,o);return Ae(a)?RE(a.inferred,r,i):F()})():R(e)}function O0(e,r,n){let o=nt(n);return re(e,r,o)}function CE(e,r,n){let[o,...i]=n;return A(o)?(()=>{let a=re(e,r,o);return Ae(a)?R(a.inferred):CE(e,r,i)})():F()}function K(e,r,n){return pt(n)?b0(e,r):Ne(n)?S0(e,r,n.enum):we(n)?I0(e,n.name,r,n.extends):w(n)?RE(e,r,n.allOf):Le(n)?O0(e,r,n.pattern):O(n)?CE(e,r,n.anyOf):It(n)?R(e):F()}function PE(e,r,n){return we(n)?K(e,r,n):pt(n)?R(e):It(n)?R(e):qu(e)}function A0(e,r){let n=Cn(e),o=Cn(r);return n&&o||!n&&o?!0:!(n&&!o)}function UE(e,r,n,o){return te(o)?A0(r,o)?re(e,n,o.items):F():K(e,r,o)}function wE(e,r,n){return at(n)?re(e,r,n.iteratorItems):K(e,Xt(r),n)}function NE(e,r,n){return At(n)?R(e):K(e,r,n)}function LE(e,r,n){return lt(n)?R(e):K(e,r,n)}function x0(e,r,n,o,i){let a=we(o)?r:o,c=we(o)?o:r,l=Be(r),d=Be(o),f=re(e,a,c);return!l&&d?F():Ae(f)?fa(f.inferred,n,i):F()}function R0(e,r,n,o){let[i,...a]=o;return A(i)?x0(e,r,n,i,a):Be(r)?R(e):F()}function C0(e,r,n){let[o,...i]=r;return A(o)?R0(e,o,i,n):R(e)}function fa(e,r,n){return C0(e,r,n)}function Lc(e,r,n){return Rt(n)?R(e):re(e,r,n)}function vE(e,r,n,o){return qe(o)?(()=>{let i=fa(e,r,o.parameters);return Ae(i)?Lc(i.inferred,n,o.instanceType):F()})():F()}function kE(e,r,n){return re(e,kn(r),n)}function ME(e,r,n,o){return Fe(o)?(()=>{let i=fa(e,r,o.parameters);return Ae(i)?Lc(i.inferred,n,o.returnType):F()})():F()}function DE(e,r,n){return ze(n)?R(e):be(n)?R(e):K(e,r,n)}var ga="equal",P0="disjoint",ya="left-inside",ha="right-inside";function Ta(e,r){let n=[It(e)?L.ExtendsFalse():ot({},e,r),It(e)?L.ExtendsTrue({}):ot({},r,e)];return L.IsExtendsTrueLike(n[0])&&L.IsExtendsTrueLike(n[1])?ga:L.IsExtendsTrueLike(n[0])&&L.IsExtendsFalse(n[1])?ya:L.IsExtendsFalse(n[0])&&L.IsExtendsTrueLike(n[1])?ha:P0}function U0(e){return O(e)?ir(e.anyOf):[e]}function ir(e){return e.reduce((r,n)=>[...r,...U0(n)],[])}function Fu(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function GE(e){let r=Fu(e.items);return N(r)}function w0(e,r){return Pn(e)?!!Pn(r):!1}function N0(e,r){return Be(e)?!!Be(r):!1}function L0(e,r){let n=w0(e,r),o=N0(e,r),i=ve([e,r]),a=ac(go(i));return n&&o?_t(Et(a)):n&&!o?_t(a):!n&&o?Et(a):a}function v0(e,r,n){return n in e?n in r?L0(e[n],r[n]):e[n]:n in r?r[n]:Z()}function k0(e,r){return[...new Set([...s.Keys(r),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:v0(e,r,i)}),{})}function $E(e){return k(e)?e.properties:V(e)?Fu(e.items):H()}function jE(e,r){let n=$E(e),o=$E(r),i=k0(n,o);return N(i)}function BE(e,r){let n=Ta(e,r);return s.IsEqual(n,ya)?e:s.IsEqual(n,ha)||s.IsEqual(n,ga)?r:Z()}function qE(e){return k(e)||V(e)}function FE(e){return w(e)?ve(e.allOf):e}function M0(e,r){let n=FE(e),o=FE(r),i=qE(n),a=qE(o);return i&&a?jE(tn(n),o):i&&!a?tn(n):!i&&a?o:BE(tn(n),o)}function HE(e,r,n=[]){let[o,...i]=r;return s.IsUndefined(o)?n.length===0?[e]:n:HE(e,i,[...n,M0(e,o)])}function KE(e,r,n=[]){let[o,...i]=e;return A(o)?KE(i,r,[...n,...Ea([o],r)]):n}function Ea(e,r=[]){let[n,...o]=e;return A(n)?O(n)?Ea(o,KE(n.anyOf,r)):Ea(o,HE(n,r)):r}function ve(e){let r=Ea(e);return Hu(r)}function Er(e){return Hu(e)}function tn(e){return w(e)?ve(e.allOf):O(e)?Er(e.anyOf):e}function Mn(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?Z():B(e)}function D0(e,r){return r.filter(n=>Ta(e,n)!==ha)}function G0(e,r){let n=r.some(o=>{let i=Ta(e,o);return s.IsEqual(i,ya)||s.IsEqual(i,ga)});return s.IsEqual(n,!1)}function $0(e,r){let n=tn(e);return pt(n)?[n]:G0(n,r)?[...D0(n,r),n]:r}function Ku(e,r=[]){let[n,...o]=e;return A(n)?k(n)?Ku(o,[...r,n]):Ku(o,$0(n,r)):r}function Hu(e){let r=Ku(e),n=ir(r);return n.length===0?Z():n.length===1?n[0]:B(n)}function j0(e,r,n,o){let i=I(e,r,n);return y.Update(tn(i),{},o)}function zE(e,r,n,o){return j0(e,r,n,o)}function YE(e,r,n){let o=ve(r);return re(e,o,n)}function VE(e,r,n){return st(n)?re(e,r,n.iteratorItems):K(e,er(r),n)}function vc(e,r,n){return r===n?R(e):F()}function B0(e,r,n){return X(n)?vc(e,r,n.const):At(n)?R(e):K(e,Y(r),n)}function q0(e,r,n){return X(n)?vc(e,r,n.const):lt(n)?R(e):K(e,Y(r),n)}function F0(e,r,n){return X(n)?vc(e,r,n.const):be(n)?R(e):K(e,Y(r),n)}function H0(e,r,n){return X(n)?vc(e,r,n.const):Me(n)?R(e):K(e,Y(r),n)}function QE(e,r,n){return s.IsBigInt(r.const)?B0(e,r.const,n):s.IsBoolean(r.const)?q0(e,r.const,n):s.IsNumber(r.const)?F0(e,r.const,n):s.IsString(r.const)?H0(e,r.const,n):H()}function WE(e,r,n){return we(n)?K(e,r,n):R(e)}function ZE(e,r,n){return tr(n)?R(e):K(e,r,n)}function XE(e,r,n){return be(n)?R(e):K(e,r,n)}function K0(e,r,n){return Be(r)?Be(n)?R(e):F():R(e)}function z0(e,r,n){return we(n)&&hr(n.extends)?F():(()=>{let o=re(e,r,n);return Ae(o)?K0(o.inferred,r,n):F()})()}function Y0(e,r){return e.reduce((n,o)=>o in r?Ae(r[o])?{...n,...r[o].inferred}:H():H(),{})}function V0(e,r,n){let o={};for(let c of s.Keys(n))o[c]=c in r?z0({},r[c],n[c]):Be(n[c])?we(n[c])?R(y.Assign(e,{[n[c].name]:n[c].extends})):R(e):F();let i=s.Values(o).every(c=>Ae(c)),a=i?Y0(s.Keys(o),o):{};return i?R(a):F()}function Q0(e,r,n){let o=V0(e,r,n);return Ae(o)?R(y.Assign(e,o.inferred)):F()}function W0(e,r,n){return Q0(e,r,n)}function JE(e,r,n){return k(n)?W0(e,r,n.properties):K(e,N(r),n)}function e_(e,r,n){return tt(n)?re(e,r,n.item):K(e,nr(r),n)}function t_(e,r,n){return Me(n)?R(e):K(e,r,n)}function r_(e,r,n){return rr(n)?R(e):K(e,r,n)}function n_(e,r,n){let o=nt(r);return re(e,o,n)}function zu(e,r){return y.Create({"~kind":"Inferrable"},{name:e,type:r},{})}function _a(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 Yu(e){return Xr(e)?we(e.items)?te(e.items.extends)?zu(e.items.name,e.items.extends.items):It(e.items.extends)?zu(e.items.name,e.items.extends):void 0:H():void 0}function kc(e){return we(e)?zu(e.name,e.extends):void 0}function Vu(e,r,n=[]){let[o,...i]=e;return A(o)?(()=>{let a=re({},o,r);return Ae(a)?Vu(i,r,[...n,o]):void 0})():n}function o_(e,r,n,o){let i=Vu(n,o);return s.IsArray(i)?R(y.Assign(e,{[r]:Ye(i)})):F()}function Mc(e,r,n,o){let i=Vu(n,o);return s.IsArray(i)?R(y.Assign(e,{[r]:B(i)})):F()}function Z0(e){return[...e].reverse()}function Qu(e,r){return r?Z0(e):e}function X0(e){let r=e.length>0?e[0]:void 0,n=A(r)?Yu(r):void 0;return A(n)}function J0(e,r,n,o,i,a){let c=re(e,n,i);return Ae(c)?i_(c.inferred,r,o,a):F()}function eD(e,r,n,o,i){let a=Yu(o);return _a(a)?o_(e,a.name,Qu(n,r),a.type):(()=>{let[c,...l]=n;return A(c)?J0(e,r,c,l,o,i):F()})()}function tD(e,r,n,o){let[i,...a]=o;return A(i)?eD(e,r,n,i,a):s.IsEqual(n.length,0)?R(e):F()}function i_(e,r,n,o){return tD(e,r,n,o)}function rD(e,r,n){let o=Dc(e,{callstack:[]},n),i=X0(o);return i_(e,i,Qu(r,i),Qu(o,i))}function a_(e,r,n){let o=kc(n);return _a(o)?Mc(e,o.name,r,o.type):(()=>{let[i,...a]=r;return A(i)?(()=>{let c=re(e,i,n);return Ae(c)?a_(c.inferred,a,n):F()})():R(e)})()}function s_(e,r,n){let o=Dc(e,{callstack:[]},r);return V(n)?rD(e,o,n.items):te(n)?a_(e,o,n.items):K(e,Ye(o),n)}function c_(e,r,n){return Rt(n)?R(e):or(n)?R(e):K(e,r,n)}function p_(e,r,n){let[o,...i]=n;return A(o)?(()=>{let a=re(e,r,o);return Ae(a)?R(a.inferred):p_(e,r,i)})():F()}function Wu(e,r,n){let[o,...i]=r;return A(o)?(()=>{let a=p_(e,o,n);return Ae(a)?Wu(a.inferred,i,n):F()})():R(e)}function u_(e,r,n){let o=kc(n);return _a(o)?Mc(e,o.name,r,o.type):O(n)?Wu(e,r,n.anyOf):Wu(e,r,[n])}function l_(e,r,n){return we(n)?K(e,r,n):pt(n)?R(e):It(n)?R(e):F()}function m_(e,r,n){return Rt(n)?R(e):K(e,r,n)}function re(e,r,n){return pt(r)?PE(e,r,n):te(r)?UE(e,r,r.items,n):at(r)?wE(e,r.iteratorItems,n):At(r)?NE(e,r,n):lt(r)?LE(e,r,n):qe(r)?vE(e,r.parameters,r.instanceType,n):Ne(r)?kE(e,r,n):Fe(r)?ME(e,r.parameters,r.returnType,n):ze(r)?DE(e,r,n):w(r)?YE(e,r.allOf,n):st(r)?VE(e,r.iteratorItems,n):X(r)?QE(e,r,n):hr(r)?WE(e,r,n):tr(r)?ZE(e,r,n):be(r)?XE(e,r,n):k(r)?JE(e,r.properties,n):tt(r)?e_(e,r.item,n):Me(r)?t_(e,r,n):rr(r)?r_(e,r,n):Le(r)?n_(e,r.pattern,n):V(r)?s_(e,r.items,n):or(r)?c_(e,r,n):O(r)?u_(e,r.anyOf,n):It(r)?l_(e,r,n):Rt(r)?m_(e,r,n):F()}function Ro(e,r,n={}){return P("Interface",[e,r],n)}function vo(e){return A(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function d_(e,r,n={}){return C({},Ro(e,r,n))}function nD(e,r,n){return e.includes(n)?!0:rn([...e,n],r,r[n])}function f_(e,r,n){let o=yc(n);return Dn(e,r,o)}function Dn(e,r,n){let[o,...i]=n;return A(o)?rn(e,r,o)?!0:Dn(e,r,i):!1}function rn(e,r,n){return ue(n)?nD(e,r,n.$ref):te(n)?rn(e,r,n.items):at(n)?rn(e,r,n.iteratorItems):qe(n)?Dn(e,r,[...n.parameters,n.instanceType]):Fe(n)?Dn(e,r,[...n.parameters,n.returnType]):vo(n)?f_(e,r,n.parameters[1]):w(n)?Dn(e,r,n.allOf):st(n)?rn(e,r,n.iteratorItems):k(n)?f_(e,r,n.properties):tt(n)?rn(e,r,n.item):O(n)?Dn(e,r,n.anyOf):V(n)?Dn(e,r,n.items):Se(n)?rn(e,r,rt(n)):!1}function Gc(e,r,n){return rn(e,r,n)}function oD(e,r){return r.reduce((n,o)=>o in e?Gc([o],e,e[o])?[...n,o]:n:H(),[])}function g_(e){let r=fy(e);return oD(e,r)}function iD(e,r,n){return n.includes(r)?n:r in e?nn(e,e[r],[...n,r]):H()}function y_(e,r,n){let o=yc(r);return ko(e,o,n)}function ko(e,r,n){return r.reduce((o,i)=>nn(e,i,o),n)}function nn(e,r,n){return ue(r)?iD(e,r.$ref,n):te(r)?nn(e,r.items,n):at(r)?nn(e,r.iteratorItems,n):qe(r)?ko(e,[...r.parameters,r.instanceType],n):Fe(r)?ko(e,[...r.parameters,r.returnType],n):vo(r)?y_(e,r.parameters[1],n):w(r)?ko(e,r.allOf,n):st(r)?nn(e,r.iteratorItems,n):k(r)?y_(e,r.properties,n):tt(r)?nn(e,r.item,n):O(r)?ko(e,r.anyOf,n):V(r)?ko(e,r.items,n):Se(r)?nn(e,rt(r),n):n}function h_(e,r,n){return nn(e,n,[r])}function aD(e){return ho()}function sD(e){return s.Keys(e).reduce((r,n)=>({...r,[n]:ar(e[n])}),{})}function Ia(e){return e.reduce((r,n)=>[...r,ar(n)],[])}function ar(e){return ue(e)?aD(e.$ref):te(e)?Ht(ar(e.items),cc(e)):at(e)?Xt(ar(e.iteratorItems)):qe(e)?zr(Ia(e.parameters),ar(e.instanceType)):Fe(e)?Yr(Ia(e.parameters),ar(e.returnType)):w(e)?wt(Ia(e.allOf)):st(e)?er(ar(e.iteratorItems)):k(e)?N(sD(e.properties)):tt(e)?nr(ar(e.item)):Se(e)?Tc(Oo(e),ar(rt(e))):O(e)?B(Ia(e.anyOf)):V(e)?Ye(Ia(e.items)):e}function cD(e,r){return r in e?ar(e[r]):Je()}function T_(e){return cD(e.$defs,e.$ref)}function pD(e,r,n){let o=Ct(e,{callstack:[]},r),i=ba({},{callstack:[]},n);return ve([...o,N(i)])}function uD(e,r){return s.Keys(e).filter(o=>r.includes(o)).reduce((o,i)=>{let a=e[i],c=vo(a)?pD(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function E_(e,r,n){let o=h_(e,r,n),i=uD(e,o);return Jt(i,r)}function __(e,r){return r in e?ue(e[r])?__(e,e[r].$ref):e[r]:Z()}function sr(e,r){return __(e,r)}function I_(e){return me(e)?T_(e):e}function ot(e,r,n){let o=I_(r),i=I_(n);return re(e,o,i)}function lD(e,r,n){if(we(r)||Mo(r)||L.IsExtendsTrueLike(ot({},r,n)))return;let o={parameter:e,extends:n,received:r};throw new Error("Generic argument does not satify constraint",{cause:o})}function b_(e,r,n,o,i){let a=I(e,r,i);return lD(n,a,o),y.Assign(e,{[n]:a})}function mD(e,r,n,o,i){let a=I(e,r,n.extends),c=I(e,r,n.equals),[l,...d]=i;return A(l)?Zu(b_(e,r,n.name,a,l),r,o,d):Zu(b_(e,r,n.name,a,c),r,o,[])}function Zu(e,r,n,o){let[i,...a]=n;return A(i)?mD(e,r,i,a,o):e}function S_(e,r,n,o){return Zu(e,r,n,o)}function dD(e){return s.IsGreaterThan(e.length,0)?e[0]:""}function O_(e,r,n,o){let i=Ct(e,r,o);return bc(n,i)}function fD(e,r,n,o){return O_(e,r,ke(n),o)}function gD(e,r,n,o,i,a){let c=Ct(e,r,a),l=S_(e,r,o,c),d=I(l,{callstack:[...r.callstack,n]},i);return I(e,r,d)}function $c(e,r,n,o){let[i,a]=Hg(e,n,o);return yo(a)?s.IsEqual(dD(r.callstack),i)?fD(e,r,i,o):gD(e,r,i,a.parameters,a.expression,o):O_(e,r,n,o)}function bc(e,r){return y.Create({"~kind":"Call"},{target:e,arguments:r},{})}function A_(e,r){return $c({},{callstack:[]},e,r)}function Mo(e){return S(e,"Call")}function x_(e){return tt(e)?x_(e.item):e}function yD(e,r,n,o){let i=I(e,r,n);return y.Update(x_(i),{},o)}function R_(e,r,n,o){return v(e,[n])?yD(e,r,n,o):ma(n,o)}function C_(e,r){return e(r)}function P_(e,r){return s.IsString(r)?Y(C_(e,r)):Y(r)}function U_(e,r){let n=nt(r);return _r(e,n)}function w_(e,r){let n=r.map(o=>_r(e,o));return B(n)}function _r(e,r){return X(r)?P_(e,r.const):Le(r)?U_(e,r.pattern):O(r)?w_(e,r.anyOf):r}function Qi(e,r={}){return P("Capitalize",[e],r)}function N_(e,r={}){return C({},Qi(e,r))}function Wi(e,r={}){return P("Lowercase",[e],r)}function L_(e,r={}){return C({},Wi(e,r))}function Zi(e,r={}){return P("Uncapitalize",[e],r)}function v_(e,r={}){return C({},Zi(e,r))}function Xi(e,r={}){return P("Uppercase",[e],r)}function k_(e,r={}){return C({},Xi(e,r))}var hD=e=>e[0].toUpperCase()+e.slice(1),TD=e=>e.toLowerCase(),ED=e=>e[0].toLowerCase()+e.slice(1),_D=e=>e.toUpperCase();function ID(e,r,n,o){let i=I(e,r,n);return y.Update(_r(hD,i),{},o)}function M_(e,r,n,o){return v(e,[n])?ID(e,r,n,o):Qi(n,o)}function bD(e,r,n,o){let i=I(e,r,n);return y.Update(_r(TD,i),{},o)}function D_(e,r,n,o){return v(e,[n])?bD(e,r,n,o):Wi(n,o)}function SD(e,r,n,o){let i=I(e,r,n);return y.Update(_r(ED,i),{},o)}function G_(e,r,n,o){return v(e,[n])?SD(e,r,n,o):Zi(n,o)}function OD(e,r,n,o){let i=I(e,r,n);return y.Update(_r(_D,i),{},o)}function $_(e,r,n,o){return v(e,[n])?OD(e,r,n,o):Xi(n,o)}function Ji(e,r,n,o,i={}){return P("Conditional",[e,r,n,o],i)}function j_(e,r,n,o,i={}){return C({},Ji(e,r,n,o,i))}function AD(e,r,n,o,i,a,c){let l=I(e,r,n),d=I(e,r,o),f=ot(e,l,d);return y.Update(L.IsExtendsUnion(f)?B([I(f.inferred,r,i),I(e,r,a)]):L.IsExtendsTrue(f)?I(f.inferred,r,i):I(e,r,a),{},c)}function B_(e,r,n,o,i,a,c){return v(e,[n,o])?AD(e,r,n,o,i,a,c):Ji(n,o,i,a,c)}function ea(e,r={}){return P("ConstructorParameters",[e],r)}function q_(e,r={}){return C({},ea(e,r))}function xD(e){return qe(e)?I({},{callstack:[]},Ye(e.parameters)):Z()}function RD(e,r,n,o){let i=I(e,r,n);return y.Update(xD(i),{},o)}function F_(e,r,n,o){return v(e,[n])?RD(e,r,n,o):ea(n,o)}function ta(e,r,n={}){return P("Exclude",[e,r],n)}function H_(e,r,n={}){return C({},ta(e,r,n))}function K_(e,r){return e.reduce((n,o)=>[...n,...z_(o,r)],[])}function z_(e,r){let n=ot({},e,r);return L.IsExtendsTrueLike(n)?[]:[e]}function CD(e,r){let n=Ne(e)?K_(Kt(e.enum),r):O(e)?K_(ir(e.anyOf),r):z_(e,r);return Er(n)}function PD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(CD(a,c),{},i)}function jc(e,r,n,o,i){return v(e,[n,o])?PD(e,r,n,o,i):ta(n,o,i)}function ra(e,r,n={}){return P("Extract",[e,r],n)}function Y_(e,r,n={}){return C({},ra(e,r,n))}function V_(e,r){return e.reduce((n,o)=>[...n,...Q_(o,r)],[])}function Q_(e,r){let n=ot({},e,r);return L.IsExtendsTrueLike(n)?[e]:[]}function UD(e,r){let n=Ne(e)?V_(Kt(e.enum),r):O(e)?V_(ir(e.anyOf),r):Q_(e,r);return Er(n)}function wD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(UD(a,c),{},i)}function W_(e,r,n,o,i){return v(e,[n,o])?wD(e,r,n,o,i):ra(n,o,i)}var ND=new RegExp("^(?:0|[1-9][0-9]*)$");function Do(e){let r=`${e}`;return ND.test(r)?parseInt(r):e}function LD(e){return Y(Do(e))}function Z_(e){return e.map(r=>X_(r))}function X_(e){return w(e)?wt(Z_(e.allOf)):O(e)?B(Z_(e.anyOf)):X(e)?LD(e.const):e}function J_(e,r){let n=X_(r),o=ot({},n,Nt());return L.IsExtendsTrueLike(o)?e:Z()}function eI(e,r){let n=sr(e,r);return cr(n)}function Bc(e){return e.reduce((r,n)=>[...r,...cr(n)],[])}function tI(e){let r=Kt(e);return Bc(r)}function rI(e){let r=ve(e);return cr(r)}function nI(e){return[`${e}`]}function oI(e){let r=nt(e);return cr(r)}function cr(e){return me(e)?eI(e.$defs,e.$ref):Ne(e)?tI(e.enum):w(e)?rI(e.allOf):X(e)?nI(e.const):Le(e)?oI(e.pattern):O(e)?Bc(e.anyOf):[]}function Go(e){return cr(e)}function vD(e,r){return r in e?[e[r]]:[]}function kD(e,r){return r.reduce((n,o)=>[...n,...vD(e,o)],[])}function iI(e,r){let n=Go(r),o=kD(e,n);return Er(o)}function MD(e){return Y(Do(e))}function aI(e){return e.map(r=>Xu(r))}function Xu(e){return w(e)?wt(aI(e.allOf)):O(e)?B(aI(e.anyOf)):X(e)?MD(e.const):e}function DD(e,r){return e.reduceRight((n,o,i)=>{let a=ot({},Y(i),r);return L.IsExtendsTrueLike(a)?[o,...n]:n},[])}function GD(e,r){let n=Xu(r),o=DD(e,n);return Mn(o)}function $D(e){return Mn(e)}function sI(e,r){return be(r)||ze(r)?$D(e):GD(e,r)}function jD(e){return e.reduce((r,n)=>fc(n)?[...r,Y(n)]:r,[])}function $o(e){let r=jD(e);return B(r)}function Co(e,r,n={}){return P("Index",[e,r],n)}function cI(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return C({},Co(e,o,n))}function pI(e,r){let n=sr(e,r);return zt(n)}function BD(e,r){let n=s.Keys(e).filter(g=>!s.HasPropertyKey(r,g)),o=s.Keys(r).filter(g=>!s.HasPropertyKey(e,g)),i=s.Keys(e).filter(g=>s.HasPropertyKey(r,g)),a=n.reduce((g,T)=>({...g,[T]:e[T]}),{}),c=o.reduce((g,T)=>({...g,[T]:r[T]}),{}),l=i.reduce((g,T)=>({...g,[T]:ve([e[T],r[T]])}),{}),d=y.Assign(a,c);return y.Assign(d,l)}function uI(e){return e.reduce((r,n)=>BD(r,zt(n)),{})}function lI(e){let r=GE(Ye(e));return zt(r)}function qD(e,r){return s.Keys(e).filter(i=>i in r).reduce((i,a)=>({...i,[a]:Er([e[a],r[a]])}),{})}function mI(e,r){let[n,...o]=e;return A(n)?mI(o,qD(r,zt(n))):r}function dI(e){let[r,...n]=e;return A(r)?mI(n,zt(r)):H()}function zt(e){return me(e)?pI(e.$defs,e.$ref):w(e)?uI(e.allOf):O(e)?dI(e.anyOf):V(e)?lI(e.items):k(e)?e.properties:{}}function jo(e){let r=zt(e);return N(r)}function FD(e){return me(e)||w(e)||O(e)?jo(e):e}function HD(e,r){let n=FD(e);return te(n)?J_(n.items,r):k(n)?iI(n.properties,r):V(n)?sI(n.items,r):Z()}function KD(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(HD(a,c),{},i)}function fI(e,r,n,o,i){return v(e,[n,o])?KD(e,r,n,o,i):Co(n,o,i)}function na(e,r={}){return P("InstanceType",[e],r)}function gI(e,r={}){return C({},na(e,r))}function zD(e){return qe(e)?e.instanceType:Z()}function YD(e,r,n,o){let i=I(e,r,n);return y.Update(zD(i),{},o)}function yI(e,r,n,o={}){return v(e,[n])?YD(e,r,n,o):na(n,o)}function VD(e,r,n,o,i){let a=Ct(e,{callstack:[]},n),c=ba(e,{callstack:[]},o),l=ve([...a,N(c)]);return y.Update(l,{},i)}function hI(e,r,n,o,i){return v(e,n)?VD(e,r,n,o,i):Ro(n,o,i)}function Po(e,r={}){return P("KeyOf",[e],r)}function TI(e,r={}){return C({},Po(e,r))}function EI(){return B([Nt(),bt(),Io()])}function _I(e){return Nt()}function QD(e){return e.reduce((n,o)=>fc(o)?[...n,Y(Do(o))]:H(),[])}function II(e){let r=s.Keys(e),n=QD(r);return Mn(n)}function bI(e){return Oo(e)}function SI(e){let r=e.map((n,o)=>Y(o));return Mn(r)}function WD(e){return me(e)||w(e)||O(e)?jo(e):e}function ZD(e){let r=WD(e);return pt(r)?EI():te(r)?_I(r.items):k(r)?II(r.properties):Se(r)?bI(r):V(r)?SI(r.items):Z()}function XD(e,r,n,o){let i=I(e,r,n);return y.Update(ZD(i),{},o)}function OI(e,r,n,o){return v(e,[n])?XD(e,r,n,o):Po(n,o)}function JD(e){let r=nt(e);return Ju(r)}function AI(e){return e.reduce((r,n)=>[...r,...Ju(n)],[])}function Ju(e){return Ne(e)?AI(Kt(e.enum)):_o(e)||Eo(e)?[e]:Le(e)?JD(e.pattern):O(e)?AI(e.anyOf):[]}function xI(e){return Ju(e)}function xo(e,r,n,o,i={}){return P("Mapped",[e,r,n,o],i)}function RI(e,r,n,o,i={}){return C({},xo(e,r,n,o,i))}function eG(e,r,n,o,i){let a=y.Assign(e,{[n.name]:o}),c=I(a,r,i);return Le(c)?nt(c.pattern):c}function tG(e,r,n,o,i){let a=y.Assign(e,{[n.name]:o});return I(a,r,i)}function rG(e,r,n,o,i,a){let c=tG(e,r,n,o,a),l=eG(e,r,n,o,i);return _o(l)||Eo(l)?{[l.const]:c}:{}}function nG(e,r,n,o,i,a){return o.reduce((c,l)=>({...c,...rG(e,r,n,l,i,a)}),{})}function oG(e,r,n,o,i,a){let c=xI(o),l=nG(e,r,n,c,i,a);return N(l)}function iG(e,r,n,o,i,a,c){let l=I(e,r,o);return y.Update(oG(e,r,n,l,i,a),{},c)}function CI(e,r,n,o,i,a,c){return v(e,[o])?iG(e,r,n,o,i,a,c):xo(n,o,i,a,c)}function aG(e,r){return s.Keys(e).filter(o=>r.includes(o)).reduce((o,i)=>({...o,[i]:E_(e,i,e[i])}),{})}function sG(e,r){return s.Keys(e).filter(o=>!r.includes(o)).reduce((o,i)=>({...o,[i]:I(e,{callstack:[]},e[i])}),{})}function cG(e,r){let n=g_(e),o=aG(e,n),i=sG(e,n),a={...o,...i};return y.Update(a,{},r)}function PI(e,r,n,o){let i=y.Assign(e,n);return cG(i,o)}function oa(e,r={}){return P("NonNullable",[e],r)}function UI(e,r={}){return C({},oa(e,r))}function pG(e){let r=B([Zr(),Ao()]);return jc({},{callstack:[]},e,r,{})}function uG(e,r,n,o){let i=I(e,r,n);return y.Update(pG(i),{},o)}function wI(e,r,n,o){return v(e,[n])?uG(e,r,n,o):oa(n,o)}function qc(e){let r=jo(e);return k(r)?r.properties:H()}function ia(e,r,n={}){return P("Omit",[e,r],n)}function NI(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return C({},ia(e,o,n))}function lG(e,r){return s.Keys(e).reduce((o,i)=>r.includes(i)?o:{...o,[i]:e[i]},{})}function mG(e,r){let n=qc(e),o=Go(r),i=lG(n,o);return N(i)}function dG(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(mG(a,c),{},i)}function LI(e,r,n,o,i){return v(e,[n,o])?dG(e,r,n,o,i):ia(n,o,i)}function Uo(e,r){return P("Options",[e,r],{})}function Fc(e,r){return C({},Uo(e,r))}function fG(e,r,n,o){let i=I(e,r,n);return y.Update(i,{},o)}function vI(e,r,n,o){return v(e,[n])?fG(e,r,n,o):Uo(n,o)}function aa(e,r={}){return P("Parameters",[e],r)}function kI(e,r={}){return C({},aa(e,r))}function gG(e){return Fe(e)?I({},{callstack:[]},Ye(e.parameters)):Z()}function yG(e,r,n,o){let i=I(e,r,n);return y.Update(gG(i),{},o)}function MI(e,r,n,o){return v(e,[n])?yG(e,r,n,o):aa(n,o)}function sa(e,r={}){return P("Partial",[e],r)}function DI(e,r={}){return C({},sa(e,r))}function GI(e,r){let n=sr(e,r),o=on(n);return Jt(y.Assign(e,{[r]:o}),r)}function $I(e){let r=e.map(n=>on(n));return ve(r)}function jI(e){let r=e.map(n=>on(n));return B(r)}function BI(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:ic(e[i])}),{});return N(r)}function on(e){return me(e)?GI(e.$defs,e.$ref):w(e)?$I(e.allOf):O(e)?jI(e.anyOf):k(e)?BI(e.properties):N({})}function hG(e,r,n,o){let i=I(e,r,n);return y.Update(on(i),{},o)}function qI(e,r,n,o){return v(e,[n])?hG(e,r,n,o):sa(n,o)}function ca(e,r,n={}){return P("Pick",[e,r],n)}function FI(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return C({},ca(e,o,n))}function TG(e,r){return s.Keys(e).reduce((o,i)=>r.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function EG(e,r){let n=qc(e),o=Go(r),i=TG(n,o);return N(i)}function _G(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(EG(a,c),{},i)}function HI(e,r,n,o,i){return v(e,[n,o])?_G(e,r,n,o,i):ca(n,o,i)}function pa(e,r={}){return P("ReadonlyType",[e],r)}function KI(e,r={}){return C({},pa(e,r))}function zI(e){return Kr(Ht(e))}function YI(e,r){let n=sr(e,r),o=an(n);return Jt(y.Assign(e,{[r]:o}),r)}function VI(e){let r=e.map(n=>an(n));return ve(r)}function QI(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:sc(e[i])}),{});return N(r)}function WI(e){return Kr(Ye(e))}function ZI(e){let r=e.map(n=>an(n));return B(r)}function an(e){return te(e)?zI(e.items):me(e)?YI(e.$defs,e.$ref):w(e)?VI(e.allOf):k(e)?QI(e.properties):V(e)?WI(e.items):O(e)?ZI(e.anyOf):e}function IG(e,r,n,o){let i=I(e,r,n);return y.Update(an(i),{},o)}function XI(e,r,n,o){return v(e,[n])?IG(e,r,n,o):pa(n,o)}function JI(e){return St($t,e)}function eb(e){return N({true:e,false:e})}function tb(e,r){let n=da(e);return sn(n,r)}function rb(e,r){return St(bo,r)}function nb(e,r){let n=ve(e);return sn(n,r)}function ob(e,r){return s.IsString(e)||s.IsNumber(e)?N({[e]:r}):s.IsEqual(e,!1)?N({false:r}):s.IsEqual(e,!0)?N({true:r}):N({})}function ib(e,r){return St(So,r)}function ab(e,r){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?St(e.pattern.toString(),r):St($t,r)}function sb(e,r){let n=wc(e);return Nc(n)?sn(nt(e),r):St(e,r)}function bG(e){return e.some(r=>Me(r)||be(r)||ze(r))}function SG(e,r){return s.IsEqual(bG(e),!0)?St($t,r):void 0}function OG(e,r){return e.reduce((n,o)=>X(o)&&(s.IsString(o.const)||s.IsNumber(o.const))?{...n,[o.const]:r}:n,{})}function AG(e,r){let n=OG(e,r);return N(n)}function cb(e,r){let n=ir(e),o=SG(n,r);return A(o)?o:AG(n,r)}function sn(e,r){return pt(e)?JI(r):lt(e)?eb(r):Ne(e)?tb(e.enum,r):ze(e)?rb(e,r):w(e)?nb(e.allOf,r):X(e)?ob(e.const,r):be(e)?ib(e,r):O(e)?cb(e.anyOf,r):Me(e)?ab(e,r):Le(e)?sb(e.pattern,r):N({})}function xG(e,r,n,o,i){let a=I(e,r,n),c=I(e,r,o);return y.Update(sn(a,c),{},i)}function pb(e,r,n,o,i){return v(e,[n])?xG(e,r,n,o,i):Yi(n,o,i)}function ub(e,r,n){return n in e?Gc([n],e,e[n])?ke(n):I(e,r,e[n]):ke(n)}function lb(e,r){let n=sr(e,r),o=cn(n);return Jt(y.Assign(e,{[r]:o}),r)}function mb(e){let r=e.map(n=>cn(n));return ve(r)}function db(e){let r=e.map(n=>cn(n));return B(r)}function fb(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:go(e[i])}),{});return N(r)}function cn(e){return me(e)?lb(e.$defs,e.$ref):w(e)?mb(e.allOf):O(e)?db(e.anyOf):k(e)?fb(e.properties):N({})}function ua(e,r={}){return P("Required",[e],r)}function gb(e,r={}){return C({},ua(e,r))}function RG(e,r,n,o){let i=I(e,r,n);return y.Update(cn(i),{},o)}function yb(e,r,n,o){return v(e,[n])?RG(e,r,n,o):ua(n,o)}function la(e,r={}){return P("ReturnType",[e],r)}function hb(e,r={}){return C({},la(e,r))}function CG(e){return Fe(e)?e.returnType:Z()}function PG(e,r,n,o){let i=I(e,r,n);return y.Update(CG(i),{},o)}function Tb(e,r,n,o){return v(e,[n])?PG(e,r,n,o):la(n,o)}function Eb(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function UG(e){return e.join("|")}function wG(e){return e.slice(1,e.length-1)}function NG(e,r,n){return pn(r,`${n}${e}`)}function LG(e,r){return pn(e,`${r}${cy}`)}function vG(e,r){return pn(e,`${r}${dc}`)}function kG(e,r){return pn(e,`${r}${gc}`)}function MG(e,r){return tl(B([Y("false"),Y("true")]),e,r)}function DG(e,r){return pn(e,`${r}${hc}`)}function GG(e,r,n){return pn(r,`${n}${wG(e)}`)}function $G(e,r,n,o=[]){let i=Kt(e);return el(i,r,n)}function el(e,r,n,o=[]){let[i,...a]=e;return A(i)?el(a,r,n,[...o,tl(i,[],"")]):pn(r,`${n}(${UG(o)})`)}function tl(e,r,n){return Ne(e)?$G(e.enum,r,n):ze(e)?vG(r,n):X(e)?NG(e.const,r,n):At(e)?LG(r,n):lt(e)?MG(r,n):be(e)?kG(r,n):Me(e)?DG(r,n):Le(e)?GG(e.pattern,r,n):O(e)?el(e.anyOf,r,n):qg}function pn(e,r){let[n,...o]=e;return A(n)?tl(n,o,r):r}function jG(e){return`^${pn(e,"")}$`}function _b(e){let r=jG(e);return Eb(r)}function BG(e,r,n,o){let i=Ct(e,r,n);return y.Update(_b(i),{},o)}function Ib(e,r,n,o){return v(e,n)?BG(e,r,n,o):Vi(n,o)}function qG(e){return Xr(e)?V(e.items)?rl(e.items.items):we(e.items)?[e]:ue(e.items)?[e]:[Z()]:[e]}function rl(e){return e.reduce((n,o)=>[...n,...qG(o)],[])}function FG(e,r){return r in e}function HG(e,r){return w(r)?v(e,r.allOf):O(r)?v(e,r.anyOf):ue(r)?FG(e,r.$ref):!0}function v(e,r){let[n,...o]=r;return A(n)?HG(e,n)?v(e,o):!1:!0}function Sa(e,r,n){return Mg(e)?Sa(e.type,"remove",n):Ng(e)?Sa(e.type,r,"remove"):vg(e)?Sa(e.type,"add",n):Ug(e)?Sa(e.type,r,"add"):[e,r,n]}function KG(e,r){return s.IsEqual(e,"remove")?ac(r):s.IsEqual(e,"add")?_t(r):r}function zG(e,r){return s.IsEqual(e,"remove")?go(r):s.IsEqual(e,"add")?Et(r):r}function ba(e,r,n){return s.Keys(n).reduce((o,i)=>({...o,[i]:I(e,r,n[i])}),{})}function Dc(e,r,n){let o=Ct(e,r,n);return rl(o)}function Ct(e,r,n){return n.map(o=>I(e,r,o))}function YG(e,r,n,o,i){return s.IsEqual(n,"Awaited")?R_(e,r,o[0],i):s.IsEqual(n,"Capitalize")?M_(e,r,o[0],i):s.IsEqual(n,"Conditional")?B_(e,r,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?F_(e,r,o[0],i):s.IsEqual(n,"Evaluate")?zE(e,r,o[0],i):s.IsEqual(n,"Exclude")?jc(e,r,o[0],o[1],i):s.IsEqual(n,"Extract")?W_(e,r,o[0],o[1],i):s.IsEqual(n,"Index")?fI(e,r,o[0],o[1],i):s.IsEqual(n,"InstanceType")?yI(e,r,o[0],i):s.IsEqual(n,"Interface")?hI(e,r,o[0],o[1],i):s.IsEqual(n,"KeyOf")?OI(e,r,o[0],i):s.IsEqual(n,"Lowercase")?D_(e,r,o[0],i):s.IsEqual(n,"Mapped")?CI(e,r,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?PI(e,r,o[0],i):s.IsEqual(n,"NonNullable")?wI(e,r,o[0],i):s.IsEqual(n,"Pick")?HI(e,r,o[0],o[1],i):s.IsEqual(n,"Options")?vI(e,r,o[0],o[1]):s.IsEqual(n,"Parameters")?MI(e,r,o[0],i):s.IsEqual(n,"Partial")?qI(e,r,o[0],i):s.IsEqual(n,"Omit")?LI(e,r,o[0],o[1],i):s.IsEqual(n,"ReadonlyType")?XI(e,r,o[0],i):s.IsEqual(n,"Record")?pb(e,r,o[0],o[1],i):s.IsEqual(n,"Required")?yb(e,r,o[0],i):s.IsEqual(n,"ReturnType")?Tb(e,r,o[0],i):s.IsEqual(n,"TemplateLiteral")?Ib(e,r,o[0],i):s.IsEqual(n,"Uncapitalize")?G_(e,r,o[0],i):s.IsEqual(n,"Uppercase")?$_(e,r,o[0],i):P(n,o,i)}function I(e,r,n){let o=Cn(n),i=Sa(n,Pn(n)?"add":"none",Be(n)?"add":"none"),a=Ut(i[0])?i[0].Clone():i[0],c=ue(a)?ub(e,r,a.$ref):te(a)?Ht(I(e,r,a.items),cc(a)):at(a)?Xt(I(e,r,a.iteratorItems),Gg(a)):Mo(a)?$c(e,r,a.target,a.arguments):qe(a)?zr(Ct(e,r,a.parameters),I(e,r,a.instanceType),jg(a)):Dg(a)?YG(e,r,a.action,a.parameters,a.options):Fe(a)?Yr(Ct(e,r,a.parameters),I(e,r,a.returnType),Bg(a)):w(a)?wt(Ct(e,r,a.allOf),Vg(a)):st(a)?er(I(e,r,a.iteratorItems),uy(a)):k(a)?N(ba(e,r,a.properties),gy(a)):tt(a)?nr(I(e,r,a.item),hy(a)):Se(a)?Ec(xt(a),I(e,r,rt(a))):Xr(a)?Ln(I(e,r,a.items)):V(a)?Ye(Dc(e,r,a.items),Ey(a)):O(a)?B(Ct(e,r,a.anyOf),_y(a)):a,l=o?Kr(c):c;return KG(i[1],zG(i[2],l))}function C(e,r){return I(e,{callstack:[]},r)}function ma(e,r={}){return P("Awaited",[e],r)}function bb(e,r={}){return C({},ma(e,r))}function Cu(e,r={}){return P("Evaluate",[e],r)}function Yt(e,r={}){return C({},Cu(e,r))}function Pu(e,r={}){return P("Module",[e],r)}function Sb(e,r={}){return C({},Pu(e,r))}function Ob(...e){let[r,n,o]=ie.Match(e,{2:(c,l)=>s.IsString(c)?[{},c,l]:[c,l,{}],3:(c,l,d)=>[c,l,d],1:c=>[{},c,{}]}),i=gE(n),a=s.IsArray(i)&&s.IsEqual(i.length,2)?I(r,{callstack:[]},i[0]):Z();return y.Update(a,{},o)}var t={};Gt(t,{Any:()=>ho,Array:()=>Ht,AsyncIterator:()=>Xt,Awaited:()=>bb,Base:()=>pc,BigInt:()=>Ki,Boolean:()=>mc,Call:()=>A_,Capitalize:()=>N_,Codec:()=>uc,Conditional:()=>j_,Constructor:()=>zr,ConstructorParameters:()=>q_,Cyclic:()=>Jt,Decode:()=>iy,DecodeBuilder:()=>Hi,Encode:()=>ay,EncodeBuilder:()=>Fi,Enum:()=>Yg,Evaluate:()=>Yt,Exclude:()=>H_,Extends:()=>ot,ExtendsResult:()=>L,Extract:()=>Y_,Function:()=>Yr,Generic:()=>Vr,Identifier:()=>zi,Immutable:()=>Kr,Index:()=>cI,Infer:()=>qi,InstanceType:()=>gI,Instantiate:()=>C,Integer:()=>wn,Interface:()=>d_,Intersect:()=>wt,IsAny:()=>pt,IsArray:()=>te,IsAsyncIterator:()=>at,IsBase:()=>Ut,IsBigInt:()=>At,IsBoolean:()=>lt,IsCall:()=>Mo,IsCodec:()=>Un,IsConstructor:()=>qe,IsCyclic:()=>me,IsEnum:()=>Ne,IsFunction:()=>Fe,IsGeneric:()=>yo,IsIdentifier:()=>py,IsImmutable:()=>Cn,IsInfer:()=>we,IsInteger:()=>ze,IsIntersect:()=>w,IsIterator:()=>st,IsKind:()=>S,IsLiteral:()=>X,IsNever:()=>hr,IsNull:()=>tr,IsNumber:()=>be,IsObject:()=>k,IsOptional:()=>Be,IsParameter:()=>yy,IsPromise:()=>tt,IsReadonly:()=>Pn,IsRecord:()=>Se,IsRef:()=>ue,IsRefine:()=>lc,IsRest:()=>Xr,IsSchema:()=>A,IsString:()=>Me,IsSymbol:()=>rr,IsTemplateLiteral:()=>Le,IsThis:()=>Ty,IsTuple:()=>V,IsUndefined:()=>or,IsUnion:()=>O,IsUnknown:()=>It,IsUnsafe:()=>by,IsVoid:()=>Rt,Iterator:()=>er,KeyOf:()=>TI,Literal:()=>Y,Lowercase:()=>L_,Mapped:()=>RI,Module:()=>Sb,Never:()=>Z,NonNullable:()=>UI,Null:()=>Zr,Number:()=>Nt,Object:()=>N,Omit:()=>NI,Optional:()=>ic,Options:()=>Fc,Parameter:()=>Nn,Parameters:()=>kI,Partial:()=>DI,Pick:()=>FI,Promise:()=>nr,Readonly:()=>sc,ReadonlyType:()=>KI,Record:()=>Tc,RecordKey:()=>Oo,RecordKeyAsPattern:()=>xt,RecordValue:()=>rt,Ref:()=>ke,Refine:()=>sy,Required:()=>gb,Rest:()=>Ln,ReturnType:()=>hb,Script:()=>Ob,String:()=>bt,Symbol:()=>Io,TemplateLiteral:()=>TE,This:()=>_c,Tuple:()=>Ye,Uncapitalize:()=>v_,Undefined:()=>Ao,Union:()=>B,Unknown:()=>Je,Unsafe:()=>Iy,Uppercase:()=>k_,Void:()=>Ic});var Ab="lowercase-email",nl="iana-timezone",ol="simple-time",il="simple-date-time";var VG=(e,r)=>RegExp(`^${e.source}(${r.source}${e.source})*$`),QG=/[a-zA-Z0-9-_]+/,WG=/\./,q_e=VG(QG,WG);var xb="lowercase-domain";var Bo="kebab-case";var Rb="camel-case";var ZG=new Set;function b(e,r,n={}){let o=r.map(i=>{let a=i;return a.$id?(ZG.add(i),t.Ref(a.$id)):i});return t.Unsafe({...n,type:"object",discriminator:{propertyName:e},required:[e],oneOf:o})}function xe(e,r){return t.Object({values:t.Array(e,{maxItems:r.maxItems,description:"Values compared by this filter. When `exclude` is omitted or false, rows matching any value are kept; when `exclude` is true, matching rows are removed."}),exclude:t.Optional(t.Boolean({description:"If true, exclude rows matching these values instead of including them"}))},{description:r.description})}var Fo=1e3,Hc=100,de={limit:t.Optional(t.Integer({minimum:1,maximum:Fo,description:"Maximum number of items to return in this page."})),offset:t.Optional(t.Integer({minimum:0,description:"Zero-based index of the first matching item to return. Increase it with `limit` to request later pages. If `limit` is provided without `offset`, the offset defaults to 0."}))},De={...de,limit:t.Optional(t.Integer({minimum:1,maximum:Fo,default:Hc,description:`Maximum number of items to return in this page. Omit to use the public API default of ${Hc}.`}))},XG=t.Object({totalCount:t.Integer({description:"Total number of items matching the query before `limit` and `offset` are applied."}),pageCount:t.Integer({description:"Total number of pages available for the requested `limit`."})},{description:"Counts describing the full result set that the returned page was taken from, for computing how many further pages remain."}),Y_e=t.Object({pagination:XG},{$id:"ResponseMetadata",description:"Metadata accompanying `data` on paginated operations, describing the full result set the page was taken from."});function E(e={}){return t.Unsafe({...e,type:"string"})}var qo=250;function p({allowEmpty:e=!0,type:r="short",description:n,default:o}={}){let i=e?0:1,a={...n===void 0?{}:{description:n},...o===void 0?{}:{default:o}};switch(r){case"camel-case":return t.String({format:Rb,minLength:i,maxLength:qo,...a});case"kebab-case":return t.String({format:Bo,minLength:i,maxLength:qo,...a});case"email":return t.String({format:Ab,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return t.String({format:xb,minLength:i,maxLength:qo,...a});case"tsuga-query":return t.String({format:"tsuga-query",minLength:i,maxLength:1e4,...a});case"tags-query":return t.String({format:"tags-query",minLength:i,maxLength:1e4,errorMessage:{format:"Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported. The query you provided is invalid: ${0}"},...a});case"date-time":return t.String({format:"date-time",...a});case"uri":return t.String({format:"uri",...a});case"user-password":return t.String({format:"user-password",minLength:12,maxLength:qo,...a});case"long":return t.String({minLength:i,maxLength:5e4,...a});case"short":return t.String({minLength:i,maxLength:qo,...a});case"tsuga-formula":return t.String({format:"tsuga-formula",minLength:i,maxLength:qo,errorMessage:{format:"Must be a simple mathematical formula, and all variables in it should refer to queries (q1, q2, etc.). The formula you provided is invalid: ${0}"},...a});case"time":return t.String({format:"time",...a});case"readonly-sql-query":return t.String({format:"readonly-sql-query",minLength:i,maxLength:5e4,errorMessage:{format:"Must be a readonly SQL query - only SELECT statements are allowed."},...a});default:Xe(r)}}var Oa=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],Kc=t.Array(t.Enum(Oa,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var al=["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"],iIe=t.Enum(al),JG=["CLUSTER_AGGREGATION_STRUCTURE"],aIe=t.Object({code:t.Enum(al),message:t.String()}),Cb=[...al,...JG,"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"],Pb=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var e$=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],t$=[...Cb,...Pb,...e$],r$=t.Object({assetId:t.Optional(t.String({description:"Identifier of the asset that violated the policy. Set from the existing asset for update and bulk requests. Omitted on create requests before the asset exists."})),assetName:t.String({description:"Name of the asset that violated the policy. Set from submitted data or the existing asset row. Returned for every violation."}),assetType:t.Enum(Oa,{description:"Type of Tsuga asset validated by the policy. Set by the route that ran tag-policy validation. Returned for every violation."}),tagPolicyId:t.String({description:"Identifier of the active tag policy that was violated. Generated by Tsuga when the policy is created. Returned for every violation."}),tagKey:t.String({description:"Tag key required or constrained by the violated policy. Set by the tag policy. Returned for every violation."}),message:t.String({description:"Human-readable reason this policy failed for the asset. Generated by Tsuga's tag-policy validator. Returned for every violation."})},{description:"A single tag-policy violation, identifying the offending asset, the policy and tag key involved, and why validation failed."}),n$=b("type",[t.Object({type:t.Literal("invalid-syntax",{description:"Discriminator identifying a rule the grok parser could not parse at all."}),error:t.Object({offset:t.Integer({description:"Byte offset in the rule where parsing failed."}),detail:t.String({description:"Parser detail message."})},{description:"Position and parser message for the syntax failure."})},{$id:"GrokInvalidSyntax"}),t.Object({type:t.Literal("unknown-pattern",{description:"Discriminator identifying a rule that references a pattern name the grok engine does not provide."}),error:t.Object({offset:t.Integer({description:"Byte offset of the unknown pattern."}),unknownPattern:t.String({description:"The pattern name that is not supported."})},{description:"Position and name of the unsupported pattern."})},{$id:"GrokUnknownPattern"}),t.Object({type:t.Literal("invalid-filter",{description:"Discriminator identifying a rule whose filter is a known filter used incorrectly."}),error:t.Object({offset:t.Integer({description:"Byte offset of the invalid filter."}),invalidFilter:t.String({description:"The filter that is invalid."}),message:t.String({description:"Why the filter is invalid."})},{description:"Position, text, and reason for the invalid filter."})},{$id:"GrokInvalidFilter"}),t.Object({type:t.Literal("unknown-filter",{description:"Discriminator identifying a rule that references a filter name the grok engine does not implement."}),error:t.Object({offset:t.Integer({description:"Byte offset of the unknown filter."}),unknownFilter:t.String({description:"The filter name that is not implemented."}),message:t.String({description:"Details about the unsupported filter."})},{description:"Position and name of the unimplemented filter."})},{$id:"GrokUnknownFilter"})],{description:"Full structured detail of a grok rule that failed to compile, discriminated by `type`."}),o$=t.Object({rule:t.String({description:"The rule that failed to compile."}),ruleIndex:t.Integer({description:"0-based index of the failing rule in the submitted `rules` array."}),error:n$},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),Ub=b("type",[t.Object({type:t.Literal("tag_policy_violation",{description:"Discriminator identifying tag-policy validation details. Set by Tsuga to `tag_policy_violation`. Returned when the error code is `TAG_POLICY_VALIDATION_ERROR`."}),violations:t.Array(r$,{description:"Tag-policy violations that caused the request to fail. Built from active policies applicable to the submitted asset type and owner team. Returned on tag-policy validation errors; can contain multiple policies and multiple assets for bulk requests."})},{$id:"TagPolicyViolationDetails"}),t.Object({type:t.Literal("grok_rule_error",{description:"Discriminator identifying grok rule validation details. Set by Tsuga to `grok_rule_error`. Returned when the error code is `GROK_RULE_VALIDATION_ERROR`."}),ruleErrors:t.Array(o$,{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."}),sIe=t.Object({code:t.Optional(t.Enum(t$,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"}),details:t.Optional(Ub)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),cIe=t.Object({code:t.Optional(t.Enum(Cb,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"}),details:t.Optional(Ub)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),pIe=t.Object({code:t.Optional(t.Enum(Pb,{description:"Machine readable error code describing what went wrong"})),message:t.String({description:"Human readable explanation of the error"}),statusCode:t.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),uIe=t.Object({requestId:t.String({description:"Identifier used to trace the lifecycle of this API request"}),error:t.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),lIe=t.Object({requestId:t.String({description:"Identifier used to trace the lifecycle of this API request"}),error:t.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function m({body:e,description:r,method:n,operationId:o,params:i,tags:a,query:c,paginated:l,response:d,url:f}){return i?{buildUrl:T=>f.replace(/:[a-zA-Z_]+/g,_=>T[_.slice(1)]),method:n,params:i,response:d,templateUrl:f,...e===void 0?{}:{body:e},...r===void 0?{}:{description:r},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}:{method:n,response:d,url:f,templateUrl:f,...e===void 0?{}:{body:e},...r===void 0?{}:{description:r},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}}function wb(e,r){if(!r||typeof r!="object")return e;let n=new URLSearchParams;return Object.entries(r).forEach(([o,i])=>{Array.isArray(i)?i.length>0&&i.forEach(a=>{a!==void 0&&(typeof a=="string"||typeof a=="number"||typeof a=="boolean")&&n.append(o,String(a))}):(typeof i=="boolean"||typeof i=="string"||typeof i=="number")&&n.append(o,String(i))}),`${e}?${n.toString()}`}var x=t.Object({success:t.Literal(!0,{description:"Always `true` when the delete request completed and the resource was removed."})},{$id:"DeleteResponse",description:"Confirmation that the targeted resource was deleted.",example:{success:!0}});var sl="tsuga-cli";var Gn="/v0/oauth",Nb=m({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${Gn}/authorize`,method:"GET",query:t.Partial(t.Object({response_type:t.String({description:"Must be `code`"}),client_id:t.String({description:"First-party client id or CIMD document URL"}),redirect_uri:t.String({description:"Client redirect URI"}),code_challenge:t.String({description:"PKCE code challenge"}),code_challenge_method:t.String({description:"Must be `S256`"}),state:t.String({description:"Opaque client state, echoed back"}),resource:t.String({description:"RFC 8707 resource indicator"})})),response:t.Object({},{description:"Never returned: this endpoint redirects (302) or renders an HTML error (400)"})}),Lb=m({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${Gn}/token`,method:"POST",body:t.Partial(t.Object({grant_type:t.String({description:"`authorization_code` or `refresh_token`"}),code:t.String({description:"Authorization code being exchanged"}),code_verifier:t.String({description:"PKCE code verifier"}),redirect_uri:t.String({description:"Must match the redirect URI used on /authorize"}),client_id:t.String({description:"Client id, when sent by the client"}),refresh_token:t.String({description:"Refresh token, for `grant_type=refresh_token`"})})),response:t.Object({access_token:t.String(),token_type:t.Literal("Bearer"),expires_in:t.Number({description:"Access token lifetime in seconds"}),refresh_token:t.String()})}),RIe=m({description:"Resolve a signed authorization request handle for the consent page",url:`${Gn}/authorization-request`,method:"GET",query:t.Object({handle:t.String()}),response:t.Object({clientId:t.String(),clientName:t.String(),redirectUri:t.String()})}),CIe=m({description:"Approve or deny an OAuth authorization request from the consent page",url:`${Gn}/approve`,method:"POST",body:t.Object({handle:t.String({description:"The signed authorization request handle"}),approve:t.Boolean()}),response:t.Object({redirectTo:t.String({description:"The client's redirect URI carrying either the code or the denial"})})}),PIe=m({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${Gn}/introspect`,method:"POST",body:t.Object({token:t.String()}),response:t.Object({active:t.Boolean(),userId:t.Optional(t.String()),orgId:t.Optional(t.String())})}),i$=["pending","active","revoked"],a$=t.Object({id:t.String(),createdAt:E(),clientId:t.String({description:"Client ID Metadata Document URL or first-party client id"}),clientName:t.String({description:"Display name derived from the client identity"}),userId:t.String(),status:t.Enum(i$),lastUsedAt:t.Optional(E())}),UIe=m({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${Gn}/grants`,method:"GET",query:t.Object({allUsers:t.Optional(t.Boolean({description:"Admins only: list grants of every user in the org"}))}),response:t.Array(a$)}),wIe=m({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${Gn}/grants/:id`,method:"DELETE",params:t.Object({id:t.String()}),response:x});function vb(e,r){let n=new URL(Nb.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:sl,redirect_uri:r.redirectUri,code_challenge:r.challenge,code_challenge_method:"S256",state:r.state}).toString(),n.href}function s$(e){if(!e)return{};try{let r=JSON.parse(e);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}async function c$(e,r){let n=await fetch(new URL(Lb.url,e).href,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(r).toString()}),o=await n.text(),i=s$(o);if(n.status!==200){let a=i.error??`HTTP ${n.status}`;throw new Error(`OAuth token request failed (${a}${i.error_description?`: ${i.error_description}`:""})`)}if(!i.access_token||typeof i.expires_in!="number")throw new Error("OAuth token response was missing required fields");return{accessToken:i.access_token,expiresAt:new Date(Date.now()+i.expires_in*lu)}}async function kb(e,r){return c$(e,{grant_type:"authorization_code",client_id:sl,code:r.code,code_verifier:r.verifier,redirect_uri:r.redirectUri})}var jt=require("node:fs"),pl=require("node:os"),jn=require("node:path");var Db=Sn(require("os"),1),Aa=Sn(require("path"),1),un=Db.default.homedir(),{env:$n}=process,Mb=$n.XDG_DATA_HOME||(un?Aa.default.join(un,".local","share"):void 0),zc=$n.XDG_CONFIG_HOME||(un?Aa.default.join(un,".config"):void 0),MIe=$n.XDG_STATE_HOME||(un?Aa.default.join(un,".local","state"):void 0),Gb=$n.XDG_CACHE_HOME||(un?Aa.default.join(un,".cache"):void 0),DIe=$n.XDG_RUNTIME_DIR||void 0,p$=($n.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");Mb&&p$.unshift(Mb);var u$=($n.XDG_CONFIG_DIRS||"/etc/xdg").split(":");zc&&u$.unshift(zc);var $b=(0,jn.join)(zc??(0,jn.join)((0,pl.homedir)(),".config"),"tsuga"),xa=(0,jn.join)($b,"config.json"),jb=(0,jn.join)(Gb??(0,jn.join)((0,pl.homedir)(),".cache"),"tsuga"),cl=(0,jn.join)(jb,"update-check.json"),Ra="https://api.tsuga.com";function Bb(e){return ng(e.credential)}function Yc(){if(!(0,jt.existsSync)(xa))return{};try{let e=JSON.parse((0,jt.readFileSync)(xa,"utf-8")),{operationApiKey:r,userAuth:n,...o}=e;return!r&&!n?e:{...o,credentials:{...e.credentials??{},[Ra]:{...r?{operationApiKey:r}:{},...n?{userAuth:n}:{},...e.credentials?.[Ra]??{}}}}}catch{throw new Error(`Config file corrupted: ${xa}
|
|
43
|
-
Re-authenticate with \`tsuga auth login\` or \`tsuga auth operation-key <OPERATION_API_KEY>\`.`)}}function
|
|
44
|
-
`,{mode:384})}function
|
|
32
|
+
${gl.map((o,i)=>_k(o,t===0?0:i/t)).join(`
|
|
33
|
+
`)}`}function bh(){return Ik(process.stdout.isTTY&&!process.env.NO_COLOR)}var TO=require("node:crypto");var bk=Math.pow(10,8)*24*60*60*1e3,Q6=-bk;var Sh=864e5,Ah=6e4,Oh=36e5;var Sk=3600;var xh=Sk*24,W6=xh*7,Ak=xh*365.2425,Ok=Ak/12,Z6=Ok*3,yl=Symbol.for("constructDateFrom");function Jt(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&yl in e?e[yl](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ye(e,t){return Jt(t||e,e)}function Rh(e,t,n){let o=Ye(e,n?.in);return isNaN(t)?Jt(n?.in||e,NaN):(t&&o.setDate(o.getDate()+t),o)}function Ch(e,t,n){let o=Ye(e,n?.in);if(isNaN(t))return Jt(n?.in||e,NaN);if(!t)return o;let i=o.getDate(),a=Jt(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 Oo(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?Ch(h,i+o*12):h,I=c||a?Rh(E,c+a*7):E,g=m+l*60,S=(f+g*60)*1e3;return Jt(n?.in||e,+I+S)}var xk={};function Ph(){return xk}function Tl(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=Jt.bind(null,e||t.find(o=>typeof o=="object"));return t.map(n)}function El(e,t){let n=Ye(e,t?.in);return n.setHours(0,0,0,0),n}function Uh(e,t,n){let[o,i]=yt(n?.in,e,t),a=El(o),c=El(i),l=+a-Tl(a),m=+c-Tl(c);return Math.round((l-m)/Sh)}function kn(e,t){let n=+Ye(e)-+Ye(t);return n<0?-1:n>0?1:n}function wh(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 vh(e,t,n){let[o,i]=yt(n?.in,e,t);return o.getFullYear()-i.getFullYear()}function Lh(e,t,n){let[o,i]=yt(n?.in,e,t),a=Nh(o,i),c=Math.abs(Uh(o,i));o.setDate(o.getDate()-a*c);let l=+(Nh(o,i)===-a),m=a*(c-l);return m===0?0:m}function Nh(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 xo(e){return t=>{let o=(e?Math[e]:Math.trunc)(t);return o===0?0:o}}function kh(e,t,n){let[o,i]=yt(n?.in,e,t),a=(+o-+i)/Oh;return xo(n?.roundingMethod)(a)}function mc(e,t){return+Ye(e)-+Ye(t)}function Mh(e,t,n){let o=mc(e,t)/Ah;return xo(n?.roundingMethod)(o)}function Dh(e,t){let n=Ye(e,t?.in);return n.setHours(23,59,59,999),n}function Gh(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 $h(e,t){let n=Ye(e,t?.in);return+Dh(n,t)==+Gh(n,t)}function jh(e,t,n){let[o,i,a]=yt(n?.in,e,e,t),c=kn(i,a),l=Math.abs(wh(i,a));if(l<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-c*l);let m=kn(i,a)===-c;$h(o)&&l===1&&kn(o,a)===1&&(m=!1);let f=c*(l-+m);return f===0?0:f}function qh(e,t,n){let o=mc(e,t)/1e3;return xo(n?.roundingMethod)(o)}function Fh(e,t,n){let[o,i]=yt(n?.in,e,t),a=kn(o,i),c=Math.abs(vh(o,i));o.setFullYear(1584),i.setFullYear(1584);let l=kn(o,i)===-a,m=a*(c-+l);return m===0?0:m}function Bh(e,t){let[n,o]=yt(e,t.start,t.end);return{start:n,end:o}}var Rk={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"}},Hh=(e,t,n)=>{let o,i=Rk[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 dc(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Ck={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Pk={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Uk={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Kh={date:dc({formats:Ck,defaultWidth:"full"}),time:dc({formats:Pk,defaultWidth:"full"}),dateTime:dc({formats:Uk,defaultWidth:"full"})};var wk={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},zh=(e,t,n,o)=>wk[e];function Ro(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 vk={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Nk={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Lk={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"]},kk={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"]},Mk={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"}},Dk={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"}},Gk=(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"},Yh={ordinalNumber:Gk,era:Ro({values:vk,defaultWidth:"wide"}),quarter:Ro({values:Nk,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ro({values:Lk,defaultWidth:"wide"}),day:Ro({values:kk,defaultWidth:"wide"}),dayPeriod:Ro({values:Mk,defaultWidth:"wide",formattingValues:Dk,defaultFormattingWidth:"wide"})};function Co(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)?jk(l,E=>E.test(c)):$k(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 $k(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function jk(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Vh(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 qk=/^(\d+)(th|st|nd|rd)?/i,Fk=/\d+/i,Bk={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},Hk={any:[/^b/i,/^(a|c)/i]},Kk={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},zk={any:[/1/i,/2/i,/3/i,/4/i]},Yk={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},Vk={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]},Qk={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},Wk={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]},Zk={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},Xk={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}},Qh={ordinalNumber:Vh({matchPattern:qk,parsePattern:Fk,valueCallback:e=>parseInt(e,10)}),era:Co({matchPatterns:Bk,defaultMatchWidth:"wide",parsePatterns:Hk,defaultParseWidth:"any"}),quarter:Co({matchPatterns:Kk,defaultMatchWidth:"wide",parsePatterns:zk,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Co({matchPatterns:Yk,defaultMatchWidth:"wide",parsePatterns:Vk,defaultParseWidth:"any"}),day:Co({matchPatterns:Qk,defaultMatchWidth:"wide",parsePatterns:Wk,defaultParseWidth:"any"}),dayPeriod:Co({matchPatterns:Zk,defaultMatchWidth:"any",parsePatterns:Xk,defaultParseWidth:"any"})};var _l={code:"en-US",formatDistance:Hh,formatLong:Kh,formatRelative:zh,localize:Yh,match:Qh,options:{weekStartsOn:0,firstWeekContainsDate:1}};var Jk=["years","months","weeks","days","hours","minutes","seconds"];function Wh(e,t){let n=Ph(),o=t?.locale??n.locale??_l,i=t?.format??Jk,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 Zh(e,t){let{start:n,end:o}=Bh(t?.in,e),i={},a=Fh(o,n);a&&(i.years=a);let c=Oo(n,{years:i.years}),l=jh(o,c);l&&(i.months=l);let m=Oo(c,{months:i.months}),f=Lh(o,m);f&&(i.days=f);let h=Oo(m,{days:i.days}),E=kh(o,h);E&&(i.hours=E);let I=Oo(h,{hours:i.hours}),g=Mh(o,I);g&&(i.minutes=g);let T=Oo(I,{minutes:i.minutes}),S=qh(o,T);return S&&(i.seconds=S),i}var oa=require("node:crypto");function eM(e){return(0,oa.createHash)("sha256").update(e).digest("base64url")}function Xh(){let e=(0,oa.randomBytes)(32).toString("base64url");return{verifier:e,challenge:eM(e)}}var sy=require("node:child_process"),cy=require("node:http"),wl=require("node:os");var tM={"&":"&","<":"<",">":">",'"':""","'":"'"};function Il(e){return e.replace(/[&<>"']/g,t=>tM[t]??t)}var rM=[":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(""),nM=['<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 bl(e,t){let n=Il(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>${rM}</style></head><body><main>`,`<span class="tile">${nM}</span>`,`<div class="copy"><h1>${n}</h1><p>${Il(t)}</p></div>`,"</main></body></html>"].join("")}var JQ=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 p8=60*1e3;var K8=1/1e6,Al=1e3,Ol=60*Al,pM=60*Ol,gc=24*pM,z8=7*gc,Y8=30*gc;var xl=["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 uM={s:1,m:60,h:3600,d:86400};function ey(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return!0}function ty(){return Math.floor(Date.now()/1e3)}function hc(e){if(typeof e=="number")return e;if(e==="now")return ty();if(e.startsWith("-")&&e.length>=3){let n=e.at(-1),o=n?uM[n]:void 0;if(o){let i=e.slice(1,-1);if(i.length>0&&ey(i))return ty()-parseInt(i,10)*o}}if(ey(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.`)}function V(e){process.stdout.write(`${e}
|
|
34
|
+
`)}function J(e){V(JSON.stringify(e,null,2))}function ny(e){process.stderr.write(`${e}
|
|
35
|
+
`)}var ry=["json","tsv","csv"];function Rl(e){let t=ry.find(n=>n===e);if(t!==void 0)return t;throw new Error(`--output must be one of: ${ry.join(", ")} (got: ${e})`)}function Cl(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 oy(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 Pl(e,t){let n=Object.create(null);for(let o of t){let i=oy(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 iy(e){return e==null?null:typeof e=="string"?e:JSON.stringify(e)}var lM={"\\":"\\\\"," ":"\\t","\r":"\\r","\n":"\\n"};function mM(e){let t=iy(e);return t===null?"":t.replace(/[\\\t\r\n]/g,n=>lM[n]??n)}function dM(e){let t=iy(e);return t===null?"":/[,"\n\r]/.test(t)?`"${t.replaceAll('"','""')}"`:t}function Ul(e,t,n){if(t.length===0)return"";let o=e==="csv"?",":" ",i=e==="csv"?dM:mM,a=n.map(l=>i(l)).join(o),c=t.map(l=>n.map(m=>i(oy(l,m))).join(o));return[a,...c].join(`
|
|
36
|
+
`)}var py="/oauth/callback",gM=5*Ol,hM=bl("Login complete","You can close this tab and return to the terminal."),yc=bl("Login failed","Return to the terminal for details.");function yM(e){return(0,wl.platform)()==="darwin"?["open",[e]]:(0,wl.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function TM(e){let[t,n]=yM(e),o=(0,sy.spawnSync)(t,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function EM(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)."))},gM),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!==py){m.writeHead(404,{"Content-Type":"text/html"}),m.end(yc);return}let h=f.searchParams.get("error");if(h){let I=f.searchParams.get("error_description")??"";c(m,400,yc,()=>i(new Error(`Authorization failed: ${h}${I?` (${I})`:""}`)));return}if(f.searchParams.get("state")!==t){c(m,400,yc,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let E=f.searchParams.get("code");if(!E){c(m,400,yc,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(m,200,hM,()=>o(E))})})}async function uy(e){let t=(0,cy.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}${py}`;try{let a=e.buildAuthorizeUrl(i);return TM(a)?V("Opening your browser to complete login..."):(V("Visit this URL in your browser to complete login:"),V(` ${a}`)),{code:await EM(t,e.state,o),redirectUri:i}}finally{t.close()}}var y={};Yt(y,{Assign:()=>_M,Clone:()=>Gn,Create:()=>R0,Discard:()=>C0,Metrics:()=>er,Update:()=>P0});var er={assign:0,create:0,clone:0,discard:0,update:0};function _M(e,t){return er.assign+=1,{...e,...t}}var s={};Yt(s,{Counted:()=>jM,Entries:()=>BM,EntriesRegExp:()=>FM,Every:()=>MM,EveryAll:()=>DM,GraphemeCount:()=>NM,HasPropertyKey:()=>qM,IsArray:()=>aa,IsBigInt:()=>ia,IsBoolean:()=>Ey,IsClassInstance:()=>vM,IsConstructor:()=>xM,IsDeepEqual:()=>kl,IsEqual:()=>te,IsFunction:()=>_y,IsGreaterEqualThan:()=>by,IsGreaterThan:()=>PM,IsInteger:()=>Nl,IsLessEqualThan:()=>Iy,IsLessThan:()=>UM,IsMaxLength:()=>LM,IsMinLength:()=>kM,IsMultipleOf:()=>wM,IsNull:()=>Ic,IsNumber:()=>bc,IsObject:()=>sa,IsObjectNotArray:()=>RM,IsString:()=>Sc,IsSymbol:()=>CM,IsUndefined:()=>Ll,IsUnsafePropertyKey:()=>Ay,IsValueLike:()=>Sy,Keys:()=>_c,ShiftLeft:()=>Ac,Some:()=>GM,SomeAll:()=>$M,Symbols:()=>HM,Values:()=>KM});function Mn(e,t,n){return e>=t&&e<=n}function IM(e){return e===8205}function bM(e){return Mn(e,55296,56319)}function ly(e){return Mn(e,127462,127487)}function dy(e){return Mn(e,65024,65039)}function fy(e){return Mn(e,768,879)||Mn(e,6832,6911)||Mn(e,7616,7679)||Mn(e,65056,65071)}function Ec(e){return e>65535?2:1}function my(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(fy(n)||dy(n))t+=Ec(n);else break}return t}function vl(e,t){let n=e.codePointAt(t),o=t+Ec(n);for(o=my(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+Ec(i),o=my(e,o)}return ly(n)&&o<e.length&&ly(e.codePointAt(o))&&(o+=Ec(e.codePointAt(o))),o}function gy(e){return bM(e)||fy(e)||dy(e)||IM(e)}function hy(e){let t=0,n=0;for(;n<e.length;)n=vl(e,n),t++;return t}function SM(e,t){if(t===0)return!0;let n=0,o=0;for(;o<e.length;)if(o=vl(e,o),n++,n>=t)return!0;return!1}function AM(e,t){let n=0,o=0;for(;o<e.length;)if(o=vl(e,o),n++,n>t)return!1;return!0}function yy(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(gy(e.charCodeAt(n)))return SM(e,t);if(n++,n>=t)return!0}return!1}function Ty(e,t){let n=0;for(;n<e.length;){if(gy(e.charCodeAt(n)))return AM(e,t);if(n++,n>t)return!1}return!0}function aa(e){return Array.isArray(e)}function ia(e){return te(typeof e,"bigint")}function Ey(e){return te(typeof e,"boolean")}function xM(e){if(Ll(e)||!_y(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function _y(e){return te(typeof e,"function")}function Nl(e){return Number.isInteger(e)}function Ic(e){return te(e,null)}function bc(e){return Number.isFinite(e)}function RM(e){return sa(e)&&!aa(e)}function sa(e){return te(typeof e,"object")&&!Ic(e)}function Sc(e){return te(typeof e,"string")}function CM(e){return te(typeof e,"symbol")}function Ll(e){return te(e,void 0)}function te(e,t){return e===t}function PM(e,t){return e>t}function UM(e,t){return e<t}function Iy(e,t){return e<=t}function by(e,t){return e>=t}function wM(e,t){if(ia(e)||ia(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!bc(e)||Nl(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 vM(e){if(!sa(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Ic(t)?!1:te(typeof t.constructor,"function")&&!(te(t.constructor,globalThis.Object)||te(t.constructor.name,"Object"))}function Sy(e){return ia(e)||Ey(e)||Ic(e)||bc(e)||Sc(e)||Ll(e)}function NM(e){return hy(e)}function LM(e,t){return Ty(e,t)}function kM(e,t){return yy(e,t)}function MM(e,t,n){for(let o=t;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function DM(e,t,n){let o=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(o=!1);return o}function GM(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function $M(e,t){let n=!1;for(let o=0;o<e.length;o++)t(e[o],o)&&(n=!0);return n}function jM(e,t){return e.reduce((n,o,i)=>t(o,i)?++n:n,0)}function Ac(e,t,n){return te(e.length,0)?n():t(e[0],e.slice(1))}function Ay(e){return te(e,"__proto__")||te(e,"constructor")||te(e,"prototype")}function qM(e,t){return Ay(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function FM(e){return _c(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function BM(e){return Object.entries(e)}function _c(e){return Object.getOwnPropertyNames(e)}function HM(e){return Object.getOwnPropertySymbols(e)}function KM(e){return Object.values(e)}function zM(e,t){if(!sa(t))return!1;let n=_c(e);return te(n.length,_c(t).length)&&n.every(o=>kl(e[o],t[o]))}function YM(e,t){return aa(t)&&te(e.length,t.length)&&e.every((n,o)=>kl(e[o],t[o]))}function kl(e,t){return aa(e)?YM(e,t):sa(e)?zM(e,t):te(e,t)}var Tt={};Yt(Tt,{IsBigInt64Array:()=>s0,IsBigUint64Array:()=>c0,IsBoolean:()=>VM,IsDate:()=>u0,IsFloat32Array:()=>i0,IsFloat64Array:()=>a0,IsInt16Array:()=>t0,IsInt32Array:()=>n0,IsInt8Array:()=>XM,IsMap:()=>m0,IsNumber:()=>QM,IsRegExp:()=>p0,IsSet:()=>l0,IsString:()=>WM,IsTypeArray:()=>ZM,IsUint16Array:()=>r0,IsUint32Array:()=>o0,IsUint8Array:()=>JM,IsUint8ClampedArray:()=>e0});function VM(e){return e instanceof Boolean}function QM(e){return e instanceof Number}function WM(e){return e instanceof String}function ZM(e){return globalThis.ArrayBuffer.isView(e)}function XM(e){return e instanceof globalThis.Int8Array}function JM(e){return e instanceof globalThis.Uint8Array}function e0(e){return e instanceof globalThis.Uint8ClampedArray}function t0(e){return e instanceof globalThis.Int16Array}function r0(e){return e instanceof globalThis.Uint16Array}function n0(e){return e instanceof globalThis.Int32Array}function o0(e){return e instanceof globalThis.Uint32Array}function i0(e){return e instanceof globalThis.Float32Array}function a0(e){return e instanceof globalThis.Float64Array}function s0(e){return e instanceof globalThis.BigInt64Array}function c0(e){return e instanceof globalThis.BigUint64Array}function p0(e){return e instanceof globalThis.RegExp}function u0(e){return e instanceof globalThis.Date}function l0(e){return e instanceof globalThis.Set}function m0(e){return e instanceof globalThis.Map}var Oc=s;function f0(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function g0(e){let t={};for(let n of Object.getOwnPropertyNames(e)){if(s.IsUnsafePropertyKey(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=Dn(o.value),s.IsEqual(o.enumerable,!0)?t[n]=o.value:Object.defineProperty(t,n,o)}return t}function h0(e){let t={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(t[n]=Dn(e[n]));for(let n of s.Symbols(e))t[n]=Dn(e[n]);return t}function y0(e){return s.IsClassInstance(e)?e:f0(e)?g0(e):h0(e)}function T0(e){return e.map(t=>Dn(t))}function E0(e){return e.slice()}function _0(e){return new RegExp(e.source,e.flags)}function I0(e){return new Map(Dn([...e.entries()]))}function b0(e){return new Set(Dn([...e.values()]))}function Dn(e){return Tt.IsTypeArray(e)?E0(e):Tt.IsRegExp(e)?_0(e):Tt.IsMap(e)?I0(e):Tt.IsSet(e)?b0(e):s.IsArray(e)?T0(e):s.IsObject(e)?y0(e):e}function Gn(e){return er.clone+=1,Dn(e)}var rt={};Yt(rt,{Get:()=>O0,Reset:()=>S0,Set:()=>A0});var pr={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function S0(){pr.immutableTypes=!1,pr.maxErrors=8,pr.maxInstantiationCount=128,pr.useAcceleration=!0,pr.exactOptionalPropertyTypes=!1,pr.enumerableKind=!1,pr.correctiveParse=!1,pr.unionPrioritySort=!0}function A0(e){for(let t of s.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(pr,t,{value:n})}}function O0(){return pr}function x0(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 Oy(e,t){return{...e,...t}}function R0(e,t,n={}){er.create+=1;let o=rt.Get(),i=Oy(t,n),a=o.enumerableKind?Oy(i,e):x0(i,e);return o.immutableTypes?Object.freeze(a):a}function C0(e,t){er.discard+=1;let n={};for(let o of Object.getOwnPropertyNames(e)){if(t.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);i.value=Gn(i.value),Object.defineProperty(n,o,i)}return n}function P0(e,t,n){er.update+=1;let o=rt.Get(),i=Gn(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 nn(e){return w(e,"Deferred")}function U0(e){return y.Update(e,{"~readonly":!0},{})}function ca(e,t){return y.Update(U0(e),{},t)}function xy(e,t,n,o){let i=O(e,t,n);return ca(i,o)}function w0(e){return y.Update(e,{"~optional":!0},{})}function pa(e,t){return y.Update(w0(e),{},t)}function Ry(e,t,n,o){let i=O(e,t,n);return pa(i,o)}function Pt(e,t){return y.Create({"~kind":"Array"},{type:"array",items:e},t)}function Z(e){return w(e,"Array")}function Po(e){return y.Discard(e,["~kind","type","items"])}function ur(e,t,n={}){return y.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function Be(e){return w(e,"Constructor")}function Cy(e){return y.Discard(e,["~kind","type","parameters","instanceType"])}function lr(e,t,n={}){return y.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function He(e){return w(e,"Function")}function Py(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 on(e,t){return y.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Uo(e){return w(e,"Generic")}function wo(e){return y.Create({"~kind":"Any"},{},e)}function Ve(e){return w(e,"Any")}var Uy="(?!)";function me(e){return y.Create({"~kind":"Never"},{not:{}},e)}function tr(e){return w(e,"Never")}function mr(e,t={}){return v("AddOptional",[e],t)}function $n(e,t={}){return pa(e,t)}function wy(e){return $n(e)}function Je(e){return Ue(e)&&s.HasPropertyKey(e,"~optional")}function vy(e){return s.Keys(e).filter(t=>!Je(e[t]))}function xc(e){return s.Keys(e)}function Rc(e){return s.Values(e)}function k(e,t={}){let n=vy(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 Ny(e){return y.Discard(e,["~kind","type","properties","required"])}function Qe(e){return y.Create({"~kind":"Unknown"},{},e)}function et(e){return w(e,"Unknown")}function dr(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 Ly(e){return y.Update(e,{"~unsafe":null},{})}function Cc(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var oe={};Yt(oe,{Match:()=>v0});function v0(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function ua(...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 jn(e,t,n,o={}){return y.Create({"~kind":"Dependent"},{if:e,then:t,else:n},o)}function Le(e){return w(e,"Dependent")}function ky(e){return y.Discard(e,["~kind","if","then","else"])}function My(e){return s.IsObjectNotArray(e)}function Dy(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function Gy(e){return s.IsString(e)||s.IsNumber(e)}function $y(e,t){let n=My(e)?Dy(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 jy(e){return y.Discard(e,["~kind","allOf"])}var qn={};Yt(qn,{Hash:()=>W0,HashCode:()=>Yy});function fe(){throw new Error("Unreachable")}function N0(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 L0(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 vo=BigInt("14695981039346656037"),[k0,M0]=[BigInt("1099511628211"),BigInt("18446744073709551616")],D0=Array.from({length:256}).map((e,t)=>BigInt(t)),Hy=new Float64Array(1),Ky=new DataView(Hy.buffer),zy=new Uint8Array(Hy.buffer);function lt(e){vo=vo^D0[e],vo=vo*k0%M0}function G0(e){lt(Et.Array);for(let t of e)an(t)}function $0(e){lt(Et.BigInt),Ky.setBigInt64(0,e);for(let t of zy)lt(t)}function Fy(e){lt(Et.Boolean),lt(e?1:0)}function j0(e){lt(Et.Constructor),an(e.toString())}function q0(e){lt(Et.Date),an(e.getTime())}function F0(e){lt(Et.Function),an(e.toString())}function B0(e){lt(Et.Null)}function By(e){lt(Et.Number),Ky.setFloat64(0,e,!0);for(let t of zy)lt(t)}function H0(e){lt(Et.Object);for(let t of N0(e).sort())an(t),an(e[t])}function K0(e){lt(Et.RegExp),Ml(e.toString())}var z0=new TextEncoder;function Ml(e){lt(Et.String);for(let t of z0.encode(e))lt(t)}function Y0(e){lt(Et.Symbol),an(e.toString())}function V0(e){lt(Et.TypeArray);let t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)lt(t[n])}function Q0(e){return lt(Et.Undefined)}function an(e){return Tt.IsTypeArray(e)?V0(e):Tt.IsDate(e)?q0(e):Tt.IsRegExp(e)?K0(e):Tt.IsBoolean(e)?Fy(e.valueOf()):Tt.IsString(e)?Ml(e.valueOf()):Tt.IsNumber(e)?By(e.valueOf()):L0(e)?By(e):s.IsArray(e)?G0(e):s.IsBoolean(e)?Fy(e):s.IsBigInt(e)?$0(e):s.IsConstructor(e)?j0(e):s.IsNull(e)?B0(e):s.IsObject(e)?H0(e):s.IsString(e)?Ml(e):s.IsSymbol(e)?Y0(e):s.IsUndefined(e)?Q0(e):s.IsFunction(e)?F0(e):fe()}function Yy(e){return vo=BigInt("14695981039346656037"),an(e),vo}function W0(e){return Yy(e).toString(16).padStart(16,"0")}function Vy(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 Z0=Vy;function Qy(){return Z0}var la=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,o=Fn(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=Fn(n)?c=>n["~codec"].encode(t(c)):t,a={decode:o,encode:i};return y.Update(this.type,{"~codec":a},{})}},ma=class{constructor(t){this.type=t}Decode(t){return new la(this.type,t)}};function Pc(e){return new ma(e)}function Zy(e,t){return Pc(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Xy(e,t){return Pc(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function Fn(e){return Ue(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function Jy(e){return No(e)}function Bn(e){return Ue(e)&&s.HasPropertyKey(e,"~immutable")}function fr(e,t={}){return v("AddReadonly",[e],t)}function Hn(e,t={}){return ca(e,t)}function eT(e){return Hn(e)}function Kn(e){return Ue(e)&&s.HasPropertyKey(e,"~readonly")}function J0(e,t){let n=Uc(e)?[...e["~refine"],t]:[t];return y.Update(e,{"~refine":n},{})}function tT(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,()=>"Refine Error"]});return J0(t,{check:n,error:o})}function eD(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function Uc(e){return Ue(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>eD(t))}var rT="-?(?:0|[1-9][0-9]*)n";function da(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function vt(e){return w(e,"BigInt")}function wc(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function _t(e){return w(e,"Boolean")}function fa(e){return y.Create({"~kind":"Identifier"},{name:e})}function nT(e){return w(e,"Identifier")}var vc="-?(?:0|[1-9][0-9]*)";function zn(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function ot(e){return w(e,"Integer")}var Dl=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function tD(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new Dl(e)})()}function z(e,t){return y.Create({"~kind":"Literal"},{type:tD(e),const:e},t)}function Nc(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function oT(e){return Q(e)&&s.IsBigInt(e.const)}function iT(e){return Q(e)&&s.IsBoolean(e.const)}function Lc(e){return Q(e)&&s.IsNumber(e.const)}function kc(e){return Q(e)&&s.IsString(e.const)}function Q(e){return w(e,"Literal")}function Lo(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function gr(e){return w(e,"Null")}var Mc="-?(?: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 ko(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function hr(e){return w(e,"Symbol")}function Yn(...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 aT(e){return w(e,"Parameter")}var Dc=".*";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 sT(e){return y.Discard(e,["~kind","anyOf"])}function ga(e){let t=cT(e);return s.IsEqual(t.length,2)?t[0]:[]}function rD(e){return!0}function pT(e){return s.ShiftLeft(e,(t,n)=>nD(t)?pT(n):!1,()=>!0)}function uT(e){return s.IsEqual(e.length,0)?!1:pT(e)}function nD(e){return R(e)?uT(e.anyOf):Q(e)?rD(e.const):!1}function Gc(e){return uT(e)}function $c(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function lT(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>lT(i,t,[...n,`${o}${t}`]),()=>n)}function oD(e,t){return s.IsEqual(e.length,0)?[`${t}`]:lT(e,t)}function mT(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>mT(e,i,[...n,...dT(e,o)]),()=>n)}function dT(e,t){return R(t)?mT(e,t.anyOf):Q(t)?oD(e,t.const):fe()}function fT(e,t){return s.ShiftLeft(t,(n,o)=>fT(dT(e,n),o),()=>e)}function iD(e){return e.map(t=>z(t))}function aD(e){let t=fT([],e),n=iD(t);return F(n)}function sD(e){return s.IsEqual(e.length,0)?fe():s.IsEqual(e.length,1)&&Q(e[0])?e[0]:aD(e)}function Gl(e){let t=ga(e);return s.IsEqual(t.length,0)?It():Gc(t)?sD(t):$c(e)}function ha(e){let t=Gl(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 gT(e){return Ut($t,e)}function hT(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 yT(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function cD(e){return y.Discard(e,["~readonly"])}function $l(e,t){return y.Update(cD(e),{},t)}function TT(e,t,n,o){let i=O(e,t,n);return $l(i,o)}function ET(e,t={}){return v("RemoveReadonly",[e],t)}function _T(e,t={}){return $l(e,t)}function pD(e){return y.Discard(e,["~optional"])}function jl(e,t){return y.Update(pD(e),{},t)}function IT(e,t,n,o){let i=O(e,t,n);return jl(i,o)}function bT(e,t={}){return v("RemoveOptional",[e],t)}function jc(e,t={}){return jl(e,t)}function ql(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function ST(e){let t=ql(e.items);return k(t)}function uD(e,t){return Kn(e)?!!Kn(t):!1}function lD(e,t){return Je(e)?!!Je(t):!1}function mD(e,t){let n=uD(e,t),o=lD(e,t),i=we([e,t]),a=_T(jc(i));return n&&o?Hn($n(a)):n&&!o?Hn(a):!n&&o?$n(a):a}function dD(e,t,n){return n in e?n in t?mD(e[n],t[n]):e[n]:n in t?t[n]:me()}function fD(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:dD(e,t,i)}),{})}function AT(e){return D(e)?e.properties:Y(e)?ql(e.items):fe()}function OT(e,t){let n=AT(e),o=AT(t),i=fD(n,o);return k(i)}function xT(e,t){let n=Vn(e,t);return s.IsEqual(n,Ta)?e:s.IsEqual(n,Ea)||s.IsEqual(n,ya)?t:me()}function RT(e){return D(e)||Y(e)}function gD(e,t){let n=R(e),o=R(t);return n||o}function hD(e,t){let n=Vt(e),o=Vt(t),i=gD(n,o),a=RT(n),c=RT(o);return i?we([n,o]):a&&c?OT(n,o):a&&!c?n:!a&&c?o:xT(n,o)}function CT(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>CT(e,i,[...n,hD(e,o)]),()=>s.IsEqual(n.length,0)?[e]:n)}function PT(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>PT(i,t,[...n,..._a([o],t)]),()=>n)}function _a(e,t=[]){return s.ShiftLeft(e,(n,o)=>R(n)?_a(o,PT(n.anyOf,t)):_a(o,CT(n,t)),()=>t)}function yD(e,t){let n=dt({},e,t);return G.IsExtendsTrueLike(n)?[]:[e]}function TD(e,t){return e.reduce((n,o)=>[...n,...yD(o,t)],[])}function qc(e,t){let n=Vt(e),o=R(n)?n.anyOf:[n],i=TD(o,t);return Lt(i)}function rr(e,t,n){let o=ut([e,t]),i=qc(n,e);return Lt([o,i])}function wt(e){let t=e.map(n=>z(n));return Lt(t)}function we(e){let t=_a(e),n=Fl(t);return kr(n)}function ht(e){let t=ha(e);return Vt(t)}function Lt(e){let t=Fl(e);return kr(t)}function Vt(e){return Le(e)?rr(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 kr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?me():F(e)}function UT(e,t){let n=wt(e);return sn(n,t)}function wT(e,t){return Ut(cn,t)}function vT(e,t){let n=we(e);return sn(n,t)}function NT(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 LT(e,t){return Ut(Mo,t)}function kT(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?Ut(e.pattern.toString(),t):Ut($t,t)}function MT(e,t){let n=ga(e);return Gc(n)?sn(ht(e),t):Ut(e,t)}function ED(e){return R(e)?Do(e.anyOf):[e]}function Do(e){return e.reduce((t,n)=>[...t,...ED(n)],[])}function _D(e){return e.some(t=>We(t)||Ce(t)||ot(t))}function ID(e,t){return s.IsEqual(_D(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 SD(e,t){let n=bD(e,t);return k(n)}function DT(e,t){let n=Do(e),o=ID(n,t);return Ue(o)?o:SD(n,t)}function sn(e,t){return Ve(e)?gT(t):_t(e)?hT(t):ze(e)?UT(e.enum,t):ot(e)?wT(e,t):M(e)?vT(e.allOf,t):Q(e)?NT(e.const,t):Ce(e)?LT(e,t):R(e)?DT(e.anyOf,t):We(e)?kT(e,t):Ee(e)?MT(e.pattern,t):k({})}function Bl(e,t,n){return K([e])?y.Update(sn(e,t),{},n):Fc(e,t,n)}function GT(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Bl(a,c,i)}var cn=`^${vc}$`,Mo=`^${Mc}$`,$t=`^${Dc}$`;function Fc(e,t,n={}){return v("Record",[e,t],n)}function Go(e,t,n={}){return Bl(e,t,n)}function Bc(e,t){return Ut(e,t)}function Hc(e){return s.IsEqual(e,$t)?It():s.IsEqual(e,cn)?zn():s.IsEqual(e,Mo)?Nt():Gl(e)}function it(e){return s.Keys(e.patternProperties)[0]}function pn(e){let t=it(e);return Hc(t)}function Se(e){return e.patternProperties[it(e)]}function de(e){return w(e,"Record")}function Qn(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function un(e){return w(e,"Rest")}function Kc(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function zc(e){return w(e,"This")}function $o(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function nr(e){return w(e,"Undefined")}function Yc(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function kt(e){return w(e,"Void")}function OD(e,t){return s.IsEqual(e,"Array")?Pt(t[0]):s.IsEqual(e,"Capitalize")?Qc(t[0]):s.IsEqual(e,"ConstructorParameters")?ep(t[0]):s.IsEqual(e,"Evaluate")?$_(t[0]):s.IsEqual(e,"Exclude")?tp(t[0],t[1]):s.IsEqual(e,"Extract")?rp(t[0],t[1]):s.IsEqual(e,"Index")?Aa(t[0],t[1]):s.IsEqual(e,"InstanceType")?np(t[0]):s.IsEqual(e,"Lowercase")?Wc(t[0]):s.IsEqual(e,"NonNullable")?op(t[0]):s.IsEqual(e,"Omit")?ip(t[0],t[1]):s.IsEqual(e,"Parameters")?ap(t[0]):s.IsEqual(e,"Partial")?sp(t[0]):s.IsEqual(e,"Pick")?cp(t[0],t[1]):s.IsEqual(e,"Readonly")?pp(t[0]):s.IsEqual(e,"KeyOf")?Oa(t[0]):s.IsEqual(e,"Record")?Fc(t[0],t[1]):s.IsEqual(e,"Required")?up(t[0]):s.IsEqual(e,"ReturnType")?lp(t[0]):s.IsEqual(e,"Uncapitalize")?Zc(t[0]):s.IsEqual(e,"Uppercase")?Xc(t[0]):Sa(nt(e),t)}function Wn(){throw Error("Unreachable")}function BT(e,t=[]){return s.ShiftLeft(e,(n,o)=>BT(o,[...t,n[1]]),()=>t)}function Mr(e){return s.IsEqual(e.length,3)?[e[0],...BT(e[1])]:[]}function HT(e){return Yn(e[0],e[2],e[4])}function KT(e){return Yn(e[0],e[2],e[2])}function zT(e){return Yn(e[0],Qe(),e[2])}function YT(e){return Yn(e,Qe(),Qe())}function VT(e){return Mr(e)}function QT(e){return e[1]}function WT(e){return Mr(e)}function ZT(e){return e[1]}function XT(e){return OD(e[0],e[1])}function JT(e){return null}function eE(e){return It()}function tE(e){return Nt()}function rE(e){return wc()}function nE(e){return $o()}function oE(e){return Lo()}function iE(e){return zn()}function aE(e){return da()}function sE(e){return Qe()}function cE(e){return wo()}function pE(e){return k({})}function uE(e){return me()}function lE(e){return ko()}function mE(e){return Yc()}function dE(e){return Kc()}function fE(e){return z(BigInt(e))}function gE(e){return z(s.IsEqual(e,"true"))}function hE(e){return z(parseFloat(e))}function yE(e){return z(e)}function TE(e){return e[1]}function EE(e){return z(e)}function _E(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function IE(e){return e[1]}function bE(e){return Vc(e)}function SE(e){return s.IsEqual(e.length,6)?jn(e[1],e[3],e[5]):jn(e[1],e[3],Qe())}function AE(e){return e.length>0}function OE(e){return e.reduce((t,n)=>s.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function xE(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function RE(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function CE(e){return s.IsEqual(e.length,2)?e[1]:[]}function $T(e,t){return t.reduce((n,o)=>{let i=o;return s.IsEqual(i.length,1)?Aa(n,i[0]):s.IsEqual(i.length,0)?Pt(n):Wn()},e)}function jT(e,t){return s.IsEqual(t.length,3)?Jc(e,t[0],t[1],t[2]):e}function xD(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:mp(e,t)}function PE(e){let[t,n,o,i,a]=e;return xD(jT(t?Oa($T(n,o)):$T(n,o),i),a)}function Hl(e,t){return s.IsEqual(t.length,3)?(()=>{let[n,o,i]=t,a=Hl(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]);Wn()})():e}function UE(e){let[t,n]=e;return Hl(t,n)}function wE(e){let[t,n]=e;return Hl(t,n)}function vE(e){return G_(e[1])}function NE(e){return e[1]}function LE(e){return on(e[0],e[2])}function kE(e){return s.IsEqual(e.length,4)?ua(e[1],e[3]):s.IsEqual(e.length,2)?ua(e[1],Qe()):Wn()}function ME(e){return`${e}`}function DE(e){return ot(e[3])?cn:Ce(e[3])?Mo:hr(e[3])?$t:We(e[3])?$t:Wn()}function GE(e){return e.length>0}function $E(e){return e.length>0}function jE(e){let[t,n,o,i,a]=e;return{[n]:t&&o?fr(mr(a)):t&&!o?fr(a):!t&&o?mr(a):a}}function qE(e){return Mr(e)}function FE(e){return e.reduce((t,n)=>s.HasPropertyKey(n,cn)||s.HasPropertyKey(n,Mo)||s.HasPropertyKey(n,$t)?[t[0],y.Assign(t[1],n)]:[y.Assign(t[0],n),t[1]],[{},{}])}function BE(e){return FE(e[1])}function HE(e){let[t,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return k(t,o)}function KE(e){return s.IsEqual(e.length,5)?fr(mr(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?fr(e[3]):mr(e[3]):Wn()}function zE(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[t,n,o]=e;return t&&o?fr(mr(n)):t&&!o?fr(n):!t&&o?mr(n):n}function YE(e){return s.IsEqual(e.length,2)?Qn(e[1]):s.IsEqual(e.length,1)?e[0]:Wn()}function VE(e){return Mr(e)}function QE(e){return ke(e[1])}function WE(e){return fr(mr(e[4]))}function ZE(e){return fr(e[3])}function XE(e){return mr(e[3])}function JE(e){return e[2]}function e_(e){return s.IsEqual(e.length,2)?Qn(e[1]):s.IsEqual(e.length,1)?e[0]:Wn()}function t_(e){return Mr(e)}function r_(e){return lr(e[1],e[4])}function n_(e){return ur(e[2],e[5])}function qT(e,t){return s.IsEqual(e,"remove")?ET(t):s.IsEqual(e,"add")?fr(t):t}function o_(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 FT(e,t){return s.IsEqual(e,"remove")?bT(t):s.IsEqual(e,"add")?mr(t):t}function i_(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 a_(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function s_(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?Ia(fa(e[3]),e[5],e[6][0],qT(e[1],FT(e[8],e[10]))):Ia(fa(e[3]),e[5],nt(e[3]),qT(e[1],FT(e[8],e[10])))}function c_(e){return nt(e)}function p_(e){return BigInt(e)}function u_(e){return parseFloat(e)}function l_(e){return s.IsEqual(e,"true")}function m_(e){return null}function d_(e){return{[e[0]]:e[2]}}function f_(e){return Mr(e)}function RD(e){return e.reduce((t,n)=>y.Assign(t,n),{})}function g_(e){return RD(e[1])}function h_(e){return Mr(e)}function y_(e){return e[1]}function T_(e){return da()}function E_(e){return It()}function __(e){return Nt()}function I_(e){return zn()}function b_(e){return me()}function S_(e){return z(e)}function A_(e){return F(e[1])}function O_(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function x_(e){return[e[0],...e[1]]}function R_(e){return e[1]}function C_(e){return Mr(e)}function P_(e){return s.IsEqual(e.length,2)?e[1]:[]}function U_(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]]:on(t,ba(n,o,a))}}function w_(e){let t=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:ba(t,n,i)}}function v_(e){return{[e[1]]:on(e[2],e[4])}}function N_(e){return{[e[1]]:e[3]}}function L_(e){return null}function k_(e){return Mr(e)}function M_(e){return e[1]}function D_(e){let[t,n]=[e[0],e[1]];return j_(y.Assign(t,FE(n)[0]))}function xa(e){return te(e.length,2)}function W(e,t,n){return xa(e)?t(e[0],e[1]):n()}function UD(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=UD(e[n],t);if(xa(o))return o}return[]}function Kl(e,t){return Array.from({length:t-e+1},(n,o)=>String.fromCharCode(e+o))}var q_=[...Kl(97,122),...Kl(65,90)],zl="0",Yl=Kl(49,57),jo=[zl,...Yl],F_=" ",qo=`
|
|
37
|
+
`;var ln="_",dp=".",B_="$",fp="-";var H_="//",K_="/*",vD="*/";function z_(e){let t=e.indexOf(vD);return te(t,-1)?"":e.slice(t+2)}function Y_(e){let t=e.indexOf(qo);return te(t,-1)?"":e.slice(t)}function ND(e){return e.replace(/^[ \t\r\f\v]+/,"")}function gp(e){let t=ND(e);return t.startsWith(K_)?gp(z_(t.slice(2))):t.startsWith(H_)?gp(Y_(t.slice(2))):t}function mt(e){let t=e.trimStart();return t.startsWith(K_)?mt(z_(t.slice(2))):t.startsWith(H_)?mt(Y_(t.slice(2))):t}function hp(e,t){return W(ve([e],t),(n,o)=>[n,o],()=>["",t])}function LD(e,t){return e.includes(t)}function Fo(e,t,n,o=""){return W(ve(e,n),(i,a)=>LD(t,i)?Fo(e,t,a,o):Fo(e,t,a,`${o}${i}`),()=>[o,n])}function kD(e){return ve(Yl,e)}var MD=[...jo,ln];function DD(e){return Fo(MD,[ln],e)}function GD(e){return W(ve([zl],e),(t,n)=>[t,n],()=>W(kD(e),(t,n)=>W(DD(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[]))}function yp(e){return GD(mt(e))}function $D(e){return hp(fp,e)}function jD(e){return W($D(e),(t,n)=>W(yp(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function V_(e){return jD(mt(e))}function qD(e){return W(V_(e),(t,n)=>W(ve(["n"],n),(o,i)=>[`${t}`,i],()=>[]),()=>[])}function Vl(e){return qD(e)}function Ql(e,t){return ve([e],t)}function _(e,t){return te(e,"")?["",t]:e.startsWith(qo)?Ql(e,gp(t)):e.startsWith(F_)?Ql(e,t):Ql(e,mt(t))}var Q_=[...q_,ln,B_];function FD(e){return ve(Q_,e)}var BD=[...Q_,...jo];function W_(e,t=""){return W(ve(BD,e),(n,o)=>W_(o,`${t}${n}`),()=>[t,e])}function HD(e){return W(FD(e),(t,n)=>W(W_(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function Me(e){return HD(mt(e))}var KD=[...jo,ln];function zD(e){return xa(ve([dp],e))}function Z_(e){return W(Fo(KD,[ln],e),(t,n)=>te(t,"")?[]:[t,n],()=>[])}function YD(e){return W(ve([dp],e),(t,n)=>W(Z_(n),(o,i)=>[`0${t}${o}`,i],()=>[]),()=>[])}function VD(e){return W(yp(e),(t,n)=>W(ve([dp],n),(o,i)=>W(Z_(i),(a,c)=>[`${t}${o}${a}`,c],()=>[`${t}`,i]),()=>[`${t}`,n]),()=>[])}function QD(e){return zD(e)?YD(e):VD(e)}function X_(e){return QD(mt(e))}function WD(e){return hp(fp,e)}function ZD(e){return W(WD(e),(t,n)=>W(X_(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function Tp(e){return ZD(mt(e))}function XD(e){return te(e,"")?[]:[e.slice(0,1),e.slice(1)]}function J_(e,t){return Ac(e,(n,o)=>t.startsWith(n)?!0:J_(o,t),()=>!1)}function mn(e,t,n=""){return W(XD(t),(o,i)=>J_(e,t)?[n,t]:mn(e,i,`${n}${o}`),()=>[])}function JD(e,t,n){return W(ve([e],n),(o,i)=>W(mn([t],i),(a,c)=>W(ve([t],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function eG(e,t,n){return W(ve([e],n),(o,i)=>W(mn([qo,t],i),(a,c)=>W(ve([t],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function eI(e,t,n,o){return n?JD(e,t,mt(o)):eG(e,t,mt(o))}function tG(e,t){return ve(e,t)}function rG(e,t){return eI(e,e,!1,t)}function nG(e,t){return W(tG(e,t),(n,o)=>rG(n,`${n}${o}`),()=>[])}function Ep(e,t){return nG(e,mt(t))}function tI(e,t){return W(mn(e,t),(n,o)=>te(n,"")?[]:[n,o],()=>[])}var p=(e,t,n=()=>[])=>e.length===2?t(e):n(),iG=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])=>[HT(t),n]),aG=e=>p(p(Me(e),([t,n])=>p(_("extends",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[KT(t),n]),sG=e=>p(p(Me(e),([t,n])=>p(_("=",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[zT(t),n]),cG=e=>p(Me(e),([t,n])=>[YT(t),n]),oI=e=>p(p(iG(e),([t,n])=>[t,n],()=>p(aG(e),([t,n])=>[t,n],()=>p(sG(e),([t,n])=>[t,n],()=>p(cG(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),iI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(oI(o),([i,a])=>[[n,i],a])),([n,o])=>iI(o,[...t,n]),()=>[t,e]),pG=e=>p(p(p(oI(e),([t,n])=>p(iI(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])=>[VT(t),n]),Xl=e=>p(p(_("<",e),([t,n])=>p(pG(n),([o,i])=>p(_(">",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[QT(t),n]),aI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(re(o),([i,a])=>[[n,i],a])),([n,o])=>aI(o,[...t,n]),()=>[t,e]),uG=e=>p(p(p(re(e),([t,n])=>p(aI(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])=>[WT(t),n]),lG=e=>p(p(_("<",e),([t,n])=>p(uG(n),([o,i])=>p(_(">",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[ZT(t),n]),mG=e=>p(p(Me(e),([t,n])=>p(lG(n),([o,i])=>[[t,o],i])),([t,n])=>[XT(t),n]),sI=e=>p(p(p(_(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[JT(t),n]),cI=e=>p(_("string",e),([t,n])=>[eE(t),n]),pI=e=>p(_("number",e),([t,n])=>[tE(t),n]),dG=e=>p(_("boolean",e),([t,n])=>[rE(t),n]),fG=e=>p(_("undefined",e),([t,n])=>[nE(t),n]),gG=e=>p(_("null",e),([t,n])=>[oE(t),n]),uI=e=>p(_("integer",e),([t,n])=>[iE(t),n]),hG=e=>p(_("bigint",e),([t,n])=>[aE(t),n]),yG=e=>p(_("unknown",e),([t,n])=>[sE(t),n]),TG=e=>p(_("any",e),([t,n])=>[cE(t),n]),EG=e=>p(_("object",e),([t,n])=>[pE(t),n]),_G=e=>p(_("never",e),([t,n])=>[uE(t),n]),lI=e=>p(_("symbol",e),([t,n])=>[lE(t),n]),IG=e=>p(_("void",e),([t,n])=>[mE(t),n]),bG=e=>p(_("this",e),([t,n])=>[dE(t),n]),SG=e=>p(p(_("${",e),([t,n])=>p(re(n),([o,i])=>p(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[TE(t),n]),Wl=e=>p(mn(["${","`"],e),([t,n])=>[EE(t),n]),mI=e=>p(p(p(Wl(e),([t,n])=>p(SG(n),([o,i])=>p(mI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p(p(Wl(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p(p(Wl(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[_E(t),n]),Jl=e=>p(p(_("`",e),([t,n])=>p(mI(n),([o,i])=>p(_("`",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[IE(t),n]),AG=e=>p(Jl(e),([t,n])=>[bE(t),n]),OG=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])=>[SE(t),n]),xG=e=>p(Vl(e),([t,n])=>[fE(t),n]),RG=e=>p(p(_("true",e),([t,n])=>[t,n],()=>p(_("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[gE(t),n]),CG=e=>p(Tp(e),([t,n])=>[hE(t),n]),PG=e=>p(Ep(["'",'"'],e),([t,n])=>[yE(t),n]),UG=e=>p(p(p(_("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[AE(t),n]),dI=(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])=>dI(o,[...t,n]),()=>[t,e]),wG=e=>p(dI(e),([t,n])=>[OE(t),n]),vG=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])=>[xE(t),n]),NG=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(cI(e),([t,n])=>[t,n],()=>p(pI(e),([t,n])=>[t,n],()=>p(dG(e),([t,n])=>[t,n],()=>p(fG(e),([t,n])=>[t,n],()=>p(gG(e),([t,n])=>[t,n],()=>p(uI(e),([t,n])=>[t,n],()=>p(hG(e),([t,n])=>[t,n],()=>p(yG(e),([t,n])=>[t,n],()=>p(TG(e),([t,n])=>[t,n],()=>p(EG(e),([t,n])=>[t,n],()=>p(_G(e),([t,n])=>[t,n],()=>p(lI(e),([t,n])=>[t,n],()=>p(IG(e),([t,n])=>[t,n],()=>p(bG(e),([t,n])=>[t,n],()=>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],()=>p(AG(e),([t,n])=>[t,n],()=>p(OG(e),([t,n])=>[t,n],()=>p(HG(e),([t,n])=>[t,n],()=>p(YG(e),([t,n])=>[t,n],()=>p(JG(e),([t,n])=>[t,n],()=>p(XG(e),([t,n])=>[t,n],()=>p(n$(e),([t,n])=>[t,n],()=>p(mG(e),([t,n])=>[t,n],()=>p(o$(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[RE(t),n]),LG=e=>p(p(p(_("with",e),([t,n])=>p(UI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[CE(t),n]),fI=e=>p(p(UG(e),([t,n])=>p(NG(n),([o,i])=>p(wG(i),([a,c])=>p(vG(c),([l,m])=>p(LG(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[PE(t),n]),gI=e=>p(p(p(_("&",e),([t,n])=>p(fI(n),([o,i])=>p(gI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),hI=e=>p(p(fI(e),([t,n])=>p(gI(n),([o,i])=>[[t,o],i])),([t,n])=>[UE(t),n]),yI=e=>p(p(p(_("|",e),([t,n])=>p(hI(n),([o,i])=>p(yI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),_p=e=>p(p(hI(e),([t,n])=>p(yI(n),([o,i])=>[[t,o],i])),([t,n])=>[wE(t),n]),kG=e=>p(p(_("readonly",e),([t,n])=>p(_p(n),([o,i])=>[[t,o],i])),([t,n])=>[vE(t),n]),MG=e=>p(p(_("|",e),([t,n])=>p(_p(n),([o,i])=>[[t,o],i])),([t,n])=>[NE(t),n]),DG=e=>p(p(Xl(e),([t,n])=>p(_("=",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[LE(t),n]),GG=e=>p(p(p(_("infer",e),([t,n])=>p(Me(n),([o,i])=>p(_("extends",i),([a,c])=>p(_p(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])=>[kE(t),n]),re=e=>p(p(GG(e),([t,n])=>[t,n],()=>p(MG(e),([t,n])=>[t,n],()=>p(kG(e),([t,n])=>[t,n],()=>p(_p(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),$G=e=>p(Tp(e),([t,n])=>[ME(t),n]),jG=e=>p(Me(e),([t,n])=>[t,n]),qG=e=>p(Ep(["'",'"'],e),([t,n])=>[t,n]),FG=e=>p(p(_("[",e),([t,n])=>p(Me(n),([o,i])=>p(_(":",i),([a,c])=>p(p(uI(c),([l,m])=>[l,m],()=>p(pI(c),([l,m])=>[l,m],()=>p(cI(c),([l,m])=>[l,m],()=>p(lI(c),([l,m])=>[l,m],()=>[])))),([l,m])=>p(_("]",m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[DE(t),n]),TI=e=>p(p($G(e),([t,n])=>[t,n],()=>p(jG(e),([t,n])=>[t,n],()=>p(qG(e),([t,n])=>[t,n],()=>p(FG(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),EI=e=>p(p(p(_("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[GE(t),n]),_I=e=>p(p(p(_("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[$E(t),n]),II=e=>p(p(EI(e),([t,n])=>p(TI(n),([o,i])=>p(_I(i),([a,c])=>p(_(":",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[jE(t),n]),Ip=e=>p(p(p(_(",",e),([t,n])=>p(_(`
|
|
38
|
+
`,n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(_(";",e),([t,n])=>p(_(`
|
|
39
|
+
`,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(_(`
|
|
40
|
+
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),bI=(e,t=[])=>p(p(Ip(e),([n,o])=>p(II(o),([i,a])=>[[n,i],a])),([n,o])=>bI(o,[...t,n]),()=>[t,e]),BG=e=>p(p(p(II(e),([t,n])=>p(bI(n),([o,i])=>p(p(Ip(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[qE(t),n]),em=e=>p(p(_("{",e),([t,n])=>p(BG(n),([o,i])=>p(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[BE(t),n]),HG=e=>p(em(e),([t,n])=>[HE(t),n]),KG=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])=>[KE(t),n]),rI=e=>p(p(KG(e),([t,n])=>[t,n],()=>p(p(EI(e),([t,n])=>p(re(n),([o,i])=>p(_I(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>[])),([t,n])=>[zE(t),n]),SI=e=>p(p(p(_("...",e),([t,n])=>p(rI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(rI(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[YE(t),n]),AI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(SI(o),([i,a])=>[[n,i],a])),([n,o])=>AI(o,[...t,n]),()=>[t,e]),zG=e=>p(p(p(SI(e),([t,n])=>p(AI(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])=>[VE(t),n]),YG=e=>p(p(_("[",e),([t,n])=>p(zG(n),([o,i])=>p(_("]",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[QE(t),n]),VG=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])=>[WE(t),n]),QG=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])=>[ZE(t),n]),WG=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])=>[XE(t),n]),ZG=e=>p(p(Me(e),([t,n])=>p(_(":",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[JE(t),n]),nI=e=>p(p(VG(e),([t,n])=>[t,n],()=>p(QG(e),([t,n])=>[t,n],()=>p(WG(e),([t,n])=>[t,n],()=>p(ZG(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),OI=e=>p(p(p(_("...",e),([t,n])=>p(nI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(nI(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[e_(t),n]),xI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(OI(o),([i,a])=>[[n,i],a])),([n,o])=>xI(o,[...t,n]),()=>[t,e]),RI=e=>p(p(p(OI(e),([t,n])=>p(xI(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]),XG=e=>p(p(_("(",e),([t,n])=>p(RI(n),([o,i])=>p(_(")",i),([a,c])=>p(_("=>",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[r_(t),n]),JG=e=>p(p(_("new",e),([t,n])=>p(_("(",n),([o,i])=>p(RI(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])=>[n_(t),n]),e$=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])=>[o_(t),n]),t$=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])=>[i_(t),n]),r$=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])=>[a_(t),n]),n$=e=>p(p(_("{",e),([t,n])=>p(e$(n),([o,i])=>p(_("[",i),([a,c])=>p(Me(c),([l,m])=>p(_("in",m),([f,h])=>p(re(h),([E,I])=>p(r$(I),([g,T])=>p(_("]",T),([S,b])=>p(t$(b),([x,P])=>p(_(":",P),([ue,en])=>p(re(en),([vr,Nr])=>p(sI(Nr),([sk,ck])=>p(_("}",ck),([pk,uk])=>[[t,o,a,l,f,E,g,S,x,ue,vr,sk,pk],uk]))))))))))))),([t,n])=>[s_(t),n]),o$=e=>p(Me(e),([t,n])=>[c_(t),n]),i$=e=>p(Vl(e),([t,n])=>[p_(t),n]),a$=e=>p(Tp(e),([t,n])=>[u_(t),n]),s$=e=>p(p(_("true",e),([t,n])=>[t,n],()=>p(_("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[l_(t),n]),c$=e=>p(Ep(['"',"'"],e),([t,n])=>[t,n]),p$=e=>p(_("null",e),([t,n])=>[m_(t),n]),u$=e=>p(_("undefined",e),([t,n])=>[void 0,n]),CI=e=>p(p(TI(e),([t,n])=>p(_(":",n),([o,i])=>p(tm(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[d_(t),n]),PI=(e,t=[])=>p(p(Ip(e),([n,o])=>p(CI(o),([i,a])=>[[n,i],a])),([n,o])=>PI(o,[...t,n]),()=>[t,e]),l$=e=>p(p(p(CI(e),([t,n])=>p(PI(n),([o,i])=>p(p(Ip(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[f_(t),n]),UI=e=>p(p(_("{",e),([t,n])=>p(l$(n),([o,i])=>p(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[g_(t),n]),wI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(tm(o),([i,a])=>[[n,i],a])),([n,o])=>wI(o,[...t,n]),()=>[t,e]),m$=e=>p(p(p(tm(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])=>[h_(t),n]),d$=e=>p(p(_("[",e),([t,n])=>p(m$(n),([o,i])=>p(_("]",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[y_(t),n]),tm=e=>p(p(i$(e),([t,n])=>[t,n],()=>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],()=>p(u$(e),([t,n])=>[t,n],()=>p(UI(e),([t,n])=>[t,n],()=>p(d$(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),f$=e=>p(_("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[T_(t),n]),g$=e=>p(_(".*",e),([t,n])=>[E_(t),n]),h$=e=>p(_("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[__(t),n]),y$=e=>p(_("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[I_(t),n]),T$=e=>p(_("(?!)",e),([t,n])=>[b_(t),n]),E$=e=>p(tI(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[S_(t),n]),_$=e=>p(p(f$(e),([t,n])=>[t,n],()=>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],()=>p(I$(e),([t,n])=>[t,n],()=>p(E$(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),I$=e=>p(p(_("(",e),([t,n])=>p(rm(n),([o,i])=>p(_(")",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[A_(t),n]),vI=e=>p(p(p(Zl(e),([t,n])=>p(_("|",n),([o,i])=>p(vI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p(p(Zl(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[O_(t),n]),Zl=e=>p(p(_$(e),([t,n])=>p(rm(n),([o,i])=>[[t,o],i])),([t,n])=>[x_(t),n]),rm=e=>p(p(vI(e),([t,n])=>[t,n],()=>p(Zl(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),cT=e=>p(p(_("^",e),([t,n])=>p(rm(n),([o,i])=>p(_("$",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[R_(t),n]),NI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(re(o),([i,a])=>[[n,i],a])),([n,o])=>NI(o,[...t,n]),()=>[t,e]),b$=e=>p(p(p(re(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]),LI=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])=>[P_(t),n]),S$=e=>p(p(_("interface",e),([t,n])=>p(Me(n),([o,i])=>p(Xl(i),([a,c])=>p(LI(c),([l,m])=>p(em(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[U_(t),n]),A$=e=>p(p(_("interface",e),([t,n])=>p(Me(n),([o,i])=>p(LI(i),([a,c])=>p(em(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[w_(t),n]),O$=e=>p(p(_("type",e),([t,n])=>p(Me(n),([o,i])=>p(Xl(i),([a,c])=>p(_("=",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[v_(t),n]),x$=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])=>[N_(t),n]),R$=e=>p(p(p(_("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[L_(t),n]),kI=e=>p(p(p(_(";",e),([t,n])=>p(_(`
|
|
41
|
+
`,n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(_(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p(p(_(`
|
|
42
|
+
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),MI=(e,t=[])=>p(p(kI(e),([n,o])=>p(nm(o),([i,a])=>[[n,i],a])),([n,o])=>MI(o,[...t,n]),()=>[t,e]),C$=e=>p(p(p(nm(e),([t,n])=>p(MI(n),([o,i])=>p(p(kI(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]),nm=e=>p(p(R$(e),([t,n])=>p(p(S$(n),([o,i])=>[o,i],()=>p(A$(n),([o,i])=>[o,i],()=>p(O$(n),([o,i])=>[o,i],()=>p(x$(n),([o,i])=>[o,i],()=>[])))),([o,i])=>p(sI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[M_(t),n]),P$=e=>p(p(nm(e),([t,n])=>p(C$(n),([o,i])=>[[t,o],i])),([t,n])=>[D_(t),n]),DI=e=>p(p(P$(e),([t,n])=>[t,n],()=>p(DG(e),([t,n])=>[t,n],()=>p(re(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function GI(e){let t=Jl(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:fe()}function w$(e){return e.join("|")}function v$(e){return e.slice(1,e.length-1)}function N$(e,t,n){return dn(t,`${n}${e}`)}function L$(e,t){return dn(e,`${t}${rT}`)}function k$(e,t){return dn(e,`${t}${vc}`)}function M$(e,t){return dn(e,`${t}${Mc}`)}function D$(e,t){return Ra(F([z("false"),z("true")]),e,t)}function G$(e,t){return dn(e,`${t}${Dc}`)}function $$(e,t,n){return dn(t,`${n}${v$(e)}`)}function j$(e,t,n){let o=Ca(e,{});return Ra(o,t,n)}function q$(e,t,n){let o=wt(e);return Ra(o,t,n)}function $I(e,t,n,o=[]){return s.ShiftLeft(e,(i,a)=>$I(a,t,n,[...o,Ra(i,[],"")]),()=>dn(t,`${n}(${w$(o)})`))}function Ra(e,t,n){return ze(e)?q$(e.enum,t,n):ot(e)?k$(t,n):Q(e)?N$(e.const,t,n):vt(e)?L$(t,n):_t(e)?D$(t,n):Ce(e)?M$(t,n):We(e)?G$(t,n):Ee(e)?$$(e.pattern,t,n):qI(e)?j$(e.parameters[0],t,n):R(e)?$I(e.anyOf,t,n):Uy}function dn(e,t){return s.ShiftLeft(e,(n,o)=>Ra(n,o,t),()=>t)}function F$(e){return`^${dn(e,"")}$`}function jI(e){let t=F$(e);return $c(t)}function Ca(e,t){return K(e)?y.Update(jI(e),{},t):Vc(e,t)}function FI(e,t,n,o){let i=jt(e,t,n);return Ca(i,o)}function Vc(e,t={}){return v("TemplateLiteral",[e],t)}function qI(e){return Ue(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function BI(e){return Ca(e,{})}function B$(e){let t=GI(e);return BI(t)}function HI(e,t={}){let n=s.IsString(e)?B$(e):BI(e);return y.Update(n,{},t)}function Ee(e){return w(e,"TemplateLiteral")}var G={};Yt(G,{ExtendsFalse:()=>B,ExtendsTrue:()=>U,ExtendsUnion:()=>om,IsExtendsFalse:()=>H$,IsExtendsTrue:()=>zI,IsExtendsTrueLike:()=>Bo,IsExtendsUnion:()=>KI,Match:()=>Ae});function om(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function KI(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 H$(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function Bo(e){return KI(e)||zI(e)}function Ae(e,t,n){return Bo(e)?t(e.inferred):n()}function K$(e,t,n,o){return Ae(ee(e,n,o),i=>U(y.Assign(y.Assign(e,i),{[t]:n})),()=>B())}function z$(e,t){return U(e)}function Y$(e,t,n,o,i){return Ae(ee(e,t,n),a=>Ae(ee(a,t,o),c=>U(c),()=>B()),()=>Ae(ee(e,t,i),a=>U(a),()=>B()))}function V$(e,t,n){let o=wt(n);return ee(e,t,o)}function YI(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(ee(e,t,o),a=>YI(a,t,i),()=>B()),()=>U(e))}function Q$(e,t,n){let o=ht(n);return ee(e,t,o)}function VI(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(ee(e,t,o),a=>U(a),()=>VI(e,t,i)),()=>B())}function ae(e,t,n){return Ve(n)?z$(e,t):Le(n)?Y$(e,t,n.if,n.then,n.else):ze(n)?V$(e,t,n.enum):Ke(n)?K$(e,n.name,t,n.extends):M(n)?YI(e,t,n.allOf):Ee(n)?Q$(e,t,n.pattern):R(n)?VI(e,t,n.anyOf):et(n)?U(e):B()}function QI(e,t,n){return Ke(n)?ae(e,t,n):Ve(n)?U(e):et(n)?U(e):om(e)}function W$(e,t){let n=Bn(e),o=Bn(t);return n&&o||!n&&o?!0:!(n&&!o)}function WI(e,t,n,o){return Z(o)?W$(t,o)?ee(e,n,o.items):B():ae(e,t,o)}function ZI(e,t,n){return vt(n)?U(e):ae(e,t,n)}function XI(e,t,n){return _t(n)?U(e):ae(e,t,n)}function Z$(e,t,n,o,i){let a=Ke(o)?t:o,c=Ke(o)?o:t,l=Je(t),m=Je(o);return!l&&m?B():Ae(ee(e,a,c),f=>Pa(f,n,i),()=>B())}function X$(e,t,n,o){return s.ShiftLeft(o,(i,a)=>Z$(e,t,n,i,a),()=>Je(t)?U(e):B())}function J$(e,t,n){return s.ShiftLeft(t,(o,i)=>X$(e,o,i,n),()=>U(e))}function Pa(e,t,n){return J$(e,t,n)}function bp(e,t,n){return kt(n)?U(e):ee(e,t,n)}function JI(e,t,n,o){return Ve(o)?U(e):et(o)?U(e):Be(o)?Ae(Pa(e,t,o.parameters),i=>bp(i,n,o.instanceType),()=>B()):B()}function eb(e,t,n,o,i){return Ae(ee(e,t,i),()=>ee(e,n,i),()=>ee(e,o,i))}function tb(e,t,n){let o=wt(t);return ee(e,o,n)}function rb(e,t,n,o){return Ve(o)?U(e):et(o)?U(e):He(o)?Ae(Pa(e,t,o.parameters),i=>bp(i,n,o.returnType),()=>B()):B()}function nb(e,t,n){return ot(n)?U(e):Ce(n)?U(e):ae(e,t,n)}function ob(e,t,n){let o=we(t);return ee(e,o,n)}function Sp(e,t,n){return t===n?U(e):B()}function e1(e,t,n){return Q(n)?Sp(e,t,n.const):vt(n)?U(e):ae(e,z(t),n)}function t1(e,t,n){return Q(n)?Sp(e,t,n.const):_t(n)?U(e):ae(e,z(t),n)}function r1(e,t,n){return Q(n)?Sp(e,t,n.const):Ce(n)?U(e):ae(e,z(t),n)}function n1(e,t,n){return Q(n)?Sp(e,t,n.const):We(n)?U(e):ae(e,z(t),n)}function ib(e,t,n){return s.IsBigInt(t.const)?e1(e,t.const,n):s.IsBoolean(t.const)?t1(e,t.const,n):s.IsNumber(t.const)?r1(e,t.const,n):s.IsString(t.const)?n1(e,t.const,n):fe()}function ab(e,t,n){return Ke(n)?ae(e,t,n):U(e)}function sb(e,t,n){return gr(n)?U(e):ae(e,t,n)}function cb(e,t,n){return Ce(n)?U(e):ae(e,t,n)}function o1(e,t,n){return Je(t)?Je(n)?U(e):B():U(e)}function i1(e,t,n){return Ke(n)&&tr(n.extends)?B():Ae(ee(e,t,n),o=>o1(o,t,n),()=>B())}function a1(e,t){return e.reduce((n,o)=>o in t?Bo(t[o])?{...n,...t[o].inferred}:fe():fe(),{})}function s1(e,t,n){let o={};for(let c of s.Keys(n))o[c]=c in t?i1({},t[c],n[c]):Je(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=>Bo(c)),a=i?a1(s.Keys(o),o):{};return i?U(a):B()}function c1(e,t,n){let o=s1(e,t,n);return Bo(o)?U(y.Assign(e,o.inferred)):B()}function p1(e,t,n){return c1(e,t,n)}function u1(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 pb(e,t,n,o){return s.ShiftLeft(t,(i,a)=>Ae(ee({},e[i],n),c=>pb(e,a,n,u1(o,c)),()=>B()),()=>U(o))}function l1(e,t,n,o){let i=s.Keys(t);return pb(t,i,o,e)}function ub(e,t,n){return de(n)?l1(e,t,it(n),Se(n)):D(n)?p1(e,t,n.properties):ae(e,k(t),n)}function m1(e,t){return s.IsEqual(s.Keys(t).length,0)?U(e):B()}function d1(e,t,n,o,i){return ee(e,n,i)}function lb(e,t,n,o){return de(o)?d1(e,Hc(t),n,Hc(it(o)),Se(o)):D(o)?m1(e,o.properties):Ve(o)?U(e):et(o)?U(e):B()}function mb(e,t,n){return We(n)?U(e):ae(e,t,n)}function db(e,t,n){return hr(n)?U(e):ae(e,t,n)}function fb(e,t,n){let o=ht(t);return ee(e,o,n)}function im(e,t){return y.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Ua(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 am(e){return un(e)?Ke(e.items)?Z(e.items.extends)?im(e.items.name,e.items.extends.items):et(e.items.extends)?im(e.items.name,e.items.extends):void 0:fe():void 0}function Ap(e){return Ke(e)?im(e.name,e.extends):void 0}function sm(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>Ae(ee({},o,t),()=>sm(i,t,[...n,o]),()=>{}),()=>n)}function gb(e,t,n,o){let i=sm(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:ke(i)})):B()}function Op(e,t,n,o){let i=sm(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:F(i)})):B()}function f1(e){return[...e].reverse()}function cm(e,t){return t?f1(e):e}function g1(e){let t=e.length>0?e[0]:void 0,n=Ue(t)?am(t):void 0;return Ue(n)}function h1(e,t,n,o,i,a){return Ae(ee(e,n,i),c=>hb(c,t,o,a),()=>B())}function y1(e,t,n,o,i){let a=am(o);return Ua(a)?gb(e,a.name,cm(n,t),a.type):s.ShiftLeft(n,(c,l)=>h1(e,t,c,l,o,i),()=>B())}function T1(e,t,n,o){return s.ShiftLeft(o,(i,a)=>y1(e,t,n,i,a),()=>s.IsEqual(n.length,0)?U(e):B())}function hb(e,t,n,o){return T1(e,t,n,o)}function E1(e,t,n){let o=fn(e,be([],[]),n),i=g1(o);return hb(e,i,cm(t,i),cm(o,i))}function yb(e,t,n){let o=Ap(n);return Ua(o)?Op(e,o.name,t,o.type):s.ShiftLeft(t,(i,a)=>Ae(ee(e,i,n),c=>yb(c,a,n),()=>B()),()=>U(e))}function Tb(e,t,n){let o=fn(e,be([],[]),t);return Y(n)?E1(e,o,n.items):Z(n)?yb(e,o,n.items):ae(e,ke(o),n)}function Eb(e,t,n){return kt(n)?U(e):nr(n)?U(e):ae(e,t,n)}function _b(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(ee(e,t,o),a=>U(a),()=>_b(e,t,i)),()=>B())}function pm(e,t,n){return s.ShiftLeft(t,(o,i)=>Ae(_b(e,o,n),a=>pm(a,i,n),()=>B()),()=>U(e))}function Ib(e,t,n){let o=Ap(n);return Ua(o)?Op(e,o.name,t,o.type):R(n)?pm(e,t,n.anyOf):pm(e,t,[n])}function bb(e,t,n){return Ke(n)?ae(e,t,n):Ve(n)?U(e):et(n)?U(e):B()}function Sb(e,t,n){return kt(n)?U(e):ae(e,t,n)}function ee(e,t,n){return Ve(t)?QI(e,t,n):Z(t)?WI(e,t,t.items,n):vt(t)?ZI(e,t,n):_t(t)?XI(e,t,n):Be(t)?JI(e,t.parameters,t.instanceType,n):Le(t)?eb(e,t.if,t.then,t.else,n):ze(t)?tb(e,t.enum,n):He(t)?rb(e,t.parameters,t.returnType,n):ot(t)?nb(e,t,n):M(t)?ob(e,t.allOf,n):Q(t)?ib(e,t,n):tr(t)?ab(e,t,n):gr(t)?sb(e,t,n):Ce(t)?cb(e,t,n):D(t)?ub(e,t.properties,n):de(t)?lb(e,it(t),Se(t),n):We(t)?mb(e,t,n):hr(t)?db(e,t,n):Ee(t)?fb(e,t.pattern,n):Y(t)?Tb(e,t.items,n):nr(t)?Eb(e,t,n):R(t)?Ib(e,t.anyOf,n):et(t)?bb(e,t,n):kt(t)?Sb(e,t,n):B()}function _1(e,t){return we([...e,k(t)])}function um(e,t,n){return K(e)?y.Update(_1(e,t),{},n):ba(e,t,n)}function Ab(e,t,n,o,i){let a=jt(e,t,n),c=wa(e,t,o);return um(a,c,i)}function ba(e,t,n={}){return v("Interface",[e,t],n)}function Ho(e){return Ue(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function Ob(e,t,n={}){return um(e,t,n)}function I1(e,t,n){return e.includes(n)?!0:va([...e,n],t,t[n])}function xb(e,t,n){let o=Rc(n);return Zn(e,t,o)}function Zn(e,t,n){return s.ShiftLeft(n,(o,i)=>va(e,t,o)?!0:Zn(e,t,i),()=>!1)}function va(e,t,n){return ce(n)?I1(e,t,n.$ref):Z(n)?va(e,t,n.items):Be(n)?Zn(e,t,[...n.parameters,n.instanceType]):He(n)?Zn(e,t,[...n.parameters,n.returnType]):Ho(n)?xb(e,t,n.parameters[1]):M(n)?Zn(e,t,n.allOf):D(n)?xb(e,t,n.properties):R(n)?Zn(e,t,n.anyOf):Y(n)?Zn(e,t,n.items):de(n)?va(e,t,Se(n)):!1}function Rb(e,t,n){return va(e,t,n)}function b1(e,t){return t.reduce((n,o)=>Rb([o],e,e[o])?[...n,o]:n,[])}function Cb(e){let t=xc(e);return b1(e,t)}function S1(e,t,n){return n.includes(t)?n:t in e?Na(e,e[t],[...n,t]):fe()}function Pb(e,t,n){let o=Rc(t);return Ko(e,o,n)}function Ko(e,t,n){return t.reduce((o,i)=>Na(e,i,o),n)}function Na(e,t,n){return ce(t)?S1(e,t.$ref,n):Z(t)?Na(e,t.items,n):Be(t)?Ko(e,[...t.parameters,t.instanceType],n):He(t)?Ko(e,[...t.parameters,t.returnType],n):Ho(t)?Pb(e,t.parameters[1],n):M(t)?Ko(e,t.allOf,n):D(t)?Pb(e,t.properties,n):R(t)?Ko(e,t.anyOf,n):Y(t)?Ko(e,t.items,n):de(t)?Na(e,Se(t),n):n}function Ub(e,t,n){return Na(e,n,[t])}function A1(e){return wo()}function O1(e){return s.Keys(e).reduce((t,n)=>({...t,[n]:Xn(e[n])}),{})}function La(e){return e.reduce((t,n)=>[...t,Xn(n)],[])}function Xn(e){return ce(e)?A1(e.$ref):Z(e)?Pt(Xn(e.items),Po(e)):Be(e)?ur(La(e.parameters),Xn(e.instanceType)):He(e)?lr(La(e.parameters),Xn(e.returnType)):M(e)?ut(La(e.allOf)):D(e)?k(O1(e.properties)):de(e)?Go(pn(e),Xn(Se(e))):R(e)?F(La(e.anyOf)):Y(e)?ke(La(e.items)):e}function x1(e,t){return t in e?Xn(e[t]):Qe()}function wb(e){return x1(e.$defs,e.$ref)}function R1(e,t,n){let o=jt(e,be([],[]),t),i=wa({},be([],[]),n);return we([...o,k(i)])}function C1(e,t){return s.Keys(e).filter(o=>t.includes(o)).reduce((o,i)=>{let a=e[i],c=Ho(a)?R1(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function vb(e,t,n){let o=Ub(e,t,n),i=C1(e,o);return dr(i,t)}function Nb(e,t){return t in e?ce(e[t])?Nb(e,e[t].$ref):e[t]:me()}function yr(e,t){return Nb(e,t)}function Lb(e){return Te(e)?wb(e):Cc(e)?Qe():e}function dt(e,t,n){let o=Lb(t),i=Lb(n);return ee(e,o,i)}var ya="equal",P1="disjoint",Ta="left-inside",Ea="right-inside";function Vn(e,t){let n=[et(e)?G.ExtendsFalse():dt({},e,t),et(e)?G.ExtendsTrue({}):dt({},t,e)];return G.IsExtendsTrueLike(n[0])&&G.IsExtendsTrueLike(n[1])?ya:G.IsExtendsTrueLike(n[0])&&G.IsExtendsFalse(n[1])?Ta:G.IsExtendsFalse(n[0])&&G.IsExtendsTrueLike(n[1])?Ea:P1}function U1(e,t){return t.filter(n=>Vn(e,n)!==Ea)}function w1(e,t){let n=t.some(o=>{let i=Vn(e,o);return s.IsEqual(i,Ta)||s.IsEqual(i,ya)});return s.IsEqual(n,!1)}function v1(e,t){let n=Vt(e);return Ve(n)?[n]:w1(n,t)?[...U1(n,t),n]:t}function N1(e){return e.reduce((t,n)=>D(n)?[...t,n]:tr(n)?t:v1(n,t),[])}function Fl(e){let t=N1(e);return Do(t)}function lm(e,t){return y.Update(Vt(e),{},t)}function kb(e,t,n,o){let i=O(e,t,n);return lm(i,o)}function ka(e,t=[]){return nn(e)&&s.IsEqual(e.action,"Conditional")?ce(e.parameters[0])?ka(e.parameters[2],ka(e.parameters[3],[...t,e.parameters[0].$ref])):ka(e.parameters[2],ka(e.parameters[3],t)):nn(e)&&s.IsEqual(e.action,"Mapped")&&nn(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 L1(e,t){return e.reduce((n,o)=>[...n,t.includes(o.name)],[])}function Gb(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>s.ShiftLeft(t,(a,c)=>Gb(i,c,[...n,[a,o]]),()=>n),()=>n)}function k1(e){return Ee(e)?ht(e.pattern):ze(e)?wt(e.enum):e}function M1(e){let t=k1(e);return R(t)?[...t.anyOf]:[t]}function D1(e,t){return e.reduce((n,o)=>[...n,[...o,t]],[])}function Mb(e,t){return t.reduce((n,o)=>[...n,...D1(e,o)],[])}function Db(e){return e.reduce((t,n)=>s.IsEqual(n[0],!0)?Mb(t,M1(n[1])):Mb(t,[n[1]]),[[]])}function $b(e,t,n){let o=ka(n),i=L1(e,o),a=Gb(t,i);return nn(n)&&s.IsEqual(n.action,"Conditional")||nn(n)&&s.IsEqual(n.action,"Mapped")?Db(a):[t]}function G1(){return["(not-resolvable)",me()]}function $1(){return["(not-generic)",me()]}function j1(e,t,n){return[e,on(t,n)]}function q1(e,t,n){return t in e?jb(e,t,e[t],n):G1()}function jb(e,t,n,o){return Uo(n)?j1(t,n.parameters,n.expression):ce(n)?q1(e,n.$ref,o):$1()}function qb(e,t,n){return jb(e,"(anonymous)",t,n)}function F1(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 Fb(e,t,n,o,i){let a=O(e,t,i);return F1(n,a,o),y.Assign(e,{[n]:a})}function B1(e,t,n,o,i){let a=O(e,t,n.extends),c=O(e,t,n.equals);return s.ShiftLeft(i,(l,m)=>mm(Fb(e,t,n.name,a,l),t,o,m),()=>mm(Fb(e,t,n.name,a,c),t,o,[]))}function mm(e,t,n,o){return s.ShiftLeft(n,(i,a)=>B1(e,t,i,a,o),()=>e)}function Bb(e,t,n,o){return mm(e,t,n,o)}var dm=0,fm=0;function H1(){if(!s.IsLessThan(fm,rt.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function K1(){H1(),fm++,dm++}function z1(){dm--,s.IsEqual(dm,0)&&(fm=0)}function Y1(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function V1(e,t){return s.IsEqual(Y1(e),t)}function Q1(e,t,n,o,i,a){K1();try{let c=Bb(e,t,o,a),l=O(c,be([...t.callstack,n.$ref],t.visited),i);return O(c,be([],[]),l)}finally{z1()}}function W1(e,t,n,o,i,a){return a.reduce((c,l)=>{let m=Q1(e,t,n,o,i,l);return[...c,m]},[])}function Z1(e,t,n,o,i,a){let c=$b(o,a,i),l=W1(e,t,n,o,i,c);return s.IsEqual(l.length,1)?l[0]:Lt(l)}function xp(e,t,n,o){let i=jt(e,t,o),a=qb(e,n,o),c=a[0],l=a[1];return Uo(l)?V1(t,c)?Sa(nt(c),i):Z1(e,t,nt(c),l.parameters,l.expression,i):Sa(n,i)}function Sa(e,t){return y.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Hb(e,t){return xp({},be([],[]),e,t)}function zo(e){return w(e,"Call")}function X1(e){return y.Discard(e,["~immutable"])}function Kb(e,t){return y.Update(X1(e),{},t)}function zb(e,t,n,o){let i=O(e,t,n);return Kb(i,o)}function Yb(e,t){return e(t)}function Vb(e,t){return s.IsString(t)?z(Yb(e,t)):z(t)}function Qb(e,t){let n=ht(t);return Dr(e,n)}function Wb(e,t){let n=t.map(o=>Dr(e,o));return F(n)}function Dr(e,t){return Q(t)?Vb(e,t.const):Ee(t)?Qb(e,t.pattern):R(t)?Wb(e,t.anyOf):t}function Qc(e,t={}){return v("Capitalize",[e],t)}function Zb(e,t={}){return gm(e,t)}function Wc(e,t={}){return v("Lowercase",[e],t)}function Xb(e,t={}){return hm(e,t)}function Zc(e,t={}){return v("Uncapitalize",[e],t)}function Jb(e,t={}){return ym(e,t)}function Xc(e,t={}){return v("Uppercase",[e],t)}function eS(e,t={}){return Tm(e,t)}var J1=e=>e[0].toUpperCase()+e.slice(1),ej=e=>e.toLowerCase(),tj=e=>e[0].toLowerCase()+e.slice(1),rj=e=>e.toUpperCase();function gm(e,t){return K([e])?y.Update(Dr(J1,e),{},t):Qc(e,t)}function hm(e,t){return K([e])?y.Update(Dr(ej,e),{},t):Wc(e,t)}function ym(e,t){return K([e])?y.Update(Dr(tj,e),{},t):Zc(e,t)}function Tm(e,t){return K([e])?y.Update(Dr(rj,e),{},t):Xc(e,t)}function tS(e,t,n,o){let i=O(e,t,n);return gm(i,o)}function rS(e,t,n,o){let i=O(e,t,n);return hm(i,o)}function nS(e,t,n,o){let i=O(e,t,n);return ym(i,o)}function oS(e,t,n,o){let i=O(e,t,n);return Tm(i,o)}function Jc(e,t,n,o,i={}){return v("Conditional",[e,t,n,o],i)}function iS(e,t,n,o,i={}){return Em({},be([],[]),e,t,n,o,i)}function nj(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 Em(e,t,n,o,i,a,c){return K([n,o])?y.Update(nj(e,t,n,o,i,a),{},c):Jc(n,o,i,a,c)}function aS(e,t,n,o,i,a,c){let l=O(e,t,n),m=O(e,t,o);return Em(e,t,l,m,i,a,c)}function ep(e,t={}){return v("ConstructorParameters",[e],t)}function sS(e,t={}){return _m(e,t)}function oj(e){let t=Be(e)?e.parameters:[],n=fn({},be([],[]),t);return ke(n)}function _m(e,t){return K([e])?y.Update(oj(e),{},t):ep(e,t)}function cS(e,t,n,o){let i=O(e,t,n);return _m(i,o)}function tp(e,t,n={}){return v("Exclude",[e,t],n)}function pS(e,t,n={}){return Ma(e,t,n)}function Ma(e,t,n){return K([e,t])?y.Update(qc(e,t),{},n):tp(e,t,n)}function uS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Ma(a,c,i)}function rp(e,t,n={}){return v("Extract",[e,t],n)}function lS(e,t,n={}){return Im(e,t,n)}function ij(e,t){let n=dt({},e,t);return G.IsExtendsTrueLike(n)?[e]:[]}function aj(e,t){return e.reduce((n,o)=>[...n,...ij(o,t)],[])}function mS(e,t){let n=Vt(e),o=R(n)?n.anyOf:[n],i=aj(o,t);return Lt(i)}function Im(e,t,n){return K([e,t])?y.Update(mS(e,t),{},n):rp(e,t,n)}function dS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Im(a,c,i)}function sj(e){return e.reduce((t,n)=>Nc(n)?[...t,z(n)]:t,[])}function Yo(e){let t=sj(e);return F(t)}function Aa(e,t,n={}){return v("Index",[e,t],n)}function fS(e,t,n={}){let o=s.IsArray(t)?Yo(t):t;return bm(e,o,n)}function gS(e,t){let n=yr(e,t);return qt(n)}function hS(e,t,n){let o=rr(e,t,n);return qt(o)}function cj(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 yS(e){return e.reduce((t,n)=>cj(t,qt(n)),{})}function TS(e){let t=ST(ke(e));return qt(t)}function pj(e,t){return s.Keys(e).filter(i=>i in t).reduce((i,a)=>({...i,[a]:Lt([e[a],t[a]])}),{})}function ES(e,t){return s.ShiftLeft(e,(n,o)=>ES(o,pj(t,qt(n))),()=>t)}function _S(e){return s.ShiftLeft(e,(t,n)=>ES(n,qt(t)),()=>fe())}function qt(e){return Te(e)?gS(e.$defs,e.$ref):Le(e)?hS(e.if,e.then,e.else):M(e)?yS(e.allOf):R(e)?_S(e.anyOf):Y(e)?TS(e.items):D(e)?e.properties:{}}function Vo(e){let t=qt(e);return k(t)}var uj=new RegExp("^(?:0|[1-9][0-9]*)$");function Qo(e){let t=`${e}`;return uj.test(t)?parseInt(t):e}function lj(e){return z(Qo(e))}function IS(e){return e.map(t=>bS(t))}function bS(e){return M(e)?ut(IS(e.allOf)):R(e)?F(IS(e.anyOf)):Q(e)?lj(e.const):e}function SS(e,t){let n=bS(t),o=dt({},n,Nt());return G.IsExtendsTrueLike(o)?e:Q(t)&&s.IsEqual(t.const,"length")?Nt():me()}function AS(e,t){let n=yr(e,t);return Mt(n)}function OS(e,t,n){let o=rr(e,t,n);return Mt(o)}function xS(e){let t=wt(e);return Mt(t)}function RS(e){let t=we(e);return Mt(t)}function CS(e){return[`${e}`]}function PS(e){let t=ht(e);return Mt(t)}function US(e){return e.reduce((t,n)=>[...t,...Mt(n)],[])}function Mt(e){return Te(e)?AS(e.$defs,e.$ref):Le(e)?OS(e.if,e.then,e.else):ze(e)?xS(e.enum):M(e)?RS(e.allOf):Q(e)?CS(e.const):Ee(e)?PS(e.pattern):R(e)?US(e.anyOf):[]}function Wo(e){return Mt(e)}function Da(e,t){return t.map(n=>Ga(e,n))}function Ga(e,t){return Z(t)?Pt(Ga(e,t.items)):Be(t)?ur(Da(e,t.parameters),Ga(e,t.instanceType)):He(t)?lr(Da(e,t.parameters),Ga(e,t.returnType)):Y(t)?ke(Da(e,t.items)):R(t)?F(Da(e,t.anyOf)):M(t)?ut(Da(e,t.allOf)):zc(t)?k(e):t}function wS(e,t){return Ga(e,t)}function mj(e,t){let n=t in e?e[t]:me();return wS(e,n)}function vS(e,t){return t.reduce((n,o)=>[...n,mj(e,o)],[])}function dj(e,t){let n=Wo(t),o=vS(e,n);return Lt(o)}var fj=new RegExp(cn);function gj(e){return e.filter(n=>fj.test(n))}function hj(e){let t=xc(e),n=gj(t),o=vS(e,n);return Lt(o)}function NS(e,t){return Ce(t)?hj(e):dj(e,t)}function yj(e){return z(Qo(e))}function LS(e){return e.map(t=>Sm(t))}function Sm(e){return M(e)?ut(LS(e.allOf)):R(e)?F(LS(e.anyOf)):Q(e)?yj(e.const):e}function Tj(e,t){return e.reduceRight((n,o,i)=>{let a=dt({},z(i),t);return G.IsExtendsTrueLike(a)?[o,...n]:n},[])}function Ej(e,t){let n=Sm(t),o=Tj(e,n);return kr(o)}function _j(e){return kr(e)}function kS(e,t){return Q(t)&&s.IsEqual(t.const,"length")?z(e.length):Ce(t)||ot(t)?_j(e):Ej(e,t)}function MS(e,t){return Z(e)?SS(e.items,t):D(e)?NS(e.properties,t):Y(e)?kS(e.items,t):me()}function Ij(e){return Te(e)||Le(e)||M(e)||R(e)?Vo(e):e}function bm(e,t,n){return K([e,t])?y.Update(MS(Ij(e),t),{},n):Aa(e,t,n)}function DS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return bm(a,c,i)}function np(e,t={}){return v("InstanceType",[e],t)}function GS(e,t={}){return Am(e,t)}function bj(e){return Be(e)?e.instanceType:me()}function Am(e,t){return K([e])?y.Update(bj(e),{},t):np(e,t)}function $S(e,t,n,o={}){let i=O(e,t,n);return Am(i,o)}function Oa(e,t={}){return v("KeyOf",[e],t)}function jS(e,t={}){return Om(e,t)}function qS(){return F([Nt(),It(),ko()])}function FS(e){return Nt()}function Sj(e){return e.reduce((n,o)=>Nc(o)?[...n,z(Qo(o))]:fe(),[])}function BS(e){let t=s.Keys(e),n=Sj(t);return kr(n)}function HS(e){return pn(e)}function KS(e){let t=e.map((n,o)=>z(o));return kr(t)}function zS(e){return Ve(e)?qS():Z(e)?FS(e.items):D(e)?BS(e.properties):de(e)?HS(e):Y(e)?KS(e.items):me()}function Aj(e){return Te(e)||Le(e)||M(e)||R(e)?Vo(e):e}function Om(e,t){return K([e])?y.Update(zS(Aj(e)),{},t):Oa(e,t)}function YS(e,t,n,o){let i=O(e,t,n);return Om(i,o)}function Ia(e,t,n,o,i={}){return v("Mapped",[e,t,n,o],i)}function VS(e,t,n,o,i={}){return xm({},be([],[]),e,t,n,o,i)}function Oj(e){let t=ht(e);return Rp(t)}function xj(e){return e.reduce((t,n)=>[...t,...Rp(n)],[])}function Rj(e){let t=wt(e);return Rp(t)}function Cj(e){return s.IsNumber(e)?[z(`${e}`)]:[z(e)]}function Rp(e){return ze(e)?Rj(e.enum):Q(e)?Cj(e.const):Ee(e)?Oj(e.pattern):R(e)?xj(e.anyOf):[e]}function QS(e){return Rp(e)}function Pj(e){return Ee(e)?ht(e.pattern):e}function Uj(e,t,n,o,i,a){let c=y.Assign(e,{[n.name]:o}),l=O(c,t,i),m=Pj(l),f=O(c,t,a);return Lc(m)||kc(m)?{[m.const]:f}:{}}function wj(e,t,n,o,i,a){return o.reduce((c,l)=>[...c,Uj(e,t,n,l,i,a)],[])}function vj(e){return e.reduce((t,n)=>[...t,k(n)],[])}function WS(e,t,n,o,i,a){let c=QS(o),l=wj(e,t,n,c,i,a),m=vj(l);return we(m)}function xm(e,t,n,o,i,a,c){return K([o])?y.Update(WS(e,t,n,o,i,a),{},c):Ia(n,o,i,a,c)}function ZS(e,t,n,o,i,a,c){let l=O(e,t,o);return xm(e,t,n,l,i,a,c)}function Nj(e,t,n){let o=y.Assign(e,t);return s.Keys(t).filter(a=>n.includes(a)).reduce((a,c)=>({...a,[c]:vb(o,c,t[c])}),{})}function Lj(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 kj(e,t,n){let o=Cb(t),i=Nj(e,t,o),a=Lj(e,t,o),c={...i,...a};return y.Update(c,{},n)}function Cp(e,t,n,o){return kj(e,n,o)}function op(e,t={}){return v("NonNullable",[e],t)}function XS(e,t={}){return Rm(e,t)}function Mj(e){let t=F([Lo(),$o()]);return Ma(e,t,{})}function Rm(e,t){return K([e])?y.Update(Mj(e),{},t):op(e,t)}function JS(e,t,n,o){let i=O(e,t,n);return Rm(i,o)}function ip(e,t,n={}){return v("Omit",[e,t],n)}function eA(e,t,n={}){let o=s.IsArray(t)?Yo(t):t;return Cm(e,o,n)}function Pp(e){let t=Vo(e);return D(t)?t.properties:fe()}function Dj(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?o:{...o,[i]:e[i]},{})}function tA(e,t){let n=Pp(e),o=Wo(t),i=Dj(n,o);return k(i)}function Cm(e,t,n){return K([e,t])?y.Update(tA(e,t),{},n):ip(e,t,n)}function rA(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Cm(a,c,i)}function ap(e,t={}){return v("Parameters",[e],t)}function nA(e,t={}){return Pm(e,t)}function Gj(e){let t=He(e)?e.parameters:[],n=fn({},be([],[]),t);return ke(n)}function Pm(e,t){return K([e])?y.Update(Gj(e),{},t):ap(e,t)}function oA(e,t,n,o){let i=O(e,t,n);return Pm(i,o)}function sp(e,t={}){return v("Partial",[e],t)}function iA(e,t={}){return Um(e,t)}function aA(e,t){let n=yr(e,t),o=Tr(n);return dr(y.Assign(e,{[t]:o}),t)}function sA(e,t,n){let o=rr(e,t,n);return Tr(o)}function cA(e){let t=we(e);return Tr(t)}function pA(e){let t=e.map(n=>Tr(n));return F(t)}function uA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:$n(e[i])}),{});return k(t)}function Tr(e){return Te(e)?aA(e.$defs,e.$ref):Le(e)?sA(e.if,e.then,e.else):M(e)?cA(e.allOf):R(e)?pA(e.anyOf):D(e)?uA(e.properties):k({})}function Um(e,t){return K([e])?y.Update(Tr(e),{},t):sp(e,t)}function lA(e,t,n,o){let i=O(e,t,n);return Um(i,o)}function cp(e,t,n={}){return v("Pick",[e,t],n)}function mA(e,t,n={}){let o=s.IsArray(t)?Yo(t):t;return wm(e,o,n)}function $j(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function dA(e,t){let n=Pp(e),o=Wo(t),i=$j(n,o);return k(i)}function wm(e,t,n){return K([e,t])?y.Update(dA(e,t),{},n):cp(e,t,n)}function fA(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return wm(a,c,i)}function pp(e,t={}){return v("ReadonlyObject",[e],t)}function vm(e,t={}){return Nm(e,t)}var gA=vm;function hA(e){return No(Pt(e))}function yA(e,t){let n=yr(e,t),o=Er(n);return dr(y.Assign(e,{[t]:o}),t)}function TA(e,t,n){let o=rr(e,t,n);return Er(o)}function EA(e){let t=we(e);return Er(t)}function _A(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:Hn(e[i])}),{});return k(t)}function IA(e){return No(ke(e))}function bA(e){let t=e.map(n=>Er(n));return F(t)}function Er(e){return Z(e)?hA(e.items):Te(e)?yA(e.$defs,e.$ref):Le(e)?TA(e.if,e.then,e.else):M(e)?EA(e.allOf):D(e)?_A(e.properties):Y(e)?IA(e.items):R(e)?bA(e.anyOf):e}function Nm(e,t){return K([e])?y.Update(Er(e),{},t):pp(e)}function SA(e,t,n,o){let i=O(e,t,n);return Nm(i,o)}function AA(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 OA(e,t){let n=yr(e,t),o=_r(n);return dr(y.Assign(e,{[t]:o}),t)}function xA(e,t,n){let o=rr(e,t,n);return _r(o)}function RA(e){let t=we(e);return _r(t)}function CA(e){let t=e.map(n=>_r(n));return F(t)}function PA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:jc(e[i])}),{});return k(t)}function _r(e){return Te(e)?OA(e.$defs,e.$ref):Le(e)?xA(e.if,e.then,e.else):M(e)?RA(e.allOf):R(e)?CA(e.anyOf):D(e)?PA(e.properties):k({})}function up(e,t={}){return v("Required",[e],t)}function UA(e,t={}){return Lm(e,t)}function Lm(e,t){return K([e])?y.Update(_r(e),{},t):up(e,t)}function wA(e,t,n,o){let i=O(e,t,n);return Lm(i,o)}function lp(e,t={}){return v("ReturnType",[e],t)}function vA(e,t={}){return km(e,t)}function jj(e){return He(e)?e.returnType:me()}function km(e,t){return K([e])?y.Update(jj(e),{},t):lp(e,t)}function NA(e,t,n,o={}){let i=O(e,t,n);return km(i,o)}function mp(e,t){return v("With",[e,t],{})}function Up(e,t){return Mm(e,t)}function Mm(e,t){return K([e])?y.Update(e,{},t):mp(e,t)}function LA(e,t,n,o){let i=O(e,t,n);return Mm(i,o)}function qj(e){return un(e)?Y(e.items)?Dm(e.items.items):Ke(e.items)?[e]:ce(e.items)?[e]:[me()]:[e]}function Dm(e){return e.reduce((n,o)=>[...n,...qj(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 wa(e,t,n){return s.Keys(n).reduce((o,i)=>({...o,[i]:O(e,t,n[i])}),{})}function fn(e,t,n){let o=jt(e,t,n);return Dm(o)}function jt(e,t,n){return n.map(o=>O(e,t,o))}function Fj(e,t){let n=Je(e)?pa(t,{}):t,o=Kn(e)?ca(n,{}):n;return Bn(e)?$a(o,{}):o}function Bj(e,t,n,o,i){return s.IsEqual(n,"AddImmutable")?kA(e,t,o[0],i):s.IsEqual(n,"RemoveImmutable")?zb(e,t,o[0],i):s.IsEqual(n,"AddReadonly")?xy(e,t,o[0],i):s.IsEqual(n,"RemoveReadonly")?TT(e,t,o[0],i):s.IsEqual(n,"AddOptional")?Ry(e,t,o[0],i):s.IsEqual(n,"RemoveOptional")?IT(e,t,o[0],i):s.IsEqual(n,"Capitalize")?tS(e,t,o[0],i):s.IsEqual(n,"Conditional")?aS(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?cS(e,t,o[0],i):s.IsEqual(n,"Evaluate")?kb(e,t,o[0],i):s.IsEqual(n,"Exclude")?uS(e,t,o[0],o[1],i):s.IsEqual(n,"Extract")?dS(e,t,o[0],o[1],i):s.IsEqual(n,"Index")?DS(e,t,o[0],o[1],i):s.IsEqual(n,"InstanceType")?$S(e,t,o[0],i):s.IsEqual(n,"Interface")?Ab(e,t,o[0],o[1],i):s.IsEqual(n,"KeyOf")?YS(e,t,o[0],i):s.IsEqual(n,"Lowercase")?rS(e,t,o[0],i):s.IsEqual(n,"Mapped")?ZS(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?Cp(e,t,o[0],i):s.IsEqual(n,"NonNullable")?JS(e,t,o[0],i):s.IsEqual(n,"Pick")?fA(e,t,o[0],o[1],i):s.IsEqual(n,"Parameters")?oA(e,t,o[0],i):s.IsEqual(n,"Partial")?lA(e,t,o[0],i):s.IsEqual(n,"Omit")?rA(e,t,o[0],o[1],i):s.IsEqual(n,"ReadonlyObject")?SA(e,t,o[0],i):s.IsEqual(n,"Record")?GT(e,t,o[0],o[1],i):s.IsEqual(n,"Required")?wA(e,t,o[0],i):s.IsEqual(n,"ReturnType")?NA(e,t,o[0],i):s.IsEqual(n,"TemplateLiteral")?FI(e,t,o[0],i):s.IsEqual(n,"Uncapitalize")?nS(e,t,o[0],i):s.IsEqual(n,"Uppercase")?oS(e,t,o[0],i):s.IsEqual(n,"With")?LA(e,t,o[0],o[1]):v(n,o,i)}function Hj(e,t,n){let o=ce(n)?AA(e,t,n,n.$ref):Z(n)?Pt(O(e,t,n.items),Po(n)):zo(n)?xp(e,t,n.target,n.arguments):Be(n)?ur(jt(e,t,n.parameters),O(e,t,n.instanceType),Cy(n)):He(n)?lr(jt(e,t,n.parameters),O(e,t,n.returnType),Py(n)):Le(n)?jn(O(e,t,n.if),O(e,t,n.then),O(e,t,n.else),ky(n)):M(n)?ut(jt(e,t,n.allOf),jy(n)):D(n)?k(wa(e,t,n.properties),Ny(n)):de(n)?Bc(it(n),O(e,t,Se(n))):un(n)?Qn(O(e,t,n.items)):Y(n)?ke(fn(e,t,n.items),yT(n)):R(n)?F(jt(e,t,n.anyOf),sT(n)):n;return Fj(n,o)}function O(e,t,n){return nn(n)?Bj(e,t,n.action,n.parameters,n.options):Hj(e,t,n)}function Qt(e,t){return O(e,be([],[]),t)}function Kj(e){return y.Update(e,{"~immutable":!0},{})}function $a(e,t){return y.Update(Kj(e),{},t)}function kA(e,t,n,o){let i=O(e,t,n);return $a(i,o)}function G_(e,t={}){return v("AddImmutable",[e],t)}function No(e,t={}){return $a(e,t)}function $_(e,t={}){return v("Evaluate",[e],t)}function ft(e,t={}){return lm(e,t)}function j_(e,t={}){return v("Module",[e],t)}function MA(e,t={}){return Cp({},be([],[]),e,t)}function zj(e,t){let n=Vn(e,t);return s.IsEqual(n,"right-inside")||s.IsEqual(n,"disjoint")?1:0}function DA(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>s.IsEqual(zj(e,o),1)?DA(e,i,[...n,o]):[...n,e,...t],()=>[...n,e])}function GA(e,t=[]){return s.ShiftLeft(e,(n,o)=>GA(o,DA(n,t)),()=>t)}function $A(e){return GA(e)}function jA(...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=DI(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:()=>wo,Array:()=>Pt,BigInt:()=>da,Boolean:()=>wc,Call:()=>Hb,Capitalize:()=>Zb,Codec:()=>Pc,Conditional:()=>iS,Constructor:()=>ur,ConstructorParameters:()=>sS,Cyclic:()=>dr,Decode:()=>Zy,DecodeBuilder:()=>ma,Dependent:()=>jn,Encode:()=>Xy,EncodeBuilder:()=>la,Enum:()=>$y,Evaluate:()=>ft,Exclude:()=>pS,Extends:()=>dt,ExtendsResult:()=>G,Extract:()=>lS,Function:()=>lr,Generic:()=>on,Identifier:()=>fa,Immutable:()=>Jy,Index:()=>fS,Infer:()=>ua,InstanceType:()=>GS,Instantiate:()=>Qt,Integer:()=>zn,Interface:()=>Ob,Intersect:()=>ut,IsAny:()=>Ve,IsArray:()=>Z,IsBigInt:()=>vt,IsBoolean:()=>_t,IsCall:()=>zo,IsCodec:()=>Fn,IsConstructor:()=>Be,IsCyclic:()=>Te,IsDependent:()=>Le,IsEnum:()=>ze,IsEnumValue:()=>Gy,IsFunction:()=>He,IsGeneric:()=>Uo,IsIdentifier:()=>nT,IsImmutable:()=>Bn,IsInfer:()=>Ke,IsInteger:()=>ot,IsIntersect:()=>M,IsKind:()=>w,IsLiteral:()=>Q,IsNever:()=>tr,IsNull:()=>gr,IsNumber:()=>Ce,IsObject:()=>D,IsOptional:()=>Je,IsParameter:()=>aT,IsReadonly:()=>Kn,IsRecord:()=>de,IsRef:()=>ce,IsRefine:()=>Uc,IsRest:()=>un,IsSchema:()=>Ue,IsString:()=>We,IsSymbol:()=>hr,IsTemplateLiteral:()=>Ee,IsThis:()=>zc,IsTuple:()=>Y,IsUndefined:()=>nr,IsUnion:()=>R,IsUnknown:()=>et,IsUnsafe:()=>Cc,IsVoid:()=>kt,KeyOf:()=>jS,Literal:()=>z,Lowercase:()=>Xb,Mapped:()=>VS,Module:()=>MA,Never:()=>me,NonNullable:()=>XS,Null:()=>Lo,Number:()=>Nt,Object:()=>k,Omit:()=>eA,Optional:()=>wy,Parameter:()=>Yn,Parameters:()=>nA,Partial:()=>iA,Pick:()=>mA,Readonly:()=>eT,ReadonlyObject:()=>vm,ReadonlyType:()=>gA,Record:()=>Go,RecordKey:()=>pn,RecordPattern:()=>it,RecordValue:()=>Se,Ref:()=>nt,Refine:()=>tT,Required:()=>UA,Rest:()=>Qn,ReturnType:()=>vA,Script:()=>jA,String:()=>It,Symbol:()=>ko,TemplateLiteral:()=>HI,This:()=>Kc,Tuple:()=>ke,Uncapitalize:()=>Jb,Undefined:()=>$o,Union:()=>F,Unknown:()=>Qe,Unsafe:()=>Ly,Uppercase:()=>eS,Void:()=>Yc,With:()=>Up});var qA="Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported.";var Yj=tn(BA());var HA="lowercase-email",Gm="iana-timezone",$m="simple-time",jm="simple-date-time";var Vj=(e,t)=>RegExp(`^${e.source}(${t.source}${e.source})*$`),Qj=/[a-zA-Z0-9-_]+/,Wj=/\./,$Re=Vj(Qj,Wj);var KA="lowercase-domain";var Zo="kebab-case";var zA="camel-case";var Zj=new Set;function C(e,t,n={}){let o=t.map(i=>{let a=i;return a.$id?(Zj.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})}var Jo=1e3,vp=100,ge={limit:r.Optional(r.Integer({minimum:1,maximum:Jo,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={...ge,limit:r.Optional(r.Integer({minimum:1,maximum:Jo,default:vp,description:`Maximum number of items to return in this page. Omit to use the public API default of ${vp}.`}))},Xj=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."}),KRe=r.Object({pagination:Xj},{$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 Xo=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:Xo,...a});case"kebab-case":return r.String({format:Zo,minLength:i,maxLength:Xo,...a});case"email":return r.String({format:HA,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return r.String({format:KA,minLength:i,maxLength:Xo,...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:`${qA} 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:Xo,...a});case"long":return r.String({minLength:i,maxLength:5e4,...a});case"short":return r.String({minLength:i,maxLength:Xo,...a});case"tsuga-formula":return r.String({format:"tsuga-formula",minLength:i,maxLength:Xo,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:tt(t)}}var ja=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],Np=r.Array(r.Enum(ja,{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"],nCe=r.Enum(qm),Jj=["CLUSTER_AGGREGATION_STRUCTURE"],oCe=r.Object({code:r.Enum(qm),message:r.String()}),YA=[...qm,...Jj,"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"],VA=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var eq=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],tq=[...YA,...VA,...eq],rq=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(ja,{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."}),nq=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`."}),oq=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:nq},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),QA=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(rq,{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(oq,{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(tq,{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(QA)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),aCe=r.Object({code:r.Optional(r.Enum(YA,{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(QA)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),sCe=r.Object({code:r.Optional(r.Enum(VA,{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"}),cCe=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"}),pCe=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 WA(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 Fm="tsuga-cli";var Jn="/v0/oauth",ZA=d({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${Jn}/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)"})}),XA=d({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${Jn}/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()})}),OCe=d({description:"Resolve a signed authorization request handle for the consent page",url:`${Jn}/authorization-request`,method:"GET",query:r.Object({handle:r.String()}),response:r.Object({clientId:r.String(),clientName:r.String(),redirectUri:r.String()})}),xCe=d({description:"Approve or deny an OAuth authorization request from the consent page",url:`${Jn}/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"})})}),RCe=d({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${Jn}/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())})}),iq=["pending","active","revoked"],aq=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(iq),lastUsedAt:r.Optional(A())}),CCe=d({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${Jn}/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(aq)}),PCe=d({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${Jn}/grants/:id`,method:"DELETE",params:r.Object({id:r.String()}),response:N});function JA(e,t){let n=new URL(ZA.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:Fm,redirect_uri:t.redirectUri,code_challenge:t.challenge,code_challenge_method:"S256",state:t.state}).toString(),n.href}function sq(e){if(!e)return{};try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}async function cq(e,t){let n=await fetch(new URL(XA.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=sq(o);if(n.status!==200){let a=i.error??`HTTP ${n.status}`;throw new Error(`OAuth token request failed (${a}${i.error_description?`: ${i.error_description}`:""})`)}if(!i.access_token||typeof i.expires_in!="number")throw new Error("OAuth token response was missing required fields");return{accessToken:i.access_token,expiresAt:new Date(Date.now()+i.expires_in*Al)}}async function eO(e,t){return cq(e,{grant_type:"authorization_code",client_id:Fm,code:t.code,code_verifier:t.verifier,redirect_uri:t.redirectUri})}var Wt=require("node:fs"),Hm=require("node:os"),to=require("node:path");var rO=tn(require("os"),1),qa=tn(require("path"),1),gn=rO.default.homedir(),{env:eo}=process,tO=eo.XDG_DATA_HOME||(gn?qa.default.join(gn,".local","share"):void 0),Lp=eo.XDG_CONFIG_HOME||(gn?qa.default.join(gn,".config"):void 0),LCe=eo.XDG_STATE_HOME||(gn?qa.default.join(gn,".local","state"):void 0),nO=eo.XDG_CACHE_HOME||(gn?qa.default.join(gn,".cache"):void 0),kCe=eo.XDG_RUNTIME_DIR||void 0,pq=(eo.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");tO&&pq.unshift(tO);var uq=(eo.XDG_CONFIG_DIRS||"/etc/xdg").split(":");Lp&&uq.unshift(Lp);var oO=(0,to.join)(Lp??(0,to.join)((0,Hm.homedir)(),".config"),"tsuga"),Fa=(0,to.join)(oO,"config.json"),iO=(0,to.join)(nO??(0,to.join)((0,Hm.homedir)(),".cache"),"tsuga"),Bm=(0,to.join)(iO,"update-check.json"),Ba="https://api.tsuga.com";function aO(e){return Ih(e.credential)}function kp(){if(!(0,Wt.existsSync)(Fa))return{};try{let e=JSON.parse((0,Wt.readFileSync)(Fa,"utf-8")),{operationApiKey:t,userAuth:n,...o}=e;return!t&&!n?e:{...o,credentials:{...e.credentials??{},[Ba]:{...t?{operationApiKey:t}:{},...n?{userAuth:n}:{},...e.credentials?.[Ba]??{}}}}}catch{throw new Error(`Config file corrupted: ${Fa}
|
|
43
|
+
Re-authenticate with \`tsuga auth login\` or \`tsuga auth operation-key <OPERATION_API_KEY>\`.`)}}function Ha(){try{return kp()}catch{return{}}}function Ka(e){(0,Wt.mkdirSync)(oO,{recursive:!0,mode:448}),(0,Wt.writeFileSync)(Fa,`${JSON.stringify(e,null,2)}
|
|
44
|
+
`,{mode:384})}function Km(e,t=ei()){return e.credentials?.[t]??{}}function zm(e,t,n=ei()){return{...e,credentials:{...e.credentials??{},[n]:t}}}function ei(e){return(e?.trim()||process.env.TSUGA_API_URL?.trim()||Ba).replace(/\/+$/,"")}function ti(e){let t=kp(),n=ei(e.apiUrl),o=Km(t,n),i=_h({overrideKey:e.operationApiKey??process.env.TSUGA_OPERATION_API_KEY,operationApiKey:o.operationApiKey,userAuth:o.userAuth}),a=t.defaults??{},c=e.clusterId?.trim()||process.env.TSUGA_CLUSTER_ID?.trim()||a.cluster?.trim()||void 0;return{apiUrl:n,credential:i,clusterId:c,defaults:a}}function sO(){return Km(kp()).userAuth}function cO(e){let t=Ha();Ka(zm(t,{userAuth:e}))}function pO(e){let t=Ha();Ka(zm(t,{operationApiKey:e}))}function uO(){let e=Ha(),t=Km(e);Ka(zm(e,t.operationApiKey?{operationApiKey:t.operationApiKey}:{}))}function za(){return Fa}var lO={from:"-30m",to:"now",query:"*","max-results":"100"};function Gr(e){return(kp().defaults??{})[e]??lO[e]}function mO(e,t){let n=Ha();Ka({...n,defaults:{...n.defaults??{},[e]:t}})}function dO(){let{defaults:e,...t}=Ha();Ka(t)}function fO(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: ${na(o.userAuth.accessToken)} (expires ${o.userAuth.accessExpiresAt})`);break;default:tt(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={...lO,...e.defaults};for(let[a,c]of Object.entries(i)){let l=a in e.defaults?" *":"";n.push(` ${a}: ${c}${l}`)}return`${n.join(`
|
|
45
45
|
`)}
|
|
46
|
-
`}function
|
|
47
|
-
`,{mode:384})}async function
|
|
48
|
-
`),process.exitCode=1;return}if(Qs({kind:"user-session",userAuth:r},new Date)){process.stderr.write("Your session expired. Run `tsuga auth login` to sign in again.\n"),process.exitCode=1;return}q(r.accessToken)}function d$(){let{credential:e}=Ko({});if(!e){q("Not authenticated. Run `tsuga auth login` or `tsuga auth operation-key <OPERATION_API_KEY>`.");return}switch(e.kind){case"user-session":q(`Logged in as a user (token ${Gi(e.userAuth.accessToken)}, expires ${e.userAuth.accessExpiresAt}).`);return;case"operation-api-key":q("Authenticated with an operation API key.");return;default:Xe(e)}}function f$(){Kb(),q("Local user session cleared.")}function Jb(e){let r=e.command("auth").description("Manage authentication: user login (OAuth) or operation API key");r.action(()=>r.help()),r.command("login").description("Log in as a user with a browser authorization flow and save the session (replaces any saved operation API key)").action(l$),r.command("logout").description("Clear the saved user session").action(f$),r.command("token").description("Print the saved user access token to stdout").action(m$),r.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(n=>{Hb(n),q(`Operation API key saved to ${Ua()}`)}),r.command("status").description("Show the current authentication method").action(d$)}var g$=["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"],y$=["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"],h$=["log","metric","trace","rum"],ml=[...y$,...h$],tbe=[...g$,...ml];var Qc=["admin","public_editor","public_viewer","teams_only"],zo=["admin","editor","viewer"];var Bn="/v0/team-membership",dl="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.",fl=t.Object({id:t.String({description:"Tsuga-generated team membership ID assigned when the membership is created."}),userId:t.String({description:"User ID that belongs to the team."}),teamId:t.String({description:"Team ID that contains the user."}),roleKey:t.Enum(zo,{description:dl})}),eS=t.Object({userId:p({allowEmpty:!1,description:"User ID to add to or update in the team."}),teamId:p({allowEmpty:!1,description:"Team ID receiving the membership change."}),roleKey:t.Enum(zo,{description:dl})}),T$=t.Object({userId:p({allowEmpty:!1,description:"User ID to remove from the team."}),teamId:p({allowEmpty:!1,description:"Team ID to remove the user from."})}),E$=t.Optional(t.Object({userId:t.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this user ID."})),teamId:t.Optional(p({allowEmpty:!1,description:"Restrict results to memberships for this team ID."}))})),rbe=m({tags:["access-control"],url:Bn,method:"GET",query:E$,response:t.Array(fl)}),nbe=m({tags:["access-control"],url:Bn,method:"POST",body:eS,response:fl}),obe=m({tags:["access-control"],url:Bn,method:"PUT",body:eS,response:fl}),ibe=m({tags:["access-control"],url:Bn,method:"DELETE",body:T$,response:x}),Vc=500,tS=t.Object({teamId:p({allowEmpty:!1,description:"Team ID receiving all requested memberships."}),members:t.Array(t.Object({userId:t.Optional(p({allowEmpty:!1,description:"Existing user ID to add to the team."})),userEmail:t.Optional(p({allowEmpty:!1,type:"email",description:"Existing user email to resolve and add to the team."})),roleKey:t.Enum(zo,{description:dl})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:Vc,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."}),_$={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(tS,{examples:[_$]});var rS=t.Object({results:t.Array(t.Object({userId:t.String({description:"Resolved user ID for this bulk add result. For `user_not_found`, this is the submitted user ID or email that Tsuga could not resolve."}),status:t.Enum(["added","already_member","user_not_found"],{description:"`added` means the membership was created, `already_member` means no change was needed, and `user_not_found` means Tsuga could not resolve the requested user."})}))},{description:"Per-user result summary for a bulk team-membership add request."}),I$={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(rS,{examples:[I$]});var abe=m({tags:["access-control"],url:`${Bn}/bulk-add`,method:"POST",body:tS,response:rS}),sbe=m({tags:["access-control"],url:`${Bn}/bulk-update-user-roles`,method:"PUT",body:t.Object({userIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:Vc}),teamId:p({allowEmpty:!1}),role:t.Enum(zo)}),response:t.Object({})}),nS=t.Object({teamId:p({allowEmpty:!1,description:"Team ID to remove the requested users from."}),userIds:t.Optional(t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:Vc,description:"User IDs to remove from the team. Items are processed independently: a user who is not a member or cannot be resolved does not stop the other items from being removed."})),userEmails:t.Optional(t.Array(p({allowEmpty:!1,type:"email"}),{minItems:1,maxItems:Vc,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."}),b$={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(nS,{examples:[b$]});var oS=t.Object({results:t.Array(t.Object({userId:t.String({description:"Resolved user ID for this bulk remove result. For `user_not_found`, this is the submitted user ID or email that Tsuga could not resolve."}),status:t.Enum(["removed","not_member","user_not_found"],{description:"`removed` means the membership was deleted, `not_member` means no membership existed, and `user_not_found` means Tsuga could not resolve the requested user."})}))},{description:"Per-user result summary for a bulk team-membership removal request."}),S$={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(oS,{examples:[S$]});var cbe=m({tags:["access-control"],url:`${Bn}/bulk-remove`,method:"DELETE",body:nS,response:oS});var O$=["logs","metrics","traces","llm-obs","profiling","analytics","dashboards","ongoing-alerts","slo","monitor","notification-rules","notification-silences","notification-integrations","investigations","routes","sensitive-data-scanner","inventory","services","rum","sessions","host-catalog","kubernetes"],iS=t.Enum(O$,{description:"Stable nav item key within a main sidebar category."}),aS=t.Array(iS,{description:"Nav item keys shown in the primary sidebar for this category, in display order."}),sS=t.Optional(t.Array(iS,{description:"Nav item keys for this category that are folded away (e.g. View more). Omitted or empty means none."})),cS="Stable category id. Unknown or renamed ids are ignored by the client catalog.",pS="Sidebar categories in display order. Unknown or renamed ids are ignored by the client catalog.",gl=t.Object({categories:t.Array(t.Object({id:t.String({description:cS}),visible:aS,folded:sS}),{description:pS})}),uS=t.Object({categories:t.Array(t.Object({id:p({allowEmpty:!1,description:cS}),visible:aS,folded:sS}),{description:pS})});var Wc="/v0/org",A$=`${Wc}/current-user`,lS=`${Wc}/settings`,mS=`${Wc}/allowed-domains`,Zc=50,dS=t.Object({id:t.String(),name:t.String(),createdAt:E(),allowedDomains:t.Array(t.String(),{description:"Email domains whose users are allowed to join the account, via invitation or SSO/SAML just-in-time provisioning. Domains are stored in lowercase."}),enableLlmFeatures:t.Boolean(),allowEmailPasswordLogin:t.Boolean()}),fS=t.Object({allowedDomains:t.Array(p({allowEmpty:!1,type:"lowercase-domain",description:'A lowercase email domain (e.g. "acme.com").'}),{maxItems:Zc,description:"The new full list of email domains whose users are allowed to join the account via invitation or SSO/SAML just-in-time provisioning. Replaces the existing list; omitted domains are no longer allowed."})}),gS=t.Pick(dS,["allowedDomains"]),hbe=m({tags:["organization"],url:A$,method:"GET",response:dS}),Tbe=m({tags:["organization"],url:lS,method:"GET",response:t.Object({enableLlmFeatures:t.Boolean(),allowEmailPasswordLogin:t.Boolean(),sidebarNavLayout:t.Optional(gl)})}),Ebe=m({tags:["organization"],url:lS,method:"PUT",body:t.Object({enableLlmFeatures:t.Optional(t.Boolean()),allowEmailPasswordLogin:t.Optional(t.Boolean()),sidebarNavLayout:t.Optional(t.Union([uS,t.Null()]))}),response:t.Object({enableLlmFeatures:t.Boolean(),allowEmailPasswordLogin:t.Boolean(),sidebarNavLayout:t.Optional(gl)})}),_be=m({tags:["organization"],url:Wc,method:"PUT",body:fS,response:t.Object({allowedDomains:t.Array(t.String())})}),Ibe=m({tags:["organization"],url:mS,method:"GET",response:gS}),bbe=m({tags:["organization"],url:mS,method:"PUT",body:fS,response:gS});var Xc="/v0/admin",Ge=`${Xc}/clusters`,hS=t.Object({helmParameters:t.Record(t.String(),t.Union([t.Number(),t.Boolean(),t.Null(),t.String()])),helmVersion:t.String()}),yS=t.Record(t.String(),hS),Tl=["eu-central-1","eu-central-2","eu-north-1","eu-south-1","eu-south-2","eu-west-1","eu-west-2","eu-west-3","us-east-1","us-east-2","us-west-1","us-west-2","af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-south-1","ap-south-2","ap-southeast-1","ap-southeast-2","ap-southeast-3","ap-southeast-4","ap-southeast-5","ap-southeast-7","ca-central-1","ca-west-1","il-central-1","me-central-1","me-south-1","mx-central-1","sa-east-1"],El=["europe-west1","europe-west2","europe-west3","europe-west4","europe-west6","europe-west9","europe-central2","europe-north1","us-central1","us-east1","us-east4","us-west1","us-west2","us-west3","us-west4","northamerica-northeast1","southamerica-east1","asia-east1","asia-east2","asia-northeast1","asia-northeast2","asia-northeast3","asia-south1","asia-south2","asia-southeast1","asia-southeast2","australia-southeast1","australia-southeast2"],_l=["australiacentral","australiacentral2","australiaeast","australiasoutheast","austriaeast","belgiumcentral","brazilsouth","brazilsoutheast","canadacentral","canadaeast","centralindia","centralus","chilecentral","eastasia","eastus","eastus2","francecentral","francesouth","germanynorth","germanywestcentral","indonesiacentral","israelcentral","italynorth","japaneast","japanwest","jioindiacentral","jioindiawest","koreacentral","koreasouth","malaysiawest","mexicocentral","newzealandnorth","northcentralus","northeurope","norwayeast","norwaywest","polandcentral","qatarcentral","southafricanorth","southafricawest","southcentralus","southeastasia","southindia","spaincentral","swedencentral","switzerlandnorth","switzerlandwest","uaecentral","uaenorth","uksouth","ukwest","westcentralus","westeurope","westindia","westus","westus2","westus3"],TS=["aws","gcp","azure"],wa=["xs","s","m","l"],Il=["1.0"],x$=["tsuga-cluster","tsuga-telemetry","tsuga-deployer","tsuga-events"],Jc=t.Enum(x$,{description:"Helm installation name identifying a chart component on the cluster."}),R$={id:t.String(),name:t.String(),createdAt:E(),clusterCertificateExpiresAt:E(),bridgeEndpoint:t.String(),deployerEndpoint:t.String(),targetConfiguration:yS,appliedConfiguration:t.Optional(yS),automaticallyDeployLatestVersion:t.Boolean(),automatedDeploymentDisabledBy:t.Optional(t.String()),automatedDeploymentDisabledReason:t.Optional(t.String()),automatedDeploymentDisabledAt:t.Optional(E()),soakTimeMin:t.Optional(t.Number()),clusterSize:t.Optional(t.Enum(wa)),gitSyncByInstallation:t.Record(Jc,t.Boolean(),{description:"Per-installation git-sync state, keyed by installationName."})},yl={...R$,orgId:t.String(),orgName:t.String()},Ube=m({tags:["admin"],method:"GET",url:Ge,query:t.Object({orgId:t.Optional(p())}),response:t.Array(b("clusterType",[t.Object({...yl,clusterType:t.Literal("aws"),clusterAccountId:t.String(),clusterBuilderRoleVersion:t.Optional(t.Enum(Il)),clusterRegion:t.Enum(Tl)}),t.Object({...yl,clusterType:t.Literal("gcp"),clusterAccountId:t.String(),clusterRegion:t.Enum(El)}),t.Object({...yl,clusterType:t.Literal("azure"),clusterTenantId:t.String(),clusterSubscriptionId:t.String(),clusterRegion:t.Enum(_l)})]))}),wbe=m({tags:["admin"],method:"PUT",url:`${Ge}/create`,body:b("clusterType",[t.Object({clusterType:t.Literal("aws"),orgId:p(),name:p(),clusterSize:t.Enum(wa),clusterAccountId:t.String({minLength:12,maxLength:12}),clusterBuilderRoleVersion:t.Enum(Il),clusterRegion:t.Enum(Tl)}),t.Object({clusterType:t.Literal("gcp"),orgId:p(),name:p(),clusterSize:t.Enum(wa),clusterAccountId:p(),clusterRegion:t.Enum(El)}),t.Object({clusterType:t.Literal("azure"),orgId:p(),name:p(),clusterSize:t.Enum(wa),clusterTenantId:p(),clusterSubscriptionId:p(),clusterRegion:t.Enum(_l)})]),response:t.Object({id:t.String(),bridgeEndpoint:t.String(),deployerEndpoint:t.String()})}),Nbe=m({tags:["admin"],method:"DELETE",url:`${Ge}/:id`,params:t.Object({id:p()}),body:t.Object({orgId:p()}),response:x}),Lbe=m({tags:["admin"],method:"PUT",url:`${Ge}/add-inbounder-key`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),vbe=m({tags:["admin"],method:"PUT",url:`${Ge}/replace-all-inbounder-keys`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),kbe=m({tags:["admin"],method:"PUT",url:`${Ge}/replace-inbounder-key`,body:t.Object({orgId:p(),clusterId:p(),inbounderAuthenticationKeyToReplace:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),Mbe=m({tags:["admin"],method:"PUT",url:`${Ge}/delete-inbounder-key`,body:t.Object({orgId:p(),clusterId:p(),inbounderAuthenticationKeyToDelete:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyDeleted:t.Boolean()})}),Dbe=m({tags:["admin"],method:"PUT",url:`${Ge}/rotate-deployer-key`,body:t.Object({orgId:p(),clusterId:p(),newKey:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyUpdated:t.Boolean()})}),Gbe=m({tags:["admin"],method:"PUT",url:`${Ge}/rotate-bridge-key`,body:t.Object({orgId:p(),clusterId:p(),newKey:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyUpdated:t.Boolean()})}),hl={central:t.String(),ngrokBridgeDomain:t.String(),ngrokDeployerDomain:t.String(),clusterCertificateExpiresAt:E(),clusterName:t.String(),clusterSize:t.Optional(t.Enum(wa)),secretBridgeAuthenticationKey:t.String(),secretDeployerAuthenticationKey:t.String(),secretOutbounderAuthenticationKey:t.String(),slackChannelEmail:t.String(),customerTier:t.String()},$be=m({tags:["admin"],method:"POST",url:`${Ge}/:id`,body:t.Object({orgId:p()}),params:t.Object({id:p()}),response:b("clusterType",[t.Object({...hl,clusterType:t.Literal("aws"),clusterAccountId:t.String(),clusterBuilderRoleVersion:t.Optional(t.Enum(Il)),clusterRegion:t.Enum(Tl)}),t.Object({...hl,clusterType:t.Literal("gcp"),clusterAccountId:t.String(),clusterRegion:t.Enum(El)}),t.Object({...hl,clusterType:t.Literal("azure"),clusterTenantId:t.String(),clusterSubscriptionId:t.String(),clusterRegion:t.Enum(_l)})])}),jbe=m({tags:["admin"],method:"POST",url:`${Ge}/configuration`,body:t.Object({id:p({allowEmpty:!1}),orgId:p({allowEmpty:!1}),installationName:Jc,targetConfiguration:hS,gitSyncEnabled:t.Boolean({description:"Persisted on upgrade: whether this chart's values are synced from git."})}),response:t.Object({status:t.String()})}),Bbe=m({tags:["admin"],method:"GET",url:`${Ge}/git-values`,query:t.Object({orgId:p({allowEmpty:!1}),clusterId:p({allowEmpty:!1}),installationName:Jc}),response:t.Object({valuesYaml:t.Optional(t.String({description:"Merged git values rendered as YAML. Absent when the cluster/chart has no resolvable values in the repository mirror."})),sha:t.Optional(t.String({description:"Abbreviated commit SHA of the mirrored repository. Absent if not yet successfully fetched (or sync disabled)."}))})}),qbe=m({tags:["admin"],method:"POST",url:`${Ge}/git-sync`,body:t.Object({clusterId:p({allowEmpty:!1}),orgId:p({allowEmpty:!1}),installationName:Jc,gitSyncEnabled:t.Boolean({description:"Whether this chart syncs its Helm values from git."})}),response:t.Object({status:t.String()})}),Fbe=m({tags:["admin"],method:"POST",url:`${Ge}/automation`,body:t.Object({id:p(),orgId:p(),enableAutomatedDeployment:t.Boolean(),disabledReason:t.Optional(p())}),response:t.Object({status:t.String()})}),Hbe=m({tags:["admin"],method:"POST",url:`${Ge}/soak-time`,body:t.Object({id:p(),orgId:p(),soakTimeMin:t.Optional(t.Number())}),response:t.Object({status:t.String()})}),Kbe=m({tags:["admin"],method:"POST",url:`${Ge}/deploy`,body:t.Object({orgId:p(),clusterId:p(),chartName:p(),toVersion:p()}),response:t.Object({id:t.String()})}),C$=b("type",[t.Object({type:t.Literal("pending")}),t.Object({type:t.Literal("running")}),t.Object({type:t.Literal("cancelled")}),t.Object({type:t.Literal("timed_out")}),t.Object({type:t.Literal("success"),stateValue:t.Object({message:t.String()})}),t.Object({type:t.Literal("failure"),stateValue:t.Object({message:t.String()})})]),zbe=m({tags:["admin"],method:"GET",url:`${Ge}/deploy`,query:t.Object({orgId:t.Optional(p()),clusterId:t.Optional(p())}),response:t.Array(t.Object({id:t.String(),orgId:t.String(),orgName:t.String(),clusterId:t.String(),clusterName:t.String(),fromVersion:t.Optional(t.String()),toVersion:t.String(),state:C$,updatedAt:E(),createdAt:E(),installationName:t.String(),chartName:t.String(),isAutomated:t.Boolean(),createdBy:t.Optional(t.String()),createdByName:t.Optional(t.String()),createdByEmail:t.Optional(t.String())}))}),P$=t.Object({installations:t.Array(t.Object({installationName:t.String(),parameters:t.Record(t.String(),t.Union([t.Number(),t.Boolean(),t.Null(),t.String()])),version:t.Union([t.String(),t.Null()]),resources:t.Array(t.Object({id:t.Object({kind:t.String(),name:t.String()}),status:t.String(),health:t.String(),rawDetails:t.Optional(t.Any()),liveManifest:t.Optional(t.String()),targetManifest:t.Optional(t.String())})),deployedAt:t.Optional(t.String()),syncStatus:t.Optional(t.String()),healthStatus:t.Optional(t.String())}))}),Ybe=m({tags:["admin"],method:"POST",url:`${Ge}/status`,body:t.Object({orgId:t.Optional(p()),clusterId:t.Optional(p())}),response:t.Array(t.Object({orgId:t.String(),clusterId:t.String(),status:P$}))}),Vbe=m({tags:["admin"],method:"POST",url:`${Ge}/argocd-cert-info`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({certificateExpiresAt:t.String()})}),U$=t.Object({kind:t.String(),name:t.String()}),w$=t.Object({id:U$,liveManifest:t.Optional(t.String()),targetManifest:t.Optional(t.String())}),Qbe=m({tags:["admin"],method:"POST",url:`${Ge}/resource-details`,body:t.Object({orgId:p(),clusterId:p(),installationName:p()}),response:t.Object({resources:t.Array(w$)})}),Wbe=m({tags:["admin"],method:"GET",url:`${Ge}/versions`,query:t.Object({chartName:t.Optional(p())}),response:t.Array(t.Object({id:t.String(),chartName:t.String(),locator:t.String(),version:t.String(),repositoryArn:t.String(),type:t.Optional(t.String()),commitHash:t.Optional(t.String()),author:t.Optional(t.String()),lastPulledAt:t.Optional(E()),pushedAt:t.Optional(E())}))});var N$=t.Object({id:t.Object({name:t.String(),kind:t.String()}),previewManifest:t.Optional(t.String())}),Zbe=m({tags:["admin"],method:"POST",url:`${Ge}/versions/render`,body:t.Object({chartName:p(),version:p(),values:p({type:"long"}),installationName:p(),namespace:p()}),response:t.Array(N$)}),br=`${Xc}/orgs`,Xbe=m({tags:["admin"],url:br,method:"GET",query:t.Object({onlyDeleted:t.Optional(t.Boolean())}),response:t.Array(t.Object({id:t.String(),name:t.String(),allowedDomains:t.Array(t.String()),createdAt:E(),updatedAt:E()}))}),Jbe=m({tags:["admin"],url:br,method:"POST",body:t.Object({allowedDomains:t.Array(p({type:"lowercase-domain"}),{maxItems:Zc}),name:p()}),response:t.Object({id:t.String(),name:t.String()})}),eSe=m({tags:["admin"],url:`${br}/:id`,method:"PUT",params:t.Object({id:p()}),body:t.Object({allowedDomains:t.Optional(t.Array(p({type:"lowercase-domain"}),{maxItems:Zc}))}),response:t.Object({id:t.String(),name:t.String(),allowedDomains:t.Array(t.String())})}),tSe=m({tags:["admin"],url:`${br}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),rSe=m({tags:["admin"],url:`${br}/:id/restore`,method:"POST",params:t.Object({id:p()}),response:t.Object({success:t.Boolean()})}),nSe=m({tags:["admin"],url:`${br}/:id/permanent-delete`,method:"DELETE",params:t.Object({id:p()}),response:t.Object({success:t.Boolean(),hasDeletedSecret:t.Boolean(),hasDeletedTenantDb:t.Boolean(),hasDeletedOrgRow:t.Boolean()})}),oSe=m({tags:["admin"],url:`${br}/synchronize-sds-rules`,method:"POST",response:t.Object({errorOrgs:t.Optional(t.Array(t.Object({id:t.String(),name:t.String()}))),synchronizedOrgsCount:t.Number()})}),L$=["custom_usage_tag","ingestion_api_key","inventory_resource","monitor","retention_policy","route","sensitive_data_scanner_rule","tag_policy","team"],v$=t.Enum(L$),iSe=m({tags:["admin"],url:`${br}/refresh-assets`,method:"POST",body:t.Object({assetTypes:t.Array(v$,{minItems:1}),orgId:t.Optional(p({allowEmpty:!1}))}),response:t.Array(t.Object({orgId:t.String(),orgName:t.String(),results:t.Record(t.String(),t.Object({success:t.Boolean()}))}))}),aSe=m({tags:["admin"],url:`${br}/sudo`,method:"POST",body:t.Object({orgId:p()}),response:t.Object({sudoToken:t.String()})}),k$=`${Xc}/users`,sSe=m({tags:["admin"],url:`${k$}/invite`,method:"POST",body:t.Object({email:p({type:"email"}),orgId:p(),userRole:t.Enum(Qc)}),response:t.Array(t.Object({inviteId:t.String(),email:t.String(),result:t.Union([t.Literal("success"),t.Literal("email-failed")])}))});var cSe=m({tags:["admin"],url:`${Xc}/billing-data`,method:"GET",query:t.Object({orgId:p(),maxDaysFetched:t.Optional(t.Number({minimum:1,maximum:365}))}),response:t.Object({dataPoints:t.Array(t.Object({date:t.String(),telemetryKind:t.Union([t.Literal("logs"),t.Literal("metrics"),t.Literal("rum"),t.Literal("traces")]),totalBytes:t.Number(),clusterId:t.String(),apiKeyId:t.String(),apiKeyName:t.String(),teamName:t.String()})),availableFilters:t.Object({clusters:t.Array(t.Object({id:t.String(),name:t.String()})),apiKeys:t.Array(t.Object({id:t.String(),name:t.String()})),teamNames:t.Array(t.String())})})});var ES=t.Object({id:t.String({description:"Unique Tsuga cluster ID. Tsuga assigns it when the cluster record is created. Use this value as `clusterId` with public API requests that accept `clusterId`."}),name:t.String({description:"Cluster name stored in Tsuga. Usable as a display label when `friendlyName` is not set."}),friendlyName:t.Optional(t.String({description:"Human-readable display name for the cluster. Present when a friendly name is configured."})),clusterType:t.Enum(TS,{description:"Cloud provider selected for the Tsuga cluster."}),clusterRegion:t.String({description:"Cloud region selected for the cluster using the provider region identifier."})},{$id:"Cluster",description:"Tsuga cluster available to the organization. Use its `id` to scope public API requests that accept `clusterId`."}),M$={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(ES,{examples:[M$]});var _S=m({description:"Lists Tsuga clusters available to the organization. Use cluster IDs with public API requests that accept `clusterId`, such as telemetry, service, Kubernetes Explorer, and quality-report requests.",operationId:"listClusters",tags:["clusters"],url:`/${"v1"}/clusters`,method:"GET",response:t.Array(ES)});function IS(e,r){e.command("clusters").description("Manage Tsuga cluster selection").command("list").description("List all Tsuga clusters available to the operation API key").action(async()=>{let o=await r()(_S);Q(o)})}function SS(e,r,n,o){let i=e.commands.map(c=>c.name()).filter(c=>!c.startsWith("__")),a=e.options.map(c=>c.long).filter(c=>!!c);for(let c of e.options)(c.required||c.optional)&&(c.long&&o.add(c.long),c.short&&o.add(c.short));n.set(r.join(" "),{cmds:i,flags:[...a,"--help"]});for(let c of e.commands)c.name().startsWith("__")||SS(c,[...r,c.name()],n,o)}function D$(e){let r=new Map,n=new Set;return SS(e,[],r,n),{rows:[...r].map(([i,{cmds:a,flags:c}])=>({key:i,cmds:[...new Set(a)].join(" "),flags:[...new Set(c)].join(" ")})),valueFlags:[...n].join(" ")}}function bS(e){return e.map(({key:r,cmds:n,flags:o})=>` ${JSON.stringify(r)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
|
|
49
|
-
|
|
46
|
+
`}function gO(){if((0,Wt.existsSync)(Bm))try{return JSON.parse((0,Wt.readFileSync)(Bm,"utf-8")).lastUpdateCheck}catch{return}}function hO(e){(0,Wt.mkdirSync)(iO,{recursive:!0,mode:448}),(0,Wt.writeFileSync)(Bm,`${JSON.stringify({lastUpdateCheck:e})}
|
|
47
|
+
`,{mode:384})}async function lq(){let e=ei(),{verifier:t,challenge:n}=Xh(),o=(0,TO.randomBytes)(16).toString("base64url"),{code:i,redirectUri:a}=await uy({state:o,buildAuthorizeUrl:l=>JA(e,{redirectUri:l,challenge:n,state:o})}),c=await eO(e,{code:i,verifier:t,redirectUri:a});cO(Eh(c)),V(`Logged in. Session token ${na(c.accessToken)} saved to ${za()}`)}function mq(){let e=ei(),t=sO();if(!t){let n=e===Ba?"":` for ${e}`;process.stderr.write(`No user session${n}. Run \`tsuga auth login\`.
|
|
48
|
+
`),process.exitCode=1;return}if(lc({kind:"user-session",userAuth:t},new Date)){process.stderr.write("Your session expired. Run `tsuga auth login` to sign in again.\n"),process.exitCode=1;return}V(t.accessToken)}function yO(e,t){let n=Wh(Zh({start:e,end:t}),{format:["years","months","days","hours","minutes"]});return n===""?"less than a minute":n}function dq(e){let t=na(e.accessToken),n=new Date,o=new Date(e.accessExpiresAt);return Number.isNaN(o.getTime())?`Logged in as a user (token ${t}, expires ${e.accessExpiresAt}).`:o<=n?`Logged in as a user (token ${t}). Session expired ${yO(o,n)} ago, on ${e.accessExpiresAt}. Run \`tsuga auth login\` to sign in again.`:`Logged in as a user (token ${t}). Session expires in ${yO(n,o)}, on ${e.accessExpiresAt}.`}function fq(){let{credential:e}=ti({});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(dq(e.userAuth));return;case"operation-api-key":V("Authenticated with an operation API key.");return;default:tt(e)}}function gq(){uO(),V("Local user session cleared.")}function EO(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(lq),t.command("logout").description("Clear the saved user session").action(gq),t.command("token").description("Print the saved user access token to stdout").action(mq),t.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(n=>{pO(n),V(`Operation API key saved to ${za()}`)}),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"],yq=["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"],Tq=["log","metric","trace","rum"],Ym=[...yq,...Tq],ePe=[...hq,...Ym];var _O=["admin","public_editor","public_viewer","teams_only"],ri=["admin","editor","viewer"];var ro="/v0/team-membership",Vm="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.",Qm=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(ri,{description:Vm})}),IO=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(ri,{description:Vm})}),Eq=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."})}),_q=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."}))})),tPe=d({tags:["access-control"],url:ro,method:"GET",query:_q,response:r.Array(Qm)}),rPe=d({tags:["access-control"],url:ro,method:"POST",body:IO,response:Qm}),nPe=d({tags:["access-control"],url:ro,method:"PUT",body:IO,response:Qm}),oPe=d({tags:["access-control"],url:ro,method:"DELETE",body:Eq,response:N}),Mp=500,bO=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(ri,{description:Vm})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:Mp,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."}),Iq={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(bO,{examples:[Iq]});var SO=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."}),bq={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(SO,{examples:[bq]});var iPe=d({tags:["access-control"],url:`${ro}/bulk-add`,method:"POST",body:bO,response:SO}),aPe=d({tags:["access-control"],url:`${ro}/bulk-update-user-roles`,method:"PUT",body:r.Object({userIds:r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:Mp}),teamId:u({allowEmpty:!1}),role:r.Enum(ri)}),response:r.Object({})}),AO=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:Mp,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:Mp,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."}),Sq={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(AO,{examples:[Sq]});var OO=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."}),Aq={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(OO,{examples:[Aq]});var sPe=d({tags:["access-control"],url:`${ro}/bulk-remove`,method:"DELETE",body:AO,response:OO});var Oq={"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:[]}},xq={"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:[]}},Rq={user:Oq,team:xq};function Wm(e){return xO(e,"team")}function Zm(e){return xO(e,"user")}function xO(e,t){let n=[],o=Rq[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 dPe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:Zm("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:Zm("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:Zm("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},fPe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:Wm("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:Wm("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:Wm("viewer"),roleKey:"viewer"}};var gPe=new Set(Ym);var Cq={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"},Pq=Object.entries(Cq),hPe=new Map(Pq.flatMap(([e,t])=>t?[[t,e]]:[]));var RO="__tsuga_cluster_id__",Uq=r.Object({}),wq=r.Object({status:r.Literal("error"),message:r.String({description:"Why this cluster failed to answer the query."})});function ni(e=Uq){let t=C("status",[r.Object({...e.properties,status:r.Literal("ok")}),wq]);return Object.assign(Bc($t,t),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var vq=5,Ya=r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:vq,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var CO=r.Object({type:r.Literal("number"),number:r.String()}),Nq=r.Object({type:r.Literal("string"),string:r.String()}),Lq=r.Object({type:r.Literal("timestamp"),timestamp:r.String()}),Va=C("type",[CO,Nq,Lq]),kq=r.Object({by:r.Record(r.String(),Va),computed:r.Record(r.String(),CO)}),Mq=r.Object({type:r.Literal("buckets"),buckets:r.Array(kq),clusterResponses:r.Optional(ni())}),Dq=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()))}),Dp=C("type",[Mq,Dq]);var Gq=["all","owning-team-and-public","owning-team-only"],hn=r.Enum(Gq,{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 UO=1456444800,wO=4927737600,$q=UO*1e3,jq=wO*1e3,Gp=1704067200,Xm=Gp*1e3,vO={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:Gp,to:Gp}]},qq={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:Xm,to:Xm}]},$p=e=>r.Integer({description:e,examples:[Gp],minimum:UO,maximum:wO,format:"int64"}),PO=e=>r.Integer({description:e,examples:[Xm],minimum:$q,maximum:jq,format:"int64"}),at=r.Object({from:r.Optional($p("Start of the query window as a Unix timestamp in seconds")),to:r.Optional($p("End of the query window as a Unix timestamp in seconds"))},vO),bt=r.Object({from:$p("Start of the query window as a Unix timestamp in seconds"),to:$p("End of the query window as a Unix timestamp in seconds")},vO),oi=r.Object({from:PO("Start of the query window as a Unix timestamp in milliseconds"),to:PO("End of the query window as a Unix timestamp in milliseconds")},qq);var Hq="/v0/aggregation",Kq=r.Union([r.Literal("a"),r.Literal("d"),r.Literal("q"),r.Literal("w"),r.Literal("t")]),Jm=r.Object({parallelism:r.Number(),engine:Kq,recordBatchCache:r.Optional(r.Boolean()),includeNullGroups:r.Optional(r.Boolean()),restartAwareGaugeSum:r.Optional(r.Boolean())}),ed=["logs","metrics","traces"];var kO={logs:"Logs",metrics:"Metrics",traces:"Spans"},zq=[...ed,"connections","log-patterns","spans","rum"];var $Pe={...kO,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},Ir=[...ed,"rum"];var jPe={...kO,rum:"RUM events"};var qPe=r.Enum(zq,{description:"Data source being queried"}),MO=r.Enum(ed,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),or=r.Enum(Ir,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),no=r.String({description:"Attribute containing the values to aggregate"}),oo=u({description:"Attribute containing the values to aggregate"}),Yq=C("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(no)},{$id:"AggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:no},{$id:"AggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:no},{$id:"AggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:no},{$id:"AggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:no},{$id:"AggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:no},{$id:"AggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:no,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`."}),Vq=C("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(oo)},{$id:"InputAggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:oo},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:oo},{$id:"InputAggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:oo},{$id:"InputAggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:oo},{$id:"InputAggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:oo},{$id:"InputAggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:oo,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`."}),DO=r.Object({type:r.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),GO=r.Object({type:r.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),$O=r.Object({type:r.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),jO=r.Object({type:r.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),qO=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"}),FO=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"}),BO=r.Object({type:r.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),HO=r.Object({type:r.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),Qq=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"}),Wq=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"}),Zq=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"}),Xq=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"}),Jq=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"}),eF=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"}),tF=C("type",[DO,GO,$O,jO,qO,Qq,Zq,FO,BO,HO,Jq],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),rF=C("type",[DO,GO,$O,jO,qO,Wq,Xq,FO,BO,HO,eF],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var NO=r.Object({min:r.Number({description:"Lower bound of the distribution range."}),max:r.Number({description:"Upper bound of the distribution range."})}),nF=["linear","log"],jp=r.Enum(nF,{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."}),LO=r.Integer({minimum:1}),oF=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(LO),bounds:r.Optional(NO),boundsScale:r.Optional(jp),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(LO),bounds:r.Optional(NO)},{title:"Heatmap",description:"Returns a distribution per time window"})]),Qa=15,iF=["zero","null"],aF=r.Enum(iF,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),KO=r.Object({mode:r.Object({type:aF},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),sF=["avg","sum","min","max","last"],zO=r.Enum(sF,{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 YO={aggregate:Yq,functions:r.Optional(r.Array(tF,{description:"Post-processing functions applied to aggregation results"})),fill:r.Optional(KO),timeAggregate:r.Optional(zO)},VO={aggregate:Vq,functions:r.Optional(r.Array(rF,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:r.Optional(KO),timeAggregate:r.Optional(zO)},cF={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."},QO={maxItems:Qa,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").'},WO=r.Array(r.Object({...YO,filter:r.Optional(r.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),cF),Wa=r.Array(r.Object({...VO,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"}),QO),$r=r.Array(r.Object({...YO,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."}),yn=r.Array(r.Object({...VO,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."}),{...QO,description:"Aggregation queries used by alerting. Each query is referenced from formulas as q1, q2, and so on."}),ZO=r.Array(r.Omit(yn.items,["fill"],{title:"SloAggregationQuery",description:"Single aggregation query evaluated by an SLO."}),{minItems:1,maxItems:Qa,description:"Aggregation queries used by SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var qp=r.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),io=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."}),pF=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"}),uF=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"}),XO=7;var ii=r.Array(pF,{description:"Nested grouping levels applied to the results, outermost first (e.g. group by service, then by level within each service). Each level splits results further, so the response contains one result per unique combination of group values."}),jr=r.Array(uF,{maxItems:XO,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 FPe=d({tags:["aggregation"],url:`${Hq}/multi-query`,method:"POST",body:r.Object({timeRange:oi,queries:Wa,groupBy:r.Optional(jr),returnType:oF,dataSource:or,formula:io,executionOptions:Jm,triggeredBy:r.Optional(r.Literal("refresh")),shouldStreamResults:r.Optional(r.Boolean()),clusterId:r.Optional(u({allowEmpty:!1})),clusterIds:r.Optional(Ya),viewAs:r.Optional(r.Object({owner:u({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:hn}))}),response:Dp});var td=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],rd=["light","dark"];var lF={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)"}},JO=["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 VPe=lF.light.red.background;var nd=2,od=2;var ex=[{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-----
|
|
49
|
+
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAC4AWkdwKYSd8
|
|
50
|
+
Ks14IReLcYgADhoXk56ZzXI=
|
|
51
|
+
-----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}"}],mF=ex.map(e=>e.key);var nUe=new Set(mF),oUe=ex.map(e=>e.key);var $="context";var tx="trace_id",Fp=`${$}.team`,fUe=`${$}.env`,gUe=`${$}.api_key_id`,Bp=`${$}.service.name`,hUe=`${$}.service.version`,Hp=`${$}.span.kind`,Kp=`${$}.span.name`,ao=`${$}.status.code`,id="resource.attributes.team",rx=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var Za=`${$}.host.name`,dF=`${$}.instance`,fF=`${$}.instanceid`,gF=`${$}.instance_name`,yUe=`${$}.telemetry.sdk.language`,TUe=`${$}.process.runtime.name`,EUe=`${$}.scope.name`,_Ue=`${$}.cloud.provider`,IUe=`${$}.cloud.platform`,bUe=`${$}.aws.ecs.task.arn`,SUe=`${$}.k8s.cluster.name`,AUe=`${$}.k8s.cluster.uid`,OUe=`${$}.k8s.namespace.name`,hF=`${$}.k8s.pod.name`,xUe=`${$}.k8s.pod.uid`,RUe=`${$}.k8s.container.name`,CUe=`${$}.k8s.node.name`,PUe=`${$}.k8s.node.uid`,yF=`${$}.k8s.deployment.name`,UUe=`${$}.k8s.deployment.uid`,TF=`${$}.k8s.replicaset.name`,wUe=`${$}.k8s.replicaset.uid`,EF=`${$}.k8s.statefulset.name`,vUe=`${$}.k8s.statefulset.uid`,_F=`${$}.k8s.daemonset.name`,NUe=`${$}.k8s.daemonset.uid`,LUe=`${$}.k8s.job.name`,kUe=`${$}.k8s.job.uid`,MUe=`${$}.k8s.cronjob.name`,DUe=`${$}.k8s.cronjob.uid`,ai="status_code",zp="span.name";var Yp="span.kind";var IF="db.system.name",bF="db.system",SF="db.namespace",AF="db.name";var GUe=`span_attributes.${SF}`,$Ue=`span_attributes.${AF}`,jUe=`span_attributes.${IF}`,qUe=`span_attributes.${bF}`;var FUe={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${$}.tag_policy_id`,dataSource:`${$}.data_source`}};var BUe={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 ad="__tsuga_metadata__",HUe=`${ad}.signature`,KUe=`${ad}.routes`,zUe=`${ad}.trace_id_bucket`;var ZUe={[Hp]:Yp,[Hp.replace(`${$}.`,"")]:Yp,[Kp]:zp,[Kp.replace(`${$}.`,"")]:zp,[ao]:ai,[ao.replace(`${$}.`,"")]:ai},XUe={[Yp]:Hp,[zp]:Kp,[ai]:ao};function nx(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var ox=["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"],ix=["alert_queries","alert_thresholds","alert_values"],OF=[...ox,...ix],ax=["alert_event_name","alert_message"],Awe=[...OF,...ax],Owe=new Set([...ox,...ax]),xwe=new Set(ix);var sd={aws:"aws",gcp:"gcp",azure:"azure"},Tn=[sd.aws,sd.gcp,sd.azure];var sx=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(Tn,{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`."}),xF={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(sx,{examples:[xF]});var cx=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(sx)});function px(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()(cx);J(o)})}function lx(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("__")||lx(c,[...t,c.name()],n,o)}function RF(e){let t=new Map,n=new Set;return lx(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 ux(e){return e.map(({key:t,cmds:n,flags:o})=>` ${JSON.stringify(t)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
|
|
52
|
+
`)}function CF(e,t){return`_tsuga_complete() {
|
|
50
53
|
local cur key cmds flags words i word prev
|
|
51
|
-
local valueflags="${
|
|
54
|
+
local valueflags="${t}"
|
|
52
55
|
local -a path
|
|
53
56
|
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
54
57
|
prev=""
|
|
@@ -67,10 +70,10 @@ ${e}
|
|
|
67
70
|
COMPREPLY=( $(compgen -W "$words" -- "$cur") )
|
|
68
71
|
}
|
|
69
72
|
complete -F _tsuga_complete tsuga
|
|
70
|
-
`}function
|
|
73
|
+
`}function PF(e,t){return`#compdef tsuga
|
|
71
74
|
_tsuga_complete() {
|
|
72
75
|
local cur key cmds flags out i word prev
|
|
73
|
-
local valueflags="${
|
|
76
|
+
local valueflags="${t}"
|
|
74
77
|
local -a path
|
|
75
78
|
cur="\${words[CURRENT]}"
|
|
76
79
|
prev=""
|
|
@@ -89,12 +92,12 @@ ${e}
|
|
|
89
92
|
compadd -- \${=out}
|
|
90
93
|
}
|
|
91
94
|
compdef _tsuga_complete tsuga
|
|
92
|
-
`}function
|
|
93
|
-
set cmds ${
|
|
94
|
-
set flags ${
|
|
95
|
-
`)}function
|
|
95
|
+
`}function cd(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function UF(e){return e.map(({key:t,cmds:n,flags:o})=>` case ${cd(t)}
|
|
96
|
+
set cmds ${cd(n)}
|
|
97
|
+
set flags ${cd(o)}`).join(`
|
|
98
|
+
`)}function wF(e,t){return`# Update with: tsuga completion fish > ~/.config/fish/completions/tsuga.fish
|
|
96
99
|
function __tsuga_complete
|
|
97
|
-
set -l valueflags -- ${
|
|
100
|
+
set -l valueflags -- ${t}
|
|
98
101
|
set -l tokens (commandline -xpc)
|
|
99
102
|
set -l cur (commandline -ct)
|
|
100
103
|
set -l path
|
|
@@ -127,51 +130,47 @@ ${e}
|
|
|
127
130
|
end
|
|
128
131
|
end
|
|
129
132
|
complete -c tsuga -f -a '(__tsuga_complete)'
|
|
130
|
-
`}function
|
|
133
|
+
`}function mx(e){e.command("completion <SHELL>").description("Print a shell completion script (bash, zsh, or fish)").addHelpText("after",`
|
|
131
134
|
Usage:
|
|
132
135
|
bash: eval "$(tsuga completion bash)" # add to ~/.bashrc
|
|
133
136
|
zsh: eval "$(tsuga completion zsh)" # add to ~/.zshrc
|
|
134
|
-
fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(
|
|
135
|
-
...`};Object.assign(RS,{examples:[q$]});var CS=t.Object({kind:t.Enum(["doc","api"],{description:"`doc` for documentation pages (guides, references, release notes); `api` for API-reference endpoints indexed from the OpenAPI spec. Use this to decide how to present or follow up on the result."}),path:t.String({description:"Path identifying the result. Documentation pages use a slug path (e.g. `data-collection/guides/how-to-add-resource-attributes`). API-reference results use `api/<operationId>` (e.g. `api/aggregateScalar`)."}),title:t.String({description:'Title of the result (e.g. "How to Add Resource Attributes" or "POST /v1/aggregation/multi-query/scalar")'}),subsection:t.Optional(t.String({description:'For documentation pages: the heading path inside the page that matched (e.g. "Language setup"). For API results: the matched field or parameter breadcrumb (e.g. "Body \u203A queries"). Absent when the match is the page or endpoint intro.'})),tab:t.Optional(t.String({description:'Tab label inside the page that the result matched. Set when the matching content is inside a <Tabs><Tab label="\u2026"> block. Always absent for API results.'})),anchor:t.Optional(t.String({description:"For documentation pages: the slugified heading ID used as the URL fragment (e.g. `language-setup`). For API results: the Scalar deep-link fragment (`tag/<tag>/<METHOD><path>`). The `link` field already has this baked in."})),score:t.Number({description:"Relevance score between 0 and 1 (higher is more relevant)"}),excerpt:t.String({description:"Short snippet of matching content"}),link:t.String({description:"URL to the result in the Tsuga app. Documentation pages include the section anchor and tab query parameter when applicable. API results deep-link into the API reference at `/documentation/api#tag/\u2026`."})},{$id:"DocSearchResult",description:"A documentation page or API-reference endpoint search result"}),F$={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(CS,{examples:[F$]});var PS=m({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:xS,method:"GET",query:t.Object({path:p({allowEmpty:!1,description:"Documentation path to fetch. Use page slug paths for docs or `api/<operationId>` for API-reference pages."})},{description:"Documentation page lookup query."}),response:RS}),US=m({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:`${xS}/search`,method:"GET",query:t.Object({query:p({allowEmpty:!1,description:"Search text to match against documentation and API-reference content."})},{description:"Documentation search query."}),response:t.Array(CS)});function wS(e,r){let n=e.command("docs").description("Search and fetch Tsuga documentation and API-reference pages");n.command("get <DOC_PATH>").description("Get a documentation or API-reference page by path (e.g. 'getting-started/send-your-first-logs' or 'api/aggregateScalar')").action(async o=>{let i=await r()(PS,{query:{path:o}});Q(i)}),n.command("search <SEARCH_TEXT>").description("Search Tsuga documentation and the full API reference, ranked by relevance").action(async o=>{let i=await r()(US,{query:{query:o}});Q(i)})}var H$=`/${"v1"}/feedback`,NS=t.Object({id:t.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),K$={id:"request-123-abc"};Object.assign(NS,{examples:[K$]});var LS=t.Object({content:p({allowEmpty:!1,type:"long",description:"Free-text feedback content, e.g. what went wrong, what was confusing, or a suggestion. Required and must be non-empty."})}),z$={content:"The traces command times out for large services."};Object.assign(LS,{examples:[z$]});var vS=m({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:H$,method:"POST",body:LS,response:NS});function kS(e,r){e.command("feedback <MESSAGE...>").description("Send feedback about Tsuga tools or APIs (e.g. a tool that failed or was confusing)").action(async n=>{let o=await r()(vS,{body:{content:n.join(" ")}});Q(o)})}var Y$={"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:[]}},V$={"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:[]}},Q$={user:Y$,team:V$};function Sl(e){return MS(e,"team")}function Ol(e){return MS(e,"user")}function MS(e,r){let n=[],o=Q$[r];for(let[i,a]of Object.entries(o))for(let[c,l]of Object.entries(a))l.includes(e)&&n.push({actionType:c,resourceType:i});return n}var HSe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:Ol("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:Ol("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:Ol("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},KSe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:Sl("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:Sl("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:Sl("viewer"),roleKey:"viewer"}};var zSe=new Set(ml);var W$={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",slo:"slo","tag-policy":"tag-policy",team:"team","user-invitation":"user-invitation"},Z$=Object.entries(W$),YSe=new Map(Z$.flatMap(([e,r])=>r?[[r,e]]:[]));var DS="__tsuga_cluster_id__",X$=t.Object({}),J$=t.Object({status:t.Literal("error"),message:t.String({description:"Why this cluster failed to answer the query."})});function Yo(e=X$){let r=b("status",[t.Object({...e.properties,status:t.Literal("ok")}),J$]);return Object.assign(Ec($t,r),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var e1=5,Na=t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:e1,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var GS=t.Object({type:t.Literal("number"),number:t.String()}),t1=t.Object({type:t.Literal("string"),string:t.String()}),r1=t.Object({type:t.Literal("timestamp"),timestamp:t.String()}),La=b("type",[GS,t1,r1]),n1=t.Object({by:t.Record(t.String(),La),computed:t.Record(t.String(),GS)}),o1=t.Object({type:t.Literal("buckets"),buckets:t.Array(n1),clusterResponses:t.Optional(Yo())}),i1=t.Object({type:t.Literal("distribution"),bounds:t.Array(t.Number()),buckets:t.Array(t.Object({timestamp:t.Number(),counts:t.Array(t.Number())})),percentiles:t.Optional(t.Array(t.Number()))}),ep=b("type",[o1,i1]);var a1=["all","owning-team-and-public","owning-team-only"],ln=t.Enum(a1,{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 jS=1456444800,BS=4927737600,s1=jS*1e3,c1=BS*1e3,tp=1704067200,Al=tp*1e3,qS={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:tp,to:tp}]},p1={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:Al,to:Al}]},rp=e=>t.Integer({description:e,examples:[tp],minimum:jS,maximum:BS,format:"int64"}),$S=e=>t.Integer({description:e,examples:[Al],minimum:s1,maximum:c1,format:"int64"}),Ve=t.Object({from:t.Optional(rp("Start of the query window as a Unix timestamp in seconds")),to:t.Optional(rp("End of the query window as a Unix timestamp in seconds"))},qS),mt=t.Object({from:rp("Start of the query window as a Unix timestamp in seconds"),to:rp("End of the query window as a Unix timestamp in seconds")},qS),Vo=t.Object({from:$S("Start of the query window as a Unix timestamp in milliseconds"),to:$S("End of the query window as a Unix timestamp in milliseconds")},p1);var m1="/v0/aggregation",d1=t.Union([t.Literal("a"),t.Literal("d"),t.Literal("q"),t.Literal("w"),t.Literal("t")]),xl=t.Object({parallelism:t.Number(),engine:d1,recordBatchCache:t.Optional(t.Boolean()),includeNullGroups:t.Optional(t.Boolean()),restartAwareGaugeSum:t.Optional(t.Boolean())}),Rl=["logs","metrics","traces"];var KS={logs:"Logs",metrics:"Metrics",traces:"Spans"},f1=[...Rl,"connections","log-patterns","spans","rum"];var yOe={...KS,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},pr=[...Rl,"rum"];var hOe={...KS,rum:"RUM events"};var TOe=t.Enum(f1,{description:"Data source being queried"}),zS=t.Enum(Rl,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),Vt=t.Enum(pr,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),qn=t.String({description:"Attribute containing the values to aggregate"}),Fn=p({description:"Attribute containing the values to aggregate"}),g1=b("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(qn)},{$id:"AggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:qn},{$id:"AggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:qn},{$id:"AggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:qn},{$id:"AggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:qn},{$id:"AggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:qn},{$id:"AggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:qn,percentile:t.Number({description:"Percentile to compute for the selected field."})},{$id:"AggregatePercentile",title:"Percentile"})],{title:"Aggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),y1=b("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(Fn)},{$id:"InputAggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:Fn},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:Fn},{$id:"InputAggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:Fn},{$id:"InputAggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:Fn},{$id:"InputAggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:Fn},{$id:"InputAggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:Fn,percentile:t.Number({description:"Percentile to compute for the selected field."})},{$id:"InputAggregatePercentile",title:"Percentile"})],{title:"InputAggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),YS=t.Object({type:t.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),VS=t.Object({type:t.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),QS=t.Object({type:t.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),WS=t.Object({type:t.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),ZS=t.Object({type:t.Literal("increase",{description:"`Increase` is designed for cumulative metrics. It computes the increase of cumulative metrics by automatically handling counter resets. When used with an aggregation such as `sum` it combines all series without requiring an explicit group-by."})},{$id:"FunctionIncrease",title:"Increase"}),XS=t.Object({type:t.Literal("power",{description:"Raises values to a specified power"}),exponent:t.Integer({description:"The exponent to raise values to"})},{$id:"FunctionPower",title:"Power"}),JS=t.Object({type:t.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),eO=t.Object({type:t.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),h1=t.Object({type:t.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:t.String({description:"Duration of the rolling window"})},{$id:"FunctionRolling",title:"Rolling"}),T1=t.Object({type:t.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:p({allowEmpty:!1,description:"Duration of the rolling window"})},{$id:"InputFunctionRolling",title:"Rolling"}),E1=t.Object({type:t.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:t.Integer({description:"The base of the logarithm"})},{$id:"FunctionLog",title:"Log"}),_1=t.Object({type:t.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:t.Integer({description:"The base of the logarithm",minimum:2})},{$id:"InputFunctionLog",title:"Log"}),I1=t.Object({type:t.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:t.Integer({description:"Number of seconds to offset"})},{$id:"FunctionTimeOffset",title:"TimeOffset"}),b1=t.Object({type:t.Literal("time-offset",{description:"Shifts a query's data backward by a specified duration for easy comparison over different periods of time."}),seconds:t.Integer({description:"Number of seconds to offset",minimum:1})},{$id:"InputFunctionTimeOffset",title:"TimeOffset"}),S1=b("type",[YS,VS,QS,WS,ZS,h1,E1,XS,JS,eO,I1],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),O1=b("type",[YS,VS,QS,WS,ZS,T1,_1,XS,JS,eO,b1],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var FS=t.Object({min:t.Number({description:"Lower bound of the distribution range."}),max:t.Number({description:"Upper bound of the distribution range."})}),A1=["linear","log"],np=t.Enum(A1,{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."}),HS=t.Integer({minimum:1}),x1=b("type",[t.Object({type:t.Literal("scalar")},{title:"Scalar",description:"Returns a single value"}),t.Object({type:t.Literal("timeseries"),aggregationWindow:p({description:'Time bucket size for aggregation (e.g. "10s", "60s", "1m")'})},{title:"Timeseries",description:"Returns a time series"}),t.Object({type:t.Literal("histogram"),by:t.Optional(p()),bucketCount:t.Optional(HS),bounds:t.Optional(FS),boundsScale:t.Optional(np),percentiles:t.Optional(t.Array(t.Number({minimum:0,maximum:100,multipleOf:1}),{minItems:1}))},{title:"Histogram",description:"Returns a single distribution over the entire time range"}),t.Object({type:t.Literal("heatmap"),aggregationWindow:p({description:'Time bucket size for the heatmap (e.g. "10s", "60s", "1m")'}),by:t.Optional(p()),bucketCount:t.Optional(HS),bounds:t.Optional(FS)},{title:"Heatmap",description:"Returns a distribution per time window"})]),op=15,R1=["zero","null"],C1=t.Enum(R1,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),tO=t.Object({mode:t.Object({type:C1},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),rO=t.Union([t.Literal("avg"),t.Literal("sum"),t.Literal("min"),t.Literal("max"),t.Literal("last")],{description:"Per-series rollup applied within each time bucket before the cross-series aggregate. When omitted, a default is derived from the metric type."}),nO={aggregate:g1,functions:t.Optional(t.Array(S1,{description:"Post-processing functions applied to aggregation results"})),fill:t.Optional(tO),timeAggregate:t.Optional(rO)},oO={aggregate:y1,functions:t.Optional(t.Array(O1,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:t.Optional(tO),timeAggregate:t.Optional(rO)},P1={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."},iO={maxItems:op,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").'},aO=t.Array(t.Object({...nO,filter:t.Optional(t.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),P1),va=t.Array(t.Object({...oO,filter:t.Optional(p({type:"tsuga-query",description:"Tsuga query filter to apply to the aggregation. Defaults to an empty string when omitted."}))},{title:"AggregationQuery"}),iO),Sr=t.Array(t.Object({...nO,filter:t.String({description:"Filter to apply to the aggregation"})},{title:"MonitorAggregationQuery",description:"Single aggregation query evaluated by a monitor or SLO."}),{description:"Aggregation queries used by alerting and SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."}),Or=t.Array(t.Object({...oO,filter:p({type:"tsuga-query",description:"Tsuga query filter applied to this alerting or SLO aggregation query. Required by the API; use the query language for the selected data source."})},{title:"MonitorAggregationQuery",description:"Single aggregation query evaluated by a monitor or SLO."}),{...iO,description:"Aggregation queries used by alerting and SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var ip=t.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),Hn=p({type:"tsuga-formula",description:"Formula referencing query outputs, such as `q1 + q2`, to compute derived results. Defaults to `q1`. Formulas may reference only submitted queries (`q1` through `qN`); undefined query references return 400."}),U1=t.Object({fields:t.Array(t.String(),{description:"Telemetry attribute names used to group aggregation results."}),limit:t.Number({description:'Maximum number of distinct values of `fields` returned for this grouping level, ranked by aggregate value. Groups beyond the limit are truncated, not merged into an "other" group.'}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(t.String({description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),w1=t.Object({fields:t.Array(p(),{maxItems:1,description:"Telemetry attribute name to group aggregation results by. Currently limited to one field per grouping level."}),limit:t.Number({description:'Maximum number of distinct values of `fields` to return for this grouping level, ranked by aggregate value. Groups beyond the limit are truncated from the response, not merged into an "other" group.'}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))},{title:"AggregationGroupBy"}),sO=7;var Qo=t.Array(U1,{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."}),Ar=t.Array(w1,{maxItems:sO,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 EOe=m({tags:["aggregation"],url:`${m1}/multi-query`,method:"POST",body:t.Object({timeRange:Vo,queries:va,groupBy:t.Optional(Ar),returnType:x1,dataSource:Vt,formula:Hn,executionOptions:xl,triggeredBy:t.Optional(t.Literal("refresh")),shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1})),clusterIds:t.Optional(Na),viewAs:t.Optional(t.Object({owner:p({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:ln}))}),response:ep});var Cl=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],Pl=["light","dark"];var N1={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)"}},cO=["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 AOe=N1.light.red.background;var pO=[{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-----
|
|
136
|
-
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAC4AWkdwKYSd8
|
|
137
|
-
|
|
138
|
-
-----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}"}],L1=pO.map(e=>e.key);var LOe=new Set(L1),vOe=pO.map(e=>e.key);var D="context";var uO="trace_id",HOe=`${D}.team`,KOe=`${D}.env`,zOe=`${D}.api_key_id`,ap=`${D}.service.name`,YOe=`${D}.service.version`,Ul=`${D}.span.kind`,wl=`${D}.span.name`,Nl=`${D}.status.code`,lO=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var ka=`${D}.host.name`,v1=`${D}.instance`,k1=`${D}.instanceid`,M1=`${D}.instance_name`,VOe=`${D}.telemetry.sdk.language`,QOe=`${D}.process.runtime.name`,WOe=`${D}.scope.name`,ZOe=`${D}.cloud.provider`,XOe=`${D}.cloud.platform`,JOe=`${D}.aws.ecs.task.arn`,eAe=`${D}.k8s.cluster.name`,tAe=`${D}.k8s.cluster.uid`,rAe=`${D}.k8s.namespace.name`,D1=`${D}.k8s.pod.name`,nAe=`${D}.k8s.pod.uid`,oAe=`${D}.k8s.container.name`,iAe=`${D}.k8s.node.name`,aAe=`${D}.k8s.node.uid`,G1=`${D}.k8s.deployment.name`,sAe=`${D}.k8s.deployment.uid`,$1=`${D}.k8s.replicaset.name`,cAe=`${D}.k8s.replicaset.uid`,j1=`${D}.k8s.statefulset.name`,pAe=`${D}.k8s.statefulset.uid`,B1=`${D}.k8s.daemonset.name`,uAe=`${D}.k8s.daemonset.uid`,lAe=`${D}.k8s.job.name`,mAe=`${D}.k8s.job.uid`,dAe=`${D}.k8s.cronjob.name`,fAe=`${D}.k8s.cronjob.uid`,Ll="status_code",vl="span.name";var kl="span.kind";var q1="db.system.name",F1="db.system",H1="db.namespace",K1="db.name";var gAe=`span_attributes.${H1}`,yAe=`span_attributes.${K1}`,hAe=`span_attributes.${q1}`,TAe=`span_attributes.${F1}`;var EAe={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${D}.tag_policy_id`,dataSource:`${D}.data_source`}};var _Ae={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${D}.batch_kind`,batchKindMetricsFilter:`${D}.batch_kind:metrics`,sourceApiKeyId:`${D}.source_api_key_id`,sourceEnv:`${D}.source_env`,sourceTeam:`${D}.source_team`}};var Ml="__tsuga_metadata__",IAe=`${Ml}.signature`,bAe=`${Ml}.routes`,SAe=`${Ml}.trace_id_bucket`;var CAe={[Ul]:kl,[Ul.replace(`${D}.`,"")]:kl,[wl]:vl,[wl.replace(`${D}.`,"")]:vl,[Nl]:Ll,[Nl.replace(`${D}.`,"")]:Ll};function mO(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var dO=["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"],fO=["alert_queries","alert_thresholds","alert_values"],z1=[...dO,...fO],gO=["alert_event_name","alert_message"],exe=[...z1,...gO],txe=new Set([...dO,...gO]),rxe=new Set(fO);var Y1="^\\S(.*\\S)?$",V1=128,Q1=256,W1=t.Object({key:t.String({description:"Tag key attached to the resource. Consumers can use key/value tags for filtering, ownership context, and policy checks."}),value:t.String({description:"Tag value attached to the resource for this key. Tsuga returns the value exactly as stored."})},{title:"Tag"}),Z1=t.Object({key:t.String({maxLength:V1,description:"Tag key to attach to the resource."}),value:t.String({maxLength:Q1,pattern:Y1,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),Lt=t.Array(W1,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),vt=t.Array(Z1,{title:"Tags",maxItems:50,description:"Key/value tags to apply to the resource. Tag policies may require specific keys or values."}),Re=t.Optional(Lt),$e=t.Optional(vt);var mn="/v0/teams",cp=["public","private"],sp={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},X1=t.Enum([sp.NAME,sp.CREATED_AT,sp.MEMBER_COUNT,sp.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),TO=t.Object({color:t.Enum(Cl,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:t.Enum(Pl,{description:"Avatar rendering mode selected for the team."}),iconName:t.Enum(cO,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),Dl=t.Object({color:t.Enum(Cl),mode:t.Enum(Pl)}),yO=100,hO=250,Wo=t.Object({id:t.String({description:"Unique identifier of the team. Generated by Tsuga and stable for the team lifetime."}),name:t.String({description:"Human-readable team name displayed throughout Tsuga and used in team search."}),description:t.Optional(t.String({description:"Optional free-text description of the team."})),visibility:t.Enum(cp,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:Re,createdAt:E({description:"Timestamp when Tsuga created the team."}),updatedAt:E({description:"Timestamp when Tsuga last updated the team metadata."}),memberCount:t.Optional(t.Number({description:"Number of members currently in the team"})),avatar:t.Optional(TO)}),pp=t.Object({name:t.String({minLength:1,maxLength:yO,format:Bo,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 ${yO} characters.`}),description:t.Optional(t.String({maxLength:hO,description:`Optional team description. Maximum length is ${hO} characters.`})),visibility:t.Enum(cp,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:$e,avatar:t.Optional(TO)}),J1=t.Object({id:t.String(),name:t.String(),email:t.String(),role:t.Enum(zo),joinedTeamAt:E(),orgRole:t.Enum(Qc),avatar:t.Optional(Dl)}),Xxe=m({tags:["teams"],url:mn,method:"GET",paginated:!0,response:t.Array(Wo),query:t.Object({...de,includeMemberCount:t.Optional(t.Boolean()),searchQuery:t.Optional(p({description:"Substring matched against team names and descriptions."})),visibility:t.Optional(t.Enum(cp,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:t.Optional(t.Boolean({description:"If true, return only teams that include the authenticated user."})),sortBy:t.Optional(X1),sortDirection:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending."}))})}),Jxe=m({tags:["teams"],url:`${mn}/:id`,method:"GET",params:t.Object({id:p()}),response:Wo}),eRe=m({tags:["teams"],url:`${mn}/:id/members`,method:"GET",params:t.Object({id:p()}),response:t.Array(J1)}),tRe=m({tags:["teams"],url:`${mn}/:id/assets`,method:"GET",params:t.Object({id:p()}),response:t.Object({apiKeyCount:t.Number(),logRouteCount:t.Number(),monitorCount:t.Number(),notificationRuleCount:t.Number(),dashboardCount:t.Number()})}),rRe=m({tags:["teams"],url:mn,method:"POST",body:pp,response:Wo}),nRe=m({tags:["teams"],url:`${mn}/:id`,method:"PUT",params:t.Object({id:p()}),body:pp,response:Wo}),oRe=m({tags:["teams"],url:`${mn}/bulk-update`,method:"POST",body:t.Object({teamIds:t.Array(p(),{maxItems:100}),config:t.Object({visibility:t.Enum(cp)})}),response:t.Object({})}),iRe=m({tags:["teams"],url:`${mn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x});var ej=t.Enum(["terraform-provider","web-frontend","mcp-server","cli"],{description:"Tsuga client surface that performed the operation. Use this to distinguish UI, CLI, MCP, and Terraform-originated changes."}),ae=b("type",[t.Object({type:t.Literal("user",{description:"The resource was created or updated by a user."}),id:t.String({description:"Unique identifier of the user actor."}),name:t.String({description:"Display name of the user actor at the time of response."}),avatar:t.Optional(Dl)}),t.Object({type:t.Literal("operation-api-key",{description:"The resource was created or updated by an operation API key."}),id:t.String({description:"Unique identifier of the operation API key actor."}),name:t.String({description:"Display name of the operation API key actor."}),source:t.Optional(ej)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var ft="/v0/monitors",Zo=["alert","resolve","keep_last_status","consider_zero"],Xo=["alert","resolve","keep_last_status"];var _O=["no_aggregation","all","any","each","proportion"],IO=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var tj=t.Object({formula:t.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(IO,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison."})}),rj=t.Object({formula:p({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(IO,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison."})}),nj=5,Gl=t.Array(tj,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),$l=t.Array(rj,{minItems:1,maxItems:nj,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),jl=t.Object({formula:t.String({description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:t.Enum(["rate","error","cpu","general","to_be_set"],{description:"Anomaly model type Tsuga uses to classify expected behavior: `rate` flags downward anomalies (e.g. count rates), `error` and `cpu` flag upward anomalies (e.g. error counts/rates, CPU usage), `general` flags both directions, and `to_be_set` is a placeholder Tsuga replaces by inferring the model type from the monitor query when the monitor is created or updated."})},{description:"Anomaly detection condition evaluated by this monitor. The `formula` result is compared against behavior learned from historical query results, and the monitor alerts on deviations in the direction implied by `conditionType`."}),Bl=t.Object({formula:p({type:"tsuga-formula",description:"Formula result analyzed for anomalous behavior, usually `q1` or a formula alias."}),conditionType:t.Enum(["rate","error","cpu","general","to_be_set"],{description:"Anomaly model type used to classify expected behavior: `rate` flags downward anomalies (e.g. count rates), `error` and `cpu` flag upward anomalies (e.g. error counts/rates, CPU usage), and `general` flags both directions. Use `to_be_set` to let Tsuga infer the model type from the monitor query during create or update."})},{description:"Anomaly detection condition evaluated by this monitor. The `formula` result is compared against behavior learned from historical query results, and the monitor alerts on deviations in the direction implied by `conditionType`."}),dt=[1,2,3,4,5];var up={timeframe:t.Number({description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over. Always a whole number, at least 1."}),groupByFields:t.Array(t.Object({fields:t.Array(t.String(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty means the monitor evaluates a single ungrouped series."}),limit:t.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(t.String({description:"Value used to group documents that have no value for a grouped field."}))}),{description:"Monitor group by configuration. The `limit` setting is currently ignored; evaluation applies a fixed limit of 100 groups per field."}),aggregationAlertLogic:t.Optional(t.Enum(_O,{description:"How grouped results are combined into alert state. Use `no_aggregation` only when `groupByFields` is empty; use `all`, `any`, `each`, or `proportion` with non-empty `groupByFields`. `proportion` also requires `proportionAlertThreshold`."})),proportionAlertThreshold:t.Optional(t.Integer({description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},lp={timeframe:t.Integer({minimum:1,description:"Lookback window, in minutes, that each query-backed threshold monitor evaluation aggregates over."}),groupByFields:t.Array(t.Object({fields:t.Array(p(),{description:"Attribute names the monitor splits results by, evaluating each resulting group independently. Empty or omitted means the monitor evaluates a single ungrouped series."}),limit:t.Number({description:"Configured limit for this group by. Currently ignored; monitor evaluation applies a fixed limit of 100 groups per field."}),sortOrder:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction applied to groups: ascending or descending."})),replaceNullWith:t.Optional(p({allowEmpty:!1,description:"Value used to group documents that have no value for a grouped field."}))}),{maxItems:1,description:"Monitor group by configuration. The `limit` setting is currently ignored; evaluation applies a fixed limit of 100 groups per field."}),aggregationAlertLogic:t.Optional(t.Enum(_O,{description:"How grouped results are combined into alert state. Use `no_aggregation` only when `groupByFields` is empty; use `all`, `any`, `each`, or `proportion` with non-empty `groupByFields`. `proportion` also requires `proportionAlertThreshold`. On create, omitted query-monitor values default to `no_aggregation`; on update, omitted values keep the existing aggregation logic."})),proportionAlertThreshold:t.Optional(t.Integer({minimum:1,maximum:99,description:"Percentage threshold used when `aggregationAlertLogic` is `proportion`."}))},ql={...up,timeframe:t.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},Fl={...lp,timeframe:t.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},bO=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Gl,noDataBehavior:t.Enum(Zo,{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."}),...up,queries:Sr},{$id:"MonitorConfigurationMetric"}),SO=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:$l,noDataBehavior:t.Enum(Zo,{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."}),...lp,queries:Or},{$id:"InputMonitorConfigurationMetric"}),OO=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Gl,noDataBehavior:t.Enum(Zo,{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."}),...up,queries:Sr},{$id:"MonitorConfigurationLog"}),AO=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:$l,noDataBehavior:t.Enum(Zo,{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."}),...lp,queries:Or},{$id:"InputMonitorConfigurationLog"}),xO=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Gl,noDataBehavior:t.Enum(Zo,{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."}),...up,queries:Sr},{$id:"MonitorConfigurationTrace"}),oj=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:$l,noDataBehavior:t.Enum(Zo,{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."}),...lp,queries:Or},{$id:"InputMonitorConfigurationTrace"}),RO=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:jl,noDataBehavior:t.Enum(Xo,{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."}),...ql,queries:Sr},{$id:"MonitorConfigurationAnomalyLog"}),CO=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Bl,noDataBehavior:t.Enum(Xo,{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."}),...Fl,queries:Or},{$id:"InputMonitorConfigurationAnomalyLog"}),PO=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:jl,noDataBehavior:t.Enum(Xo,{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."}),...ql,queries:Sr},{$id:"MonitorConfigurationAnomalyMetric"}),UO=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Bl,noDataBehavior:t.Enum(Xo,{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."}),...Fl,queries:Or},{$id:"InputMonitorConfigurationAnomalyMetric"}),wO=t.Object({type:t.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Use this configuration when Tsuga should learn historical trace query behavior and alert on unusual movement in trace-derived values."}),condition:jl,noDataBehavior:t.Enum(Xo,{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."}),...ql,queries:Sr},{$id:"MonitorConfigurationAnomalyTrace"}),ij=t.Object({type:t.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Set this value to create or update an anomaly monitor that learns historical trace query behavior and alerts on unusual movement in trace-derived values."}),condition:Bl,noDataBehavior:t.Enum(Xo,{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."}),...Fl,queries:Or},{$id:"InputMonitorConfigurationAnomalyTrace"}),NO=t.Object({type:t.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:t.Integer({description:"Number of days before certificate expiry when the monitor should warn."}),cloudAccounts:t.Optional(t.Array(t.String(),{description:"Cloud account IDs whose certificates are checked. Omitted means certificates from all cloud accounts are checked."})),aggregationAlertLogic:t.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:t.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"MonitorConfigurationCertificateExpiry"}),aj=t.Object({type:t.Literal("certificate-expiry",{description:"Monitor that alerts before discovered certificates expire."}),warnBeforeInDays:t.Integer({minimum:1,maximum:365,description:"Number of days before certificate expiry when the monitor should warn. Valid values are 1 through 365."}),cloudAccounts:t.Optional(t.Array(t.String(),{minItems:1,description:"Cloud account IDs whose certificates are checked. Omit to check certificates from all cloud accounts."})),aggregationAlertLogic:t.Literal("each",{description:"Certificate expiry monitors alert independently for each certificate."}),noDataBehavior:t.Literal("resolve",{description:"Certificate expiry monitors resolve when matching certificate data disappears."})},{$id:"InputMonitorConfigurationCertificateExpiry"}),sj=t.Object({type:t.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:t.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:t.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:t.Object({teamIds:t.Array(t.String(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets."}),env:t.String({description:"Environment whose logs are searched for new error patterns."}),service:t.Optional(t.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"}),cj=t.Object({type:t.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:t.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:t.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:t.Object({teamIds:t.Array(p(),{description:"Team IDs whose logs are searched for new error patterns. Tsuga resolves these team IDs to team names when exporting monitor assets."}),env:p({description:"Environment whose logs are searched for new error patterns."}),service:t.Optional(p({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"}),pj=b("type",[bO,OO,xO,RO,PO,sj,wO,NO],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),uj=b("type",[SO,AO,oj,CO,UO,ij,cj,aj],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var xr=t.Object({id:t.String({description:"Tsuga-generated monitor ID assigned when the monitor is created."}),name:t.String({description:"Display name of the monitor and alert source."}),owner:t.String({description:"Team ID that owns and manages the monitor."}),message:t.Optional(t.String({description:"Caller-supplied message included in notifications triggered by this monitor. Omitted when the monitor was created or last updated without one."})),tags:Re,configuration:pj,priority:t.Enum(dt,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:ln,dashboardId:t.Optional(t.String({description:"ID of the dashboard linked to this monitor for context when investigating alerts. Caller-supplied. Omitted when no dashboard is linked."})),pauseUntil:t.Optional(E({description:"Timestamp until which the monitor is snoozed."})),creator:t.Optional(ae),updater:t.Optional(ae),createdAt:E({description:"Timestamp when Tsuga created the monitor."}),updatedAt:E({description:"Timestamp when Tsuga last updated the monitor."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."}),clusterIds:t.Array(t.String(),{description:"Cluster IDs where the monitor is deployed. Empty means all eligible clusters."})},{title:"Monitor"}),lj=b("type",[bO,OO,xO,RO,PO,wO,NO]),ARe=t.Object({...xr.properties,configuration:lj},{title:"Monitor"}),xRe=t.Object({...xr.properties,configuration:b("type",[SO,AO,CO,UO])},{title:"Monitor"}),Ma=t.Object({name:p({description:"Display name of the monitor and alert source."}),message:t.Optional(p({type:"long",description:"Message included in notifications triggered by this monitor. Optional on create. On update, omitting it keeps the existing message."})),tags:$e,configuration:uj,priority:t.Enum(dt,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the monitor."}),dashboardId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"ID of the dashboard to link to this monitor for context when investigating alerts. On create: omit or send `null` to leave the monitor unlinked. On update: omit to skip updating this field, send `null` to clear an existing link."})),pauseUntil:t.Optional(p({allowEmpty:!1,type:"date-time",description:"ISO timestamp until which the monitor should be snoozed."})),permissions:ln,clusterIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Cluster IDs where the monitor should be deployed. Empty or omitted means all eligible clusters for cluster-deployed monitor types."}))}),EO=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],dn={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var Hl=t.Object({owners:xe(p({allowEmpty:!1}),{description:"Restrict results to monitors owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Case-insensitive substring matched against monitor ID, monitor name, query filters, and aggregate fields. Wildcard characters are treated literally."}),exclude:t.Optional(t.Boolean({description:"If true, exclude monitors matching this value instead of including them"}))},{description:"Search query filter for monitors."}),tags:xe(vt.items,{description:"Restrict results to monitors that have at least one of the listed key/value tags",maxItems:50}),priorities:xe(t.Enum(dt),{description:"Restrict results to monitors with one of these priorities",maxItems:dt.length}),types:xe(t.Enum(EO),{description:"Restrict results to monitors with these types",maxItems:EO.length}),activity:t.Enum(["active","snoozed"],{description:"Restrict results by activity status: active monitors or currently snoozed monitors"}),clusterIds:xe(p({allowEmpty:!1}),{description:"Restrict results to monitors deployed to any of these cluster IDs (monitors with no cluster restriction are always included)",maxItems:50})},{description:"Optional filters applied to narrow the returned monitors"}),Kl=t.Partial(t.Object({...de,filters:t.Partial(Hl),sort:t.Object({by:t.Enum([dn.PRIORITY,dn.TYPE,dn.NAME,dn.OWNER,dn.TAGS,dn.CLUSTER_IDS,dn.PAUSE_UNTIL,dn.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:t.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."})})),RRe=m({tags:["monitors"],url:`${ft}/query`,method:"POST",paginated:!0,response:t.Array(xr),body:Kl}),CRe=m({tags:["monitors"],url:`${ft}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(Hl,["tags"])))}),response:Lt}),PRe=m({tags:["monitors"],url:`${ft}/counts/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(Hl,["activity"])))}),response:t.Object({all:t.Integer({description:"Total number of monitors matching the filters that the user can read."}),active:t.Integer({description:"Number of matching readable monitors that are not currently snoozed."}),snoozed:t.Integer({description:"Number of matching readable monitors that are currently snoozed."})})}),URe=m({tags:["monitors"],url:`${ft}/:id`,method:"GET",params:t.Object({id:p()}),response:xr}),wRe=m({tags:["monitors"],url:ft,method:"POST",body:Ma,response:xr}),NRe=m({tags:["monitors"],url:`${ft}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ma,response:xr}),LRe=m({tags:["monitors"],url:`${ft}/bulk-update`,method:"PUT",body:t.Object({monitorIds:t.Array(p({allowEmpty:!1}),{minItems:1}),owner:p({allowEmpty:!1})}),response:t.Object({})}),vRe=m({tags:["monitors"],url:`${ft}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),kRe=m({tags:["monitors"],url:`${ft}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})}),MRe=m({tags:["monitors"],url:`${ft}/:id/snooze`,method:"POST",params:t.Object({id:p()}),body:t.Object({pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:xr}),DRe=m({tags:["monitors"],url:`${ft}/bulk-snooze`,method:"POST",body:t.Object({monitorIds:t.Array(p()),pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:t.Object({})}),mj=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],dj=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],fj=[...mj,...dj],Kn=t.Enum(fj),gj=b("type",[t.Object({type:t.Literal("each"),subStates:t.Record(t.String(),t.Object({stateValue:t.Union([Kn,t.Null()]),lastChangedAt:E()}))}),t.Object({type:t.Literal("no_aggregation"),stateValue:t.Optional(Kn)}),t.Object({type:t.Literal("any"),stateValue:t.Optional(Kn)}),t.Object({type:t.Literal("all"),stateValue:t.Optional(Kn)}),t.Object({type:t.Literal("proportion"),stateValue:t.Optional(Kn)})]),yj=t.Object({monitorId:t.String(),currentState:gj,lastChangedAt:t.Optional(E())}),GRe=m({tags:["monitors"],url:`${ft}/states/:id`,method:"GET",params:t.Object({id:p()}),response:yj}),$Re=m({tags:["monitors"],url:`${ft}/:id/transitions`,method:"GET",params:t.Object({id:p()}),query:t.Object({from:t.Number(),to:t.Number()}),response:t.Array(t.Object({id:t.String(),createdAt:E(),fromState:t.Optional(Kn),toState:t.Optional(Kn),dimension:t.Optional(t.String())}))}),hj=["unprocessed","processed","failed-to-process"],jRe=m({tags:["monitors"],url:`${ft}/:id/results`,method:"GET",params:t.Object({id:p()}),query:t.Object({from:t.Number(),to:t.Number()}),response:t.Object({isTruncated:t.Boolean(),results:t.Array(t.Object({id:t.String(),evaluationAt:E(),formulaResult:t.Object({groups:t.Array(t.Object({groupKey:t.Record(t.String(),La),results:t.Array(t.Union([t.Number(),t.Null()])),conditionMet:t.Enum(["true","false","nan-no-data"])}))}),createdAt:E(),status:t.Enum(hj)}))})});var Rr="/v0/slos",Tj=[7,30,90],Ej=["good","bad"],MO=t.Enum(Ej,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),_j=["good","bad","ignore"],DO=t.Enum(_j,{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)"}),LO=30,vO=1440,GO=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],Ij=["healthy","breached","no_data"],mp=t.Enum(Ij,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),kO={sli:t.Optional(t.Number({description:"Service level indicator for the latest evaluation; absent when there is no data"})),errorBudget:t.Optional(t.Number({description:"Remaining error budget at the latest evaluation; negative when exhausted, absent when there is no data"})),status:mp},bj=t.Object({overall:t.Object(kO,{description:"Latest overall evaluation for the cluster"}),perGroup:t.Array(t.Object({groupKey:t.Record(t.String(),La,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...kO}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),$O=t.Record(t.String(),bj,{description:"Latest evaluation results keyed by cluster ID."}),zl=t.Object({queries:Sr,formula:ip},{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."}),Yl=t.Object({queries:Or,formula:Hn},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Formulas reference queries as q1, q2, and so on."}),Sj=t.Object({type:t.Literal("burn-rate",{description:"Alert configuration kind. Set to `burn-rate` for alerts that fire when the SLO consumes error budget faster than the configured multiplier."}),burnRate:t.Number({description:"Burn-rate multiplier that triggers this alert. The short and long evaluation windows are derived from the predefined template with the closest burn rate."})},{title:"BurnRateAlert"}),Oj=t.Object({type:t.Literal("burn-rate",{description:"Alert configuration kind. Set to `burn-rate` for alerts that fire when the SLO consumes error budget faster than the configured multiplier."}),burnRate:t.Number({minimum:1,maximum:100,description:"Burn-rate multiplier that triggers this alert. Required for burn-rate alerts; valid input is 1 through 100. Non-template values are accepted; short and long evaluation windows are derived from the predefined template with the closest burn rate."})},{title:"BurnRateAlert"});var Aj=t.Object({type:t.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:t.Number({description:"SLI percentage threshold for this alert. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),xj=t.Object({type:t.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"SLI percentage threshold for this alert. Required for threshold alerts; valid input is greater than 0 and less than 100. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),Rj=b("type",[Sj,Aj],{description:"Alert trigger configuration: burn-rate or threshold"}),jO=b("type",[Oj,xj],{description:"Alert trigger configuration: burn-rate or threshold"}),Vl=t.Enum(dt,{description:"Alert priority (1 is highest, 5 is lowest)"}),Ql=t.Object({id:t.String({description:"Tsuga-generated SLO alert ID assigned when the alert is created."}),sloId:t.String({description:"Parent SLO ID for this alert."}),priority:Vl,configuration:Rj,createdAt:E({description:"Timestamp when Tsuga created the alert."}),updatedAt:E({description:"Timestamp when Tsuga last updated the alert."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"SloAlert"}),Cj=t.Object({priority:Vl,configuration:jO}),Pj=t.Object({id:t.Optional(p({allowEmpty:!1,description:"Identifier of an existing alert to update. Omit to create a new alert on this SLO."})),priority:Vl,configuration:jO}),Uj=b("type",[t.Object({type:t.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:Vt,goodQuery:zl,totalQuery:zl,groupByFields:t.Optional(Qo),noDataBehavior:MO},{title:"EventSloConfiguration"}),t.Object({type:t.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:Vt,query:zl,sliceSizeMinutes:t.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:t.Object({operator:t.Enum(GO,{description:"Comparison operator between the query value and the threshold"}),value:t.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:t.Optional(Qo),noDataBehavior:DO},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),wj=b("type",[t.Object({type:t.Literal("event",{description:"Configuration kind. Set to `event` for SLOs that compute SLI from good and total query formulas over the rolling timeframe."}),dataSource:Vt,goodQuery:Yl,totalQuery:Yl,groupByFields:t.Optional(Ar),noDataBehavior:MO},{title:"EventSloConfiguration"}),t.Object({type:t.Literal("time",{description:"Configuration kind. Set to `time` for SLOs that evaluate a query against a threshold in fixed-size time slices."}),dataSource:Vt,query:Yl,sliceSizeMinutes:t.Integer({minimum:LO,maximum:vO,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${LO} through ${vO}.`}),threshold:t.Object({operator:t.Enum(GO,{description:"Comparison operator between the query value and the threshold"}),value:t.Number({description:"Threshold value compared against the query signal"})},{description:"Threshold comparison applied to each time-SLO evaluation slice"}),groupByFields:t.Optional(Ar),noDataBehavior:DO},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),Nj=t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),BO=t.Enum(Tj,{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."}),Lj=t.Array(t.String(),{description:"Cluster IDs this SLO is evaluated on. Omit or send an empty array on input to run on all clusters; responses use an empty array to mean all clusters. Non-empty input values must reference existing clusters."}),vj=t.Array(p({allowEmpty:!1}),{description:"Cluster IDs this SLO is evaluated on. Omit or send an empty array on input to run on all clusters; responses use an empty array to mean all clusters. Non-empty input values must reference existing clusters."}),Jo=t.Object({id:t.String({description:"Tsuga-generated SLO ID assigned when the SLO is created."}),name:t.String({description:"Display name of the SLO, set by the caller."}),description:t.Optional(t.String({description:"Free-form, caller-provided description of what the SLO measures. Absent when not set."})),tags:Re,configuration:Uj,target:t.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:BO,owner:t.String({description:"Team ID that owns the SLO"}),permissions:ln,clusterIds:Lj,creator:t.Optional(ae),updater:t.Optional(ae),alerts:t.Array(Ql,{description:"Alerts attached to this SLO"}),createdAt:E({description:"Timestamp when Tsuga created the SLO."}),updatedAt:E({description:"Timestamp when Tsuga last updated the SLO."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"Slo"}),kj=t.Object({...Jo.properties,results:$O},{title:"SloWithResults"}),dp=t.Object({name:p({allowEmpty:!1,description:"Display name of the SLO."}),description:t.Optional(p({type:"long",description:"Free-form, caller-provided description of what the SLO measures. Optional."})),tags:$e,configuration:wj,target:Nj,timeframeDays:BO,owner:p({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:ln,clusterIds:t.Optional(vj),alerts:t.Array(Cj,{description:"Alerts to create on this SLO. Send an empty array for none."})}),Wl=t.Object({...t.Omit(dp,["alerts"]).properties,alerts:t.Array(Pj,{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."})}),qO=t.Object({owners:xe(p({allowEmpty:!1}),{description:"Restrict results to SLOs owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against the SLO name or SLO ID."}),exclude:t.Optional(t.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:xe(vt.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:xe(p({allowEmpty:!1}),{description:"Restrict results to SLOs that run against any of these cluster IDs (SLOs with no cluster restriction are always included)",maxItems:50}),statuses:xe(mp,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),Zl=t.Partial(t.Object({...de,filters:t.Partial(qO),sort:t.Object({by:t.Enum(["name","owner","tags","updatedAt","sli","errorBudget","status"],{description:"Field to sort by"}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned SLOs"})})),XRe=m({tags:["slos"],url:`${Rr}/query`,method:"POST",paginated:!0,response:t.Array(kj),body:Zl}),JRe=m({tags:["slos"],url:`${Rr}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(qO,["tags","statuses"])))}),response:Lt}),eCe=m({tags:["slos"],url:`${Rr}/:id`,method:"GET",params:t.Object({id:p()}),response:Jo}),tCe=m({tags:["slos"],url:`${Rr}/:id/results`,method:"GET",params:t.Object({id:p()}),response:$O}),rCe=m({tags:["slos"],url:Rr,method:"POST",body:dp,response:Jo}),nCe=m({tags:["slos"],url:`${Rr}/:id`,method:"PUT",params:t.Object({id:p()}),body:Wl,response:Jo}),oCe=m({tags:["slos"],url:`${Rr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),iCe=m({tags:["slos"],url:`${Rr}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})}),aCe=m({tags:["slos"],url:`${Rr}/bulk-update`,method:"PUT",body:t.Object({sloIds:t.Array(p()),owner:p({allowEmpty:!1})}),response:t.Object({})});var ei="/v0/notifications",Yn=`${ei}/rules`,FO=`${ei}/slack/setup`,Da=`${ei}/integrations`,zn=["triggered","resolved","no-data"],Mj=["sent","stale","pending","rate-limited","failed","silenced"],Dj=t.Optional(t.Object({maxMessages:t.Integer({description:"Maximum number of notifications this target can send during the rate-limiting window."}),minutes:t.Integer({description:"Length of the rate-limiting window, in minutes."})},{description:"Per-target rate limit used when sending notifications. If omitted, Tsuga allows up to 1000 notifications every 10 minutes for this target."})),Xl=t.Object({maxMessages:t.Integer({minimum:1,description:"Maximum number of notifications this target can send during the rate-limiting window. The ratio of `maxMessages` to `minutes` cannot exceed 100 notifications per minute."}),minutes:t.Integer({minimum:1,description:"Length of the rate-limiting window, in minutes. The ratio of `maxMessages` to `minutes` cannot exceed 100 notifications per minute."})},{description:"Per-target rate limit used when sending notifications. If omitted, Tsuga allows up to 1000 notifications every 10 minutes for this target."}),Gj=t.Optional(Xl),ur=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),lr=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({minimum:1,description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),Ga=t.Object({id:t.String({description:"Identifier of the notification target within this rule, used with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:Dj,config:b("type",[t.Object({type:t.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:t.String({description:"Slack channel ID that receives the notification"}),integrationId:t.String({description:"Slack workspace ID that receives the notification"}),integrationName:t.String({description:"Human readable name of the Slack integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigSlack"}),t.Object({type:t.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:t.String({description:"Identifier of the incident.io integration to use"}),integrationName:t.String({description:"Human readable name of the incident.io integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigIncidentIo"}),t.Object({type:t.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:t.Array(t.String(),{description:"Email addresses that will receive the alert"}),renotifyConfig:ur},{$id:"RuleTargetConfigEmail"}),t.Object({type:t.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:t.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:t.String({description:"Human readable name of the Grafana IRM integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigGrafanaIrm"}),t.Object({type:t.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:t.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:t.String({description:"Human readable name of the PagerDuty integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigPagerDuty"}),t.Object({type:t.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:t.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:t.String({description:"Human readable name of the Microsoft Teams integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigMicrosoftTeams"}),t.Object({type:t.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:t.String({description:"Identifier of the webhook integration to use"}),integrationName:t.String({description:"Human readable name of the webhook integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigWebhook"}),t.Object({type:t.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:t.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:t.String({description:"Human readable name of the ServiceNow integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigServiceNow"}),t.Object({type:t.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:t.String({description:"Identifier of the Google Chat integration to use"}),integrationName:t.String({description:"Human readable name of the Google Chat integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigGoogleChat"}),t.Object({type:t.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:t.String({description:"Identifier of the Squadcast integration to use"}),integrationName:t.String({description:"Human readable name of the Squadcast integration"}),renotifyConfig:ur},{$id:"RuleTargetConfigSquadcast"}),t.Object({type:t.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:t.String({description:"Identifier of the Jira integration to use"}),integrationName:t.String({description:"Human readable name of the Jira integration"}),projectKey:t.String({description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:t.String({description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:t.Optional(t.String({description:"Jira status the alert ticket is moved to right after it is filed for a firing alert. A later transition between two firing states leaves the ticket status alone."})),closedStatus:t.Optional(t.String({description:"Jira status the alert ticket is moved to when the alert resolves. Only takes effect when the rule delivers recovery transitions."}))},{$id:"RuleTargetConfigJira"})],{description:"Destination that received the notification. The `type` field discriminates the variant: `email` sends directly to the listed addresses, and every other type routes through the named integration referenced by `integrationId`."})}),ti=t.Object({id:p({description:"Identifier of the notification target within this rule. Choose a stable ID that is unique among this rule's targets; Tsuga uses it with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:Gj,config:b("type",[t.Object({type:t.Literal("slack",{description:"Slack target backed by a configured Slack integration."}),channel:p({allowEmpty:!1,description:"Slack channel ID that receives the notification"}),integrationId:p({allowEmpty:!1,description:"Slack workspace ID that receives the notification"}),renotifyConfig:lr},{$id:"RuleTargetInputSlack"}),t.Object({type:t.Literal("incident-io",{description:"incident.io target backed by a configured incident.io integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the incident.io integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputIncidentIo"}),t.Object({type:t.Literal("pagerduty",{description:"PagerDuty target backed by a configured PagerDuty integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the PagerDuty integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputPagerDuty"}),t.Object({type:t.Literal("email",{description:"Email target that sends directly to the listed addresses and does not require an integration."}),addresses:t.Array(p({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"}),renotifyConfig:lr},{$id:"RuleTargetInputEmail"}),t.Object({type:t.Literal("grafana-irm",{description:"Grafana IRM target backed by a configured Grafana IRM integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Grafana IRM integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputGrafanaIrm"}),t.Object({type:t.Literal("microsoft-teams",{description:"Microsoft Teams target backed by a configured Microsoft Teams integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Microsoft Teams integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputMicrosoftTeams"}),t.Object({type:t.Literal("webhook",{description:"Webhook target backed by a configured webhook integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the webhook integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputWebhook"}),t.Object({type:t.Literal("servicenow",{description:"ServiceNow target backed by a configured ServiceNow integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the ServiceNow integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputServiceNow"}),t.Object({type:t.Literal("google-chat",{description:"Google Chat target backed by a configured Google Chat integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Google Chat integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputGoogleChat"}),t.Object({type:t.Literal("squadcast",{description:"Squadcast target backed by a configured Squadcast integration."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Squadcast integration to use"}),renotifyConfig:lr},{$id:"RuleTargetInputSquadcast"}),t.Object({type:t.Literal("jira",{description:"Jira target backed by a configured Jira integration. Jira targets file one issue per notification and do not support renotification."}),integrationId:p({allowEmpty:!1,description:"Identifier of the Jira integration to use"}),projectKey:p({allowEmpty:!1,description:'Key of the Jira project that alert issues are filed into, like "OPS".'}),issueType:p({allowEmpty:!1,description:'Name of the Jira issue type created for alerts, like "Bug" or "Task".'}),openStatus:t.Optional(p({allowEmpty:!1,description:"Jira status the alert ticket is moved to right after it is filed for a firing alert. A later transition between two firing states leaves the ticket status alone."})),closedStatus:t.Optional(p({allowEmpty:!1,description:"Jira status the alert ticket is moved to when the alert resolves. Only takes effect when the rule delivers recovery transitions."}))},{$id:"RuleTargetInputJira"})],{description:"Destination that should receive the notification. The `type` field discriminates the variant: `email` sends directly to the listed addresses and needs no integration; every other type routes through the integration identified by `integrationId`, which must already exist (create it first with the notification integration endpoints)."})}),Jl=b("type",[t.Object({type:t.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:t.Array(t.String(),{description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),t.Object({type:t.Literal("all-teams",{description:"Match alert transitions for every team in the organization. Public API callers need an API key with `all` scope to create or update this filter."})},{title:"AllTeams"}),t.Object({type:t.Literal("all-public-teams",{description:"Match alert transitions for all public teams. Public API callers need an API key with `all` or `owning-team-and-public` scope to create or update this filter."})},{title:"AllPublicTeams"})],{description:"Team visibility filter used when matching alert transitions. Tsuga validates create and update requests against the caller permissions."}),em=b("type",[t.Object({type:t.Literal("specific-teams",{description:"Match alert transitions associated with the listed teams. The caller must be allowed to access every listed team."}),teams:t.Array(p(),{minItems:1,maxItems:100,description:"Team IDs selected by this filter."})},{title:"SpecificTeams"}),t.Object({type:t.Literal("all-teams",{description:"Match alert transitions for every team in the organization. Public API callers need an API key with `all` scope to create or update this filter."})},{title:"AllTeams"}),t.Object({type:t.Literal("all-public-teams",{description:"Match alert transitions for all public teams. Public API callers need an API key with `all` or `owning-team-and-public` scope to create or update this filter."})},{title:"AllPublicTeams"})],{description:"Team visibility filter used when matching alert transitions. Tsuga validates create and update requests against the caller permissions."}),ri=t.Object({id:t.String({description:"Tsuga-generated notification rule ID assigned when the rule is created."}),name:t.String({description:"Display name of the notification rule."}),queryString:t.Optional(t.String({description:"Optional query that narrows which alert transitions trigger the rule. Matches on the monitor transition group key and the monitor tags, e.g. `env:prod service:api`. Omit or leave empty to match regardless of tags."})),teamsFilter:Jl,prioritiesFilter:t.Array(t.Enum(dt),{description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:t.Array(t.String(),{description:"Cluster IDs that must match for this rule to fire. An empty array matches every cluster, as does a transition that has no cluster ID."}),owner:t.String({description:"Team ID that owns and manages the rule."}),createdAt:E({description:"Timestamp when Tsuga created the rule."}),updatedAt:E({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when its filters match."}),tags:Re,targets:t.Array(Ga,{description:"Destinations that receive a notification whenever this rule matches an alert transition. Every target in the list is notified independently, subject to its own rate limit and renotification settings."}),creator:t.Optional(ae),updater:t.Optional(ae)}),$a=t.Object({name:p({description:"Display name of the notification rule."}),queryString:t.Optional(p({type:"tags-query",description:"Optional query that narrows which alert transitions trigger the rule. Matches on the monitor transition group key and the monitor tags, e.g. `env:prod service:api`. Omit or leave empty to match regardless of tags."})),teamsFilter:em,prioritiesFilter:t.Array(t.Enum(dt),{maxItems:dt.length,description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{maxItems:zn.length,description:"Alert state transitions that must match for this rule to fire. An empty array matches every transition type."}),clusterIdsFilter:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Cluster IDs that must match for this rule to fire. Omit it, or leave it empty, to match every cluster."})),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:$e,isActive:t.Boolean({description:"Set to true for the rule to send notifications when its filters match."}),targets:t.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."})}),fp=t.Object({id:t.String({description:"Unique identifier of the adaptive notification rule. Generated by Tsuga."}),name:t.String({description:"Display name of the adaptive notification rule."}),owner:t.String({description:"Team ID that owns and manages the rule."}),createdAt:E({description:"Timestamp when Tsuga created the rule."}),updatedAt:E({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when one of its monitors fires."}),shouldCreateInvestigation:t.Boolean({description:"Whether each page records an investigation holding the sampled traces and the call graph the destination was resolved from, linked from the notification body."}),tags:Re,monitorIds:t.Array(t.String(),{description:"Monitors this rule reacts to."}),fallbackTarget:Ga,creator:t.Optional(ae),updater:t.Optional(ae)}),HO=t.Object({name:p({description:"Display name of the adaptive notification rule."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:$e,isActive:t.Boolean({description:"Set to true for the rule to send notifications when one of its monitors fires."}),shouldCreateInvestigation:t.Optional(t.Boolean({description:"Set to true to record an investigation for each page, holding the sampled traces and the call graph the destination was resolved from, and to link it from the notification body. Defaults to false."})),monitorIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:100,description:"Monitors this rule reacts to. Only trace monitors and metric monitors over OTel span metrics are eligible."}),fallbackTarget:ti}),gCe=m({tags:["notification-rules"],url:Yn,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(ri)}),yCe=m({tags:["notification-rules"],url:`${Yn}/:id`,params:t.Object({id:p()}),method:"GET",response:ri}),hCe=m({tags:["notification-rules"],url:Yn,method:"POST",body:$a,response:ri}),TCe=m({tags:["notification-rules"],url:`${Yn}/:id`,method:"PUT",params:t.Object({id:p()}),body:$a,response:ri}),ECe=m({tags:["notification-rules"],url:`${Yn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),ja=`${ei}/adaptive-rules`,_Ce=m({tags:["notification-rules"],url:ja,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(fp)}),ICe=m({tags:["notification-rules"],url:`${ja}/:id`,params:t.Object({id:p()}),method:"GET",response:fp}),bCe=m({tags:["notification-rules"],url:ja,method:"POST",body:HO,response:fp}),SCe=m({tags:["notification-rules"],url:`${ja}/:id`,method:"PUT",params:t.Object({id:p()}),body:HO,response:fp}),OCe=m({tags:["notification-rules"],url:`${ja}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),ACe=m({tags:["notification-integrations"],url:`${FO}/start`,method:"POST",response:t.Object({redirectUrl:t.String()})}),$j=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],jj=t.Object({id:t.String(),name:t.String(),type:t.Enum($j),createdAt:E(),ruleCount:t.Number(),creator:t.Optional(ae)}),xCe=m({tags:["notification-integrations"],url:`${Yn}/integrations`,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(jj)}),RCe=m({tags:["notification-integrations"],url:`${FO}/callback`,method:"GET",query:t.Object({code:p()}),response:t.Object({success:t.Boolean()})}),tm=["POST","PUT"],Bj=t.Record(t.String(),t.String()),qj=t.Record(t.String(),t.Unknown()),Fj=t.Record(t.String(),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))])),Hj=b("type",[t.Object({type:t.Literal("json"),value:qj}),t.Object({type:t.Literal("form"),value:Fj})]),Kj=t.Object({ok:t.String(),alert:t.String()}),rm=t.Object({id:t.String(),name:t.String(),setting:b("type",[t.Object({type:t.Literal("incident-io"),alertSourceConfigId:t.String(),tokenLastChars:t.String()}),t.Object({type:t.Literal("grafana-irm"),urlLastChars:t.String()}),t.Object({type:t.Literal("pagerduty"),integrationKeyLastChars:t.String()}),t.Object({type:t.Literal("microsoft-teams"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("webhook"),urlLastChars:t.String(),method:t.Enum(tm),authentication:b("type",[t.Object({type:t.Literal("bearer"),tokenLastChars:t.String()}),t.Object({type:t.Literal("basic"),username:t.String(),passwordLastChars:t.String()}),t.Object({type:t.Literal("custom-header"),key:t.String(),valueLastChars:t.String()}),t.Object({type:t.Literal("none")})]),customHeaders:t.Optional(Bj),payloadTemplate:Hj,eventNameMapping:t.Optional(Kj)}),t.Object({type:t.Literal("servicenow"),instanceName:t.String(),username:t.String(),passwordLastChars:t.String()}),t.Object({type:t.Literal("google-chat"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("squadcast"),webhookUrlLastChars:t.String()}),t.Object({type:t.Literal("jira"),siteUrl:t.String(),email:t.String(),apiTokenLastChars:t.String()})]),tags:Re}),zj=t.Object({type:t.Literal("webhook"),url:p({type:"uri"}),method:t.Enum(tm),authentication:b("type",[t.Object({type:t.Literal("bearer"),token:p({allowEmpty:!1})}),t.Object({type:t.Literal("basic"),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),t.Object({type:t.Literal("custom-header"),key:p({allowEmpty:!1}),value:p({allowEmpty:!1})}),t.Object({type:t.Literal("none")})]),customHeaders:t.Record(p({allowEmpty:!1}),p()),payloadTemplate:b("type",[t.Object({type:t.Literal("json"),value:t.Record(p({allowEmpty:!1}),t.Unknown())}),t.Object({type:t.Literal("form"),value:t.Record(p({allowEmpty:!1}),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))]))})]),eventNameMapping:t.Optional(t.Object({ok:p({allowEmpty:!1}),alert:p({allowEmpty:!1})}))}),KO=t.Object({type:t.Literal("incident-io"),alertSourceConfigId:p(),token:p()}),zO=t.Object({type:t.Literal("grafana-irm"),url:p({type:"uri"})}),YO=t.Object({type:t.Literal("pagerduty"),integrationKey:p()}),VO=t.Object({type:t.Literal("microsoft-teams"),webhookUrl:p({type:"uri"})}),Yj=t.Object({type:t.Literal("servicenow"),instanceName:p({allowEmpty:!1,description:'Instance name of the ServiceNow instance. This corresponds to the subdomain part of the instance URL, like "my-instance" in "my-instance.service-now.com"'}),username:p({allowEmpty:!1}),password:p({allowEmpty:!1})}),Vj=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),Qj=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),Wj=t.Object({type:t.Literal("jira"),siteUrl:p({type:"uri",allowEmpty:!1,description:'Base URL of the Jira Cloud site, like "https://your-company.atlassian.net". Tsuga files issues against this site.'}),email:p({type:"email",allowEmpty:!1,description:"Atlassian account email used together with the API token for Basic authentication."}),apiToken:p({allowEmpty:!1,description:"Atlassian API token minted for the account, used as the Basic auth password."})}),Zj=t.Object({name:p(),setting:b("type",[KO,zO,YO,VO,zj,Yj,Vj,Qj,Wj]),tags:$e}),Xj=t.Object({type:t.Literal("webhook"),url:t.Optional(p({type:"uri"})),method:t.Optional(t.Enum(tm)),authentication:t.Optional(b("type",[t.Object({type:t.Literal("bearer"),token:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("basic"),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("custom-header"),key:t.Optional(p({allowEmpty:!1})),value:t.Optional(p({allowEmpty:!1}))}),t.Object({type:t.Literal("none")})])),customHeaders:t.Optional(t.Record(p({allowEmpty:!1}),p())),payloadTemplate:t.Optional(b("type",[t.Object({type:t.Literal("json"),value:t.Record(p({allowEmpty:!1}),t.Unknown())}),t.Object({type:t.Literal("form"),value:t.Record(p({allowEmpty:!1}),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))]))})])),eventNameMapping:t.Optional(t.Object({ok:t.Optional(p({allowEmpty:!1})),alert:t.Optional(p({allowEmpty:!1}))}))}),Jj=t.Object({type:t.Literal("servicenow"),instanceName:t.Optional(p({allowEmpty:!1})),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),eB=t.Object({type:t.Literal("jira"),siteUrl:t.Optional(p({type:"uri",allowEmpty:!1})),email:t.Optional(p({allowEmpty:!1})),apiToken:t.Optional(p({allowEmpty:!1}))}),tB=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),rB=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),nB=t.Object({name:t.Optional(p()),setting:t.Optional(b("type",[KO,zO,YO,VO,Xj,Jj,tB,rB,eB]))}),CCe=m({tags:["notification-integrations"],url:Da,method:"POST",body:Zj,response:rm}),PCe=m({tags:["notification-integrations"],url:`${Da}/:id`,method:"GET",params:t.Object({id:p()}),response:rm}),UCe=m({tags:["notification-integrations"],url:`${Da}/:id`,method:"PUT",params:t.Object({id:p()}),body:nB,response:rm}),wCe=m({tags:["notification-integrations"],url:`${Da}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),oB=b("status",[t.Object({status:t.Literal("ok",{description:"Tsuga reached Jira and listed the projects the credentials can file into."}),projects:t.Array(t.Object({key:t.String({description:'Jira project key, like "OPS".'}),name:t.String({description:"Human readable Jira project name."}),issueTypes:t.Array(t.String(),{description:"Issue type names available when creating an issue in this project."}),statuses:t.Optional(t.Array(t.String(),{description:"Status names an issue in this project can be transitioned to. Omitted when Jira refused the status lookup for this project."}))}),{description:"Projects the connected Jira account can file issues into."})},{title:"JiraMetadataOk"}),t.Object({status:t.Literal("error",{description:"Tsuga could not load Jira metadata with the stored credentials."}),message:t.String({description:"Human readable reason the Jira metadata could not be loaded."})},{title:"JiraMetadataError"})],{description:"Result of probing Jira for the projects, issue types and statuses reachable with a stored integration. Returns a typed error instead of failing so the rule editor can fall back to free-text entry."}),NCe=m({tags:["notification-integrations"],url:`${Da}/:id/jira-metadata`,method:"GET",params:t.Object({id:p()}),response:oB}),LCe=m({tags:["notification-rules"],url:`${ft}/:id/notifications`,method:"GET",params:t.Object({id:p()}),query:t.Optional(t.Object({from:t.Optional(t.Number()),to:t.Optional(t.Number())})),response:t.Object({notifications:t.Array(t.Object({id:t.String(),monitorId:t.String(),monitorResultId:t.String(),ruleId:t.Optional(t.String()),targetId:t.Optional(t.String()),status:t.Enum(Mj),tryCount:t.Number(),nextTryAt:E(),createdAt:E(),updatedAt:E(),sentAt:t.Optional(E())})),isTruncated:t.Boolean()})}),iB=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],vCe=m({tags:["notification-rules"],url:`${Yn}/test`,method:"POST",body:t.Object({notificationRule:$a,targetIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:t.Union([t.Object({success:t.Literal(!1),overallMessage:t.String({description:"Message when there is an overall error"})}),t.Object({success:t.Boolean(),results:t.Array(t.Object({targetId:t.String({description:"The ID of the target that was tested"}),targetType:t.Enum(iB,{description:"The type of the target (e.g., slack, webhook)"}),status:t.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:t.Optional(t.String({description:"Message if the notification failed for this specific target"}))}))})])});var kt="/v0/service-catalog";var aB=t.Object({team:t.String({description:"Team name observed on telemetry for this service."}),lastSeenAt:E({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."}),sB=t.Object({ingestionApiKey:t.String({description:"Ingestion API key name or identifier observed on telemetry for this service."}),lastSeenAt:E({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."}),cB=t.Object({version:t.String({description:"Service version value observed in telemetry."}),firstSeenAt:E({description:"First time this version was observed for the service."}),lastSeenAt:E({description:"Most recent time this version was observed for the service."}),faulty:t.Optional(t.Boolean({description:"Whether Tsuga detected this version as associated with faulty behavior."})),faultyLatency:t.Optional(t.Boolean({description:"Whether the faulty behavior Tsuga detected for this version is a latency degradation. Only set by faulty deployment detection when it reports on latency; absent when the detection did not evaluate latency."})),detectionTriggered:t.Optional(t.Boolean({description:"Whether faulty deployment detection has already been triggered for this version. Set when the detection job is launched to avoid re-triggering it. Absent on versions predating this field."}))},{description:"A service version observed in telemetry, with first and last seen timestamps and faulty deployment detection results."}),pB=t.Object({language:t.String({description:"Programming language observed for this service."}),lastSeenAt:E({description:"Most recent time this language was observed."})},{description:"A programming language observed for this service, with the last time it was seen."}),uB=t.Object({runtime:t.String({description:"Runtime observed for this service."}),lastSeenAt:E({description:"Most recent time this runtime was observed."})},{description:"A runtime observed for this service, with the last time it was seen."}),QO=t.Object({protocol:t.String({description:"Observed API protocol (e.g. 'http', 'grpc', 'graphql')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"An API protocol observed for this service, with the last time it was seen."}),lB=t.Object({framework:t.String({description:"Observed application framework (e.g. 'express', 'fastify', 'django', 'rails')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"An application framework detected from OpenTelemetry instrumentation scope, with the last time it was seen."}),mB=t.Object({platform:t.String({description:"Observed cloud or orchestration platform (e.g. 'aws_eks', 'kubernetes')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"A cloud or orchestration platform this service runs on, with the last time it was seen."}),dB=t.Object({provider:t.String({description:"Observed cloud provider (e.g. 'aws', 'gcp', 'azure')"}),lastSeenAt:E({description:"Most recent observation timestamp"})},{description:"A cloud provider this service runs on, with the last time it was seen."}),gp=t.Object({id:t.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:t.String({description:"Identifier of the service catalog entry this target is attached to."}),config:Ga.properties.config,rateLimit:Ga.properties.rateLimit,createdAt:E({description:"Timestamp when user created this service target."}),updatedAt:E({description:"Timestamp when user last updated this service target."})}),fB=t.Object({config:ti.properties.config,rateLimit:ti.properties.rateLimit}),gB=t.Object({config:ti.properties.config,rateLimit:t.Union([Xl,t.Null()])}),Ba=t.Object({id:t.String({description:"Unique identifier of this service. Use it with service detail and graph endpoints."}),serviceName:t.String({description:"OpenTelemetry service name observed in telemetry."}),serviceNamespace:t.Optional(t.String({description:"OpenTelemetry service namespace observed in telemetry."})),env:t.Optional(t.String({description:"Environment value observed for this service."})),teams:t.Array(aB,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:t.Array(sB,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:t.Array(cB,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:t.Array(pB,{description:"Programming languages observed for this service."}),runtimes:t.Array(uB,{description:"Runtime values observed for this service."}),serverProtocols:t.Array(QO,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:t.Array(QO,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:t.Array(lB,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:t.Array(mB,{description:"Cloud platforms this service is running on"}),cloudProviders:t.Array(dB,{description:"Cloud providers this service is running on"}),lastSeenAt:E({description:"Most recent time Tsuga observed telemetry for this service."}),firstSeenAt:E({description:"First time Tsuga observed telemetry for this service."}),sources:t.Array(t.String(),{description:"Telemetry sources that contributed evidence for this service entry."}),additionalUserFields:t.Optional(t.Unsafe({type:"object",additionalProperties:!0,description:"Additional user-defined service metadata, when configured."})),logsCount24h:t.Number({description:"Number of logs observed for this service in the last 24 hours."}),errorLogsCount24h:t.Number({description:"Number of error logs observed for this service in the last 24 hours."}),tracesCount24h:t.Number({description:"Number of traces observed for this service in the last 24 hours."}),errorTracesCount24h:t.Number({description:"Number of error traces observed for this service in the last 24 hours."}),notificationTargets:t.Array(gp,{description:"Notification targets attached to this service, used by adaptive notification rules to page its owners."}),createdAt:E({description:"Timestamp when Tsuga created this service catalog entry."}),updatedAt:E({description:"Timestamp when Tsuga last updated this service catalog entry."})}),KCe=m({tags:["service-catalog"],query:t.Object({...de,clusterId:t.Optional(p())}),method:"GET",paginated:!0,url:`${kt}/services`,response:t.Array(Ba)}),yB=t.Object({spanKind:t.Enum(lO),count:t.Number()}),WO=t.Object({...Ba.properties,spanKindCounts:t.Array(yB),envs:t.Object({primaryEnv:t.String(),allEnvs:t.Array(t.String())})}),zCe=m({tags:["service-catalog"],query:t.Object({...de,clusterId:t.Optional(p()),env:t.Optional(p())}),method:"GET",paginated:!0,url:`${kt}/v2/services`,response:t.Array(WO)}),YCe=m({tags:["service-catalog"],query:t.Object({serviceName:p({allowEmpty:!1}),serviceNamespace:t.Optional(p({allowEmpty:!1})),env:p({allowEmpty:!1}),clusterId:t.Optional(p())}),method:"GET",url:`${kt}/v2/service`,response:WO}),VCe=m({tags:["service-catalog"],method:"GET",url:`${kt}/services/:serviceId`,params:t.Object({serviceId:p()}),response:Ba}),QCe=m({tags:["service-catalog"],method:"GET",url:`${kt}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),response:t.Array(gp)}),WCe=m({tags:["service-catalog"],method:"POST",url:`${kt}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),body:fB,response:gp}),ZCe=m({tags:["service-catalog"],method:"PUT",url:`${kt}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),body:gB,response:gp}),XCe=m({tags:["service-catalog"],method:"DELETE",url:`${kt}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),response:x}),hB=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var ZO=t.Object({id:t.String(),hostName:t.String(),env:t.Optional(t.String()),cpuUtilizationAverage:t.Number(),hostType:t.Enum(hB),teams:t.Array(t.String()),tags:t.Array(t.String()),firstSeenAt:E(),lastSeenAt:E(),clusterId:t.String()}),JCe=m({tags:["service-catalog"],method:"GET",url:`${kt}/hosts`,response:t.Array(ZO)}),ePe=m({tags:["service-catalog"],method:"GET",url:`${kt}/hosts/:hostId`,params:t.Object({hostId:p()}),response:ZO}),TB=["http","rpc","messaging","genai","object_store"],XO={name:t.String({description:"Service or inferred dependency name shown in the graph."}),env:t.Optional(t.String({description:"Environment observed from spans."}))},nm=t.Object({...XO,nodeType:t.Literal("observed",{description:"Discriminator for this node variant. Always `observed` for a graph node matched to a service catalog entry by name and env."}),id:t.Union([t.String(),t.Null()],{description:"Service ID, or null when multiple namespaces match the observed service name."}),namespace:t.Union([t.String(),t.Null()],{description:"Service namespace, or null when multiple namespaces match the observed service name."}),errorRate:t.Optional(t.Number({description:"Ratio of entry requests with at least one error to total entry requests observed on this service. Omitted when no entry requests were observed."})),entryErrorRequestCount:t.Number({description:"Number of entry requests on this service where at least one entry span had error status."}),entryRequestCount:t.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."})}),JO={...XO,endpoint:t.Optional(t.String({description:"Inferred service endpoint address"})),resourceName:t.Optional(t.String({description:"Inferred resource name, e.g. table or queue name"}))},om=t.Object({...JO,nodeType:t.Literal("inferred_db",{description:"Discriminator for this node variant. Always `inferred_db` for a database dependency detected from client-span attributes that could not be matched to a service catalog entry."}),serviceType:t.Literal("db",{description:"Inferred dependency type. Always `db` for this node variant."}),databaseName:t.Optional(t.String({description:"Database name from span_attributes db.namespace (falling back to legacy db.name). Matches the database catalog `name`."})),databaseSystem:t.String({description:"Database system from span_attributes db.system.name (falling back to legacy db.system). Matches the database catalog `databaseSystem`."})}),im=t.Object({...JO,nodeType:t.Literal("inferred",{description:"Discriminator for this node variant. Always `inferred` for a non-database dependency detected from client-span attributes (e.g. a queue or external HTTP call) that could not be matched to a service catalog entry. Database dependencies use the `inferred_db` variant."}),serviceType:t.Enum(TB,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),EB=b("nodeType",[nm,om,im]),am=t.Object({from:t.Object({env:t.Optional(t.String({description:"Environment of the source node"})),name:t.String({description:"Name of the source node"})},{description:"Reference to the caller node, i.e. the service or dependency that issued the request."}),to:t.Object({env:t.Optional(t.String({description:"Environment of the target node"})),name:t.String({description:"Name of the target node"}),databaseSystem:t.Optional(t.String({description:"Database system of the target when it is an inferred database node (`inferred_db`). Together with `name` and `env` it identifies the target node, distinguishing a database from a same-named service or a same-named database on another system."}))},{description:"Reference to the callee node, i.e. the service or dependency that received the request."}),count:t.Number({description:"Number of cross-service transitions observed on this directed edge in the graph query window."}),errorRate:t.Optional(t.Number({description:"Ratio of errored client spans to total client spans observed on this edge. Omitted when no client spans were observed. For edges to inferred services, the originating span is treated as the client span regardless of its kind."})),errorCount:t.Number({description:"Number of client spans with error status observed on this edge"}),clientSpanCount:t.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."}),tPe=m({tags:["service-catalog"],url:`${kt}/services/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p()}),query:t.Object({...Ve.properties,query:t.Optional(p({type:"tsuga-query"}))}),response:t.Object({clusterId:t.String(),nodes:t.Array(EB),edges:t.Array(am)})}),_B=t.Object({monitors:t.Array(t.Object({id:t.String({description:"Identifier of the monitor"}),name:t.String({description:"Display name of the monitor"}),owner:t.String({description:"Team ID that owns the monitor"}),priority:t.Enum(dt,{description:"Priority of the monitor"})})),slos:t.Array(t.Object({id:t.String({description:"Identifier of the SLO"}),name:t.String({description:"Display name of the SLO"}),owner:t.String({description:"Team ID that owns the SLO"}),statusCount:t.Partial(t.Record(mp,t.Number()),{description:"Count of SLO statuses for this service: one entry per group matching the service when the SLO groups by service.name, otherwise the overall status"})}))}),rPe=m({tags:["service-catalog"],method:"GET",url:`${kt}/services/:serviceId/related-resources`,params:t.Object({serviceId:p()}),response:_B}),nPe=m({tags:["service-catalog"],method:"GET",url:`${kt}/services/by-api-keys`,response:t.Record(t.String(),t.Array(t.Object({serviceName:t.String(),serviceNamespace:t.Optional(t.String())})))});var sm=`/${"v1"}/services`,cm=t.Pick(Ba,["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)."}),IB={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(cm,{examples:[IB]});var eA=m({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:sm,method:"GET",paginated:!0,query:t.Object({...De,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Omit to use the first cluster in the organization; this does not query all clusters."}))},{description:"Service list query. Use pagination and optional cluster scope."}),response:t.Array(cm)}),tA=m({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${sm}/:serviceId`,method:"GET",params:t.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to retrieve. Use the `id` returned by service list responses."})}),response:cm}),bB=t.Pick(nm,["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."}),SB=t.Pick(im,["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."}),OB=t.Pick(om,["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."}),AB=b("nodeType",[bB,OB,SB]),xB=t.Pick(am,["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."}),RB=t.Optional(t.Integer({...Ve.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."})),CB=t.Optional(t.Integer({...Ve.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."})),PB=p({type:"tsuga-query",default:"*",description:"Tsuga query used to filter spans considered for the graph. Defaults to `*`, which applies no additional filter beyond the service identity."}),rA=m({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:`${sm}/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p({allowEmpty:!1,description:"Identifier of the service to use as the graph root. Use the `id` returned by service list or get responses."})}),query:t.Object({from:RB,to:CB,query:t.Optional(PB)},{description:"Service graph query. Use time range and optional span query filters."}),response:t.Object({clusterId:t.String({description:"Cluster ID the graph was built from"}),nodes:t.Array(AB,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:t.Array(xB,{description:"Directed dependency edges between graph nodes."})})});var Ce=" (unix seconds, ISO 8601, or relative like -1h/-30m/now)";function nA(e,r){let n=r??Ir(e);return n===void 0?void 0:Xs(n)}function pm(e){let r=Ir(e);return r===void 0?"":` (default: ${r})`}function oA(e,r){e.command("service-graph").description("Inspect service dependency graphs").command("get <SERVICE_ID>").description("Retrieve the dependency graph for a service").option("--from <TIMESTAMP>",`Start of time range${Ce}${pm("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${pm("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${pm("query")}`).action(async(o,i)=>{let a={},c=nA("from",i.from),l=nA("to",i.to);c!==void 0&&(a.from=c),l!==void 0&&(a.to=l),i.query!==void 0&&(a.query=i.query);let d=await r()(rA,{params:{serviceId:o},query:a});Q(d)})}var UB=`/${"v1"}/grok`,wB=25,NB=100,iA=t.Object({rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok parsing rule to preview against each sample. The rule uses the same Grok syntax as the log route **Grok parser** processor, for example `pod:%{DATA:namespace}/%{DATA:name}`."}),{minItems:1,maxItems:wB,description:"Ordered Grok parsing rules to preview. For each sample, Tsuga tries the rules in order and returns the first successful match, matching route Grok processor semantics."}),samples:t.Array(p({allowEmpty:!1,type:"long",description:"Raw log line to parse with the provided Grok rules. The value is parsed as preview input only; this endpoint does not ingest or store the sample."}),{minItems:1,maxItems:NB,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."}),LB={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(iA,{examples:[LB]});var aA=t.Object({results:t.Array(t.Object({sample:t.String({description:"Echo of the submitted log line, so results can be matched to the samples in the request."}),matched:t.Boolean({description:"Whether any submitted rule matched this sample. `true` means `extracted` contains the captured fields; `false` means no rule matched."}),extracted:t.Union([t.Record(t.String(),t.Unknown()),t.Null()],{description:"Fields extracted from the first matching Grok rule when `matched` is `true`; dotted capture names are expanded into nested objects. `null` when no rule matched."})}),{description:"Preview result for each submitted sample, in the same order as the request `samples` array."})},{description:"Grok extraction preview results from applying the ordered rules to each submitted sample."}),vB={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(aA,{examples:[vB]});var sA=m({url:`${UB}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:iA,response:aA,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 cA=Sn(require("node:fs"));function ni(e){if(e.file){let r=cA.default.readFileSync(e.file==="-"?0:e.file,"utf-8");return JSON.parse(r)}if(e.data)return JSON.parse(e.data);throw new Error("Provide a request body with -f <FILE_PATH> or -d <JSON>. Use --generate-skeleton to get a template.")}function kB(e){return s.IsObject(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"errors")&&s.IsFunction(e.check)&&s.IsFunction(e.errors)}function um(e){return s.HasPropertyKey(e,"~guard")&&kB(e["~guard"])}function lm(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,r=>s.IsObject(r)&&s.HasPropertyKey(r,"refine")&&s.HasPropertyKey(r,"message")&&s.IsFunction(r.refine)&&s.IsString(r.message))}function Cr(e){return s.IsObject(e)&&!s.IsArray(e)}function yp(e){return s.IsBoolean(e)}function j(e){return Cr(e)||yp(e)}function mm(e){return s.HasPropertyKey(e,"additionalItems")&&j(e.additionalItems)}function Pr(e){return s.HasPropertyKey(e,"additionalProperties")&&j(e.additionalProperties)}function dm(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(r=>j(r))}function qa(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function fm(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(r=>j(r))}function gm(e){return s.HasPropertyKey(e,"const")}function Vn(e){return s.HasPropertyKey(e,"contains")&&j(e.contains)}function Mt(e){return s.HasPropertyKey(e,"default")}function ym(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(r=>j(r)||s.IsArray(r)&&r.every(n=>s.IsString(n)))}function hm(e){return s.HasPropertyKey(e,"dependentRequired")&&s.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(r=>s.IsArray(r)&&r.every(n=>s.IsString(n)))}function Tm(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(r=>j(r))}function Em(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function _m(e){return s.HasPropertyKey(e,"else")&&j(e.else)}function Im(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function bm(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function Ur(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Fa(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Qn(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function Sm(e){return s.HasPropertyKey(e,"if")&&j(e.if)}function oi(e){return s.HasPropertyKey(e,"items")&&(j(e.items)||s.IsArray(e.items)&&e.items.every(r=>j(r)))}function Om(e){return oi(e)&&s.IsArray(e.items)}function Am(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function xm(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function hp(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Rm(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function Cm(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function wr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function Wn(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function ii(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function Ha(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function Ka(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function Pm(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function Um(e){return s.HasPropertyKey(e,"not")&&j(e.not)}function wm(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(r=>j(r))}function za(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function Ya(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(r=>j(r))}function ai(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(r=>j(r))}function Va(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(r=>j(r))}function Nm(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||j(e.propertyNames))}function MB(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function Tp(e){return MB(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function Lm(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function vm(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function Zn(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(r=>s.IsString(r))}function km(e){return s.HasPropertyKey(e,"then")&&j(e.then)}function Mm(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(r=>s.IsString(r)))}function si(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Ep(e){return s.HasPropertyKey(e,"unevaluatedItems")&&j(e.unevaluatedItems)}function _p(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&j(e.unevaluatedProperties)}var yt=class{constructor(){this.indices=new Set,this.keys=new Set}AddIndex(r){return this.indices.add(r),!0}AddKey(r){return this.keys.add(r),!0}GetIndices(){return this.indices}GetKeys(){return this.keys}Merge(r){for(let n of r)n.indices.forEach(o=>this.indices.add(o)),n.keys.forEach(o=>this.keys.add(o));return!0}},Qa=class extends yt{constructor(r){super(),this.callback=r}AddError(r){return this.callback(r),!1}},Qe=class extends Qa{constructor(){super(r=>this.errors.push(r)),this.errors=[]}AddError(r){return this.errors.push(r),!1}GetErrors(){return this.errors}};var DB="external_",GB=0,VNe={identifier:`${DB}${GB}`,variables:[]};function pA(e,r,n,o){return n["~guard"].check(o)}function uA(e,r,n,o,i,a){return i["~guard"].check(a)||r.AddError({keyword:"~guard",schemaPath:n,instancePath:o,params:{errors:i["~guard"].errors(a)}})}function lA(e,r,n,o){return s.Every(n["~refine"],0,(i,a)=>i.refine(o))}function mA(e,r,n,o,i,a){return s.EveryAll(i["~refine"],0,(c,l)=>c.refine(a)||r.AddError({keyword:"~refine",schemaPath:n,instancePath:o,params:{index:l,message:c.message}}))}function dA(e){return oi(e)&&s.IsArray(e.items)}function fA(e,r,n,o){return dA(n)?o.every((a,c)=>s.IsLessThan(c,n.items.length)||$(e,r,n.additionalItems,a)&&r.AddIndex(c)):!0}function gA(e,r,n,o,i,a){return dA(i)?a.every((l,d)=>{let f=`${n}/additionalItems`,g=`${o}/${d}`;return s.IsLessThan(d,i.items.length)||W(e,r,f,g,i.additionalItems,l)&&r.AddIndex(d)}):!0}function $B(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function yA(e){let r=[];return Ya(e)&&r.push(...s.Keys(e.patternProperties)),Va(e)&&r.push(...s.Keys(e.properties).map($B)),s.IsEqual(r.length,0)?"(?!)":`(${r.join("|")})`}function hA(e,r,n,o){let i=new RegExp(yA(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||$(e,r,n.additionalProperties,o[c])&&r.AddKey(c))}function TA(e,r,n,o,i,a){let c=new RegExp(yA(i)),l=[];return s.EveryAll(s.Keys(a),0,(f,g)=>{let T=`${n}/additionalProperties`,_=`${o}/${f}`,se=new Qe,ge=c.test(f)||W(e,se,T,_,i.additionalProperties,a[f])&&r.AddKey(f);return ge||l.push(f),ge})||r.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:o,params:{additionalProperties:l}})}function EA(e,r,n,o){let i=n.allOf.reduce((a,c)=>{let l=new yt;return $(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,n.allOf.length)&&r.Merge(i)}function _A(e,r,n,o,i,a){let c=[],l=i.allOf.reduce((f,g,T)=>{let _=`${n}/allOf/${T}`,se=new Qe,ge=W(e,se,_,o,g,a);return ge||c.push(se),ge?[...f,se]:f},[]),d=s.IsEqual(l.length,i.allOf.length)&&r.Merge(l);return d||c.forEach(f=>f.GetErrors().forEach(g=>r.AddError(g))),d}function IA(e,r,n,o){let i=n.anyOf.reduce((a,c,l)=>{let d=new yt;return $(e,d,c,o)?[...a,d]:a},[]);return s.IsGreaterThan(i.length,0)&&r.Merge(i)}function bA(e,r,n,o,i,a){let c=[],l=i.anyOf.reduce((f,g,T)=>{let _=new Qe,se=`${n}/anyOf/${T}`,ge=W(e,_,se,o,g,a);return ge||c.push(_),ge?[...f,_]:f},[]),d=s.IsGreaterThan(l.length,0)&&r.Merge(l);return d||c.forEach(f=>f.GetErrors().forEach(g=>r.AddError(g))),d||r.AddError({keyword:"anyOf",schemaPath:n,instancePath:o,params:{}})}function Gm(e,r,n,o){return n}function SA(e,r,n,o,i,a){return Gm(e,r,i,a)||r.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function $m(e,r,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function OA(e,r,n,o,i,a){return $m(e,r,i,a)||r.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function jB(e){return!(Wn(e)&&s.IsEqual(e.minContains,0))}function jm(e,r,n,o){return jB(n)?!s.IsEqual(o.length,0)&&o.some(i=>$(e,r,n.contains,i)):!0}function AA(e,r,n,o,i,a){return jm(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function xA(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependencies),0,([c,l])=>!s.HasPropertyKey(o,c)||(s.IsArray(l)?l.every(d=>s.HasPropertyKey(o,d)):$(e,r,l,o)));return i||a}function RA(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependencies),0,([d,f])=>{let g=`${n}/dependencies/${d}`;return!s.HasPropertyKey(a,d)||(s.IsArray(f)?f.every(T=>s.HasPropertyKey(a,T)||r.AddError({keyword:"dependencies",schemaPath:n,instancePath:o,params:{property:d,dependencies:f}})):W(e,r,g,o,f,a))});return c||l}function CA(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependentRequired),0,([c,l])=>!s.HasPropertyKey(o,c)||l.every(d=>s.HasPropertyKey(o,d)));return i||a}function PA(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentRequired),0,([d,f])=>!s.HasPropertyKey(a,d)||s.EveryAll(f,0,g=>s.HasPropertyKey(a,g)||r.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:o,params:{property:d,dependencies:f}})));return c||l}function UA(e,r,n,o){let i=s.IsEqual(s.Keys(o).length,0),a=s.Every(s.Entries(n.dependentSchemas),0,([c,l])=>!s.HasPropertyKey(o,c)||$(e,r,l,o));return i||a}function wA(e,r,n,o,i,a){let c=s.IsEqual(s.Keys(a).length,0),l=s.EveryAll(s.Entries(i.dependentSchemas),0,([d,f])=>{let g=`${n}/dependentSchemas/${d}`;return!s.HasPropertyKey(a,d)||W(e,r,g,o,f,a)});return c||l}function Bm(e,r,n,o){return n.enum.some(i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function NA(e,r,n,o,i,a){return Bm(e,r,i,a)||r.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function qm(e,r,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function LA(e,r,n,o,i,a){return qm(e,r,i,a)||r.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function Fm(e,r,n,o){return s.IsGreaterThan(o,n.exclusiveMinimum)}function vA(e,r,n,o,i,a){return Fm(e,r,i,a)||r.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var pi={};Gt(pi,{Clear:()=>MA,Entries:()=>iq,Get:()=>cq,Has:()=>sq,IsDate:()=>Wa,IsDateTime:()=>Hm,IsDuration:()=>Km,IsEmail:()=>zm,IsHostname:()=>Ym,IsIPv4:()=>Zm,IsIPv6:()=>Xm,IsIdnEmail:()=>Vm,IsIdnHostname:()=>Wm,IsIri:()=>ed,IsIriReference:()=>Jm,IsJsonPointer:()=>rd,IsJsonPointerUriFragment:()=>td,IsRegex:()=>nd,IsRelativeJsonPointer:()=>od,IsTime:()=>Za,IsUri:()=>sd,IsUriReference:()=>id,IsUriTemplate:()=>ad,IsUrl:()=>cd,IsUuid:()=>pd,Reset:()=>DA,Set:()=>aq,Test:()=>pq});var BB=[0,31,28,31,30,31,30,31,31,30,31,30,31],qB=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function FB(e){return e%4===0&&(e%100!==0||e%400===0)}function Wa(e){let r=qB.exec(e);if(!r)return!1;let n=+r[1],o=+r[2],i=+r[3];return o>=1&&o<=12&&i>=1&&i<=(o===2&&FB(n)?29:BB[o])}var HB=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Za(e,r=!0){let n=HB.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),d=+(n[6]||0);if(l>23||d>59||r&&!n[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(o<=23&&i<=59&&a<60)return!0;let f=i-d*c,g=o-l*c-(f<0?1:0);return(g===23||g===-1)&&(f===59||f===-1)&&a<61}function Hm(e,r=!0){let n=e.split(/T/i);return n.length===2&&Wa(n[0])&&Za(n[1],r)}var KB=/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/;function Km(e){return KB.test(e)}var zB=/^(?!.*\.\.)[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 zm(e){return zB.test(e)}var YB=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;function Ym(e){return YB.test(e)}var VB=/^(?!.*\.\.)[\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 Vm(e){return VB.test(e)}function Qm(e){let r=e.codePointAt(0);return r===void 0?!1:r>=12352&&r<=12447||r>=12448&&r<=12543&&r!==12539||r>=19968&&r<=40959}function Wm(e){if(e.length===0||e.includes(" "))return!1;let r=/[\u002E\u3002\uFF0E\uFF61]/g,n=e.normalize("NFC").replace(r,".");if(n.length>253)return!1;let o=n.split(".");if(o.some(i=>i.length===0))return!1;for(let i of o){if(i.length>63||i.startsWith("-")||i.endsWith("-"))return!1;if(/^xn--/i.test(i)){let d=i.slice(4);if(d.length<2||d.includes("---"))return!1;continue}if(/[\u302E\u302F\u3031\u3032\u3033\u3034\u3035\u303B\u0640\u07FA]/.test(i))return!1;let a=i.charAt(0);if(/[\u0903\u0300\u0488]/.test(a))return!1;for(let d=0;d<i.length;d++){let f=i.charAt(d);if(f==="\xB7"){if(d===0||d===i.length-1)return!1;let g=i.charAt(d-1),T=i.charAt(d+1);if(!/^[lL]$/.test(g)||!/^[lL]$/.test(T))return!1}if(f==="\u30FB"){if(i.length===1)return!1;if(d===0){let g=i.charAt(d+1);if(!Qm(g))return!1}else{let g=i.charAt(d-1),T=i.charAt(d+1);if(!Qm(g)||!Qm(T))return!1}}if(f==="\u0375"){if(d===i.length-1)return!1;let g=i.charAt(d+1);if(!/[\u0370-\u03FF]/.test(g))return!1}if(f==="\u05F3"||f==="\u05F4"){if(d===0)return!1;let g=i.charAt(d-1);if(!/[\u05D0-\u05EA]/.test(g))return!1}if(f==="\u200D"&&(d===0||i.charAt(d-1)!=="\u094D"))return!1}let c=!1,l=!1;for(let d=0;d<i.length;d++){let f=i.charAt(d);/[\u0660-\u0669]/.test(f)&&(c=!0),/[\u06F0-\u06F9]/.test(f)&&(l=!0)}if(c&&l)return!1}return!0}var QB=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function Zm(e){return QB.test(e)}var WB=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function Xm(e){return WB.test(e)}function kA(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function Jm(e){if(e.includes(" ")||e.includes("\\")||/[\x00-\x1F\x7F]/.test(e)||/%(?![0-9a-fA-F]{2})/.test(e))return!1;if(e==="")return!0;let r=e.indexOf(":");return r>0&&/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e.substring(0,r))?kA(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&r===-1?!1:kA(e)}function ed(e){try{return new URL(e),!0}catch{return!1}}var ZB=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function td(e){return ZB.test(e)}var XB=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function rd(e){return XB.test(e)}function nd(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var JB=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function od(e){return JB.test(e)}var eq=/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i;function id(e){return eq.test(e)}var tq=/^(?:(?:[^\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 ad(e){return tq.test(e)}var rq=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i;function sd(e){return rq.test(e)}var nq=/^(?: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 cd(e){return nq.test(e)}var oq=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function pd(e){return oq.test(e)}var he=new Map;function MA(){he.clear()}function iq(){return[...he.entries()]}function aq(e,r){he.set(e,r)}function sq(e){return he.has(e)}function cq(e){return he.get(e)}function pq(e,r){return he.get(e)?.(r)??!0}function DA(){MA(),he.set("date-time",Hm),he.set("date",Wa),he.set("duration",Km),he.set("email",zm),he.set("hostname",Ym),he.set("idn-email",Vm),he.set("idn-hostname",Wm),he.set("ipv4",Zm),he.set("ipv6",Xm),he.set("iri-reference",Jm),he.set("iri",ed),he.set("json-pointer-uri-fragment",td),he.set("json-pointer",rd),he.set("regex",nd),he.set("relative-json-pointer",od),he.set("time",Za),he.set("uri-reference",id),he.set("uri-template",ad),he.set("uri",sd),he.set("url",cd),he.set("uuid",pd)}DA();function ud(e,r,n,o){return pi.Test(n.format,o)}function GA(e,r,n,o,i,a){return ud(e,r,i,a)||r.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function $A(e,r,n,o){let i=km(n)?n.then:!0,a=_m(n)?n.else:!0;return $(e,r,n.if,o)?$(e,r,i,o):$(e,r,a,o)}function jA(e,r,n,o,i,a){let c=km(i)?i.then:!0,l=_m(i)?i.else:!0,d=new Qe,f=W(e,d,`${n}/if`,o,i.if,a)?W(e,d,`${n}/then`,o,c,a)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"then"}}):W(e,r,`${n}/else`,o,l,a)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"else"}});return f&&r.Merge([d]),f}function uq(e,r,n,o){return s.Every(n.items,0,(i,a)=>s.IsLessEqualThan(o.length,a)||$(e,r,i,o[a])&&r.AddIndex(a))}function lq(e,r,n,o,i,a){return s.EveryAll(i.items,0,(c,l)=>{let d=`${n}/items/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||W(e,r,d,f,c,a[l])&&r.AddIndex(l)})}function mq(e,r,n,o){let i=ai(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>$(e,r,n.items,a)&&r.AddIndex(c))}function dq(e,r,n,o,i,a){let c=ai(i)?i.prefixItems.length:0;return s.EveryAll(a,c,(l,d)=>{let f=`${n}/items`,g=`${o}/${d}`;return W(e,r,f,g,i.items,l)&&r.AddIndex(d)})}function BA(e,r,n,o){return Om(n)?uq(e,r,n,o):mq(e,r,n,o)}function qA(e,r,n,o,i,a){return Om(i)?lq(e,r,n,o,i,a):dq(e,r,n,o,i,a)}function fq(e){return Vn(e)}function ld(e,r,n,o){if(!fq(n))return!0;let i=o.reduce((a,c)=>$(e,r,n.contains,c)?++a:a,0);return s.IsLessEqualThan(i,n.maxContains)}function FA(e,r,n,o,i,a){let c=Wn(i)?i.minContains:1;return ld(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function md(e,r,n,o){return s.IsLessEqualThan(o,n.maximum)}function HA(e,r,n,o,i,a){return md(e,r,i,a)||r.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function dd(e,r,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function KA(e,r,n,o,i,a){return dd(e,r,i,a)||r.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function fd(e,r,n,o){return s.IsMaxLength(o,n.maxLength)}function zA(e,r,n,o,i,a){return fd(e,r,i,a)||r.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function gd(e,r,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function YA(e,r,n,o,i,a){return gd(e,r,i,a)||r.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function gq(e){return Vn(e)}function yd(e,r,n,o){if(!gq(n))return!0;let i=o.reduce((a,c)=>$(e,r,n.contains,c)?++a:a,0);return s.IsGreaterEqualThan(i,n.minContains)}function VA(e,r,n,o,i,a){return yd(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function hd(e,r,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function QA(e,r,n,o,i,a){return hd(e,r,i,a)||r.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function Td(e,r,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function WA(e,r,n,o,i,a){return Td(e,r,i,a)||r.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function Ed(e,r,n,o){return s.IsMinLength(o,n.minLength)}function ZA(e,r,n,o,i,a){return Ed(e,r,i,a)||r.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function _d(e,r,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function XA(e,r,n,o,i,a){return _d(e,r,i,a)||r.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function Id(e,r,n,o){return s.IsMultipleOf(o,n.multipleOf)}function JA(e,r,n,o,i,a){return Id(e,r,i,a)||r.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function bd(e,r,n,o){let i=new yt;return!$(e,i,n.not,o)&&r.Merge([i])}function ex(e,r,n,o,i,a){return bd(e,r,i,a)||r.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function tx(e,r,n,o){let i=n.oneOf.reduce((a,c)=>{let l=new yt;return $(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,1)&&r.Merge(i)}function rx(e,r,n,o,i,a){let c=[],l=[],d=i.oneOf.reduce((g,T,_)=>{let se=new Qe,ge=`${n}/oneOf/${_}`,jr=W(e,se,ge,o,T,a);return jr&&l.push(_),jr||c.push(se),jr?[...g,se]:g},[]),f=s.IsEqual(d.length,1)&&r.Merge(d);return!f&&s.IsEqual(l.length,0)&&c.forEach(g=>g.GetErrors().forEach(T=>r.AddError(T))),f||r.AddError({keyword:"oneOf",schemaPath:n,instancePath:o,params:{passingSchemas:l}})}function Sd(e,r,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern):n.pattern).test(o)}function nx(e,r,n,o,i,a){return Sd(e,r,i,a)||r.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function ox(e,r,n,o){return s.Every(s.Entries(n.patternProperties),0,([i,a])=>{let c=new RegExp(i);return s.Every(s.Entries(o),0,([l,d])=>!c.test(l)||$(e,r,a,d)&&r.AddKey(l))})}function ix(e,r,n,o,i,a){return s.EveryAll(s.Entries(i.patternProperties),0,([c,l])=>{let d=`${n}/patternProperties/${c}`,f=new RegExp(c);return s.EveryAll(s.Entries(a),0,([g,T])=>{let _=`${o}/${g}`;return!f.test(g)||W(e,r,d,_,l,T)&&r.AddKey(g)})})}function ax(e,r,n,o){return s.IsEqual(o.length,0)||s.Every(n.prefixItems,0,(i,a)=>s.IsLessEqualThan(o.length,a)||$(e,r,i,o[a])&&r.AddIndex(a))}function sx(e,r,n,o,i,a){return s.IsEqual(a.length,0)||s.EveryAll(i.prefixItems,0,(c,l)=>{let d=`${n}/prefixItems/${l}`,f=`${o}/${l}`;return s.IsLessEqualThan(a.length,l)||W(e,r,d,f,c,a[l])&&r.AddIndex(l)})}function Od(e,r){return e.includes(r)||Pt.Get().exactOptionalPropertyTypes}function Ad(e,r){return s.IsUndefined(e[r])}function cx(e,r,n,o){let i=Zn(n)?n.required:[];return s.Every(s.Entries(n.properties),0,([c,l])=>{let d=!s.HasPropertyKey(o,c)||$(e,r,l,o[c])&&r.AddKey(c);return Od(i,c)?d:Ad(o,c)||d})}function px(e,r,n,o,i,a){let c=Zn(i)?i.required:[];return s.EveryAll(s.Entries(i.properties),0,([d,f])=>{let g=`${n}/properties/${d}`,T=`${o}/${d}`,_=()=>!s.HasPropertyKey(a,d)||W(e,r,g,T,f,a[d])&&r.AddKey(d);return Od(c,d)?_():Ad(a,d)||_()})}function ux(e,r,n,o){return s.Every(s.Keys(o),0,(i,a)=>$(e,r,n.propertyNames,i))}function lx(e,r,n,o,i,a){let c=[];return s.EveryAll(s.Keys(a),0,(d,f)=>{let g=`${o}/${d}`,T=`${n}/propertyNames`,_=new Qe,se=W(e,_,T,g,i.propertyNames,d);return se||c.push(d),se})||r.AddError({keyword:"propertyNames",schemaPath:n,instancePath:o,params:{propertyNames:c}})}function mx(e,r,n,o){let i=e.RecursiveRef(n.$recursiveRef)??!1;return j(i)&&$(e,r,i,o)}function dx(e,r,n,o,i,a){let c=e.RecursiveRef(i.$recursiveRef)??!1;return j(c)&&W(e,r,"#",o,c,a)}function yx(e,r,n,o){let i=e.Ref(n.$ref)??!1,a=new yt,c=j(i)&&$(e,a,i,o);return c&&r.Merge([a]),c}function hx(e,r,n,o,i,a){let c=e.Ref(i.$ref)??!1,l=new Qe,d=j(c)&&W(e,l,"#",o,c,a);return d&&r.Merge([l]),d||l.GetErrors().forEach(f=>r.AddError(f)),d}function Tx(e,r,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function Ex(e,r,n,o,i,a){let c=[];return s.EveryAll(i.required,0,d=>{let f=s.HasPropertyKey(a,d);return f||c.push(d),f})||r.AddError({keyword:"required",schemaPath:n,instancePath:o,params:{requiredProperties:c}})}function xd(e,r,n,o,i){return s.IsEqual(n,"object")?s.IsObjectNotArray(i):s.IsEqual(n,"array")?s.IsArray(i):s.IsEqual(n,"boolean")?s.IsBoolean(i):s.IsEqual(n,"integer")?s.IsInteger(i):s.IsEqual(n,"number")?s.IsNumber(i):s.IsEqual(n,"null")?s.IsNull(i):s.IsEqual(n,"string")?s.IsString(i):s.IsEqual(n,"asyncIterator")?s.IsAsyncIterator(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,"iterator")?s.IsIterator(i):s.IsEqual(n,"symbol")?s.IsSymbol(i):s.IsEqual(n,"undefined")?s.IsUndefined(i):s.IsEqual(n,"void")?s.IsUndefined(i):!0}function _x(e,r,n,o,i){return n.some(a=>xd(e,r,a,o,i))}function Ix(e,r,n,o){return s.IsArray(n.type)?_x(e,r,n.type,n,o):xd(e,r,n.type,n,o)}function bx(e,r,n,o,i,a){return(s.IsArray(i.type)?_x(e,r,i.type,i,a):xd(e,r,i.type,i,a))||r.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function Sx(e,r,n,o){let i=r.GetIndices();return s.Every(o,0,(a,c)=>(i.has(c)||$(e,r,n.unevaluatedItems,a))&&r.AddIndex(c))}function Ox(e,r,n,o,i,a){let c=r.GetIndices(),l=[];return s.EveryAll(a,0,(f,g)=>{let T=new Qe,_=(c.has(g)||W(e,T,n,o,i.unevaluatedItems,f))&&r.AddIndex(g);return _||l.push(g),_})||r.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:o,params:{unevaluatedItems:l}})}function Ax(e,r,n,o){let i=r.GetKeys();return s.Every(s.Entries(o),0,([a,c])=>i.has(a)||$(e,r,n.unevaluatedProperties,c)&&r.AddKey(a))}function xx(e,r,n,o,i,a){let c=r.GetKeys(),l=[];return s.EveryAll(s.Entries(a),0,([f,g])=>{let T=new Qe,_=c.has(f)||W(e,T,n,o,i.unevaluatedProperties,g)&&r.AddKey(f);return _||l.push(f),_})||r.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function Rx(e){return!s.IsEqual(e.uniqueItems,!1)}function Cx(e,r,n,o){if(!Rx(n))return!0;let i=new Set(o.map(Wr.Hash)).size,a=o.length;return s.IsEqual(i,a)}function Px(e,r,n,o,i,a){if(!Rx(i))return!0;let c=new Set,l=a.reduce((f,g,T)=>{let _=Wr.Hash(g);return c.has(_)?[...f,T]:(c.add(_),f)},[]);return s.IsEqual(l.length,0)||r.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:o,params:{duplicateItems:l}})}function $(e,r,n,o){e.Push(n);let i=yp(n)?Gm(e,r,n,o):(!Mm(n)||Ix(e,r,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!Zn(n)||Tx(e,r,n,o))&&(!Pr(n)||hA(e,r,n,o))&&(!ym(n)||xA(e,r,n,o))&&(!hm(n)||CA(e,r,n,o))&&(!Tm(n)||UA(e,r,n,o))&&(!Ya(n)||ox(e,r,n,o))&&(!Va(n)||cx(e,r,n,o))&&(!Nm(n)||ux(e,r,n,o))&&(!Ka(n)||_d(e,r,n,o))&&(!Cm(n)||gd(e,r,n,o)))&&(!s.IsArray(o)||(!mm(n)||fA(e,r,n,o))&&(!Vn(n)||jm(e,r,n,o))&&(!oi(n)||BA(e,r,n,o))&&(!xm(n)||ld(e,r,n,o))&&(!hp(n)||dd(e,r,n,o))&&(!Wn(n)||yd(e,r,n,o))&&(!ii(n)||Td(e,r,n,o))&&(!ai(n)||ax(e,r,n,o))&&(!si(n)||Cx(e,r,n,o)))&&(!s.IsString(o)||(!Fa(n)||ud(e,r,n,o))&&(!Rm(n)||fd(e,r,n,o))&&(!Ha(n)||Ed(e,r,n,o))&&(!za(n)||Sd(e,r,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!bm(n)||qm(e,r,n,o))&&(!Ur(n)||Fm(e,r,n,o))&&(!Am(n)||md(e,r,n,o))&&(!wr(n)||hd(e,r,n,o))&&(!Pm(n)||Id(e,r,n,o)))&&(!Lm(n)||mx(e,r,n,o))&&(!vm(n)||yx(e,r,n,o))&&(!um(n)||pA(e,r,n,o))&&(!gm(n)||$m(e,r,n,o))&&(!Im(n)||Bm(e,r,n,o))&&(!Sm(n)||$A(e,r,n,o))&&(!Um(n)||bd(e,r,n,o))&&(!dm(n)||EA(e,r,n,o))&&(!fm(n)||IA(e,r,n,o))&&(!wm(n)||tx(e,r,n,o))&&(!Ep(n)||!s.IsArray(o)||Sx(e,r,n,o))&&(!_p(n)||!s.IsObject(o)||Ax(e,r,n,o))&&(!lm(n)||lA(e,r,n,o));return e.Pop(n),i}function W(e,r,n,o,i,a){e.Push(i);let c=yp(i)?SA(e,r,n,o,i,a):!!(+(!Mm(i)||bx(e,r,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!Zn(i)||Ex(e,r,n,o,i,a))&+(!Pr(i)||TA(e,r,n,o,i,a))&+(!ym(i)||RA(e,r,n,o,i,a))&+(!hm(i)||PA(e,r,n,o,i,a))&+(!Tm(i)||wA(e,r,n,o,i,a))&+(!Ya(i)||ix(e,r,n,o,i,a))&+(!Va(i)||px(e,r,n,o,i,a))&+(!Nm(i)||lx(e,r,n,o,i,a))&+(!Ka(i)||XA(e,r,n,o,i,a))&+(!Cm(i)||YA(e,r,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!mm(i)||gA(e,r,n,o,i,a))&+(!Vn(i)||AA(e,r,n,o,i,a))&+(!oi(i)||qA(e,r,n,o,i,a))&+(!xm(i)||FA(e,r,n,o,i,a))&+(!hp(i)||KA(e,r,n,o,i,a))&+(!Wn(i)||VA(e,r,n,o,i,a))&+(!ii(i)||WA(e,r,n,o,i,a))&+(!ai(i)||sx(e,r,n,o,i,a))&+(!si(i)||Px(e,r,n,o,i,a))))&+(!s.IsString(a)||!!(+(!Fa(i)||GA(e,r,n,o,i,a))&+(!Rm(i)||zA(e,r,n,o,i,a))&+(!Ha(i)||ZA(e,r,n,o,i,a))&+(!za(i)||nx(e,r,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!bm(i)||LA(e,r,n,o,i,a))&+(!Ur(i)||vA(e,r,n,o,i,a))&+(!Am(i)||HA(e,r,n,o,i,a))&+(!wr(i)||QA(e,r,n,o,i,a))&+(!Pm(i)||JA(e,r,n,o,i,a))))&+(!Lm(i)||dx(e,r,n,o,i,a))&+(!vm(i)||hx(e,r,n,o,i,a))&+(!um(i)||uA(e,r,n,o,i,a))&+(!gm(i)||OA(e,r,n,o,i,a))&+(!Im(i)||NA(e,r,n,o,i,a))&+(!Sm(i)||jA(e,r,n,o,i,a))&+(!Um(i)||ex(e,r,n,o,i,a))&+(!dm(i)||_A(e,r,n,o,i,a))&+(!fm(i)||bA(e,r,n,o,i,a))&+(!wm(i)||rx(e,r,n,o,i,a))&+(!Ep(i)||!s.IsArray(a)||Ox(e,r,n,o,i,a))&+(!_p(i)||!s.IsObject(a)||xx(e,r,n,o,i,a)))&&(!lm(i)||mA(e,r,n,o,i,a));return e.Pop(i),c}var Jn={};Gt(Jn,{Ref:()=>Cq});var Nr={};Gt(Nr,{Delete:()=>bq,Get:()=>_q,Has:()=>Eq,Indices:()=>Xa,Set:()=>Iq});function Ux(e){if(e.length===0)throw Error("Cannot set root")}function wx(e){if(!s.IsObject(e))throw Error("Cannot set value")}function yq(e){return/^(0|[1-9]\d*)$/.test(e)}function Nx(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function hq(e,r){return s.IsObject(r)&&s.HasPropertyKey(r,e)}function Tq(e,r){return s.IsObject(r)?r[e]:void 0}function Rd(e,r){return e.reduce((n,o)=>Tq(o,n),r)}function Xa(e){if(s.IsEqual(e.length,0))return[];let r=e.split("/").map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"));return r.length>0&&r[0]===""?r.slice(1):r}function Eq(e,r){let n=e;return Xa(r).every(o=>hq(o,n)?(n=n[o],!0):!1)}function _q(e,r){let n=Xa(r);return Rd(n,e)}function Iq(e,r,n){let o=Xa(r);Ux(o);let[i,a]=Nx(o),c=Rd(i,e);return wx(c),c[a]=n,e}function bq(e,r){let n=Xa(r);Ux(n);let[o,i]=Nx(n),a=Rd(o,e);return wx(a),s.IsArray(a)&&yq(i)?a.splice(+i,1):delete a[i],e}function Sq(e,r,n){if(e.$id===n.hash)return e;let o=new URL(e.$id,r.href),i=new URL(n.href,r.href);if(s.IsEqual(o.pathname,i.pathname))return n.hash.startsWith("#")?Lx(e,r,n):e}function Oq(e,r,n){let o=new URL(`#${e.$anchor}`,r.href),i=new URL(n.href,r.href);if(s.IsEqual(o.href,i.href))return e}function Lx(e,r,n){return n.href.endsWith("#")?e:n.hash.startsWith("#")?Nr.Get(e,decodeURIComponent(n.hash.slice(1))):void 0}function Aq(e,r,n){if(Qn(e)){let o=Sq(e,r,n);if(!s.IsUndefined(o))return o}if(qa(e)){let o=Oq(e,r,n);if(!s.IsUndefined(o))return o}return Lx(e,r,n)}function xq(e,r,n){return e.reduce((o,i)=>{let a=Cd(i,r,n);return s.IsUndefined(a)?o:a},void 0)}function Rq(e,r,n){return s.Keys(e).reduce((o,i)=>{let a=Cd(e[i],r,n);return s.IsUndefined(a)?o:a},void 0)}function Cd(e,r,n){if(r=Cr(e)&&Qn(e)?new URL(e.$id,r.href):r,Cr(e)){let o=Aq(e,r,n);if(!s.IsUndefined(o))return o}if(s.IsArray(e))return xq(e,r,n);if(s.IsObject(e))return Rq(e,r,n)}function Cq(e,r){let n=new URL("http://unknown"),o=Qn(e)?new URL(e.$id,n.href):n,i=new URL(r,o.href);return Cd(e,o,i)}var eo=class{constructor(r,n){this.context=r,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((r,n)=>new URL(n.$id,r),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(r){Cr(r)&&(Qn(r)&&this.ids.push(r),qa(r)&&this.anchors.push(r),Tp(r)&&this.recursiveAnchors.push(r),Em(r)&&this.dynamicAnchors.push(r))}Pop(r){Cr(r)&&(Qn(r)&&this.ids.pop(),qa(r)&&this.anchors.pop(),Tp(r)&&this.recursiveAnchors.pop(),Em(r)&&this.dynamicAnchors.pop())}FromContext(r){return s.HasPropertyKey(this.context,r)?this.context[r]:void 0}FromRef(r){return r.startsWith("#")?Jn.Ref(this.Base(),r):Jn.Ref(this.schema,r)}Ref(r){return this.FromContext(r)??this.FromRef(r)}RecursiveRef(r){return Tp(this.Base())?Jn.Ref(this.recursiveAnchors[0],r):Jn.Ref(this.Base(),r)}};function vx(...e){let[r,n,o]=ie.Match(e,{3:(c,l,d)=>[c,l,d],2:(c,l)=>[{},c,l]}),i=new eo(r,n),a=new yt;return $(i,a,n,o)}function kx(...e){let[r,n,o]=ie.Match(e,{3:(g,T,_)=>[g,T,_],2:(g,T)=>[{},g,T]}),i=Pt.Get(),a=ny(),c=[],l=new eo(r,n),d=new Qa(g=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...g,message:a(g)})});return[W(l,d,"#","",n,o),c]}function fe(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return vx(r,n,o)}function gn(...e){let[r,n,o]=ie.Match(e,{3:(c,l,d)=>[c,l,d],2:(c,l)=>[{},c,l]}),[i,a]=kx(r,n,o);return a}var yn=class extends Error{constructor(r,n,o){super(r),Object.defineProperty(this,"cause",{value:{source:r,errors:o,value:n},writable:!1,configurable:!1,enumerable:!1})}};function Mx(e,r,n){return s.IsArray(n)?n.map(o=>Ze(e,r.items,o)):n}function Dx(e,r,n){return r.Clean(n)}function Gx(e,r,n){return Ze({...e,...r.$defs},ke(r.$ref),n)}function Uq(e){let r=s.HasPropertyKey(e,"unevaluatedProperties")?{additionalProperties:e.unevaluatedProperties}:{},n=Yt(e);return k(n)?Fc(n,r):n}function $x(e,r,n){let o=Uq(r);return Ze(e,o,n)}function Ip(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function jx(e,r,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=Ip(r);for(let i of s.Keys(n)){if(s.HasPropertyKey(r.properties,i)){n[i]=Ze(e,r.properties[i],n[i]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||A(o)&&fe(e,o,n[i])){n[i]=Ze(e,o,n[i]);continue}delete n[i]}return n}function Bx(e,r,n){if(!s.IsObject(n))return n;let o=Ip(r),[i,a]=[new RegExp(xt(r)),rt(r)];for(let c of s.Keys(n)){if(i.test(c)){n[c]=Ze(e,a,n[c]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||A(o)&&fe(e,o,n[c])){n[c]=Ze(e,o,n[c]);continue}delete n[c]}return n}function qx(e,r,n){return s.HasPropertyKey(e,r.$ref)?Ze(e,e[r.$ref],n):n}function Fx(e,r,n){if(!s.IsArray(n))return n;let o=Math.min(n.length,r.items.length);for(let i=0;i<o;i++)n[i]=Ze(e,r.items[i],n[i]);return s.IsGreaterThan(n.length,o)?n.slice(0,o):n}function wq(e){let r={};for(let n of Object.getOwnPropertyNames(e))r[n]=ye(e[n]);for(let n of Object.getOwnPropertySymbols(e))r[n]=ye(e[n]);return r}function Nq(e){return s.IsClassInstance(e)?e:wq(e)}function Lq(e){return e.map(r=>ye(r))}function vq(e){return e.slice()}function kq(e){return new Map(ye([...e.entries()]))}function Mq(e){return new Set(ye([...e.values()]))}function ye(e){return ct.IsTypeArray(e)?vq(e):ct.IsMap(e)?kq(e):ct.IsSet(e)?Mq(e):s.IsArray(e)?Lq(e):s.IsObject(e)?Nq(e):e}function Hx(e,r,n){for(let o of r.anyOf){let i=Ze(e,o,ye(n));if(fe(e,o,i))return i}return n}function Ze(e,r,n){return te(r)?Mx(e,r,n):Ut(r)?Dx(e,r,n):me(r)?Gx(e,r,n):w(r)?$x(e,r,n):k(r)?jx(e,r,n):Se(r)?Bx(e,r,n):ue(r)?qx(e,r,n):V(r)?Fx(e,r,n):O(r)?Hx(e,r,n):n}function ro(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return Ze(r,n,o)}function Kx(e,r,n){return s.IsArray(n)?n.map(o=>je(e,r.items,o)):n}function zx(e,r,n){return r.Convert(n)}var ne={};Gt(ne,{Fail:()=>no,IsOk:()=>Ud,Ok:()=>U,TryBigInt:()=>wd,TryBoolean:()=>tF,TryNull:()=>cF,TryNumber:()=>hF,TryString:()=>OF,TryUndefined:()=>wF});function Ud(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function U(e){return{value:e}}function no(){}function Dq(e){return U(e)}function Gq(e){return s.IsEqual(e,!0)?U(BigInt(1)):U(BigInt(0))}function $q(e){return U(BigInt(Math.trunc(e)))}function jq(e){return U(BigInt(0))}var Bq=/^-?(0|[1-9]\d*)n$/,qq=/^-?(0|[1-9]\d*)\.\d+$/,Fq=/^-?(0|[1-9]\d*)$/;function Hq(e){return Bq.test(e)}function Kq(e){return qq.test(e)}function zq(e){return Fq.test(e)}function Yq(e){let r=e.toLowerCase();return Hq(e)?U(BigInt(e.slice(0,e.length-1))):Kq(e)?U(BigInt(e.split(".")[0])):zq(e)?U(BigInt(e)):s.IsEqual(r,"false")?U(BigInt(0)):s.IsEqual(r,"true")?U(BigInt(1)):void 0}function Vq(e){return U(BigInt(0))}function wd(e){return s.IsBigInt(e)?Dq(e):s.IsBoolean(e)?Gq(e):s.IsNumber(e)?$q(e):s.IsNull(e)?jq(e):s.IsString(e)?Yq(e):s.IsUndefined(e)?Vq(e):void 0}function Qq(e){return s.IsEqual(e,BigInt(0))?U(!1):s.IsEqual(e,BigInt(1))?U(!0):void 0}function Wq(e){return U(e)}function Zq(e){return s.IsEqual(e,0)?U(!1):s.IsEqual(e,1)?U(!0):void 0}function Xq(e){return U(!1)}function Jq(e){return s.IsEqual(e.toLowerCase(),"false")?U(!1):s.IsEqual(e.toLowerCase(),"true")?U(!0):s.IsEqual(e,"0")?U(!1):s.IsEqual(e,"1")?U(!0):void 0}function eF(e){return U(!1)}function tF(e){return s.IsBigInt(e)?Qq(e):s.IsBoolean(e)?Wq(e):s.IsNumber(e)?Zq(e):s.IsNull(e)?Xq(e):s.IsString(e)?Jq(e):s.IsUndefined(e)?eF(e):void 0}function rF(e){return s.IsEqual(e,BigInt(0))?U(null):void 0}function nF(e){return s.IsEqual(e,!1)?U(null):void 0}function oF(e){return s.IsEqual(e,0)?U(null):void 0}function iF(e){return U(null)}function aF(e){let r=e.toLowerCase();return s.IsEqual(r,"undefined")||s.IsEqual(r,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?U(null):void 0}function sF(e){return U(null)}function cF(e){return s.IsBigInt(e)?rF(e):s.IsBoolean(e)?nF(e):s.IsNumber(e)?oF(e):s.IsNull(e)?iF(e):s.IsString(e)?aF(e):s.IsUndefined(e)?sF(e):void 0}var pF=BigInt(Number.MAX_SAFE_INTEGER),uF=BigInt(Number.MIN_SAFE_INTEGER);function lF(e){return e<=pF&&e>=uF}function Yx(e){return lF(e)?U(Number(e)):void 0}function mF(e){return e?U(1):U(0)}function dF(e){return U(e)}function fF(e){return U(0)}function gF(e){let r=+e;if(s.IsNumber(r))return U(r);let n=e.toLowerCase();if(s.IsEqual(n,"false"))return U(0);if(s.IsEqual(n,"true"))return U(1);let o=wd(e);return Ud(o)?Yx(o.value):void 0}function yF(e){return U(0)}function hF(e){return s.IsBigInt(e)?Yx(e):s.IsBoolean(e)?mF(e):s.IsNumber(e)?dF(e):s.IsNull(e)?fF(e):s.IsString(e)?gF(e):s.IsUndefined(e)?yF(e):void 0}function TF(e){return U(e.toString())}function EF(e){return U(e.toString())}function _F(e){return U(e.toString())}function IF(e){return U("null")}function bF(e){return U(e)}function SF(e){return U("")}function OF(e){return s.IsBigInt(e)?TF(e):s.IsBoolean(e)?EF(e):s.IsNumber(e)?_F(e):s.IsNull(e)?IF(e):s.IsString(e)?bF(e):s.IsUndefined(e)?SF(e):void 0}function AF(e){return s.IsEqual(e,BigInt(0))?U(void 0):void 0}function xF(e){return s.IsEqual(e,!1)?U(void 0):void 0}function RF(e){return s.IsEqual(e,0)?U(void 0):void 0}function CF(e){return U(void 0)}function PF(e){let r=e.toLowerCase();return s.IsEqual(r,"undefined")||s.IsEqual(r,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?U(void 0):void 0}function UF(e){return U(void 0)}function wF(e){return s.IsBigInt(e)?AF(e):s.IsBoolean(e)?xF(e):s.IsNumber(e)?RF(e):s.IsNull(e)?CF(e):s.IsString(e)?PF(e):s.IsUndefined(e)?UF(e):void 0}function Vx(e,r,n){if(s.IsBigInt(n))return n;let o=ne.TryBigInt(n);return ne.IsOk(o)?o.value:n}function Qx(e,r,n){if(s.IsBoolean(n))return n;let o=ne.TryBoolean(n);return ne.IsOk(o)?o.value:n}function Wx(e,r,n){return je({...e,...r.$defs},ke(r.$ref),n)}function bp(e,r,n){if(r.anyOf.some(c=>fe(e,c,n)))return n;let a=r.anyOf.map(c=>je(e,c,ye(n))).find(c=>fe(e,r,c));return s.IsUndefined(a)?n:a}function Zx(e,r,n){let o=kn(r);return bp(e,o,n)}function Xx(e,r,n){if(s.IsInteger(n))return n;let o=ne.TryNumber(n);return ne.IsOk(o)?Math.trunc(o.value):n}function Jx(e,r,n){let o=Yt(r);return je(e,o,n)}function NF(e,r,n){let o=ne.TryBigInt(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function LF(e,r,n){let o=ne.TryBoolean(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function vF(e,r,n){let o=ne.TryNumber(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function kF(e,r,n){let o=ne.TryString(n);return ne.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function eR(e,r,n){return s.IsEqual(r.const,n)?n:ly(r)?NF(e,r,n):my(r)?LF(e,r,n):Eo(r)?vF(e,r,n):_o(r)?kF(e,r,n):H()}function tR(e,r,n){if(s.IsNull(n))return n;let o=ne.TryNull(n);return ne.IsOk(o)?o.value:n}function rR(e,r,n){if(s.IsNumber(n))return n;let o=ne.TryNumber(n);return ne.IsOk(o)?o.value:n}function Sp(e,r,n,o){let i=s.Keys(o);for(let[a,c]of r)for(let l of i)a.test(l)||(o[l]=je(e,n,o[l]));return o}function Ja(e,r,n){return Be(e)&&s.IsUndefined(n[r])}function MF(e,r,n){let o=s.EntriesRegExp(r.properties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)!a.test(l)||Ja(c,l,n)||(n[l]=je(e,c,n[l]));return s.HasPropertyKey(r,"additionalProperties")&&s.IsObject(r.additionalProperties)?Sp(e,o,r.additionalProperties,n):n}function nR(e,r,n){return s.IsObjectNotArray(n)?MF(e,r,n):n}function DF(e,r,n){let o=s.EntriesRegExp(r.patternProperties),i=s.Keys(n);for(let[a,c]of o)for(let l of i)a.test(l)&&(n[l]=je(e,c,n[l]));return s.HasPropertyKey(r,"additionalProperties")&&s.IsObject(r.additionalProperties)?Sp(e,o,r.additionalProperties,n):n}function oR(e,r,n){return s.IsObjectNotArray(n)?DF(e,r,n):n}function iR(e,r,n){return s.HasPropertyKey(e,r.$ref)?je(e,e[r.$ref],n):n}function aR(e,r,n){if(s.IsString(n))return n;let o=ne.TryString(n);return ne.IsOk(o)?o.value:n}function sR(e,r,n){let o=nt(r.pattern);return je(e,o,n)}function cR(e,r,n){if(!s.IsArray(n))return n;for(let o=0;o<Math.min(r.items.length,n.length);o++)n[o]=je(e,r.items[o],n[o]);return n}function pR(e,r,n){if(s.IsUndefined(n))return n;let o=ne.TryUndefined(n);return ne.IsOk(o)?o.value:n}function uR(e,r,n){if(s.IsUndefined(n))return n;let o=ne.TryUndefined(n);return ne.IsOk(o)?void 0:n}function je(e,r,n){return te(r)?Kx(e,r,n):Ut(r)?zx(e,r,n):At(r)?Vx(e,r,n):lt(r)?Qx(e,r,n):me(r)?Wx(e,r,n):Ne(r)?Zx(e,r,n):ze(r)?Xx(e,r,n):w(r)?Jx(e,r,n):X(r)?eR(e,r,n):tr(r)?tR(e,r,n):be(r)?rR(e,r,n):k(r)?nR(e,r,n):Se(r)?oR(e,r,n):ue(r)?iR(e,r,n):Me(r)?aR(e,r,n):Le(r)?sR(e,r,n):V(r)?cR(e,r,n):or(r)?pR(e,r,n):O(r)?bp(e,r,n):Rt(r)?uR(e,r,n):n}function hn(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return je(r,n,o)}function lR(e,r,n){if(!s.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=Ke(e,r.items,n[o]);return n}function mR(e,r,n){return r.Default(n)}function dR(e,r,n){return Ke({...e,...r.$defs},ke(r.$ref),n)}function fR(e,r){return s.IsUndefined(r)?s.IsFunction(e.default)?e.default():ye(e.default):r}function gR(e,r,n){let o=Yt(r);return Ke(e,o,n)}function yR(e,r,n){if(!s.IsObject(n))return n;let o=s.Keys(r.properties);for(let i of o){let a=Ke(e,r.properties[i],n[i]);s.IsUndefined(a)&&(Be(r.properties[i])||!s.HasPropertyKey(r.properties[i],"default"))||(n[i]=Ke(e,r.properties[i],n[i]))}if(!Pr(r)||s.IsBoolean(r.additionalProperties))return n;for(let i of s.Keys(n))o.includes(i)||(n[i]=Ke(e,r.additionalProperties,n[i]));return n}function hR(e,r,n){if(!s.IsObject(n))return n;let[o,i]=[new RegExp(xt(r)),rt(r)];for(let a of s.Keys(n))o.test(a)&&Mt(i)&&(n[a]=Ke(e,i,n[a]));if(!Pr(r))return n;for(let a of s.Keys(n))o.test(a)||(n[a]=Ke(e,r.additionalProperties,n[a]));return n}function TR(e,r,n){return s.HasPropertyKey(e,r.$ref)?Ke(e,e[r.$ref],n):n}function ER(e,r,n){if(!s.IsArray(n))return n;let[o,i]=[r.items,Math.max(r.items.length,n.length)];for(let a=0;a<i;a++)a<o.length&&(n[a]=Ke(e,o[a],n[a]));return n}function _R(e,r,n){for(let o of r.anyOf){let i=Ke(e,o,ye(n));if(fe(e,o,i))return i}return n}function Ke(e,r,n){let o=Mt(r)?fR(r,n):n;return te(r)?lR(e,r,o):Ut(r)?mR(e,r,o):me(r)?dR(e,r,o):w(r)?gR(e,r,o):k(r)?yR(e,r,o):Se(r)?hR(e,r,o):ue(r)?TR(e,r,o):V(r)?ER(e,r,o):O(r)?_R(e,r,o):o}function oo(...e){let[r,n,o]=ie.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return Ke(r,n,o)}function ui(e){return(...r)=>{let[n,o,i]=ie.Match(r,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]});return e.reduce((a,c)=>c(n,o,a),i)}}function GF(e,r,n){return r["~codec"].decode(n)}function $F(e,r,n){return r["~codec"].encode(n)}function Pe(e,r,n,o){return Un(n)?s.IsEqual(e,"Decode")?GF(r,n,o):$F(r,n,o):o}function jF(e,r,n,o){if(!s.IsArray(o))return H();for(let i=0;i<o.length;i++)o[i]=Te(e,r,n.items,o[i]);return Pe(e,r,n,o)}function BF(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsArray(i))return i;for(let a=0;a<i.length;a++)i[a]=Te(e,r,n.items,i[a]);return i}function IR(e,r,n,o){return s.IsEqual(e,"Decode")?jF(e,r,n,o):BF(e,r,n,o)}function bR(e,r,n,o){return o=Te(e,{...r,...n.$defs},ke(n.$ref),o),Pe(e,r,n,o)}function qF(e,r,n,o){for(let i of n.allOf)o=Te(e,r,i,o);return Pe(e,r,n,o)}function FF(e,r,n,o){let i=Pe(e,r,n,o);for(let a of n.allOf)i=Te(e,r,a,i);return i}function SR(e,r,n,o){return s.IsEqual(e,"Decode")?qF(e,r,n,o):FF(e,r,n,o)}function HF(e,r,n,o){if(!s.IsObjectNotArray(o))return H();for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||Ja(n.properties[i],i,o)||(o[i]=Te(e,r,n.properties[i],o[i]));return Pe(e,r,n,o)}function KF(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsObjectNotArray(i))return i;for(let a of s.Keys(n.properties))!s.HasPropertyKey(i,a)||Ja(n.properties[a],a,i)||(i[a]=Te(e,r,n.properties[a],i[a]));return i}function OR(e,r,n,o){return s.IsEqual(e,"Decode")?HF(e,r,n,o):KF(e,r,n,o)}function zF(e,r,n,o){if(!s.IsObjectNotArray(o))return H();let i=new RegExp(xt(n));for(let a of s.Keys(o))i.test(a)||H(),o[a]=Te(e,r,rt(n),o[a]);return Pe(e,r,n,o)}function YF(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsObjectNotArray(i))return i;let a=new RegExp(xt(n));for(let c of s.Keys(i))a.test(c)&&(i[c]=Te(e,r,rt(n),i[c]));return i}function AR(e,r,n,o){return s.IsEqual(e,"Decode")?zF(e,r,n,o):YF(e,r,n,o)}function xR(e,r,n,o){return o=s.HasPropertyKey(r,n.$ref)?Te(e,r,r[n.$ref],o):o,Pe(e,r,n,o)}function VF(e,r,n,o){if(!s.IsArray(o))return H();for(let i=0;i<Math.min(n.items.length,o.length);i++)o[i]=Te(e,r,n.items[i],o[i]);return Pe(e,r,n,o)}function QF(e,r,n,o){let i=Pe(e,r,n,o);if(!s.IsArray(i))return o;for(let a=0;a<Math.min(n.items.length,i.length);a++)i[a]=Te(e,r,n.items[a],i[a]);return i}function RR(e,r,n,o){return s.IsEqual(e,"Decode")?VF(e,r,n,o):QF(e,r,n,o)}function WF(e,r,n,o){for(let i of n.anyOf){if(!fe(r,i,o))continue;let a=Te(e,r,i,o);return Pe(e,r,n,a)}return H()}function ZF(e,r,n,o){let i=Pe(e,r,n,o);for(let a of n.anyOf){let c=Te(e,r,a,ye(i));if(fe(r,a,c))return c}return i}function CR(e,r,n,o){return s.IsEqual(e,"Decode")?WF(e,r,n,o):ZF(e,r,n,o)}function Te(e,r,n,o){return te(n)?IR(e,r,n,o):me(n)?bR(e,r,n,o):w(n)?SR(e,r,n,o):k(n)?OR(e,r,n,o):Se(n)?AR(e,r,n,o):ue(n)?xR(e,r,n,o):V(n)?RR(e,r,n,o):O(n)?CR(e,r,n,o):Pe(e,r,n,o)}var Nd=class extends yn{constructor(r,n){super("Decode",r,n)}};function XF(e,r,n){if(!fe(e,r,n))throw new Nd(n,gn(e,r,n));return n}function JF(e,r,n){return Te("Decode",e,r,n)}var nHe=ui([(e,r,n)=>ye(n),(e,r,n)=>oo(e,r,n),(e,r,n)=>hn(e,r,n),(e,r,n)=>ro(e,r,n),(e,r,n)=>XF(e,r,n),(e,r,n)=>JF(e,r,n)]);var Ld=class extends yn{constructor(r,n){super("Encode",r,n)}};function eH(e,r,n){if(!fe(e,r,n))throw new Ld(n,gn(e,r,n));return n}function tH(e,r,n){return Te("Encode",e,r,n)}var gHe=ui([(e,r,n)=>ye(n),(e,r,n)=>tH(e,r,n),(e,r,n)=>oo(e,r,n),(e,r,n)=>hn(e,r,n),(e,r,n)=>ro(e,r,n),(e,r,n)=>eH(e,r,n)]);var Bt=class extends Error{constructor(r,n){super(n),this.type=r}};function PR(e,r){return s.IsFunction(r.default)?r.default(r):s.IsObject(r.default)?ye(r.default):r.default}function UR(e,r){if(si(r)&&!Mt(r))throw new Bt(r,"Arrays with uniqueItems constraints must specify a default annotation");let n=ii(r)?r.minItems:0;return Array.from({length:n},()=>Ee(e,r.items))}async function*rH(){}function wR(e,r){return rH()}function NR(e,r){return r.Create()}function LR(e,r){return Ur(r)?BigInt(r.exclusiveMinimum)+BigInt(1):wr(r)?BigInt(r.minimum):BigInt(0)}function vR(e,r){return!1}function kR(e,r){let n=Ee(e,r.instanceType);return class{constructor(){Object.assign(this,n)}}}function MR(e,r){return Ee({...e,...r.$defs},ke(r.$ref))}function DR(e,r){return Ee(e,kn(r))}function GR(e,r){let n=Ee(e,r.returnType);return()=>n}function $R(e,r){return Ur(r)&&s.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:wr(r)?r.minimum:0}function jR(e,r){return Ee(e,Yt(r))}function*nH(){}function BR(e,r){return nH()}function qR(e,r){return r.const}function FR(e,r){throw new Bt(r,"Cannot create TNever types")}function HR(e,r){return null}function KR(e,r){return Ur(r)&&s.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:wr(r)?r.minimum:0}function zR(e,r){return(s.IsUndefined(r.required)?[]:r.required).reduce((o,i)=>({...o,[i]:Ee(e,r.properties[i])}),{})}function YR(e,r){return Promise.resolve(Ee(e,r.item))}function VR(e,r){if(Ka(r)&&!Mt(r))throw new Bt(r,"Record with the minProperties constraint must have a default annotation");return{}}function QR(e,r){return s.HasPropertyKey(e,r.$ref)?Ee(e,e[r.$ref]):(()=>{throw new Bt(r,"Unable to deref Ref")})()}function WR(e,r){if((za(r)||Fa(r))&&!Mt(r))throw Error("Strings with format or pattern constraints must specify default");let o=Ha(r)?r.minLength:0;return"".padEnd(o)}function ZR(e,r){return Symbol()}function XR(e,r){let n=nt(r.pattern);if(Me(n))throw new Bt(r,"Unable to create TemplateLiteral due to infinite type expansion");return Ee(e,n)}function JR(e,r){return Array.from({length:r.minItems},(n,o)=>Ee(e,r.items[o]))}function eC(e,r){if(s.IsEqual(r.anyOf.length,0))throw Error("Unable to create Union with no variants");return Ee(e,r.anyOf[0])}function Ee(e,r){return Mt(r)?PR(e,r):te(r)?UR(e,r):at(r)?wR(e,r):Ut(r)?NR(e,r):At(r)?LR(e,r):lt(r)?vR(e,r):qe(r)?kR(e,r):me(r)?MR(e,r):Ne(r)?DR(e,r):Fe(r)?GR(e,r):ze(r)?$R(e,r):w(r)?jR(e,r):st(r)?BR(e,r):X(r)?qR(e,r):hr(r)?FR(e,r):tr(r)?HR(e,r):be(r)?KR(e,r):k(r)?zR(e,r):tt(r)?YR(e,r):Se(r)?VR(e,r):ue(r)?QR(e,r):Me(r)?WR(e,r):rr(r)?ZR(e,r):Le(r)?XR(e,r):V(r)?JR(e,r):or(r)?void 0:O(r)?eC(e,r):Rt(r)?void 0:void 0}function mr(...e){let[r,n]=ie.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return Ee(r,n)}var vd=class extends yn{constructor(r,n){super("Parse",r,n)}};function oH(e,r,n){if(!fe(e,r,n))throw new vd(n,gn(e,r,n));return n}var _ze=ui([(e,r,n)=>ye(n),(e,r,n)=>oo(e,r,n),(e,r,n)=>hn(e,r,n),(e,r,n)=>ro(e,r,n),(e,r,n)=>oH(e,r,n)]);var aH=N({type:Y("insert"),path:bt(),value:Je()}),sH=Object({type:Y("update"),path:bt(),value:Je()}),cH=N({type:Y("delete"),path:bt()}),Rze=B([aH,sH,cH]);function li(e){if(!e.body)throw new Error("This command does not accept a request body");let r=e.body;return r.examples?.length?r.examples[0]:mr(r)}function io(e,r,n,o,i){e.command(r).description(n).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async a=>{if(a.generateSkeleton){Q(li(o));return}let c=ni(a),l=await i()(o,{body:c});Q(l)})}function nC(e,r){let n=e.command("grok").description("Test and preview grok parsing rules");io(n,"parse","Parse sample log lines with grok rules and return the extracted fields",sA,r)}var oC=require("node:child_process"),iC=require("node:fs"),aC=require("node:os"),xp=require("node:path");var ao=require("node:fs");function es(e,r){let n=`${e}.tmp.${process.pid}`;(0,ao.writeFileSync)(n,r),(0,ao.renameSync)(n,e)}function ts(e){try{return(0,ao.readFileSync)(e,"utf8")}catch(r){if(r.code==="ENOENT")return;throw r}}function rs(e,r){if(r===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,ao.writeFileSync)(n,r),n}function so(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Md="tsuga-dev/agent-plugins",Op="tsuga";function Ap(e,r){q(` $ ${e} ${r.join(" ")}`);try{(0,oC.execFileSync)(e,r,{stdio:["ignore","inherit","inherit"]})}catch(n){let o=n.status??1;throw new Error(`${e} ${r.join(" ")} exited ${o}`,{cause:n})}}function mH(e,r){q("Claude Code \u2192 installing Tsuga plugin"),Ap("claude",["plugin","marketplace","add",Md]),Ap("claude",["plugin","install",`tsuga@${Op}`]),r.autoUpdate&&dH(e)}function dH(e){let r=(0,xp.join)(e,".claude","settings.json");q(`Claude Code \u2192 ${r} (autoUpdate)`),(0,iC.mkdirSync)((0,xp.dirname)(r),{recursive:!0});let n=ts(r),o=JSON.parse(n??"{}");if(!so(o))throw new Error(`${r} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!so(i))throw new Error(`${r} "extraKnownMarketplaces" must be a JSON object`);let a=i[Op],c=so(a)?a:{};o.extraKnownMarketplaces={...i,[Op]:{source:{source:"github",repo:Md},...c,autoUpdate:!0}};let l=rs(r,n);es(r,`${JSON.stringify(o,null,2)}
|
|
139
|
-
`),q(l===void 0?" created":` patched (backup: ${l})`)}function fH(){q("Codex \u2192 installing Tsuga plugin"),Ap("codex",["plugin","marketplace","add",Md]),Ap("codex",["plugin","add",`tsuga@${Op}`])}function sC(e){let r=e.command("install").description("Install Tsuga plugins into local LLM CLIs").command("plugin").description("Install the Tsuga plugin into a specific LLM CLI");r.command("claude-code").description("Install the Tsuga plugin into Claude Code (requires the claude CLI in PATH)").option("--no-auto-update","Skip patching ~/.claude/settings.json with autoUpdate=true").action(n=>{mH((0,aC.homedir)(),n),q("Restart your claude session to load the new plugins.")}),r.command("codex").description("Install the Tsuga plugin into Codex (requires the codex CLI in PATH)").action(()=>{fH(),q("Restart your codex session to load the new plugins.")})}var Qt="/v0/kubernetes-explorer",gH="^[a-z0-9.-]+$",yH="^[A-Za-z0-9._-]+$",cC=256,pC=t.Optional(p({allowEmpty:!1,description:"Tsuga cluster ID to target. Tsuga assigns it when a cluster is connected to the organization. Optional for single-cluster organizations and required for organizations with multiple clusters to scope the request to one cluster."}));var dr=e=>t.Optional(t.Array(p({allowEmpty:!1}),{description:e})),uC={clusterId:pC,search:t.Optional(t.String({pattern:gH,minLength:1,maxLength:cC,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."}))},lC={clusterId:pC,search:t.Optional(t.String({pattern:yH,minLength:1,maxLength:cC,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."}))},mC=t.Object(uC),dC=t.Object(lC),ns={...uC,includeInternalNamespaces:t.Optional(t.Boolean({description:"When false or omitted, resources in internal namespaces (kube-system, kube-public, kube-node-lease, local-path-storage, gke-managed-*) are excluded."})),clusters:dr("Restrict results to these Kubernetes cluster names."),namespaces:dr("Restrict results to these namespaces."),teams:dr("Restrict results to these team names."),envs:dr("Restrict results to these environments."),...de},fC=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],hH={...ns,nodes:dr("Restrict results to pods scheduled on these nodes."),deployments:dr("Restrict results to pods owned by these Deployments."),statefulsets:dr("Restrict results to pods owned by these StatefulSets."),daemonsets:dr("Restrict results to pods owned by these DaemonSets."),podStatus:t.Optional(t.Array(t.Enum(fC),{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."}))},mi=t.Enum(["asc","desc"],{description:"Sort direction. Defaults to ascending."}),TH=["deployment","statefulset","daemonset"],gC=t.Object({kind:t.Enum(TH,{description:"Kind of Kubernetes workload associated with the pod. Derived from workload attributes in pod telemetry."}),name:t.String({description:"Name of the workload associated with the pod. Derived from workload attributes in pod telemetry."})},{description:"Kubernetes workload controller that owns the pod. Present when workload attributes are observed in pod telemetry."}),yC=t.Object({podName:t.String({description:"Name of the Kubernetes pod. Set when the pod is created."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the pod. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that reported the pod. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the pod. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the pod, such as production or staging. Present when an environment label or mapping is observed."})),node:t.Optional(t.String({description:"Kubernetes node currently or most recently running the pod. Present when node telemetry is observed."})),phase:t.Enum(fC,{description:"Current or most recently observed pod status. From pod status and container state telemetry. Values include the Kubernetes phases Pending, Running, Succeeded, Failed, and Unknown, plus Tsuga-derived CrashLoopBackOff and Error values."}),readyContainers:t.Integer({description:"Number of containers in the pod that are currently ready. From container readiness telemetry. Zero or greater."}),totalContainers:t.Integer({description:"Number of observed containers for the pod based on container readiness telemetry. Zero or greater."}),restarts:t.Integer({description:"Total restart count across containers in the pod. From container restart telemetry. Zero or greater."}),createdAt:t.Optional(E({description:"Timestamp from pod start time telemetry for the selected pod instance. Present when pod start time telemetry is observed."}))}),Dd=t.Object({...yC.properties,workload:t.Optional(gC),cpuUsageMilli:t.Optional(t.Number({description:"Recent pod CPU usage in millicores. Present when CPU usage telemetry is observed."})),cpuLimitMilli:t.Optional(t.Number({description:"Configured pod CPU limit in millicores, summed across observed containers. Present when a CPU limit is configured and observed."})),cpuRequestMilli:t.Optional(t.Number({description:"Configured pod CPU request in millicores, summed across observed containers. Present when a CPU request is configured and observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent pod memory usage in bytes. Present when memory usage telemetry is observed."})),memoryLimitBytes:t.Optional(t.Number({description:"Configured pod memory limit in bytes, summed across observed containers. Present when a memory limit is configured and observed."})),memoryRequestBytes:t.Optional(t.Number({description:"Configured pod memory request in bytes, summed across observed containers. Present when a memory request is configured and observed."})),cpuUtilization:t.Optional(t.Number({description:"Recent CPU usage divided by the configured CPU limit. Present when both usage and limit are observed."})),memoryUtilization:t.Optional(t.Number({description:"Recent memory usage divided by the configured memory limit. Present when both usage and limit are observed."})),cpuRequestUtilization:t.Optional(t.Number({description:"Recent CPU usage divided by the configured CPU request. Present when both usage and request are observed."})),memoryRequestUtilization:t.Optional(t.Number({description:"Recent memory usage divided by the configured memory request. Present when both usage and request are observed."}))}),EH=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],_4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/pods`,query:t.Object({...hH,sortBy:t.Optional(t.Enum(EH,{description:"Field to sort pods by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(Dd)}),Gd=t.Object({cluster:t.String({description:"Kubernetes cluster name from cluster telemetry."}),teams:t.Optional(t.Array(t.String(),{description:"Team metadata values observed on pods in non-default Kubernetes namespaces on the cluster. Present when team labels or mappings are observed."})),envs:t.Optional(t.Array(t.String(),{description:"Environment metadata values observed on pods in non-default Kubernetes namespaces on the cluster. Present when environment labels or mappings are observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Aggregate recent CPU usage for observed pods in the cluster, excluding default Kubernetes namespaces, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Aggregate recent memory usage for observed pods in the cluster, excluding default Kubernetes namespaces, in bytes. Present when memory usage telemetry is observed."})),readyNodes:t.Optional(t.Integer({description:"Number of Kubernetes nodes in the cluster that are ready. Present when node readiness telemetry is observed."})),podPhaseCounts:t.Optional(t.Object({Pending:t.Integer({description:"Number of observed pods currently in the Pending phase."}),Running:t.Integer({description:"Number of observed pods currently in the Running phase."}),Succeeded:t.Integer({description:"Number of observed pods currently in the Succeeded phase."}),Failed:t.Integer({description:"Number of observed pods currently in the Failed phase."}),Unknown:t.Integer({description:"Number of observed pods currently in the Unknown phase."})},{description:"Counts of observed pods by Kubernetes phase, excluding default Kubernetes namespaces. Present when pod phase telemetry is observed."}))}),_H=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],I4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/clusters`,query:t.Object({...lC,teams:dr("Restrict to clusters that host workloads from these team names."),envs:dr("Restrict to clusters that host workloads in these environments."),sortBy:t.Optional(t.Enum(_H,{description:"Field to sort clusters by."})),sortDirection:t.Optional(mi),...de}),paginated:!0,response:t.Array(Gd)}),$d=t.Object({namespace:t.String({description:"Kubernetes namespace name from namespace telemetry. Includes namespaces with no observed pods when namespace telemetry is observed."}),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the namespace. Present when cluster telemetry is observed."})),teams:t.Optional(t.Array(t.String(),{description:"Team metadata values observed in workloads in the namespace. Present when team labels or mappings are observed."})),envs:t.Optional(t.Array(t.String(),{description:"Environment metadata values observed in workloads in the namespace. Present when environment labels or mappings are observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods in the namespace. Present when pod telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Aggregate recent CPU usage for observed pods in the namespace, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Aggregate recent memory usage for observed pods in the namespace, in bytes. Present when memory usage telemetry is observed."}))}),IH=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],b4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/namespaces`,query:t.Object({...ns,sortBy:t.Optional(t.Enum(IH,{description:"Field to sort namespaces by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array($d)}),jd=t.Object({deployment:t.String({description:"Kubernetes Deployment name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the Deployment. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the Deployment. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the Deployment. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the Deployment. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the Deployment. Present when pod telemetry and workload attributes are observed."})),availableReplicas:t.Optional(t.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed Deployment pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed Deployment pods, in bytes. Present when memory usage telemetry is observed."}))}),bH=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],S4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/deployments`,query:t.Object({...ns,sortBy:t.Optional(t.Enum(bH,{description:"Field to sort deployments by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(jd)}),Bd=t.Object({statefulSet:t.String({description:"Kubernetes StatefulSet name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the StatefulSet. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the StatefulSet. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the StatefulSet. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the StatefulSet. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the StatefulSet. Present when pod telemetry and workload attributes are observed."})),readyReplicas:t.Optional(t.Integer({description:"Number of ready StatefulSet replicas from StatefulSet status telemetry. Present when StatefulSet status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the StatefulSet. Present when StatefulSet spec telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed StatefulSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed StatefulSet pods, in bytes. Present when memory usage telemetry is observed."}))}),SH=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],O4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/statefulsets`,query:t.Object({...ns,sortBy:t.Optional(t.Enum(SH,{description:"Field to sort StatefulSets by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(Bd)}),qd=t.Object({daemonSet:t.String({description:"Kubernetes DaemonSet name from workload telemetry."}),namespace:t.Optional(t.String({description:"Kubernetes namespace that contains the DaemonSet. Present when namespace telemetry is observed."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name that contains the DaemonSet. Present when cluster telemetry is observed."})),team:t.Optional(t.String({description:"Team metadata associated with the DaemonSet. Present when a team label or mapping is observed."})),env:t.Optional(t.String({description:"Environment metadata associated with the DaemonSet. Present when an environment label or mapping is observed."})),pods:t.Optional(t.Integer({description:"Number of observed pods associated with the DaemonSet. Present when pod telemetry and workload attributes are observed."})),readyNodes:t.Optional(t.Integer({description:"Number of eligible nodes with a ready DaemonSet pod. Present when DaemonSet status telemetry is observed."})),desiredNodes:t.Optional(t.Integer({description:"Number of eligible nodes where the DaemonSet should run a pod. Present when DaemonSet status telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent aggregate CPU usage for observed DaemonSet pods, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent aggregate memory usage for observed DaemonSet pods, in bytes. Present when memory usage telemetry is observed."}))}),OH=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],A4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/daemonsets`,query:t.Object({...ns,sortBy:t.Optional(t.Enum(OH,{description:"Field to sort DaemonSets by."})),sortDirection:t.Optional(mi)}),paginated:!0,response:t.Array(qd)}),Fd=t.Object({overview:t.Object({...yC.properties,workload:t.Optional(gC)},{description:"Pod identity, status, and owning workload, derived from recent pod metrics."}),healthMetrics:t.Object({cpu:t.Object({usage:t.String({description:"Metric name callers can use to query pod CPU usage. This is not the current CPU value."}),limit:t.String({description:"Metric name callers can use to query configured container CPU limits for the pod. This is not the current CPU limit value."}),request:t.String({description:"Metric name callers can use to query configured container CPU requests for the pod. This is not the current CPU request value."})},{description:"Metric names for pod CPU usage and for configured container CPU limits and requests."}),memory:t.Object({usage:t.String({description:"Metric name callers can use to query pod memory usage. This is not the current memory value."}),limit:t.String({description:"Metric name callers can use to query configured container memory limits for the pod. This is not the current memory limit value."}),request:t.String({description:"Metric name callers can use to query configured container memory requests for the pod. This is not the current memory request value."})},{description:"Metric names for pod memory usage and for configured container memory limits and requests."})},{description:"Metric names callers can use to query pod CPU and memory telemetry. These are fixed metric identifiers, not current values."}),searchFilters:t.Object({logs:t.String({description:"TQL log search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."}),traces:t.String({description:"TQL trace search filter scoped to this pod. Built from cluster, namespace, and pod identifiers."})},{description:"TQL filters scoped to this pod, ready to use as the query for log and trace search."})}),hC=t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),podName:p({allowEmpty:!1})}),x4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/pod-details`,query:hC,response:Fd}),Hd=t.Object({configuration:t.Optional(t.Object({spec:t.Record(t.String(),t.Unknown(),{description:"Kubernetes PodSpec from the latest observed pod manifest. Fields outside `object.spec` are stripped."}),lastObservedAt:E({description:"Timestamp when Tsuga last observed the pod manifest used for configuration."})},{description:"Pod configuration from the latest observed pod manifest. Present when a pod manifest log is found for the pod."})),labels:t.Record(t.String(),t.String(),{description:"Kubernetes labels on the pod from the latest observed pod manifest. Key-value strings."}),annotations:t.Record(t.String(),t.String(),{description:"Kubernetes annotations on the pod from the latest observed pod manifest. Key-value strings."}),deletedAt:t.Optional(E({description:"Timestamp when Tsuga last observed the pod deletion event. Present when the latest observed pod event is deleted."}))}),R4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/pod-manifest`,query:hC,response:Hd}),Kd=t.Object({podName:t.String({description:"Name of a pod instance associated with the workload. Resolved from recent pod usage telemetry and workload attributes."}),podUid:t.Optional(t.String({description:"Kubernetes UID for the pod replica. Present when UID telemetry is observed."})),cpuUsageMilli:t.Optional(t.Number({description:"Recent CPU usage for the pod replica, in millicores. Present when CPU usage telemetry is observed."})),memoryUsageBytes:t.Optional(t.Number({description:"Recent memory usage for the pod replica, in bytes. Present when memory usage telemetry is observed."}))},{description:"A single pod instance with recent CPU or memory telemetry for the workload, resolved from pod usage telemetry and workload attributes."}),zd=t.Object({overview:t.Object({deploymentName:t.String({description:"Kubernetes Deployment name for this detail response."}),namespace:t.Optional(t.String({description:"Kubernetes namespace for this detail response. Present when any deployment signal is found."})),cluster:t.Optional(t.String({description:"Kubernetes cluster name for this detail response. Present when any deployment signal is found."})),team:t.Optional(t.String({description:"Team metadata from the Deployment available-replica metric. Present when the metric includes team metadata."})),env:t.Optional(t.String({description:"Environment metadata from the Deployment available-replica metric. Present when the metric includes environment metadata."})),availableReplicas:t.Optional(t.Integer({description:"Number of available Deployment replicas from Deployment status telemetry. Present when deployment status is observed."})),desiredReplicas:t.Optional(t.Integer({description:"Desired replica count configured for the Deployment. Present when Deployment spec telemetry is observed."})),latestRevisionAt:t.Optional(E({description:"Latest ReplicaSet metadata.creationTimestamp observed for the Deployment. Present when ReplicaSet object telemetry is observed."}))}),podReplicas:t.Array(Kd,{description:"Pod instances with recent CPU or memory telemetry for the Deployment. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({replicaSetName:t.String({description:"ReplicaSet name for a Deployment revision from workload telemetry."}),revision:t.Integer({description:"Deployment revision number from ReplicaSet annotations. Integer greater than or equal to zero."}),firstSeen:t.Optional(E({description:"ReplicaSet metadata.creationTimestamp from the latest observed ReplicaSet object. Present when creation time is observed."})),observedGeneration:t.Optional(t.Integer({description:"Latest generation observed for the ReplicaSet revision. Present when generation telemetry is observed."})),readyReplicas:t.Optional(t.Integer({description:"Number of ready replicas for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),replicas:t.Optional(t.Integer({description:"Total replica count for the ReplicaSet revision. Present when ReplicaSet status telemetry is observed."})),logsSearchFilter:t.String({description:"TQL log search filter scoped to this ReplicaSet revision. Built from cluster, namespace, and ReplicaSet identifiers."})}),{description:"Deployment rollout revisions from recent ReplicaSet object telemetry. Includes the latest observed event per ReplicaSet, excludes ReplicaSets whose latest observed spec.replicas is 0, and returns up to 8 revisions sorted by revision number descending."})}),C4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/deployment-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),deploymentName:p({allowEmpty:!1})}),response:zd}),AH=t.Object({overview:t.Object({statefulSetName:t.String(),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),team:t.Optional(t.String()),env:t.Optional(t.String()),readyReplicas:t.Optional(t.Integer()),desiredReplicas:t.Optional(t.Integer()),latestRevisionAt:t.Optional(E())}),podReplicas:t.Array(Kd,{description:"Pod instances with recent CPU or memory telemetry for the StatefulSet. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({revisionName:t.String(),firstSeen:t.Optional(E())}))}),P4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/statefulset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),statefulSetName:p({allowEmpty:!1})}),response:AH}),xH=t.Object({overview:t.Object({daemonSetName:t.String(),namespace:t.Optional(t.String()),cluster:t.Optional(t.String()),team:t.Optional(t.String()),env:t.Optional(t.String()),readyNodes:t.Optional(t.Integer()),desiredNodes:t.Optional(t.Integer()),latestRevisionAt:t.Optional(E())}),podReplicas:t.Array(Kd,{description:"Pod instances with recent CPU or memory telemetry for the DaemonSet. Tsuga builds this list from pod usage telemetry and workload attributes. Empty when no matching pod usage telemetry is observed."}),revisions:t.Array(t.Object({observedGeneration:t.Integer(),firstSeen:t.Optional(E())}))}),U4e=m({tags:["kubernetes-explorer"],method:"GET",url:`${Qt}/daemonset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),daemonSetName:p({allowEmpty:!1})}),response:xH});var vr=`/${"v1"}/kubernetes-explorer`,TC=t.Pick(Dd,["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."}),RH={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(TC,{examples:[RH]});var EC=t.Pick(Gd,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),CH={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(EC,{examples:[CH]});var _C=t.Pick($d,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),PH={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(_C,{examples:[PH]});var IC=t.Pick(jd,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),UH={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(IC,{examples:[UH]});var bC=t.Pick(Bd,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),wH={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(bC,{examples:[wH]});var SC=t.Pick(qd,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),NH={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(SC,{examples:[NH]});var OC=t.Pick(Fd,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),LH={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(OC,{examples:[LH]});var AC=t.Pick(Hd,["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."}),vH={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(AC,{examples:[vH]});var xC=t.Pick(zd,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),kH={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(xC,{examples:[kH]});var RC=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Tsuga cluster ID to target. Tsuga assigns it when a cluster is connected to the organization. Optional for single-cluster organizations and required for organizations with multiple clusters to scope the request to one cluster."}))}),os=t.Pick(mC,["clusterId","search"]),MH=t.Pick(dC,["clusterId","search"]),CC=m({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:`${vr}/pods`,query:os,response:t.Array(TC)}),PC=m({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:`${vr}/clusters`,query:MH,response:t.Array(EC)}),UC=m({description:"Lists Kubernetes namespaces observed across the organization with pod counts and aggregate resource usage.",operationId:"listKubernetesNamespaces",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/namespaces`,query:os,response:t.Array(_C)}),wC=m({description:"Lists Kubernetes deployments observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesDeployments",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/deployments`,query:os,response:t.Array(IC)}),NC=m({description:"Lists Kubernetes StatefulSets observed across the organization with replica counts and aggregate resource usage.",operationId:"listKubernetesStatefulSets",tags:["public","kubernetes-explorer"],method:"GET",url:`${vr}/statefulsets`,query:os,response:t.Array(bC)}),LC=m({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:`${vr}/daemonsets`,query:os,response:t.Array(SC)}),vC=t.Object({...RC.properties,k8sCluster:p({allowEmpty:!1,description:"Kubernetes cluster name that contains the pod. From cluster telemetry. Required to identify the pod because pod names are only unique within a namespace and cluster."}),k8sNamespace:p({allowEmpty:!1,description:"Kubernetes namespace that contains the pod. From pod metadata. Required to identify the pod because pod names are only unique within a namespace and cluster."}),podName:p({allowEmpty:!1,description:"Kubernetes pod name to retrieve. Set when the pod is created. Required to fetch pod details for the selected cluster and namespace."})}),kC=m({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:`${vr}/pod-details`,query:vC,response:OC}),MC=m({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:`${vr}/pod-manifest`,query:vC,response:AC}),DC=m({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:`${vr}/deployment-details`,query:t.Object({...RC.properties,k8sCluster:p({allowEmpty:!1,description:"Kubernetes cluster name that contains the Deployment. From cluster telemetry. Required to identify the Deployment because names are only unique within a namespace and cluster."}),k8sNamespace:p({allowEmpty:!1,description:"Kubernetes namespace that contains the Deployment. From workload metadata. Required to identify the Deployment because names are only unique within a namespace and cluster."}),deploymentName:p({allowEmpty:!1,description:"Kubernetes Deployment name to retrieve. From workload telemetry. Required to fetch deployment details for the selected cluster and namespace."})}),response:xC});var DH="clusterId";function GC(e,r,n){let o=r.query.properties??{},i=Object.keys(o).filter(a=>a!==DH);for(let a of i){let c=a.replace(/([A-Z])/g,"-$1").toLowerCase(),l=c.replace(/-/g,"_").toUpperCase(),d=o[a]?.description??"";n?e.requiredOption(`--${c} <${l}>`,d):e.option(`--${c} <${l}>`,d)}return i}function di(e,r,n,o){let i=e.command(r).description(n.description??`List Kubernetes ${r}`),a=GC(i,n,!1);i.action(async c=>{let l={};for(let d of a)c[d]!==void 0&&(l[d]=c[d]);Q(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function Yd(e,r,n,o){let i=e.command(r).description(n.description??`Get Kubernetes ${r}`),a=GC(i,n,!0);i.action(async c=>{let l={};for(let d of a)l[d]=c[d];Q(await o()(n,{query:l}))})}function $C(e,r){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");di(n,"pods",CC,r),di(n,"clusters",PC,r),di(n,"namespaces",UC,r),di(n,"deployments",wC,r),di(n,"statefulsets",NC,r),di(n,"daemonsets",LC,r),Yd(n,"pod-details",kC,r),Yd(n,"pod-manifest",MC,r),Yd(n,"deployment-details",DC,r)}var GH=t.Union([t.Literal("scalar"),t.Literal("timeseries")]),$H="/v0/promql",Rp=t.Object({query:p({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:Vo,step:p({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:t.Optional(GH),executionOptions:xl,shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster to target. Defaults to the first cluster created in the organization when omitted."}))}),jH={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(Rp,{examples:[jH]});var Y4e=m({tags:["promql"],url:$H,method:"POST",body:Rp,response:ep});var jC=`/${"v1"}/aggregation`,BC=t.Object({id:t.String({description:"Result identifier. Query results use `q1`, `q2`, and so on; formula results use `formula`."}),group:t.Record(t.String(),t.Union([t.String(),t.Number()]),{description:"Group-by field values for this result. Empty when no group-by is requested."})}),qC=t.Object({results:t.Array(t.Object({...BC.properties,value:t.Number({description:"Aggregated value for this query or formula and group, over the full time range."})},{title:"ScalarResult"}),{description:"One aggregated value per query or formula and group."})},{$id:"ScalarAggregationResponse",title:"ScalarAggregationResponse",description:"Scalar aggregation response with one value per query or formula and group."}),BH={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(qC,{examples:[BH]});var Cp=t.Object({series:t.Array(t.Object({...BC.properties,points:t.Array(t.Object({timestamp:t.Integer({description:"Unix timestamp in milliseconds for this point, spaced by `aggregationWindow`."}),value:t.Number({description:"Aggregated value at this timestamp."})}),{description:"Ordered data points for this query or formula and group."})},{title:"Series"}),{description:"One time series per query or formula and group."})},{$id:"TimeseriesAggregationResponse",title:"TimeseriesAggregationResponse",description:"Timeseries aggregation response with timestamped points over time."}),qH={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign(Cp,{examples:[qH]});var FH=t.Omit(va.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),HH=t.Optional(Ar),FC={timeRange:mt,queries:t.Array(FH,{maxItems:op,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 ${op} 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:HH,dataSource:zS,formula:t.Optional(Hn)},HC=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),KC=t.Object(FC,{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."}),KH={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(KC,{examples:[KH]});var zC=m({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:`${jC}/multi-query/scalar`,method:"POST",body:KC,query:HC,response:qC}),YC=t.Object({...FC,aggregationWindow:p({description:"Time bucket size for timeseries aggregation, such as `10s`, `1m`, or `1h`."})},{description:"Timeseries aggregation request. Provide a time range, bucket size, one or more queries, a telemetry data source, and optional grouping or formula. Omit `groupBy` for ungrouped series. Send `clusterId` as a query parameter, not in the JSON body."}),zH={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(YC,{examples:[zH]});var VC=m({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:`${jC}/multi-query/timeseries`,method:"POST",body:YC,query:HC,response:Cp});var YH=`/${"v1"}/promql`,VH=t.Object({...t.Pick(Rp,["query","step"]).properties,timeRange:mt},{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"}]}),QH=t.Object({clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to query. Set by the client as the clusterId query parameter, not in the JSON body. Required when the organization has multiple clusters; omit only for single-cluster organizations. Unknown cluster IDs return 404."}))}),QC=m({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:YH,method:"POST",body:VH,query:QH,response:Cp});function WC(e,r){let n=e.command("promql").description("Run PromQL queries over metric data");io(n,"query","Run a PromQL range query over metric data",QC,r)}var gi="/v0/dashboard-folders",yi=t.Object({id:t.String({description:"Tsuga-generated dashboard folder ID assigned when the folder is created. Use it as dashboard `folderId` or child-folder `parentFolderId`."}),name:t.String({description:"Display name of the dashboard folder. Set by the caller on create or update."}),owner:t.String({description:"ID of the team that owns the dashboard folder. Set by the caller on create or update and used for folder access control."}),parentFolderId:t.Optional(t.String({description:"ID of the top-level parent folder when this folder is nested. Set by the caller on create or update. Returned only for child folders; omitted for top-level folders."})),tags:Re,creator:t.Optional(ae),updater:t.Optional(ae),createdAt:E(),updatedAt:E()},{title:"DashboardFolder"}),Vd=t.Object({...yi.properties,dashboardCount:t.Number({description:"Number of dashboards directly assigned to this folder that the caller can read. Returned only by folder list responses; callers without dashboard read access see 0."})}),Pp=t.Object({name:p({allowEmpty:!1,description:"Display name of the dashboard folder. Required and non-empty."}),owner:p({allowEmpty:!1,description:"ID of the team that owns the dashboard folder. Required and used for folder access control."}),parentFolderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"ID of the top-level folder to nest this folder under. Omit on create or pass null to create a top-level folder; omit on update to keep the current parent; pass null on update to move the folder to top level. Non-null values must name a readable top-level folder. Folders can be nested at most two levels deep."})),tags:$e}),Up=t.Partial(t.Object({owners:xe(p({allowEmpty:!1}),{description:"Restrict results to dashboard folders owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard folder names or folder IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:t.Optional(t.Boolean({description:"If true, exclude dashboard folders matching this value instead of including them"}))},{description:"Text filter for dashboard folder names or IDs. Optional; `exclude: true` returns folders whose name and ID do not match the substring."}),tags:xe(vt.items,{description:"Restrict results to dashboard folders that have at least one of the listed key/value tags",maxItems:50}),parentFolderId:t.Union([t.Null(),p({allowEmpty:!1})],{description:"Parent folder filter for dashboard folder query results. Optional; pass a folder ID to return the child folders nested directly under it, or null to return only top-level folders. Omit to return all folders."})},{description:"Optional filters applied to narrow the returned dashboard folders"})),fi={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},Qd=[fi.OWNER,fi.TAGS,fi.DASHBOARD_COUNT,fi.UPDATED_AT,fi.NAME],WH=t.Partial(t.Object({...de,filters:Up,sort:t.Object({by:t.Enum([...Qd,fi.IS_FAVORITE],{description:"Field to sort the returned dashboard folders by"}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboard folders"})})),EYe=m({tags:["dashboard-folders"],url:`${gi}/query`,method:"POST",paginated:!0,body:WH,response:t.Array(Vd)}),_Ye=m({tags:["dashboard-folders"],url:`${gi}/:id`,method:"GET",params:t.Object({id:p()}),response:yi}),IYe=m({tags:["dashboard-folders"],url:gi,method:"POST",body:Pp,response:yi}),bYe=m({tags:["dashboard-folders"],url:`${gi}/:id`,method:"PUT",params:t.Object({id:p()}),body:Pp,response:yi}),SYe=m({tags:["dashboard-folders"],url:`${gi}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),OYe=m({tags:["dashboard-folders"],url:`${gi}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit(Up,["tags"]))}),response:Lt});var is=`/${"v1"}/dashboard-folders`,wp=t.Pick(yi,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),ZC={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(wp,{examples:[ZC]});var XC=t.Pick(Vd,["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."}),ZH={...ZC,dashboardCount:10};Object.assign(XC,{examples:[ZH]});var Wd=t.Pick(Pp,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),XH={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(Wd,{examples:[XH]});var JH=t.Object({by:t.Enum(Qd,{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:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboard folders"}),JC=t.Object({...De,filters:t.Optional(t.Pick(Up,["owners","searchQuery","tags","parentFolderId"])),sort:t.Optional(JH)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),e2={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(JC,{examples:[e2]});var eP=m({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:`${is}/query`,method:"POST",paginated:!0,body:JC,response:t.Array(XC)}),tP=m({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${is}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to retrieve. Use the `id` returned by folder list, get, create, or update responses."})}),response:wp}),rP=m({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:is,method:"POST",body:Wd,response:wp}),nP=m({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:`${is}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to update. Use the `id` returned by folder list, get, create, or update responses."})}),body:Wd,response:wp}),oP=m({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:`${is}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard folder to delete. Use the `id` returned by folder list, get, create, or update responses."})}),response:x});var kr="/v0/dashboards",aP=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],t2=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],FYe=[...t2,"note"];var r2=["ns","us","ms","s","m","h","days"];var n2=["B","KB","MB","GB","TB","PB"];var o2=20;var sP=t.Object({type:t.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),cP=t.Object({type:t.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:t.Enum(r2,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),pP=t.Object({type:t.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:t.Enum(n2,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),uP=t.Object({type:t.Literal("percent",{description:"Formats numeric values as percentages. Use it when the raw value is already on a 0-100 scale, for example `25` to display `25%`."})},{$id:"DataNormalizerPercent",title:"Percent"}),lP=t.Object({type:t.Literal("percent-fraction",{description:"Formats numeric values as percentages. Use it when the raw value is a 0-1 fraction; Tsuga multiplies the value by 100 for display, for example `0.2` to display `20%`."})},{$id:"DataNormalizerPercentFraction",title:"Percent Fraction"}),mP=t.Object({type:t.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),dP=t.Object({type:t.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),fP=t.Object({type:t.Literal("none",{description:"Displays raw values without a unit. Records an explicit removal of the unit, so it is not re-derived from metric metadata"})},{$id:"DataNormalizerNone",title:"None"}),i2=t.Object({type:t.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:t.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"}),a2=t.Object({type:t.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:t.String({description:"Text label describing the custom unit. Must not be empty.",minLength:1,maxLength:o2})},{$id:"InputDataNormalizerCustom",title:"Custom"}),ht=b("type",[cP,pP,uP,lP,mP,dP,sP,fP,i2],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Tt=b("type",[cP,pP,uP,lP,mP,dP,sP,fP,a2],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Zd=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(ht)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),Xd=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(Tt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),hi=["background","no-background"],s2=["table","legend-only","no-legend"];var c2=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],gP=["alert","warning","success"],fr=t.Object({operator:t.Enum(c2,{description:"Comparator used to evaluate the metric value"}),value:t.Number({description:"Threshold value used when evaluating the operator"}),color:t.Enum(gP,{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."}),p2=t.Object({value:t.Number({description:"Y-axis value where the threshold marker is placed"}),level:t.Enum(gP,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),u2=["sec","min","hour","day"],En=t.Object({time:t.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:t.Enum(u2,{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 Tn=t.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),Ti=t.Object({formula:t.Optional(t.String({description:"Optional alias for formula (only used for display in the UI)"})),queries:t.Optional(t.Record(t.String(),t.String({description:'Display name for this query series in the legend, keyed by the zero-based query index as a string ("0" = first query, "1" = second, and so on). This differs from `formula`, which references queries as "q1", "q2". Omit to fall back to an auto-generated label like "Count on <filter>".'}),{description:"Display names for individual query series, keyed by the zero-based query index as a string."}))},{description:"Display names used for the formula series and the individual query series instead of auto-generated labels."}),Ei=t.Object({formula:t.Optional(p({type:"short",description:"Optional alias for formula (only used for display in the UI)"})),queries:t.Optional(t.Record(t.String(),p({type:"short",description:'Display name for this query series in the legend, keyed by the zero-based query index as a string ("0" = first query, "1" = second, and so on). This differs from `formula`, which references queries as "q1", "q2". Omit to fall back to an auto-generated label like "Count on <filter>".'}),{description:"Display names for individual query series, keyed by the zero-based query index as a string."}))},{description:"Display names used for the formula series and the individual query series instead of auto-generated labels."}),Lp={source:Vt,queries:aO,formula:t.Optional(ip),aliases:t.Optional(Ti),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},vp={source:Vt,queries:va,formula:t.Optional(Hn),aliases:t.Optional(Ei),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},_i={...Lp,groupBy:t.Optional(Qo)},Ii={...vp,groupBy:t.Optional(Ar)},Ue=t.Enum(s2,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),le=t.Optional(t.Union([t.Number(),t.Literal("max")],{description:"Display precision for numeric labels, tooltips, tables, and scalar values. Use a number of decimal places to round displayed values, or `max` to display the full submitted precision."})),qt=t.Optional(t.Array(p2,{description:"Threshold markers displayed on the chart"})),l2=t.Object({name:t.String({description:"Display name of the table column"}),...Lp,source:Vt,normalizer:t.Optional(ht),precision:le},{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`."}),m2=t.Object({name:p({description:"Display name of the table column"}),...vp,source:Vt,normalizer:t.Optional(Tt),precision:le},{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`."}),d2=t.Array(t.Object({id:t.String({description:"ID of the column to sort by"}),desc:t.Boolean({description:"Whether the sort is descending"})},{title:"TableDefaultSorting"}),{description:"Default sorting applied to a table widget. Column IDs are `label` for the grouping column and `col-<index>` for each entry in `columns`. Users can still change sorting by selecting columns in the rendered table."}),f2=t.Array(t.Object({id:p({description:"ID of the column to sort by"}),desc:t.Boolean({description:"Whether the sort is descending"})},{title:"TableDefaultSorting"}),{description:"Default sorting applied to a table widget. Column IDs are `label` for the grouping column and `col-<index>` for each entry in `columns`. Users can still change sorting by selecting columns in the rendered table."}),Jd=t.Array(t.Object({id:t.String({description:"Column attribute used for the default list sort. It matches an attribute in `listColumns` or a built-in list column for the selected list source."}),desc:t.Boolean({description:"Sort direction for the default list sort. `true` sorts descending; `false` sorts ascending."})},{title:"ListDefaultSorting"}),{description:"Default sorting applied to a list widget. Applies to log, span, or connection list widgets. Users can still change sorting by selecting columns in the rendered list."}),ef=t.Array(t.Object({id:p({description:"Column attribute used for the default list sort. Set this to an attribute in `listColumns` or a built-in list column for the selected list source."}),desc:t.Boolean({description:"Sort direction for the default list sort. Set `true` for descending order or `false` for ascending order."})},{title:"ListDefaultSorting"}),{description:"Default sorting applied to a list widget. Optional on create or update for log, span, or connection list widgets. Users can still change sorting by selecting columns in the rendered list."}),yP=["horizontal","vertical"],g2=t.Object({type:t.Literal("list",{description:"Displays matching logs in a tabular list"}),query:t.String({description:"Query that selects logs for the list"}),listColumns:t.Optional(t.Array(Zd,{description:"Custom columns to display for each log"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets."})),defaultSorting:t.Optional(Jd)},{$id:"GraphVisualizationList",title:"List"}),y2=t.Object({type:t.Literal("list",{description:"Displays matching logs in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects logs for the list"}),listColumns:t.Optional(t.Array(Xd,{description:"Custom columns to display for each log"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(ef)},{$id:"InputGraphVisualizationList",title:"List"}),Np=b("type",[t.Object({type:t.Literal("auto",{description:"Automatically choose this axis bound"})}),t.Object({type:t.Literal("number",{description:"Use a fixed numeric axis bound"}),value:t.Number({description:"Fixed numeric axis bound value"})})],{description:"Axis bound mode: automatic or fixed numeric value"}),bi=t.Object({min:Np,max:Np,scale:b("type",[t.Object({type:t.Literal("pow",{description:"Power scale"}),exponent:t.Number({description:"Exponent used by the power scale"})}),t.Object({type:t.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:t.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets."}),Si=t.Object({min:Np,max:Np,scale:b("type",[t.Object({type:t.Literal("pow",{description:"Power scale"}),exponent:t.Number({minimum:0,description:"Exponent used by the power scale"})}),t.Object({type:t.Enum(["linear","log","sqrt"],{description:"Built-in axis scale"})})],{description:"Y-axis scale mode"}),alwaysIncludeZero:t.Boolean({description:"Whether the rendered Y axis should always include zero"})},{description:"Y-axis bounds and scale configuration for chart widgets. Optional on create or update."}),h2=t.Array(t.Integer({description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"}),T2=t.Array(t.Integer({minimum:0,maximum:100,description:"Marker value expressed as a percentage between 0 and 100"}),{description:"Percentile markers displayed on top of the distribution chart"});var E2=t.Object({type:t.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(bi)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),_2=t.Object({type:t.Literal("timeseries-connection",{description:"Displays the database rows-based aggregation as a time series chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(Si)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),I2=t.Object({type:t.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),query:t.String({description:"The read-only SQL query to execute against the connection."}),listColumns:t.Optional(t.Array(Zd,{description:"Custom columns to display for each database row"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets."})),defaultSorting:t.Optional(Jd)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),b2=t.Object({type:t.Literal("list-connection",{description:"Displays database rows as a tabular list"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),query:p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),listColumns:t.Optional(t.Array(Xd,{description:"Custom columns to display for each database row"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to connection list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(ef)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),S2=t.Object({type:t.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."}))},{$id:"GraphVisualizationTopListConnection",title:"TopListConnection"}),O2=t.Object({type:t.Literal("top-list-connection",{description:"Displays the database rows-based aggregation as a ranked top list"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1})},{$id:"InputGraphVisualizationTopListConnection",title:"TopListConnection"}),A2=t.Object({type:t.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(Ue)},{$id:"GraphVisualizationPieConnection",title:"PieConnection"}),x2=t.Object({type:t.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),R2=t.Object({type:t.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(bi)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),C2=t.Object({type:t.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(Si)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),P2=t.Object({type:t.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:t.String({description:"The ID of the connection to use to query the datastore."}),queries:t.Array(t.String({description:"The read-only SQL query to execute against the connection."})),backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(ht),legendMode:t.Optional(Ue)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),U2=t.Object({type:t.Literal("query-value-connection",{description:"Displays a single value computed by a SQL query against a database connection"}),connectionId:p({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:t.Array(p({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(Tt),legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),w2=t.Object({type:t.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:t.String({description:"Tsuga query that selects logs to cluster into patterns"}),layout:t.Optional(t.Enum(yP,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),N2=t.Object({type:t.Literal("list-log-patterns",{description:"Displays log patterns clustered from logs matching the query"}),query:p({type:"tsuga-query",description:"Tsuga query that selects logs to cluster into patterns"}),layout:t.Optional(t.Enum(yP,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),L2=t.Object({type:t.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:t.String({description:"Query that selects trace spans for the list"}),listColumns:t.Optional(t.Array(Zd,{description:"Custom columns to display for each span"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets."})),defaultSorting:t.Optional(Jd)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),v2=t.Object({type:t.Literal("list-spans",{description:"Displays matching trace spans in a tabular list"}),query:p({type:"tsuga-query",description:"Query that selects trace spans for the list"}),listColumns:t.Optional(t.Array(Xd,{description:"Custom columns to display for each span"})),listColumnsSize:t.Optional(t.Record(t.String(),t.Number({description:"List column width by column id"}),{description:"List column widths in pixels, keyed by the `attribute` of the matching `listColumns` entry. Columns without an entry keep their default width."})),isCellWrapped:t.Optional(t.Boolean({description:"Whether list widget cell text wraps instead of truncating. Applies to span list widgets. Optional; omit or set false to use truncated cells."})),defaultSorting:t.Optional(ef)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),as=t.Array(t.String({description:"Raw PromQL expression for this widget, returned exactly as stored."}),{description:"PromQL expressions configured for this widget. PromQL-backed widgets require at least one query."}),ss=t.Array(p({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),k2=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:as,aliases:t.Optional(Ti),timeBucket:t.Optional(En),normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(bi),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),M2=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:ss,aliases:t.Optional(Ei),timeBucket:t.Optional(En),normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(Si),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),D2=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:as,aliases:t.Optional(Ti),backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(ht),legendMode:t.Optional(Ue)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),G2=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:ss,aliases:t.Optional(Ei),backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(Tt),legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),$2=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:as,aliases:t.Optional(Ti),normalizer:t.Optional(ht),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),j2=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:ss,aliases:t.Optional(Ei),normalizer:t.Optional(Tt),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),B2=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:as,aliases:t.Optional(Ti),normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ue)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),q2=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:ss,aliases:t.Optional(Ei),normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),F2=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:as,aliases:t.Optional(Ti),timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(ht),thresholds:qt,legendMode:t.Optional(Ue),yAxisSettings:t.Optional(bi)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),H2=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:ss,aliases:t.Optional(Ei),timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(Tt),thresholds:qt,legendMode:t.Optional(Ue),yAxisSettings:t.Optional(Si)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),K2=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),..._i,timeBucket:t.Optional(En),normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(bi),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),z2=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...Ii,timeBucket:t.Optional(En),normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ue),thresholds:qt,yAxisSettings:t.Optional(Si),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),Y2=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),..._i,normalizer:t.Optional(ht),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopList",title:"TopList"}),V2=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...Ii,normalizer:t.Optional(Tt),precision:le,conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),Q2=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),..._i,normalizer:t.Optional(ht),precision:le,legendMode:t.Optional(Ue)},{$id:"GraphVisualizationPie",title:"Pie"}),W2=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...Ii,normalizer:t.Optional(Tt),precision:le,legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationPie",title:"Pie"}),Z2=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Lp,backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(ht),legendMode:t.Optional(Ue)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),X2=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...vp,backgroundMode:t.Optional(t.Enum(hi,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(fr,{description:"Conditional formatting rules applied to the displayed value"})),precision:le,normalizer:t.Optional(Tt),legendMode:t.Optional(Ue)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),J2=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),..._i,timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(ht),thresholds:qt,legendMode:t.Optional(Ue),yAxisSettings:t.Optional(bi)},{$id:"GraphVisualizationBar",title:"Bar"}),eK=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...Ii,timeBucket:t.Optional(En),precision:le,normalizer:t.Optional(Tt),thresholds:qt,legendMode:t.Optional(Ue),yAxisSettings:t.Optional(Si)},{$id:"InputGraphVisualizationBar",title:"Bar"}),hP='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.',TP=t.String({description:hP}),EP=p({description:hP}),tK=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),..._i,group:t.Optional(TP),precision:le,normalizer:t.Optional(ht),percentileMarkers:t.Optional(h2),boundsScale:t.Optional(np)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),rK=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...Ii,group:t.Optional(EP),precision:le,normalizer:t.Optional(Tt),percentileMarkers:t.Optional(T2),boundsScale:t.Optional(np)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),_P=["red","pink","violet","blue","cyan","green","yellow","orange"],IP=t.Enum(_P,{description:"Color palette used to render the heatmap intensity gradient"}),nK=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),..._i,group:t.Optional(TP),precision:le,normalizer:t.Optional(ht),palette:t.Optional(IP)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),oK=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...Ii,group:t.Optional(EP),precision:le,normalizer:t.Optional(Tt),palette:t.Optional(IP)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),bP=t.Object({from:t.Number({description:"Lower bound of the Gauge color threshold; runs up to the next threshold or the max"}),color:t.Enum(_P,{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."}),iK=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Lp,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(bP,{description:"Color thresholds inside the gauge range"})),precision:le,normalizer:t.Optional(ht)},{$id:"GraphVisualizationGauge",title:"Gauge"}),aK=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...vp,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(bP,{description:"Color thresholds inside the gauge range"})),precision:le,normalizer:t.Optional(Tt)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),sK=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(l2,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Qo),defaultSorting:t.Optional(d2),columnSizes:t.Optional(t.Record(t.String(),t.Number({description:"Column width by column id"}),{description:"Table column widths in pixels, keyed by column id: `label` for the grouping column and `col-<index>` for each entry in `columns`. Columns without an entry keep their default width."}))},{$id:"GraphVisualizationTable",title:"Table"}),cK=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(m2,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Ar),defaultSorting:t.Optional(f2),columnSizes:t.Optional(t.Record(t.String(),t.Number({description:"Column width by column id"}),{description:"Table column widths in pixels, keyed by column id: `label` for the grouping column and `col-<index>` for each entry in `columns`. Columns without an entry keep their default width."}))},{$id:"InputGraphVisualizationTable",title:"Table"}),pK=t.Object({type:t.Literal("note",{description:"Displays static text on the dashboard"}),note:t.Optional(t.String({description:"Markdown-compatible text shown in the note"})),noteColor:t.Optional(t.Enum(aP,{description:"Background color used to render the note"})),noteAlign:t.Optional(Tn),noteJustifyContent:t.Optional(Tn)},{$id:"GraphVisualizationNote",title:"Note"}),uK=t.Object({type:t.Literal("note",{description:"Displays static text on the dashboard"}),note:t.Optional(p({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:t.Optional(t.Enum(aP,{description:"Background color used to render the note"})),noteAlign:t.Optional(Tn),noteJustifyContent:t.Optional(Tn)},{$id:"InputGraphVisualizationNote",title:"Note"}),lK=b("type",[E2,I2,S2,A2,R2,P2,k2,D2,$2,B2,F2,K2,Y2,Q2,Z2,iK,J2,tK,nK,sK,g2,pK,w2,L2],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),mK=b("type",[_2,b2,O2,x2,C2,U2,M2,G2,j2,q2,H2,z2,V2,W2,X2,aK,eK,rK,oK,cK,y2,uK,N2,v2],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),kp=t.Object({id:t.String({description:"Unique identifier of the graph widget inside the dashboard. Set by the caller when the graph is created; use it to target the graph in later update requests."}),name:t.Optional(t.String({description:"Display name of the graph widget."})),description:t.Optional(t.String({description:"Optional text shown with the graph widget."})),descriptionAlign:t.Optional(Tn),descriptionJustifyContent:t.Optional(Tn),visualization:lK,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall."})},{description:"Grid position and size of the widget. Optional; when provided, width and height must meet the minimum size for the widget type."}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),Mp=t.Object({id:p({description:"Unique identifier of the graph widget inside the dashboard. Assign it when the graph is created; use it to target the graph in later update requests."}),name:t.Optional(p({description:"Display name of the graph widget."})),description:t.Optional(t.String({minLength:1,maxLength:800,description:"Text shown with the graph widget."})),descriptionAlign:t.Optional(Tn),descriptionJustifyContent:t.Optional(Tn),visualization:mK,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall."})},{description:"Grid position and size of the widget. Optional; when provided, width and height must meet the minimum size for the widget type."}))},{title:"Graph",description:"Single dashboard widget, combining its identity, its visualization configuration, and its position on the dashboard grid."}),iP=10,dK=t.Array(t.Object({key:t.String({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:t.Array(t.String({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:t.Optional(t.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{description:"Dashboard-wide filters applied to every widget on the dashboard."}),fK=t.Array(t.Object({key:p({description:"Dashboard-wide filter key, usually a telemetry attribute name."}),values:t.Array(p({description:"Filter value."}),{description:"Allowed values for this dashboard-wide filter."}),exclude:t.Optional(t.Boolean({description:"If true, widgets exclude telemetry whose value matches this filter instead of including it (is-not)."}))}),{maxItems:iP,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${iP} filters are allowed.`}),Oi=t.Object({id:t.String({description:"Tsuga-generated dashboard ID assigned when the dashboard is created."}),name:t.String({description:"Display name of the dashboard. Set by the caller on create or update."}),owner:t.String({description:"ID of the team that owns the dashboard. Set by the caller on create or update and used for dashboard access control."}),graphs:t.Array(kp,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(dK),createdAt:E({description:"Timestamp when Tsuga created the dashboard."}),updatedAt:E({description:"Timestamp when Tsuga last updated the dashboard."}),creator:t.Optional(ae),updater:t.Optional(ae),tags:Re,timePreset:t.Optional(t.Enum(du,{description:"Relative time preset used when opening the dashboard."})),folderId:t.Optional(t.String({description:"Folder that contains the dashboard. Set from the dashboard's saved folder relationship. Returned when the dashboard is in a folder; omitted when it is not."}))}),Dp=t.Object({name:p({description:"Display name of the dashboard."}),owner:p({allowEmpty:!1,description:"ID of the team that owns the dashboard. Required and used for dashboard access control."}),graphs:t.Array(Mp,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(fK),tags:$e,timePreset:t.Optional(t.Enum(du,{description:"Relative time preset used when opening the dashboard. Optional; create defaults to `past-30-minutes` when omitted, and update omission preserves the current value."})),folderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder that should contain the dashboard. Optional; omit on update to keep the current folder, pass null to clear the folder, or pass a readable dashboard-folder ID to move it."}))}),Wt={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},SP=[Wt.OWNER,Wt.TAGS,Wt.WIDGET_COUNT,Wt.UPDATED_AT,Wt.NAME],Gp=t.Partial(t.Object({owners:xe(p({allowEmpty:!1}),{description:"Restrict results to dashboards owned by any of these team IDs",maxItems:50}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Substring matched case-insensitively against dashboard names or dashboard IDs. Omit the whole `searchQuery` filter to skip text filtering."}),exclude:t.Optional(t.Boolean({description:"If true, exclude dashboards matching this value instead of including them"}))},{description:"Text filter for dashboard names or IDs. Optional; `exclude: true` returns dashboards whose name and ID do not match the substring."}),tags:xe(vt.items,{description:"Restrict results to dashboards that have at least one of the listed key/value tags",maxItems:50}),folderId:t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder filter for dashboard query results. Optional; pass a folder ID to return dashboards in that folder, or null to return only dashboards that are not in any folder."})},{description:"Optional filters applied to narrow the returned dashboards"})),gK=t.Partial(t.Object({...de,filters:Gp,sort:t.Object({by:t.Enum([Wt.IS_FAVORITE,Wt.OWNER,Wt.TAGS,Wt.WIDGET_COUNT,Wt.UPDATED_AT,Wt.NAME],{description:"Field to sort the returned dashboards by"}),direction:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"})})),HYe=m({tags:["dashboards"],url:`${kr}/query`,method:"POST",paginated:!0,response:t.Array(Oi),body:gK}),KYe=m({tags:["dashboards"],url:`${kr}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit(Gp,["tags"]))}),response:Lt}),zYe=m({tags:["dashboards"],url:`${kr}/:id`,method:"GET",params:t.Object({id:p()}),response:Oi}),YYe=m({tags:["dashboards"],url:kr,method:"POST",body:Dp,response:Oi}),VYe=m({tags:["dashboards"],url:`${kr}/:id`,method:"PUT",params:t.Object({id:p()}),body:t.Partial(Dp),response:Oi}),QYe=m({tags:["dashboards"],url:`${kr}/bulk-update`,method:"PUT",body:t.Object({dashboardIds:t.Array(p(),{description:"Dashboard IDs to update. At least one dashboard ID is required."}),owner:t.Optional(p({allowEmpty:!1,description:"Owning team ID to apply to every dashboard. Optional when folderId is provided; omit to keep the current owner."})),folderId:t.Optional(t.Union([t.Null(),p({allowEmpty:!1})],{description:"Folder that should contain every dashboard. Optional when owner is provided; omit to keep the current folder, pass null to clear the folder, or pass a dashboard-folder ID to move dashboards."}))}),response:t.Object({})}),WYe=m({tags:["dashboards"],url:`${kr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),ZYe=m({tags:["dashboards"],url:`${kr}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1}),graphId:p({allowEmpty:!1})}),body:t.Omit(Mp,["id"]),response:kp}),XYe=m({tags:["dashboards"],url:`${kr}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})});var Ai=`/${"v1"}/dashboards`,cs=t.Pick(Oi,["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)."}),yK={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(cs,{examples:[yK]});var hK=t.Object({by:t.Enum([...SP],{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:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"}),OP=t.Object({...De,filters:t.Optional(t.Pick(Gp,["owners","searchQuery","tags","folderId"])),sort:t.Optional(hK)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),TK={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(OP,{examples:[TK]});var AP=m({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:`${Ai}/query`,method:"POST",paginated:!0,body:OP,response:t.Array(cs)}),xP=m({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${Ai}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to retrieve. Use the `id` returned by dashboard query, create, or update responses."})}),response:cs}),tf=t.Pick(Dp,["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."}),EK={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(tf,{examples:[EK]});var _K=t.Omit(Mp,["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."}),RP=m({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:Ai,method:"POST",body:tf,response:cs}),CP=m({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:`${Ai}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to update. Use the `id` returned by dashboard query, get, or create responses."})}),body:t.Partial(tf),response:cs}),IK=t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved dashboard to delete. Use the `id` returned by dashboard query, get, create, or update responses."})}),PP=m({description:"Deletes a dashboard by ID. Use only after confirming no users or automation still rely on the dashboard.",operationId:"deleteDashboard",tags:["dashboards"],url:`${Ai}/:id`,method:"DELETE",params:IK,response:x}),aVe=m({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:`${Ai}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the dashboard that contains the graph to update. Use the `id` returned by dashboard responses."}),graphId:p({allowEmpty:!1,description:"Identifier of the graph to update within the dashboard. Use graph IDs from the dashboard response."})}),body:_K,response:kp});var UP=100,wP=3,xi=t.Object({id:t.String({description:"Tsuga-generated ingestion API key ID assigned when the key is created."}),name:t.String({description:"Human-readable key name. Names must be kebab-case when creating or updating keys."}),keyLastCharacters:t.String({description:"Last visible characters of the secret key. Use this to identify a key without exposing the full secret."}),owner:t.String({description:"Team ID that owns and manages the ingestion API key."}),tags:Lt,teamOverrideFields:t.Optional(t.Array(t.String(),{description:"Telemetry attribute names used to override ownership for data sent with this key."})),updatedAt:E({description:"Timestamp when Tsuga last updated the key metadata."}),createdAt:E({description:"Timestamp when Tsuga created the key."}),creator:t.Optional(ae),updater:t.Optional(ae),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})}),ps=t.Object({name:t.String({format:Bo,minLength:1,maxLength:UP,description:`Kebab-case name for the ingestion API key. Maximum length is ${UP} characters.`}),owner:p({allowEmpty:!1,description:"Team ID that will own and manage the ingestion API key."}),tags:vt,teamOverrideFields:t.Union([t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:wP,description:`Array form. Up to ${wP} fields are allowed.`}),t.Null({description:"Clear any existing team override fields."})],{description:"Telemetry attribute names used to override ownership for data sent with this key. Send null to clear existing override fields."})}),us="/v0/ingestion-api-keys",gVe=m({tags:["ingestion-api-keys"],url:us,method:"POST",body:ps,response:t.Intersect([xi,t.Object({key:t.String({description:"Full secret value of the ingestion API key. Generated by Tsuga and returned only in this create response; subsequent get and list responses expose only `keyLastCharacters`. Store it immediately, since it cannot be retrieved again after this response."})})])}),yVe=m({tags:["ingestion-api-keys"],url:us,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(xi)}),hVe=m({tags:["ingestion-api-keys"],url:`${us}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:xi}),TVe=m({tags:["ingestion-api-keys"],url:`${us}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1})}),body:ps,response:xi}),EVe=m({tags:["ingestion-api-keys"],url:`${us}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:x});var ls=`/${"v1"}/ingestion-api-keys`,ms=t.Pick(xi,["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)."}),NP={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(ms,{examples:[NP]});var LP=t.Pick(ps,["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."}),vP=t.Pick(ps,["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."}),kP={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(LP,{examples:[kP]});Object.assign(vP,{examples:[kP]});var bK={...NP,key:"tsuga_in:v1:abc123xyx7Qm"},MP=m({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:ls,method:"GET",paginated:!0,query:t.Object(De),response:t.Array(ms)}),RVe=m({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:`${ls}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to retrieve. Use the `id` returned by ingestion API key list or create responses."})}),response:ms}),SK=t.Intersect([t.Pick(ms,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),t.Object({key:t.String({description:"Full Tsuga-generated ingestion API key secret. Returned only in the create response; list, get, and update responses expose only `keyLastCharacters`."})})],{title:"IngestionApiKeyCreated",example:bK}),DP=m({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:ls,method:"POST",body:LP,response:SK}),GP=m({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:`${ls}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to update. Use the `id` returned by ingestion API key list, get, or create responses."})}),body:vP,response:ms}),$P=m({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:`${ls}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the ingestion API key to delete. Use the `id` returned by ingestion API key list, create, or update responses."})}),response:x});var OK={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"]}},[wVe,of,ds]=AK(OK);function AK(e){let r=[],n=[],o=[],i=Object.keys(e);for(let a of i){r.push(a);let c=e[a];for(let l in c){n.push(l);let d=c[l];Array.isArray(d)&&o.push(...d)}}return[rf(r),rf(n),rf(o)]}function rf(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var nf=t.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),xK=t.Object({versioningStatus:t.Optional(t.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),RK=t.Object({domainName:t.Optional(t.String()),origins:t.Optional(t.Array(t.String()))}),CK=t.Object({allocatedStorageGib:t.Optional(t.Number()),encryptedAtRest:t.Optional(t.Boolean()),engine:t.Optional(t.String()),dynamoDbItemCount:t.Optional(t.Number()),dynamoDbActualSizeGib:t.Optional(t.Number())}),PK=t.Object({version:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnets:t.Optional(t.Array(t.String()))}),UK=t.Object({artifactRegistryFormat:t.Optional(t.Enum(["FORMAT_UNSPECIFIED","DOCKER","MAVEN","NPM","APT","YUM","PYTHON","KFP","GO","GENERIC"])),uri:t.Optional(t.String()),tagMutability:t.Optional(t.Enum(["MUTABLE","IMMUTABLE"])),scanOnPush:t.Optional(t.Boolean()),encryptionType:t.Optional(t.String())}),wK=t.Object({status:t.Optional(t.String()),activeServices:t.Optional(t.Number()),pendingTasks:t.Optional(t.Number()),runningTasks:t.Optional(t.Number()),registeredContainerInstances:t.Optional(t.Number()),capacityProviders:t.Optional(t.Array(t.String()))}),NK=t.Object({status:t.Optional(t.String()),desiredStatus:t.Optional(t.String()),healthStatus:t.Optional(t.String()),availabilityZone:t.Optional(t.String()),startedAt:t.Optional(E())}),LK=t.Object({isEncrypted:t.Optional(t.Boolean()),ownerId:t.Optional(t.String()),state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","updating"]))}),vK=t.Object({type:t.Optional(t.String()),osType:t.Optional(t.String()),subnetIds:t.Optional(t.Array(t.String())),nbContainers:t.Optional(t.Number())}),kK=t.Object({digest:t.String(),imageTags:t.Array(t.String()),imageSizeBytes:t.Optional(t.Number()),imagePushedAt:t.Optional(E()),mediaType:t.Optional(t.String()),repositoryName:t.String(),repositoryId:t.Optional(t.String()),scanStatus:t.Optional(t.String())}),MK=t.Object({url:t.Optional(t.String()),maxMessageSizeBytes:t.Optional(t.Number()),messageRetentionHours:t.Optional(t.Number())}),DK=t.Object({runtime:t.Optional(t.String()),memoryAllocationMib:t.Optional(t.Number()),timeoutMs:t.Optional(t.Number()),codeSha256:t.Optional(t.String())}),GK=t.Object({kind:t.Optional(t.String())}),$K=t.Object({instanceId:t.String(),architecture:t.Optional(t.String()),instanceType:t.Optional(t.String()),operatingSystem:t.Optional(t.String()),memoryMib:t.Optional(t.Number()),vCpus:t.Optional(t.Number()),vpcId:t.Optional(t.String()),k8sClusterId:t.Optional(t.String())}),jK=t.Object({id:t.Optional(t.String()),ipCidrBlocks:t.Array(t.String())}),BK=t.Object({protocol:t.Optional(nf),port:t.Optional(t.Number()),instanceProtocol:t.Optional(nf),instancePort:t.Optional(t.Number())}),qK=t.Object({protocol:t.Optional(t.String()),ports:t.Optional(t.Array(t.String())),portRange:t.Optional(t.String()),allPorts:t.Optional(t.Boolean())}),FK=t.Object({name:t.String(),ip:t.Optional(t.String()),type:t.Enum(["public","private"])}),HK=t.Object({type:t.String(),name:t.String()}),KK=t.Object({frontendIp:t.Optional(FK),backendIpPools:t.Array(HK)}),zK=t.Object({targetId:t.String(),targetPort:t.Optional(t.Number()),targetType:t.Optional(t.Enum(["instance","ip","lambda","alb"])),healthState:t.Optional(t.String()),healthReason:t.Optional(t.String()),healthDescription:t.Optional(t.String()),availabilityZone:t.Optional(t.String())}),YK=t.Object({protocol:t.Optional(nf),port:t.Optional(t.Number()),type:t.Optional(t.Enum(["alb","lambda","instance","ip"])),name:t.Optional(t.String()),targetGroupArn:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),healthCheckProtocol:t.Optional(t.String()),healthCheckPort:t.Optional(t.String()),healthCheckPath:t.Optional(t.String()),healthCheckIntervalSeconds:t.Optional(t.Number()),healthCheckTimeoutSeconds:t.Optional(t.Number()),healthyThresholdCount:t.Optional(t.Number()),unhealthyThresholdCount:t.Optional(t.Number()),targets:t.Optional(t.Array(zK)),targetCount:t.Optional(t.Number()),healthyTargetCount:t.Optional(t.Number()),loadBalancerArns:t.Optional(t.Array(t.String()))}),VK=t.Object({first:t.Optional(t.String()),last:t.Optional(t.String()),scope:t.Optional(t.Number())}),QK=t.Object({type:t.Optional(t.String()),name:t.Optional(t.String()),alwaysServe:t.Optional(t.Boolean()),subnets:t.Optional(t.Array(t.Union([t.Number(),VK]))),target:t.Optional(t.String()),weight:t.Optional(t.Number()),priority:t.Optional(t.Number()),status:t.Optional(t.String())}),WK=t.Object({instanceId:t.Optional(t.String()),state:t.Optional(t.String()),reasonCode:t.Optional(t.String()),description:t.Optional(t.String())}),ZK=t.Object({loadBalancerType:t.Optional(t.String()),dnsName:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnetIds:t.Array(t.String()),scheme:t.Optional(t.String()),listeners:t.Optional(t.Union([t.Array(BK),t.Array(qK)])),targets:t.Optional(t.Union([t.Array(t.String()),t.Array(WK),t.Array(QK)])),azureLoadBalancingRules:t.Optional(t.Array(KK))}),XK=t.Object({domainName:t.Optional(t.String()),expiresAt:t.Optional(E()),inUseBy:t.Optional(t.Array(t.String())),renewalEligibility:t.Optional(t.String()),revokedAt:t.Optional(E()),status:t.Optional(t.String()),type:t.Optional(t.String())}),JK=t.Object({state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","in-use"])),volumeType:t.Optional(t.Enum(["gp2","gp3","io1","io2","st1","sc1","standard"]))}),ez=t.Object({osType:t.Optional(t.Enum(["Windows","Linux"]))}),tz=t.Object({state:t.Optional(t.String()),volumeType:t.Optional(t.String())}),rz=t.Intersect([t.Object({isEncrypted:t.Optional(t.Boolean()),sizeGib:t.Optional(t.Number())}),t.Union([JK,tz,ez])]),nz=t.Object({instanceCount:t.Optional(t.Number()),hostnames:t.Optional(t.Array(t.String())),runtime:t.Optional(t.String())}),$p=t.Union([t.Object({category:t.Literal("application"),resourceType:t.Literal("webService"),attributes:t.Optional(nz)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("bucket"),attributes:t.Optional(xK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("messagingService"),attributes:t.Optional(MK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("fileSystem"),attributes:t.Optional(LK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("contentDeliveryNetwork"),attributes:t.Optional(RK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("database"),attributes:t.Optional(CK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("storageAccount"),attributes:t.Optional(GK)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("volume"),attributes:t.Optional(rz)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("virtualMachine"),attributes:t.Optional($K)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("serverless"),attributes:t.Optional(DK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("kubernetesCluster"),attributes:t.Optional(PK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerRepository"),attributes:t.Optional(UK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerCluster"),attributes:t.Optional(wK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerServiceTask"),attributes:t.Optional(NK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerService"),attributes:t.Optional(vK)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerImage"),attributes:t.Optional(kK)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("virtualNetwork"),attributes:t.Optional(jK)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("loadBalancer"),attributes:ZK}),t.Object({category:t.Literal("network"),resourceType:t.Literal("targetGroup"),attributes:t.Optional(YK)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("certificate"),attributes:t.Optional(XK)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var co="/v0/inventory",fs=["aws","gcp","azure"],jP=["scan_in_progress","success","failure","partial"],sf=t.Object({id:t.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:t.Enum(fs,{description:"Cloud platform where Tsuga discovered this resource."}),cloudAccount:t.String({description:"Cloud-native account identifier where Tsuga discovered this resource, such as an AWS account ID, GCP project ID, or Azure subscription ID."}),cloudRegion:t.Optional(t.String({description:"Cloud region where Tsuga discovered this resource, when the resource is regional."})),fullyQualifiedResourceId:t.String({description:"Cloud-native unique identifier for this resource, such as an AWS ARN, GCP resource name, or Azure resource ID."}),displayName:t.String({description:"Human-readable resource name shown in Tsuga. Derived from cloud provider metadata when available."}),nativeResourceType:t.String({description:"Cloud-native resource type reported by the inventory integration, for example `aws_ec2_instance` or `gcp_bucket`."}),resourceCreatedAt:t.Optional(E({description:"Timestamp when the resource was created in the cloud, when known."})),resourceUpdatedAt:t.Optional(E({description:"Timestamp when the resource was last updated in the cloud, when known."})),resourceLastSeenAt:E({description:"Timestamp when Tsuga last observed this resource during an inventory scan."}),tags:Re,nativeAttributes:t.Optional(t.Unsafe({type:"object",additionalProperties:!0})),covered:t.Optional(t.Boolean({description:"Whether the resource is covered by the configured infrastructure-as-code identifiers"}))}),Ri={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},BP=t.Object({cloudPlatforms:xe(t.Enum(fs),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:fs.length}),cloudAccounts:xe(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud accounts",maxItems:500}),cloudRegions:xe(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud regions",maxItems:500}),nativeResourceTypes:xe(t.Enum(ds),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:ds.length}),resourceTypes:xe(t.Enum(of),{description:"Restrict results to resources of any of these normalized resource types",maxItems:of.length}),tags:xe(vt.items,{description:"Restrict results to resources that have at least one of the listed key/value tags",maxItems:50}),isIacManaged:t.Boolean({description:"Restrict results by infrastructure-as-code coverage. When true, only resources covered by the configured IaC identifiers are returned; when false, only uncovered resources are returned."}),searchQuery:t.Object({value:p({allowEmpty:!1,description:"Case-insensitive substring matched against resource ID, display name, fully-qualified resource ID, cloud account, region, and resource type. Use the `tags` filter to narrow by tag. Wildcard characters are treated literally."}),exclude:t.Optional(t.Boolean({description:"If true, exclude resources matching this value instead of including them"}))},{description:"Search query filter for resources."})},{description:"Optional filters applied to narrow the returned resources"}),cf=t.Partial(t.Object({...de,filters:t.Partial(BP,{description:"Filters applied to narrow the returned resources."}),sort:t.Object({by:t.Enum([Ri.DISPLAY_NAME,Ri.CLOUD_ACCOUNT,Ri.NATIVE_RESOURCE_TYPE,Ri.CLOUD_REGION,Ri.RESOURCE_TYPE,Ri.RESOURCE_CREATED_AT],{description:"Field to sort the returned resources by"}),direction:t.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."})})),$Ve=m({tags:["inventory"],method:"POST",url:`${co}/resources/query`,paginated:!0,body:cf,response:t.Array(t.Intersect([sf,$p]))}),oz=["resourceType","cloudAccount","isIacManaged"],jVe=m({tags:["inventory"],method:"POST",url:`${co}/resources/counts`,body:t.Object({filters:t.Optional(t.Partial(BP)),groupBy:t.Enum(oz,{description:"Dimension to group the resource counts by."})}),response:t.Array(t.Object({value:t.String({description:'The group value the count belongs to: a resource type, a cloud account id, or "true"/"false" for IaC coverage.'}),count:t.Integer({description:"Number of resources in this group matching the requested filters."})}))}),BVe=m({tags:["inventory"],method:"GET",url:`${co}/resources/filter-options`,response:t.Object({cloudRegions:t.Array(t.String(),{description:"Distinct cloud regions present across the tenant's resources."}),nativeResourceTypes:t.Array(t.String(),{description:"Distinct cloud-native resource types present across the tenant's resources."}),tags:Lt})}),qVe=b("type",[t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({description:"AWS account ID that Tsuga scans."}),externalId:t.String({description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:t.String({description:"ARN of the IAM role Tsuga assumes to read inventory in the account."})}),t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({description:"GCP project ID that Tsuga scans."}),serviceAccountId:t.String({description:"Service account Tsuga impersonates to read inventory."}),workloadIdentityProvider:t.String({description:"Workload identity provider resource name used for federated authentication."})}),t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({description:"Client ID of the Azure application Tsuga authenticates as."}),subscriptionId:t.String({description:"Azure subscription ID that Tsuga scans."}),tenantId:t.String({description:"Azure tenant ID that owns the subscription."})})]),iz="^[0-9]{12}$",az="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",sz="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",cz="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",pz="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",af="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",uz=t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({pattern:iz,description:"AWS account ID that Tsuga scans.",errorMessage:{pattern:"Must be a 12-digit AWS account ID."}}),externalId:p({allowEmpty:!1,description:"External ID Tsuga passes when assuming the cross-account IAM role."}),roleArn:t.String({pattern:az,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"}),lz=t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({pattern:sz,minLength:6,maxLength:30,description:"GCP project ID that Tsuga scans.",errorMessage:{pattern:"Must be a GCP project ID (6-30 chars: lowercase letters, digits, hyphens)."}}),serviceAccountId:t.String({pattern:cz,minLength:1,maxLength:128,description:"Service account Tsuga impersonates to read inventory.",errorMessage:{pattern:"Must be a service account email, e.g. name@project.iam.gserviceaccount.com."}}),workloadIdentityProvider:t.String({pattern:pz,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"}),mz=t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({pattern:af,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:t.String({pattern:af,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:t.String({pattern:af,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),qP=b("type",[uz,lz,mz],{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`."}),Ci=t.Object({id:t.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:t.Enum(fs,{description:"Cloud provider of the account."}),cloudAccountId:t.String({description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:t.Optional(t.String({description:"Human-readable name for the account shown in Tsuga."})),organizationId:t.Optional(t.String({description:"Cloud organization identifier, when known."})),createdBy:t.Optional(t.String({description:"Identifier of the user who created the account, when created by a user."})),createdAt:E({description:"Timestamp when the account was registered in Tsuga."}),lastScanStartedAt:t.Optional(E({description:"Timestamp when the most recent inventory scan started."})),lastScanFinishedAt:t.Optional(E({description:"Timestamp when the most recent inventory scan finished."})),lastScanStatus:t.Optional(t.Enum(jP,{description:"Status of the most recent inventory scan."}))}),pf=t.Object({cloudType:t.Enum(fs,{description:"Cloud provider of the account."}),cloudAccountId:p({allowEmpty:!1,description:"Cloud-native account identifier: an AWS account ID, GCP project ID, or Azure subscription ID."}),accountFriendlyName:t.Optional(p({description:"Human-readable name for the account shown in Tsuga."})),organizationId:t.Optional(p({description:"Cloud organization identifier, when known."})),connectionSettings:qP,lastScanStatus:t.Optional(t.Enum(jP,{description:"Status of the most recent inventory scan."}))}),po=`${co}/cloud-accounts`,FVe=m({tags:["inventory"],url:po,method:"GET",response:t.Array(Ci)}),HVe=m({tags:["inventory"],url:`${po}/:id`,method:"GET",params:t.Object({id:p()}),response:Ci}),KVe=m({tags:["inventory"],url:po,method:"POST",body:pf,response:Ci}),uf=t.Object({accountFriendlyName:p({description:"Human-readable name for the account shown in Tsuga."})}),zVe=m({tags:["inventory"],url:`${po}/:id`,method:"PUT",params:t.Object({id:p()}),body:uf,response:Ci}),YVe=m({tags:["inventory"],url:`${po}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),VVe=m({tags:["inventory"],url:`${co}/trigger-scan`,method:"POST",body:t.Object({}),response:t.Object({success:t.Literal(!0)})}),QVe=m({tags:["inventory"],url:`${po}/azure/onboarding`,method:"POST",body:t.Object({tenantId:p()}),response:t.Object({subjectId:t.String(),audience:t.String()})}),WVe=m({tags:["inventory"],method:"POST",url:`${po}/validate/:type`,params:t.Object({type:p()}),body:t.Object({data:qP,id:t.Optional(p())}),response:t.Object({areAccountSettingsValid:t.Boolean(),message:t.Optional(t.String())})}),FP=`${co}/settings`,ZVe=m({tags:["inventory"],url:FP,method:"GET",response:t.Object({settings:t.Optional(t.Object({id:t.String(),infrastructureIdentifiers:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))}))})}),dz=50,XVe=m({tags:["inventory"],url:FP,method:"POST",body:t.Object({infrastructureIdentifiers:t.Array(t.Object({name:p({allowEmpty:!1}),value:t.Optional(p({allowEmpty:!1}))}),{maxItems:dz})}),response:t.Object({})}),JVe=m({tags:["inventory"],url:`${co}/iac-tags-proposal`,method:"GET",response:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))});var HP=`/${"v1"}/inventory`,fz=t.Omit(sf,["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)."}),KP=t.Intersect([fz,$p],{$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)."}),gz={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(KP,{examples:[gz]});var zP=t.Object({...cf.properties,...De},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),yz={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(zP,{examples:[yz]});var YP=m({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:`${HP}/resources/query`,method:"POST",paginated:!0,body:zP,response:t.Array(KP)}),gs=`${HP}/cloud-accounts`,ys=t.Pick(Ci,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),hz={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(ys,{examples:[hz]});var VP=t.Pick(pf,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),Tz={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(VP,{examples:[Tz]});var Ez=t.Pick(uf,["accountFriendlyName"]),c5e=m({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:gs,method:"GET",response:t.Array(ys)}),p5e=m({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${gs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to retrieve. Use the `id` returned by the cloud account list or create operations."})}),response:ys}),u5e=m({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:gs,method:"POST",body:VP,response:ys}),l5e=m({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${gs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to update. Use the `id` returned by the cloud account list or create operations."})}),body:Ez,response:ys}),m5e=m({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:`${gs}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the cloud account to delete. Use the `id` returned by the cloud account list or create operations."})}),response:x});var hs="/v0/investigations",_z=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],Iz=t.Object({type:t.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:t.String({description:"Identifier of the linked asset"})}),bz=t.Object({type:t.Enum(_z,{description:"Kind of linked asset"}),id:p({allowEmpty:!1,description:"Identifier of the linked asset"})}),Mr=t.Object({id:t.String({description:"Identifier of the investigation"}),name:t.String({description:"Human readable name shown for the investigation"}),slug:t.Optional(t.String({description:'Immutable identifier supplied by the creating agent, e.g. "incident-2024-06-payments-5xx". Set once at creation and matched against the agent telemetry to link back to the run that created the investigation.'})),contentMd:t.Optional(t.String({description:"Markdown content capturing the investigation notes and findings"})),tags:Re,owner:t.String({description:"Team ID owning the investigation"}),env:t.Optional(t.String({description:'Environment the investigation relates to, e.g. "prod"'})),linkedAssets:t.Array(Iz,{description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}),creator:t.Optional(ae),updater:t.Optional(ae),createdAt:E({description:"Timestamp the investigation was created at."}),updatedAt:E({description:"Timestamp the investigation was last updated at."})},{title:"Investigation"}),jp=t.Object({name:p({allowEmpty:!1,description:"Human readable name shown for the investigation"}),slug:p({type:"kebab-case",allowEmpty:!1,description:'Immutable, unique identifier supplied by the creating agent, used to link the investigation back to the agent run, e.g. "incident-2024-06-payments-5xx". The agent should also emit this value in its telemetry.'}),contentMd:t.Optional(p({type:"long",description:"Markdown content capturing the investigation notes and findings"})),tags:$e,owner:p({allowEmpty:!1,description:"Team ID owning the investigation"}),env:t.Optional(p({allowEmpty:!0,description:"Environment the investigation relates to"})),linkedAssets:t.Optional(t.Array(bz,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),lf=t.Object(t.Omit(jp,["slug"]).properties),_5e=m({tags:["investigations"],url:hs,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(Mr)}),I5e=m({tags:["investigations"],url:`${hs}/:id`,params:t.Object({id:p()}),method:"GET",response:Mr}),b5e=m({tags:["investigations"],url:hs,method:"POST",body:jp,response:Mr}),S5e=m({tags:["investigations"],url:`${hs}/:id`,method:"PUT",body:lf,params:t.Object({id:p()}),response:Mr}),O5e=m({tags:["investigations"],url:`${hs}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x});var Ts=`/${"v1"}/investigations`,QP=m({description:"Retrieve all investigations",tags:["private"],url:Ts,method:"GET",paginated:!0,query:t.Object(De),response:t.Array(Mr)}),WP=m({description:"Retrieve an investigation by its id",tags:["private"],url:`${Ts}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:Mr}),ZP=m({description:"Create a new investigation",tags:["private"],url:Ts,method:"POST",body:jp,response:Mr}),XP=m({description:"Update an investigation by its id",tags:["private"],url:`${Ts}/:id`,method:"PUT",body:lf,params:t.Object({id:p({allowEmpty:!1})}),response:Mr}),JP=m({description:"Delete an investigation by its id",tags:["private"],url:`${Ts}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:x});var eU=15,Bp={id:t.String({description:"Unique identifier of the processor within the route. Used to preserve processor identity during updates."}),description:t.Optional(t.String({description:"Optional user-provided processor note."})),tags:Re,updatedAt:t.Optional(E({description:"Timestamp when Tsuga last updated the processor."}))},qp={id:p({allowEmpty:!1,description:"Unique identifier of the processor within the route. Preserve it across updates for existing processors."}),description:t.Optional(p({type:"long",description:"Optional processor note."})),tags:$e,updatedAt:t.Optional(E({description:"Backend-maintained timestamp for this processor. Omit this field on create and update requests; Tsuga sets or preserves it based on processor changes."}))},tU={...Bp,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},rU={...qp,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},Sz=b("subtype",[t.Object({targetAttribute:t.String({description:"Attribute that will receive the formatted value"}),formatString:t.String({description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:t.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Whether missing referenced attributes render as empty strings. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorFormatString"}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the computed value"}),formula:t.String({description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),subtype:t.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:t.Optional(t.Boolean({description:"Whether missing referenced attributes evaluate as zero. If omitted, route processing treats this as true."}))},{$id:"ProcessorParamsCreatorMathFormula"}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:t.String({description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:t.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(t.String({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:t.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"ProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),Oz=b("subtype",[t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:p({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))},{$id:"InputProcessorParamsCreatorFormatString"}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the computed value"}),formula:p({allowEmpty:!1,type:"long",description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to evaluate as zero. Defaults to true."}))},{$id:"InputProcessorParamsCreatorMathFormula"}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:p({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:p({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:eU,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(p({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:t.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"InputProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),Az=t.Object({...tU,params:Sz}),xz=t.Object({...rU,params:Oz}),nU={...Bp,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},oU={...qp,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},Rz=b("subtype",[t.Object({attributes:t.Array(t.Object({originAttribute:t.String({description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Whether the source attribute is preserved after mapping. If omitted, route processing treats this as false."})),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),targetAttribute:t.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"ProcessorParamsMapperMapAttributes"}),t.Object({attributeName:t.String({description:"Attribute whose value will determine the log level"}),subtype:t.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"ProcessorParamsMapperMapLevel"}),t.Object({attributeName:t.String({description:"Attribute whose value will determine the log timestamp"}),subtype:t.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"ProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),Cz=b("subtype",[t.Object({attributes:t.Array(t.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:t.Optional(t.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:p({allowEmpty:!1,description:"Attribute name that will receive the mapped value"})}),{minItems:1,maxItems:50,description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"InputProcessorParamsMapperMapAttributes"}),t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:t.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"InputProcessorParamsMapperMapLevel"}),t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:t.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"InputProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),Pz=t.Object({...oU,params:Cz}),Uz=t.Object({...nU,params:Rz}),iU={...Bp,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},aU={...qp,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},sU=5,wz=b("subtype",[t.Object({attributeName:t.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(t.String({description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(t.String(),{description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:t.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the URL to parse"}),subtype:t.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the user agent string to parse"}),subtype:t.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),t.Object({sourceAttribute:t.String({description:"Attribute containing the key/value string segment to parse"}),targetAttribute:t.String({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:t.String({description:"Delimiter separating keys from values in the source string"}),pairsSplitter:t.String({description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:t.Boolean({description:"Whether keys without explicit values are accepted by the parser."}),subtype:t.Literal("key-value",{description:"Parses delimited key/value text into attributes."})})],{description:"Parse processor configuration. The `subtype` discriminator selects which parser reads the source text attribute and which fields it extracts."}),Nz=b("subtype",[t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(p({type:"long"}),{maxItems:sU,description:"Example log lines for validating the Grok rules. Samples are not sent to the ingestion engine."})),subtype:t.Literal("grok",{description:"Extracts fields from unstructured text using ordered Grok rules."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:t.Literal("url",{description:"Parses a URL attribute and writes URL detail fields."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:t.Literal("user-agent",{description:"Parses a user-agent string and writes browser, operating system, and device details."})}),t.Object({sourceAttribute:p({allowEmpty:!1,description:"Attribute containing the key/value string segment to parse"}),targetAttribute:p({description:"Target map attribute where extracted key/value pairs will be written"}),keyValueSplitter:p({allowEmpty:!1,description:"Delimiter separating keys from values in the source string"}),pairsSplitter:p({allowEmpty:!0,description:"Delimiter separating each key/value pair in the source string."}),acceptStandaloneKey:t.Boolean({description:"Set to true to accept keys without explicit values."}),subtype:t.Literal("key-value",{description:"Parses delimited key/value text into attributes."})})],{description:"Parse processor configuration. The `subtype` discriminator selects which parser reads the source text attribute and which fields it extracts."}),Lz=t.Object({...iU,params:wz}),vz=t.Object({...aU,params:Nz}),kz=t.Object({...rU,params:b("subtype",[t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:p({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:t.Literal("format-string"),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))}),t.Object({targetAttribute:p({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:p({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:p({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:eU,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:t.Optional(p({description:"String category value used when no clause matches."})),subtype:t.Literal("category")})])}),Mz=t.Object({...oU,params:t.Object({attributes:t.Array(t.Object({originAttribute:p({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:t.Optional(t.Boolean({description:"Overwrite the target attribute when it already exists (defaults to true)"})),targetAttribute:p({allowEmpty:!1,description:"Attribute name that will receive the mapped value"})}),{minItems:1,maxItems:50,description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes")})}),Dz=t.Object({...aU,params:t.Object({attributeName:p({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(p({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text. Route processing sends rules as engine patterns."}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(p({type:"long"}),{maxItems:sU,description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),D5e=b("type",[Mz,Dz,kz]),Gz=t.Object({...tU,params:b("subtype",[t.Object({targetAttribute:t.String({description:"Attribute that will receive the formatted value"}),formatString:t.String({description:"Template string used to build the target attribute value"}),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),subtype:t.Literal("format-string"),replaceMissingByEmpty:t.Optional(t.Boolean({description:"Whether missing referenced attributes render as empty strings."}))}),t.Object({targetAttribute:t.String({description:"Attribute that will receive the category value"}),clauses:t.Array(t.Object({query:t.String({description:"Query that selects logs for this category clause."}),value:t.String({description:"String category value assigned when this clause matches."})}),{description:"Conditions evaluated in order to determine the category value."}),defaultValue:t.Optional(t.String({description:"String category value used when no clause matches."})),subtype:t.Literal("category")})])}),$z=t.Object({...nU,params:t.Object({attributes:t.Array(t.Object({originAttribute:t.String({description:"Attribute name to map to the target attribute"}),keepOrigin:t.Optional(t.Boolean({description:"Whether the source attribute is preserved after mapping."})),overrideTarget:t.Optional(t.Boolean({description:"Whether to overwrite the target attribute when it already exists."})),targetAttribute:t.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:t.Literal("map-attributes")})}),jz=t.Object({...iU,params:t.Object({attributeName:t.String({description:"Attribute whose value will be parsed with Grok rules"}),rules:t.Array(t.String({description:"Grok rule applied to parse text."}),{description:"Ordered Grok rules evaluated until one matches."}),samples:t.Optional(t.Array(t.String(),{description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),G5e=b("type",[$z,jz,Gz]),Bz=11,cU=t.Cyclic({OutputProcessor:t.Union([Uz,Lz,Az,t.Object({...Bp,params:t.Object({items:t.Array(t.Object({query:t.String({description:"Query that determines whether logs enter this branch"}),processors:t.Array(t.Ref("OutputProcessor"),{description:"Processors executed when the branch query matches"})}),{description:"Conditional branches evaluated in order before falling back to the default"})}),type:t.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"OutputProcessor",{description:"Processing step executed sequentially on route logs"}),pU=t.Cyclic({InputProcessor:t.Union([Pz,vz,xz,t.Object({...qp,params:t.Object({items:t.Array(t.Object({query:p({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:t.Array(t.Ref("InputProcessor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:Bz,description:"Conditional branches evaluated in order before falling back to the default"})}),type:t.Literal("split",{description:"Split processor. It sends each log through the first matching conditional branch."})})])},"InputProcessor",{description:"Processing step executed sequentially on route logs"});var qz="/v0/logs",_n=`${qz}/routes`,In=t.Object({id:t.String({description:"Tsuga-generated log route ID assigned when the route is created."}),name:t.String({description:"Human-readable route name shown in Tsuga."}),description:t.Optional(t.String({description:"Optional free-text note about the route's purpose, set by the caller. This metadata is not evaluated when matching or processing logs."})),isEnabled:t.Boolean({description:"Whether this route is active for newly ingested logs. Disabled routes remain saved but do not process logs."}),query:t.String({description:"Tsuga query that selects which newly ingested logs enter the route processor chain."}),rank:t.Number({description:"Tsuga-assigned evaluation order, unique across all routes and dense (no gaps). Enabled routes are checked from lower rank to higher rank during ingestion, and every route whose query matches a log applies its processors to it \u2014 matching is not stopped after the first hit. New routes are appended with the highest rank; deleting a route shifts all higher ranks down by one to close the gap. Use `PUT /:id/modify-ranking` to move a route to a different rank, which shifts the routes between its old and new position accordingly."}),tags:Re,owner:t.String({description:"ID of the team that owns the route. Determines which team members can view and manage it, and which tag policies apply to it. Only an org admin or an admin of this team may change the `query` field or delete the route."}),processors:t.Array(cU,{description:"Processors applied in array order to logs that match the route, each transforming the output of the previous one. A `split` processor forks the chain into branches and cannot be followed by another processor at the same level."}),creator:t.Optional(ae),updater:t.Optional(ae),updatedAt:E({description:"Timestamp when Tsuga last updated the route."}),createdAt:E({description:"Timestamp when Tsuga created the route."}),assetUpdatedAt:E({description:"Timestamp when Tsuga last changed route behavior. This can differ from `updatedAt` when only metadata such as `description` or `tags` changed."})},{title:"LogRoute"}),Es=t.Object({name:p({allowEmpty:!1,description:"Human-readable log route name shown in Tsuga."}),description:t.Optional(p({type:"long",description:"Optional free-text note about the log route's purpose. This metadata is not evaluated when matching or processing logs."})),isEnabled:t.Boolean({description:"Set to true for the log route to process newly ingested matching logs. Set to false to save it without running it."}),query:p({type:"tsuga-query",description:"Tsuga query that selects which newly ingested logs enter the log route processor chain."}),tags:$e,owner:p({allowEmpty:!1,description:"ID of the team that will own the log route, determining which team members can view and manage it and which tag policies apply. Only an org admin or an admin of this team may change the `query` field or delete the log route."}),processors:t.Array(pU,{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 Y5e=m({tags:["routes"],url:_n,method:"GET",paginated:!0,query:t.Object(de),response:t.Array(In)}),V5e=m({tags:["routes"],url:`${_n}/:id`,params:t.Object({id:p()}),method:"GET",response:In}),Q5e=m({tags:["routes"],url:_n,method:"POST",body:Es,response:In}),W5e=m({tags:["routes"],url:`${_n}/:id`,method:"PUT",body:Es,params:t.Object({id:p()}),response:In}),Z5e=m({tags:["routes"],url:`${_n}/:id/clone`,method:"POST",params:t.Object({id:p()}),body:Es,response:In}),X5e=m({tags:["routes"],url:`${_n}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),J5e=m({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:`${_n}/:id/modify-ranking`,method:"PUT",params:t.Object({id:p()}),body:t.Object({rank:t.Integer({minimum:1,description:"Target rank for the route, from 1 to the total number of routes. Requests outside that range are rejected."})}),response:t.Object({})}),e6e=m({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:`${_n}/:id/enable`,method:"PUT",params:t.Object({id:p()}),body:t.Object({enable:t.Boolean({description:"Set to true to enable the route, or false to disable it."})}),response:In});var _s=`/${"v1"}/routes`,uU={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}"]}}]},lU={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}}]},Is=t.Pick(In,["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)."}),Fz={id:"123-456-abc",...uU},Hz={id:"456-789-def",...lU};Object.assign(Is,{examples:[Fz,Hz]});var mU=m({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:_s,method:"GET",paginated:!0,query:t.Object(De),response:t.Array(Is)}),dU=m({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${_s}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to retrieve. Use the `id` returned by route list or create responses."})}),response:Is}),mf=t.Pick(Es,["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(mf,{examples:[uU,lU]});var fU=m({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:_s,method:"POST",body:mf,response:Is}),gU=m({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:`${_s}/:id`,method:"PUT",body:mf,params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to update. Use the `id` returned by route list, get, or create responses."})}),response:Is}),yU=m({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:`${_s}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the log route to delete. Use the `id` returned by route list, create, or update responses."})}),response:x});var bs=`/${"v1"}/monitors`,Ss=t.Pick(xr,["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)."}),TU={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:[]},EU={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:[]},_U={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:[]},IU={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:[]},Kz={id:"123-456-abc",...TU},zz={id:"234-567-bcd",...EU},Yz={id:"345-678-cde",..._U},Vz={id:"456-789-def",...IU};Object.assign(Ss,{examples:[Kz,zz,Yz,Vz]});var hU=t.Pick(Kl,["filters","sort","limit","offset"]),bU=t.Object({...hU.properties,...De,filters:hU.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),Qz={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(bU,{examples:[Qz]});var SU=m({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:bU,response:t.Array(Ss)}),OU=m({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${bs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:Ss}),AU=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],xU=t.Pick(Ma,AU,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),RU=t.Pick(Ma,AU,{$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."}),CU=TU,PU=EU,UU=_U,wU=IU;Object.assign(xU,{examples:[CU,PU,UU,wU]});Object.assign(RU,{examples:[CU,PU,UU,wU]});var NU=m({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:xU,response:Ss}),LU=m({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:t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to update. Use the `id` returned by monitor query or create responses."})}),body:RU,response:Ss}),Wz=t.Object({id:p({allowEmpty:!1,description:"Identifier of the saved monitor to delete. Use the `id` returned by monitor query, create, or update responses."})}),vU=m({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:Wz,response:x});var Os=`/${"v1"}/notification-rules`,As=t.Pick(ri,["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)."}),kU={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}}}]},Zz={id:"123-456-abc",...kU};Object.assign(As,{examples:[Zz]});var MU=m({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:Os,method:"GET",paginated:!0,query:t.Object(De),response:t.Array(As)}),DU=m({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${Os}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to retrieve. Use the `id` returned by notification rule list or create responses."})}),response:As}),df=t.Pick($a,["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."}),Xz=kU;Object.assign(df,{examples:[Xz]});var GU=m({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:Os,method:"POST",body:df,response:As}),$U=m({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:`${Os}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to update. Use the `id` returned by notification rule list, get, or create responses."})}),body:df,response:As}),Jz=t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification rule to delete. Use the `id` returned by notification rule list, get, create, or update responses."})}),jU=m({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:`${Os}/:id`,method:"DELETE",params:Jz,response:x});var Pi=`${ei}/silences`,BU=t.Union([t.Literal("monday"),t.Literal("tuesday"),t.Literal("wednesday"),t.Literal("thursday"),t.Literal("friday"),t.Literal("saturday"),t.Literal("sunday")]),e3=t.Partial(t.Record(BU,t.Array(t.Object({startTime:t.String({format:ol,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({format:ol,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`."}),t3=t.Partial(t.Record(BU,t.Array(t.Object({startTime:t.String({description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({description:"Local end time for this recurring silence window on this day. It must be after `startTime`, and ranges on the same day cannot overlap."})},{title:"SilenceTimeRange"}),{description:"Silence windows for this day. Each window uses the schedule time zone, and windows on the same day cannot overlap."})),{description:"Recurring silence windows keyed by day of week, evaluated in the schedule `timeZone` or in UTC when it is omitted. A day with no entry is never silenced. Each window covers `startTime` up to but not including `endTime`."}),Fp='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',qU="One-time silence schedule with specific start and end times",FU="Recurring weekly silence schedule",r3=b("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({format:il,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({format:il,description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future."}),timeZone:t.Optional(t.String({format:nl,description:Fp}))},{$id:"InputSilenceScheduleOneTime",description:qU}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:e3,timeZone:t.Optional(t.String({format:nl,description:Fp}))},{$id:"InputSilenceScheduleRecurring",description:FU})],{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."}),n3=b("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({description:"Local end date and time for the one-time silence. It must be after `startTime` and in the future when created or updated."}),timeZone:t.Optional(t.String({description:Fp}))},{$id:"OutputSilenceScheduleOneTime",description:qU}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:t3,timeZone:t.Optional(t.String({description:Fp}))},{$id:"OutputSilenceScheduleRecurring",description:FU})],{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."}),Hp=t.Object({name:p({description:"Display name of the silence"}),reason:p({allowEmpty:!1,type:"long",description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:p({allowEmpty:!1,description:"Team ID that owns and manages the silence"}),tags:$e,isActive:t.Boolean({description:"Set to true for the silence to suppress matching notifications while its schedule is active. Set to false to keep the silence without suppressing anything."}),schedule:r3,notificationRuleIds:t.Optional(t.Array(p(),{description:"Notification rule IDs this silence applies to directly, matching any notification produced by one of these rules regardless of priority or transition type. Mutually exclusive with `prioritiesFilter`, `transitionTypesFilter`, and `queryString`: a request combining this field with any of those is rejected."})),queryString:t.Optional(p({type:"tags-query",description:"Query string to filter which alerts this silence applies to"})),teamsFilter:em,prioritiesFilter:t.Array(t.Enum(dt),{maxItems:dt.length,description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{maxItems:zn.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),Ui=t.Object({id:t.String({description:"Tsuga-generated notification silence ID assigned when the silence is created."}),name:t.String({description:"Display name of the silence"}),reason:t.String({description:"Free-text explanation of why notifications are being silenced, shown to other operators reviewing active silences."}),owner:t.String({description:"Team ID that owns and manages the silence"}),tags:Re,isActive:t.Boolean({description:"Whether the silence suppresses matching notifications while its schedule is active. When false, the silence is kept but never suppresses anything."}),schedule:n3,notificationRuleIds:t.Optional(t.Array(t.String(),{description:"Notification rule IDs this silence applies to directly, matching any notification produced by one of these rules regardless of priority or transition type. Set only when `prioritiesFilter`, `transitionTypesFilter`, and `queryString` are not used to filter alerts."})),queryString:t.Optional(t.String({description:"Query string filtering which alerts this silence applies to"})),teamsFilter:Jl,prioritiesFilter:t.Array(t.Enum(dt),{description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(zn),{description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."}),createdAt:E(),updatedAt:E(),creator:t.Optional(ae),updater:t.Optional(ae)}),N6e=m({tags:["notification-silences"],url:Pi,method:"GET",response:t.Array(Ui)}),L6e=m({tags:["notification-silences"],url:`${Pi}/:id`,params:t.Object({id:p()}),method:"GET",response:Ui}),v6e=m({tags:["notification-silences"],url:Pi,method:"POST",body:Hp,response:Ui}),k6e=m({tags:["notification-silences"],url:`${Pi}/:id`,method:"PUT",params:t.Object({id:p()}),body:Hp,response:Ui}),M6e=m({tags:["notification-silences"],url:`${Pi}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),D6e=m({tags:["notification-silences"],url:`${Pi}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})});var xs=`/${"v1"}/notification-silences`,Rs=t.Pick(Ui,["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)."}),o3={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"]},i3={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(Rs,{examples:[o3,i3]});var HU=m({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:xs,method:"GET",response:t.Array(Rs)}),KU=m({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${xs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to retrieve. Use the `id` returned by notification silence list or create responses."})}),response:Rs}),ff=t.Pick(Hp,["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."}),a3={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"]},s3={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(ff,{examples:[a3,s3]});var zU=m({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:xs,method:"POST",body:ff,response:Rs}),YU=m({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:`${xs}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to update. Use the `id` returned by notification silence list, get, or create responses."})}),body:ff,response:Rs}),c3=t.Object({id:p({allowEmpty:!1,description:"Identifier of the notification silence to delete. Use the `id` returned by notification silence list, get, create, or update responses."})}),VU=m({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:`${xs}/:id`,method:"DELETE",params:c3,response:x});var p3={critical:3,important:2,normal:1},oe=e=>({label:e,weight:p3[e]}),u3={"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:oe("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:oe("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:oe("important"),recommendation:"Ensure every team manages a dedicated route scoped to its context.team value."},"service-name-present":{key:"service-name-present",title:`${ap} present`,summary:`Logs and spans must populate ${ap} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:oe("critical"),recommendation:`Populate ${ap} 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:oe("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:oe("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:`${ka} presence`,summary:`Logs and spans must populate ${ka} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:oe("important"),recommendation:`Populate ${ka} 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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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 ${uO} 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:oe("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"},"db-server-metrics-collected":{key:"db-server-metrics-collected",title:"Database server metrics collected",summary:"Every database technology seen in client spans should have its OpenTelemetry server-metrics receiver configured.",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:oe("important"),recommendation:"Configure the matching OpenTelemetry server-metrics receiver for each detected database technology (for example postgresqlreceiver, mysqlreceiver, mongodbreceiver, redisreceiver).",scope:"global"}},l3=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),m3=ds.filter(e=>e.startsWith("azure_")&&!l3.has(e)),QU={"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:m3,metricPrefixes:["azure_"]}},d3=Object.fromEntries(Object.keys(QU).map(e=>{let{label:r,source:n}=QU[e];return[e,{key:e,title:`${r} metrics collected`,summary:`${r} resources found in inventory should have their metrics collected.`,rationale:"A resource that appears in inventory but whose metrics are not collected leaves its dashboards and resource-explorer views empty and impossible to alert on.",objectType:"metric",category:"collection-coverage",impact:oe("important"),recommendation:`Enable the ${n} metrics integration so ${r} metrics are ingested.`,scope:"global"}]})),f3={...u3,...d3},WU=Object.values(f3);var ZU=["passed","failed","ignored"],g3=t.Enum(ZU,{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."}),y3=["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"],yf=["unrouted-logs","no-over-routed-logs","team-has-route","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","db-server-metrics-collected",...y3],h3=t.Enum(yf),T3=["log","metric","resource","span","api-key","dashboard","monitor","route"],E3=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],_3=["critical","important","normal"],I3=["team","global"],hf=t.Object({key:t.Enum(yf),title:t.String(),summary:t.String(),rationale:t.String(),objectType:t.Enum(T3),category:t.Enum(E3),impact:t.Object({label:t.Enum(_3),weight:t.Number()}),recommendation:t.String(),scope:t.Optional(t.Enum(I3))}),XU=t.Object({type:t.String({description:"Tsuga asset kind referenced by this example (e.g. `monitor`)"}),label:t.String({description:"Human-readable summary of the example"}),link:t.Object({to:t.String({description:"In-app route the example deep-links to"}),search:t.Optional(t.Unknown({description:"Search-query payload for the deep link"})),params:t.Optional(t.Unknown({description:"Route params for the deep link"}))},{description:"In-app deep link to inspect the example"})}),gf=t.Intersect([hf,t.Object({status:g3,normalizedScore:t.Number(),details:t.Optional(t.Record(t.String(),t.Unknown())),recommendation:t.Optional(t.String()),examples:t.Optional(t.Array(XU))})]),b3=t.Object({generatedAt:t.String(),overallScore:t.Optional(t.Number()),rules:t.Array(hf),teamResults:t.Array(t.Object({teamId:t.String(),teamName:t.String(),teamWeight:t.Number(),score:t.Number(),weightedScore:t.Number(),totalWeight:t.Number(),ruleResults:t.Array(gf)})),globalResults:t.Optional(t.Object({score:t.Optional(t.Number()),ruleResults:t.Array(gf)}))}),Tf=t.Object({id:t.String({description:"Identifier of this persisted quality-report row. Generated by Tsuga when report rows are stored. Returned on every row. Treat it as an opaque ID."}),reportId:t.String({description:"Identifier shared by rows from the same report generation for the same team or global cluster-wide scope. Generated by Tsuga when the report is stored. Returned on every row."}),ruleId:t.Enum(yf,{description:"Stable key for the telemetry-quality rule evaluated by this row. Set by Tsuga from the quality-rule catalog. Returned on every row. The enum may grow as Tsuga adds rules; clients should display unknown future values as opaque rule keys if they do not have local labels."}),owner:t.Optional(t.String({description:"Team identifier this row applies to. Set to the owning team ID for team-scoped rules. Returned for team rows; omitted for global cluster-wide rows."})),status:t.Enum(ZU,{description:"Evaluation outcome for this rule row. Set by the rule evaluator when the report is generated. Returned on every row. Allowed values are passed, failed, and ignored; ignored means the rule was not applicable to the available data."}),score:t.Number({description:"Normalized score for this rule row. Set by the rule evaluator when the report is generated. Returned on every row. Values are between 0 and 1."}),weight:t.Number({description:"Impact weight of this rule, captured at report-generation time. Set by Tsuga from the rule's impact label: 1 for normal, 2 for important, 3 for critical. Used with score to compute reportOverallScore."}),reportOverallScore:t.Number({description:"Aggregate score for this row's report group. Calculated by Tsuga from non-ignored rows in the same team or global cluster-wide report. Returned on every row in that group with the same value."}),reportTotalWeight:t.Number({description:"Sum of non-ignored rule weights for this row's report group. Calculated by Tsuga when the report is generated. Returned on every row in that group with the same value."}),recommendation:t.Optional(t.String({description:"Recommendation stored with this row. Set by the rule evaluator when the report is generated. Returned when a recommendation was persisted; omitted otherwise. The latest-report endpoint does not recompute or default it at read time."})),examples:t.Optional(t.Array(XU,{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."})),createdAt:t.String({description:"ISO timestamp the row was generated at"})}),J6e=m({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:b3}),Ef=t.Optional(p({allowEmpty:!1,description:"Identifier of the cluster whose latest quality-report rows are returned. Use the id from the clusters API. Required when the organization has multiple clusters; omit only in single-cluster organizations. Unknown cluster IDs return RESOURCE_NOT_FOUND."})),eQe=m({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:t.Object({clusterId:Ef,team:t.Optional(p({allowEmpty:!1}))}),response:t.Array(Tf,{description:"Latest persisted rule evaluation rows for the cluster"})}),tQe=m({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:t.Object({ruleKey:h3,teamId:t.Optional(p({allowEmpty:!1})),lookbackMinutes:t.Optional(t.Integer({minimum:1,maximum:60})),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Object({rule:hf,result:gf,teamId:t.Optional(t.String()),teamName:t.Optional(t.String())})}),rQe=new Map(WU.map(e=>[e.key,e]));var S3=`/${"v1"}/quality-reports`,JU=t.Pick(Tf,["id","reportId","ruleId","owner","status","score","weight","reportOverallScore","reportTotalWeight","recommendation","examples","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)."}),O3={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(JU,{examples:[O3]});var A3=t.Object({clusterId:Ef,team:t.Optional(p({allowEmpty:!1,description:"Team name used to scope the report. Matched against Tsuga team names. Optional; when set, returns only rows for that team and omits global rows. Unknown team names return RESOURCE_NOT_FOUND; teams the caller cannot access return an empty result."}))},{description:"Latest quality report lookup query."}),ew=m({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:`${S3}/latest`,method:"GET",query:A3,response:t.Array(JU)});var Cs="/v0/admin-center";var gr=`${Cs}/retention-policies`,tw=3650,x3=t.Integer({description:"Number of days Tsuga retains matching telemetry."}),rw=t.Integer({minimum:1,maximum:tw,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${tw}.`}),Dr=t.Object({id:t.String({description:"Unique identifier of the retention policy. Generated by Tsuga."}),env:t.Optional(t.String({description:"Environment tag value this policy applies to. Omitted policies apply across environments unless a more specific policy exists."})),teamId:t.Optional(t.String({description:"Team ID this policy applies to. Omitted policies apply globally unless a team-specific policy exists."})),dataSource:t.Enum(pr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:x3,isEnabled:t.Boolean({description:"Whether this policy participates in retention resolution."}),createdAt:E({description:"Timestamp when Tsuga created the retention policy."}),updatedAt:E({description:"Timestamp when Tsuga last updated the retention policy."})}),Kp=t.Object({env:t.Optional(p({description:"Environment tag value this policy applies to. Omit for a policy that is not environment-specific."})),teamId:t.Optional(p({description:"Team ID this policy applies to. Omit for a policy that is not team-specific."})),dataSource:t.Enum(pr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:rw,isEnabled:t.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),nw=t.Array(t.Object({env:p(),dataSource:t.Enum(pr),durationDays:t.Union([rw,t.Null()]),isEnabled:t.Boolean()})),ow=t.Object({inserted:t.Array(Dr),updated:t.Array(Dr),deleted:t.Array(Dr)}),hQe=m({tags:["retention-policies"],url:gr,method:"POST",body:Kp,response:Dr}),TQe=m({tags:["retention-policies"],url:gr,method:"GET",response:t.Array(Dr)}),EQe=m({tags:["retention-policies"],url:`${gr}/:id`,method:"GET",params:t.Object({id:p()}),response:Dr}),_Qe=m({tags:["retention-policies"],url:`${gr}/:id`,method:"PUT",params:t.Object({id:p()}),body:Kp,response:Dr}),IQe=m({tags:["retention-policies"],url:`${gr}/bulk-update`,method:"POST",body:nw,response:ow}),bQe=m({tags:["retention-policies"],url:`${gr}/bulk-update-for-team`,method:"POST",body:t.Object({teamId:p(),policies:nw}),response:ow}),SQe=m({tags:["retention-policies"],url:`${gr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),Ps=["past-24-hours","past-7-days","past-30-days"],OQe=m({tags:["retention-policies"],url:`${gr}/requested-history-percentile/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({percentile:t.Number({minimum:0,maximum:1}),observationWindow:t.Enum(Ps),dataSource:t.Enum(pr)}),response:t.Object({percentile:t.Number(),observationWindow:t.Enum(Ps),dataSource:t.Enum(pr),teamId:t.String(),requestedHistoryDays:t.Number()})}),R3=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var C3=t.Array(t.Object({bucket:t.Enum(R3),count:t.Number()})),AQe=m({tags:["retention-policies"],url:`${gr}/requested-history-histogram/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({observationWindow:t.Enum(Ps),dataSource:t.Enum(pr)}),response:t.Object({observationWindow:t.Enum(Ps),dataSource:t.Enum(pr),teamId:t.String(),histogram:C3})}),xQe=m({tags:["retention-policies"],url:`${gr}/top-teams-with-retention-surplus`,method:"POST",body:t.Object({dataSource:t.Enum(pr),observationWindow:t.Enum(Ps),percentile:t.Number({minimum:0,maximum:1}),topN:t.Optional(t.Number({minimum:1,maximum:20}))}),response:t.Array(t.Object({teamId:t.String(),retentionSurplusDays:t.Number()}))});var Us=`/${"v1"}/retention-policies`,ws=t.Pick(Dr,["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)."}),P3={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(ws,{examples:[P3]});var iw=m({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:Us,method:"GET",response:t.Array(ws)}),aw=m({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${Us}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to retrieve. Use the `id` returned by retention policy list or create responses."})}),response:ws}),_f=t.Pick(Kp,["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."}),U3={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(_f,{examples:[U3]});var sw=m({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:Us,method:"POST",body:_f,response:ws}),cw=m({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${Us}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to update. Use the `id` returned by retention policy list, get, or create responses."})}),body:_f,response:ws}),pw=m({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:`${Us}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the retention policy to delete. Use the `id` returned by retention policy list, create, or update responses."})}),response:x});var Ns=`/${"v1"}/slos`,w3=t.Pick(Ql,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),Ls=t.Object({...t.Pick(Jo,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:t.Array(w3,{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"}),N3={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(Ls,{examples:[N3]});var uw=t.Pick(Zl,["filters","sort","limit","offset"]),lw=t.Object({...uw.properties,...De,filters:uw.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),L3={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(lw,{examples:[L3]});var mw=m({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:`${Ns}/query`,method:"POST",paginated:!0,body:lw,response:t.Array(Ls)}),dw=m({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${Ns}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:Ls}),fw=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],gw=t.Pick(dp,fw,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),yw=t.Pick(Wl,fw,{$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."}),hw={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(gw,{examples:[hw]});Object.assign(yw,{examples:[hw]});var Tw=m({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:Ns,method:"POST",body:gw,response:Ls}),Ew=m({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:`${Ns}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to update. Use the `id` returned by SLO query or create."})}),body:yw,response:Ls}),_w=m({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${Ns}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the SLO to delete. Use the `id` returned by SLO query or create."})}),response:x});var uo=`${Cs}/tag-policies`;var v3=["logs","metrics","traces"],If=t.Array(t.Enum(v3,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),k3=t.Union([Kc,If]),M3=t.Object({teamIds:t.Array(t.String(),{description:"Team IDs used by this policy scope."}),mode:t.Enum(["include","exclude"],{description:"`include` applies the policy only to listed teams. `exclude` applies it to all teams except the listed teams."})},{description:"Team scope that limits where this policy applies. Omitted means the policy applies to all teams."}),D3=b("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:If,shouldInsertWarning:t.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:t.Optional(t.Number({description:"Percentage of non-compliant telemetry datapoints to drop. Omitted means no sampling drop is configured."}))},{title:"TelemetryTagPolicy"}),t.Object({type:t.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:Kc},{title:"TsugaAssetTagPolicy"})]),G3=b("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:If,shouldInsertWarning:t.Boolean({description:"When true, Tsuga annotates non-compliant telemetry with tag policy warnings instead of only measuring violations."}),dropSample:t.Optional(t.Number({minimum:0,maximum:100,description:"Percentage of non-compliant telemetry datapoints to drop. Valid values are 0 through 100."}))},{title:"TelemetryTagPolicy"}),t.Object({type:t.Literal("tsuga_asset",{description:"Policy applies to Tsuga-managed resources such as dashboards, routes, and keys."}),assetTypes:Kc},{title:"TsugaAssetTagPolicy"})]),Iw="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",$3=t.Unsafe({...D3,description:Iw}),j3=t.Unsafe({...G3,description:Iw}),wi=t.Object({id:t.String({description:"Tsuga-generated tag policy ID assigned when the policy is created."}),name:t.String({description:"Human-readable tag policy name."}),description:t.Optional(t.String({description:"Optional user-provided policy description."})),isActive:t.Boolean({description:"Whether Tsuga currently evaluates this policy. Reserved policies (for example the built-in `env` policy on ingestion API keys) cannot be set to false."}),tagKey:t.String({description:"Tag key enforced by this policy."}),allowedTagValues:t.Array(t.String(),{description:"Allowed values for `tagKey`. An empty array means any value is accepted when the tag exists."}),isRequired:t.Boolean({description:"Whether the tag must be present. If false, `allowedTagValues` is still enforced when the tag exists. Reserved policies cannot be set to false."}),teamScope:t.Optional(M3),configuration:$3,creator:t.Optional(ae),updater:t.Optional(ae),owner:t.Optional(t.String({description:"Team ID that owns and manages the policy."})),createdAt:E({description:"Timestamp when Tsuga created the tag policy."}),updatedAt:E({description:"Timestamp when Tsuga last updated the tag policy."}),assetUpdatedAt:E({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})});var vs=t.Object({name:p({description:"Human-readable tag policy name."}),description:t.Optional(p({description:"Optional policy description."})),isActive:t.Boolean({description:"Set to true for Tsuga to evaluate this policy. Reserved policies (for example the built-in `env` policy on ingestion API keys) reject a false value."}),tagKey:p({allowEmpty:!1,description:"Tag key enforced by this policy. Tsuga trims surrounding whitespace before storing the policy."}),allowedTagValues:t.Array(p({allowEmpty:!1}),{maxItems:1e3,description:"Allowed values for `tagKey`. Leave empty to allow any value when the tag exists. Tsuga trims each submitted value before storing the policy."}),isRequired:t.Boolean({description:"Set to true to require the tag. If false, allowed values still apply when the tag exists. Reserved policies reject a false value."}),teamScope:t.Optional(t.Object({teamIds:t.Array(p(),{minItems:1,maxItems:100,description:"Team IDs used by this policy scope."}),mode:t.Enum(["include","exclude"],{description:"`include` applies the policy only to listed teams. `exclude` applies it to all teams except the listed teams."})},{description:"Team scope to store for this policy. Omit this field to apply the policy to all teams."})),configuration:j3,owner:p({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),QQe=m({tags:["tag-policies"],url:uo,method:"GET",query:t.Object({teamIds:t.Optional(t.Array(p(),{maxItems:100})),assetTypes:t.Optional(k3),searchQuery:t.Optional(p())}),response:t.Array(wi)}),WQe=m({tags:["tag-policies"],url:`${uo}/:id`,method:"GET",params:t.Object({id:p()}),response:wi}),ZQe=m({tags:["tag-policies"],url:uo,method:"POST",body:vs,response:wi}),XQe=m({tags:["tag-policies"],url:`${uo}/:id`,method:"PUT",params:t.Object({id:p()}),body:vs,response:wi}),JQe=m({tags:["tag-policies"],url:`${uo}/:id`,method:"DELETE",params:t.Object({id:p()}),response:x}),e8e=m({tags:["tag-policies"],url:`${Cs}/applicable-tag-rules`,method:"GET",query:t.Object({assetType:t.Enum(Oa),teamId:p()}),response:t.Array(t.Object({tagKey:t.String(),allowedTagValues:t.Array(t.String()),isRequired:t.Boolean(),tagPolicyId:t.String()}))}),bw=t.Object({total:t.Number(),totalNonCompliant:t.Number(),idsNonCompliant:t.Array(t.String())}),Sw=t.Union([t.Literal("ingestion-api-key"),t.Literal("operation-api-key"),t.Literal("rum-public-token"),t.Literal("dashboard"),t.Literal("log-route"),t.Literal("metric-route"),t.Literal("monitor"),t.Literal("notification-rule"),t.Literal("notification-silence"),t.Literal("slo")]),B3=t.Object({total:t.Number(),totalNonCompliant:t.Number(),byAssetType:t.Record(Sw,bw)}),q3=t.Omit(bw,["total"]),F3=t.Object({totalNonCompliant:t.Number(),byAssetType:t.Record(Sw,q3)}),Ow=t.Object({totals:B3,byTeam:t.Record(t.String(),F3)}),t8e=m({tags:["tag-policies"],url:`${uo}/:id/stats`,method:"GET",params:t.Object({id:p()}),response:Ow}),r8e=m({tags:["tag-policies"],url:`${uo}/new-policy-stats`,method:"POST",body:vs,response:Ow});var ks=`/${"v1"}/tag-policies`,Aw={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"},xw={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"},H3={id:"123-456-abc",...Aw},K3={id:"456-789-def",...xw},Ms=t.Pick(wi,["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)."}),z3=H3,Y3=K3;Object.assign(Ms,{examples:[z3,Y3]});var bf=t.Pick(vs,["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."}),V3=Aw,Q3=xw;Object.assign(bf,{examples:[V3,Q3]});var Rw=m({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:ks,method:"GET",response:t.Array(Ms)}),Cw=m({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${ks}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to retrieve. Use the `id` returned by tag policy list or create responses."})}),response:Ms}),Pw=m({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:ks,method:"POST",body:bf,response:Ms}),Uw=m({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:`${ks}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to update. Use the `id` returned by tag policy list, get, or create responses."})}),body:bf,response:Ms}),ww=m({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:`${ks}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the tag policy to delete. Use the `id` returned by tag policy list, create, or update responses."})}),response:x});var Ds=`/${"v1"}/teams`,Gs=t.Pick(Wo,["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)."}),W3={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Gs,{examples:[W3]});var Nw=m({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:Ds,method:"GET",paginated:!0,query:t.Object(De),response:t.Array(Gs)}),Lw=m({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${Ds}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to retrieve. Use the `id` returned by team list or create responses."})}),response:Gs}),Sf=t.Pick(pp,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),Z3={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Sf,{examples:[Z3]});var vw=m({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:Ds,method:"POST",body:Sf,response:Gs}),kw=m({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${Ds}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to update. Use the `id` returned by team list, get, or create responses."})}),body:Sf,response:Gs}),Mw=m({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:`${Ds}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the team to delete. Use the `id` returned by team list, create, or update responses."})}),response:x});function X3(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function Dw(e,r){let n=Number(r);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${r})`);return n}function Gw(e){let r={};return e.limit!==void 0&&(r.limit=Dw("limit",e.limit)),e.offset!==void 0&&(r.offset=Dw("offset",e.offset)),r}function Of(e){let r=e.params;if(r?.properties){let n=Object.keys(r.properties);if(n.length===1&&n[0])return n[0]}return"id"}function $w(e,r,n){let o=e.command(r.commandName).description(r.description),i=r.singularOverride??mO(r.commandName).replace(/-/g," "),a=r.pluralOverride??r.commandName.replace(/-/g," "),c=X3(i),l=o.command("list").description(r.listDescription??`List all ${a}`);if(r.listOptions)for(let d of r.listOptions)l.option(d.flag,d.description);if(r.endpoints.list.paginated===!0&&l.option("--limit <n>",`Maximum number of items to return, up to ${Fo} (default: ${Hc})`).option("--offset <n>","Number of items to skip, to request a later page"),r.enableListBody?l.option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async d=>{if(d.generateSkeleton){Q(li(r.endpoints.list));return}let f=d.data?ni({data:d.data}):{},g=await n()(r.endpoints.list,{body:{...f,...Gw(d)}});Q(g)}):l.action(async d=>{let f=Gw(d);if(r.listOptions)for(let T of r.listOptions){let _=d[T.queryParam];_!==void 0&&(f[T.queryParam]=_)}let g=await n()(r.endpoints.list,Object.keys(f).length>0?{query:f}:void 0);Q(g)}),r.endpoints.get){let d=r.endpoints.get,f=Of(d);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async g=>{let T=await n()(d,{params:{[f]:g}});Q(T)})}if(r.endpoints.create){let d=r.endpoints.create;o.command("create").description(`Create a new ${i}`).option("-f, --file <FILE_PATH>","Read body from file (use - for stdin)").option("-d, --data <JSON>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async f=>{if(f.generateSkeleton){Q(li(d));return}let g=ni(f),T=await n()(d,{body:g});Q(T)})}if(r.endpoints.update){let d=r.endpoints.update,f=Of(d);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(g,T)=>{if(T.generateSkeleton){Q(li(d));return}let _=ni(T),se=await n()(d,{params:{[f]:g},body:_});Q(se)})}if(r.endpoints.delete){let d=r.endpoints.delete,f=Of(d);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async g=>{let T=await n()(d,{params:{[f]:g}});Q(T)})}}var J3=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:YP},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:eP,get:tP,create:rP,update:nP,delete:oP},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:AP,get:xP,create:RP,update:CP,delete:PP},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:MP,create:DP,update:GP,delete:$P}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:QP,get:WP,create:ZP,update:XP,delete:JP}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:SU,get:OU,create:NU,update:LU,delete:vU},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:MU,get:DU,create:GU,update:$U,delete:jU}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:HU,get:KU,create:zU,update:YU,delete:VU}},{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:ew},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:iw,get:aw,create:sw,update:cw,delete:pw}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:mU,get:dU,create:fU,update:gU,delete:yU}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:eA,get:tA}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:mw,get:dw,create:Tw,update:Ew,delete:_w},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:Rw,get:Cw,create:Pw,update:Uw,delete:ww}},{commandName:"teams",description:"Manage teams",endpoints:{list:Nw,get:Lw,create:vw,update:kw,delete:Mw}}];function jw(e,r){for(let n of J3)$w(e,n,r)}var Bw=require("node:child_process");var zp="@tsuga/cli@latest";function e9(){q(`Updating ${zp}`),q(` $ npm install -g ${zp}`);try{(0,Bw.execFileSync)("npm",["install","-g",zp],{stdio:["ignore","inherit","inherit"]})}catch(e){let r=e.status??1;throw new Error(`npm install -g ${zp} exited ${r}`,{cause:e})}q("Updated. Run `tsuga --version` to confirm the new version.")}function qw(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{e9()})}var wf=require("node:fs"),Uf=require("node:os"),Li=require("node:path");function t9(e,r){let n=e.slice(0,r).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function r9(e,r,n){let o=e.split(/\r\n|\n|\r/g),i="",a=(Math.log10(r+1)|0)+1;for(let c=r-1;c<=r+1;c++){let l=o[c-1];l&&(i+=c.toString().padEnd(a," "),i+=": ",i+=l,i+=`
|
|
140
|
-
`,c===r&&(i+=" ".repeat(a+n+2),i+=`^
|
|
141
|
-
`))}return i}var z=class extends Error{line;column;codeblock;constructor(r,n){let[o,i]=t9(n.toml,n.ptr),a=r9(n.toml,o,i);super(`Invalid TOML document: ${r}
|
|
137
|
+
fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(t=>{let{rows:n,valueFlags:o}=RF(e);if(t==="bash")V(CF(ux(n),o));else if(t==="zsh")V(PF(ux(n),o));else if(t==="fish")V(wF(UF(n),o));else throw new Error(`Unsupported shell "${t}". Supported: bash, zsh, fish.`)})}function dx(e){let t=e.command("config").description("Show or manage configuration");t.action(()=>{let n=e.opts(),o=ti({operationApiKey:n.operationApiKey,clusterId:n.cluster});V(fO(o,za()).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)=>{mO(n,o),V(`Default set: ${n} = ${o}`)}),t.command("reset").description("Reset configuration values").command("defaults").description("Clear all custom defaults").action(()=>{dO(),V("Custom defaults cleared")})}var fx=`/${"v1"}/docs`,gx=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"}),vF={path:"getting-started/send-your-first-logs",title:"Send your first logs",content:`# Send your first logs
|
|
138
|
+
...`};Object.assign(gx,{examples:[vF]});var hx=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"}),NF={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(hx,{examples:[NF]});var yx=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:fx,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:gx}),Tx=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:`${fx}/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(hx)});function Ex(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()(yx,{query:{path:o}});J(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()(Tx,{query:{query:o}});J(i)})}var LF=`/${"v1"}/feedback`,_x=r.Object({id:r.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),kF={id:"request-123-abc"};Object.assign(_x,{examples:[kF]});var Ix=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."})}),MF={content:"The traces command times out for large services."};Object.assign(Ix,{examples:[MF]});var bx=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:LF,method:"POST",body:Ix,response:_x});function Sx(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()(bx,{body:{content:n.join(" ")}});J(o)})}var DF="^\\S(.*\\S)?$",GF=128,$F=256,jF=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"}),qF=r.Object({key:r.String({maxLength:GF,description:"Tag key to attach to the resource."}),value:r.String({maxLength:$F,pattern:DF,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),Ft=r.Array(jF,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),Bt=r.Array(qF,{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 En="/v0/teams",Qp=["public","private"],Vp={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},FF=r.Enum([Vp.NAME,Vp.CREATED_AT,Vp.MEMBER_COUNT,Vp.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),xx=r.Object({color:r.Enum(td,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:r.Enum(rd,{description:"Avatar rendering mode selected for the team."}),iconName:r.Enum(JO,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),pd=r.Object({color:r.Enum(td),mode:r.Enum(rd)}),Ax=100,Ox=250,si=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(Qp,{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(xx)}),Wp=r.Object({name:r.String({minLength:1,maxLength:Ax,format:Zo,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 ${Ax} characters.`}),description:r.Optional(r.String({maxLength:Ox,description:`Optional team description. Maximum length is ${Ox} characters.`})),visibility:r.Enum(Qp,{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(xx)}),BF=r.Object({id:r.String(),name:r.String(),email:r.String(),role:r.Enum(ri),joinedTeamAt:A(),orgRole:r.Enum(_O),avatar:r.Optional(pd)}),Rx=r.Object({searchQuery:r.Optional(u({description:"Substring matched against team names and descriptions."})),visibility:r.Optional(r.Enum(Qp,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:r.Optional(r.Boolean({description:"If true, return only teams that include the authenticated user."}))}),tNe=d({tags:["teams"],url:En,method:"GET",paginated:!0,response:r.Array(si),query:r.Object({...ge,includeMemberCount:r.Optional(r.Boolean()),...Rx.properties,sortBy:r.Optional(FF),sortDirection:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending."}))})}),rNe=d({tags:["teams"],url:`${En}/:id`,method:"GET",params:r.Object({id:u()}),response:si}),nNe=d({tags:["teams"],url:`${En}/:id/members`,method:"GET",params:r.Object({id:u()}),response:r.Array(BF)}),oNe=d({tags:["teams"],url:`${En}/: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()})}),iNe=d({tags:["teams"],url:En,method:"POST",body:Wp,response:si}),aNe=d({tags:["teams"],url:`${En}/:id`,method:"PUT",params:r.Object({id:u()}),body:Wp,response:si}),HF=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(Rx)})]),sNe=d({tags:["teams"],url:`${En}/bulk-update`,method:"POST",body:r.Object({selection:HF,config:r.Object({visibility:r.Enum(Qp)})}),response:r.Object({})}),cNe=d({tags:["teams"],url:`${En}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N});var KF=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(pd)}),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(KF)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var At="/v0/monitors",ci=["alert","resolve","keep_last_status","consider_zero"],pi=["alert","resolve","keep_last_status"];var Px=["no_aggregation","all","any","each","proportion"],Ux=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var VF=r.Object({formula:r.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(Ux,{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."})}),QF=r.Object({formula:u({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(Ux,{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."})}),WF=5,ud=r.Array(VF,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),ld=r.Array(QF,{minItems:1,maxItems:WF,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),md=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`."}),dd=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 Zp={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(Px,{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`."}))},Xp={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(Px,{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`."}))},fd={...Zp,timeframe:r.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},gd={...Xp,timeframe:r.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},wx=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:ud,noDataBehavior:r.Enum(ci,{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."}),...Zp,queries:$r},{$id:"MonitorConfigurationMetric"}),vx=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:ld,noDataBehavior:r.Enum(ci,{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."}),...Xp,queries:yn},{$id:"InputMonitorConfigurationMetric"}),Nx=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:ud,noDataBehavior:r.Enum(ci,{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."}),...Zp,queries:$r},{$id:"MonitorConfigurationLog"}),Lx=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:ld,noDataBehavior:r.Enum(ci,{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."}),...Xp,queries:yn},{$id:"InputMonitorConfigurationLog"}),kx=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:ud,noDataBehavior:r.Enum(ci,{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."}),...Zp,queries:$r},{$id:"MonitorConfigurationTrace"}),ZF=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:ld,noDataBehavior:r.Enum(ci,{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."}),...Xp,queries:yn},{$id:"InputMonitorConfigurationTrace"}),Mx=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:md,noDataBehavior:r.Enum(pi,{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."}),...fd,queries:$r},{$id:"MonitorConfigurationAnomalyLog"}),Dx=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:dd,noDataBehavior:r.Enum(pi,{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."}),...gd,queries:yn},{$id:"InputMonitorConfigurationAnomalyLog"}),Gx=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:md,noDataBehavior:r.Enum(pi,{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."}),...fd,queries:$r},{$id:"MonitorConfigurationAnomalyMetric"}),$x=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:dd,noDataBehavior:r.Enum(pi,{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."}),...gd,queries:yn},{$id:"InputMonitorConfigurationAnomalyMetric"}),jx=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:md,noDataBehavior:r.Enum(pi,{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."}),...fd,queries:$r},{$id:"MonitorConfigurationAnomalyTrace"}),XF=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:dd,noDataBehavior:r.Enum(pi,{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."}),...gd,queries:yn},{$id:"InputMonitorConfigurationAnomalyTrace"}),qx=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"}),JF=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"}),eB=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"}),tB=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"}),rB=C("type",[wx,Nx,kx,Mx,Gx,eB,jx,qx],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),nB=C("type",[vx,Lx,ZF,Dx,$x,XF,tB,JF],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var RNe=[ai,ao,ao.replace(`${$}.`,"")];var qr=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:rB,priority:r.Enum(St,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:hn,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"}),oB=C("type",[wx,Nx,kx,Mx,Gx,jx,qx]),CNe=r.Object({...qr.properties,configuration:oB},{title:"Monitor"}),PNe=r.Object({...qr.properties,configuration:C("type",[vx,Lx,Dx,$x])},{title:"Monitor"}),Xa=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:nB,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:hn,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."}))}),Cx=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],_n={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var hd=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(Cx),{description:"Restrict results to monitors with these types",maxItems:Cx.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"}),yd=r.Partial(r.Object({...ge,filters:r.Partial(hd),sort:r.Object({by:r.Enum([_n.PRIORITY,_n.TYPE,_n.NAME,_n.OWNER,_n.TAGS,_n.CLUSTER_IDS,_n.PAUSE_UNTIL,_n.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."})})),UNe=d({tags:["monitors"],url:`${At}/query`,method:"POST",paginated:!0,response:r.Array(qr),body:yd}),wNe=d({tags:["monitors"],url:`${At}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(hd,["tags"])))}),response:Ft}),vNe=d({tags:["monitors"],url:`${At}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(hd,["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."})})}),NNe=d({tags:["monitors"],url:`${At}/:id`,method:"GET",params:r.Object({id:u()}),response:qr}),LNe=d({tags:["monitors"],url:At,method:"POST",body:Xa,response:qr}),kNe=d({tags:["monitors"],url:`${At}/:id`,method:"PUT",params:r.Object({id:u()}),body:Xa,response:qr}),MNe=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({})}),DNe=d({tags:["monitors"],url:`${At}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),GNe=d({tags:["monitors"],url:`${At}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),$Ne=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:qr}),jNe=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({})}),iB=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],aB=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],sB=[...iB,...aB],so=r.Enum(sB),cB=C("type",[r.Object({type:r.Literal("each"),subStates:r.Record(r.String(),r.Object({stateValue:r.Union([so,r.Null()]),lastChangedAt:A()}))}),r.Object({type:r.Literal("no_aggregation"),stateValue:r.Optional(so)}),r.Object({type:r.Literal("any"),stateValue:r.Optional(so)}),r.Object({type:r.Literal("all"),stateValue:r.Optional(so)}),r.Object({type:r.Literal("proportion"),stateValue:r.Optional(so)})]),pB=r.Object({monitorId:r.String(),currentState:cB,lastChangedAt:r.Optional(A())}),qNe=d({tags:["monitors"],url:`${At}/states/:id`,method:"GET",params:r.Object({id:u()}),response:pB}),FNe=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(so),toState:r.Optional(so),dimension:r.Optional(r.String())}))}),uB=["unprocessed","processed","failed-to-process"],BNe=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(),Va),results:r.Array(r.Union([r.Number(),r.Null()])),conditionMet:r.Enum(["true","false","nan-no-data"])}))}),createdAt:A(),status:r.Enum(uB)}))})});var Fr="/v0/slos",lB=[7,30,90],mB=["good","bad"],Kx=r.Enum(mB,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),dB=["good","bad","ignore"],zx=r.Enum(dB,{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)"}),Fx=30,Bx=1440,Yx=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],fB=["healthy","breached","no_data"],Jp=r.Enum(fB,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),Hx={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:Jp},gB=r.Object({overall:r.Object(Hx,{description:"Latest overall evaluation for the cluster"}),perGroup:r.Array(r.Object({groupKey:r.Record(r.String(),Va,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...Hx}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),Vx=r.Record(r.String(),gB,{description:"Latest evaluation results keyed by cluster ID."}),Td=r.Object({queries:$r,formula:qp},{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."}),Ed=r.Object({queries:ZO,formula:io},{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."}),hB=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"}),yB=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 TB=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"}),EB=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"}),_B=C("type",[hB,TB],{description:"Alert trigger configuration: burn-rate or threshold"}),Qx=C("type",[yB,EB],{description:"Alert trigger configuration: burn-rate or threshold"}),_d=r.Enum(St,{description:"Alert priority (1 is highest, 5 is lowest)"}),Id=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:_d,configuration:_B,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"}),IB=r.Object({priority:_d,configuration:Qx}),bB=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:_d,configuration:Qx}),SB=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:or,goodQuery:Td,totalQuery:Td,groupByFields:r.Optional(ii),noDataBehavior:Kx},{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:or,query:Td,sliceSizeMinutes:r.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:r.Object({operator:r.Enum(Yx,{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(ii),noDataBehavior:zx},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."});var AB=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:or,goodQuery:Ed,totalQuery:Ed,groupByFields:r.Optional(jr),noDataBehavior:Kx},{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:or,query:Ed,sliceSizeMinutes:r.Integer({minimum:Fx,maximum:Bx,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${Fx} through ${Bx}.`}),threshold:r.Object({operator:r.Enum(Yx,{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(jr),noDataBehavior:zx},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),OB=r.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),Wx=r.Enum(lB,{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."}),RB=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."}),ui=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:SB,target:r.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:Wx,owner:r.String({description:"Team ID that owns the SLO"}),permissions:hn,clusterIds:xB,creator:r.Optional(pe),updater:r.Optional(pe),alerts:r.Array(Id,{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"}),CB=r.Object({...ui.properties,results:Vx},{title:"SloWithResults"}),eu=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:AB,target:OB,timeframeDays:Wx,owner:u({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:hn,clusterIds:r.Optional(RB),alerts:r.Array(IB,{description:"Alerts to create on this SLO. Send an empty array for none."})}),bd=r.Object({...r.Omit(eu,["alerts"]).properties,alerts:r.Array(bB,{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."})}),Zx=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(Jp,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),Xx=r.Partial(Zx),Sd=r.Partial(r.Object({...ge,filters:Xx,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"})})),pLe=d({tags:["slos"],url:`${Fr}/query`,method:"POST",paginated:!0,response:r.Array(CB),body:Sd}),uLe=d({tags:["slos"],url:`${Fr}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(Zx,["tags","statuses"])))}),response:Ft}),lLe=d({tags:["slos"],url:`${Fr}/:id`,method:"GET",params:r.Object({id:u()}),response:ui}),mLe=d({tags:["slos"],url:`${Fr}/:id/results`,method:"GET",params:r.Object({id:u()}),response:Vx}),dLe=d({tags:["slos"],url:Fr,method:"POST",body:eu,response:ui}),fLe=d({tags:["slos"],url:`${Fr}/:id`,method:"PUT",params:r.Object({id:u()}),body:bd,response:ui}),gLe=d({tags:["slos"],url:`${Fr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),Jx=r.Object({type:r.Literal("all"),filters:r.Optional(Xx)}),PB=C("type",[r.Object({type:r.Literal("ids"),ids:r.Array(u({allowEmpty:!1}),{minItems:1})}),Jx]),hLe=d({tags:["slos"],url:`${Fr}/bulk-delete`,method:"DELETE",body:r.Object({selection:PB}),response:r.Object({})}),UB=C("type",[r.Object({type:r.Literal("ids"),ids:r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:100})}),Jx]),yLe=d({tags:["slos"],url:`${Fr}/bulk-update`,method:"PUT",body:r.Object({selection:UB,owner:u({allowEmpty:!1})}),response:r.Object({})});var li="/v0/notifications",In=`${li}/rules`,eR=`${li}/slack/setup`,Ja=`${li}/integrations`,co=["triggered","resolved","no-data"],wB=["sent","stale","pending","rate-limited","failed","silenced"],vB=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."})),Ad=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."}),NB=r.Optional(Ad),br=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."})),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({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."})),es=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:vB,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:br},{$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:br},{$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:br},{$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:br},{$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:br},{$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:br},{$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:br},{$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:br},{$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:br},{$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:br},{$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`."})}),mi=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:NB,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:Sr},{$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:Sr},{$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:Sr},{$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:Sr},{$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:Sr},{$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:Sr},{$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:Sr},{$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:Sr},{$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:Sr},{$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:Sr},{$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)."})}),Od=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."}),xd=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."}),di=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:Od,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(co),{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(es,{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)}),ts=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:xd,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(co),{maxItems:co.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(mi,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),tu=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:es,creator:r.Optional(pe),updater:r.Optional(pe)}),tR=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:mi}),xLe=d({tags:["notification-rules"],url:In,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(di)}),RLe=d({tags:["notification-rules"],url:`${In}/:id`,params:r.Object({id:u()}),method:"GET",response:di}),CLe=d({tags:["notification-rules"],url:In,method:"POST",body:ts,response:di}),PLe=d({tags:["notification-rules"],url:`${In}/:id`,method:"PUT",params:r.Object({id:u()}),body:ts,response:di}),ULe=d({tags:["notification-rules"],url:`${In}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),wLe=d({tags:["notification-rules"],url:`${In}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),fi=`${li}/adaptive-rules`,vLe=d({tags:["notification-rules"],url:fi,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(tu)}),NLe=d({tags:["notification-rules"],url:`${fi}/:id`,params:r.Object({id:u()}),method:"GET",response:tu}),LLe=d({tags:["notification-rules"],url:fi,method:"POST",body:tR,response:tu}),kLe=d({tags:["notification-rules"],url:`${fi}/:id`,method:"PUT",params:r.Object({id:u()}),body:tR,response:tu}),MLe=d({tags:["notification-rules"],url:`${fi}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),DLe=d({tags:["notification-rules"],url:`${fi}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),GLe=d({tags:["notification-integrations"],url:`${eR}/start`,method:"POST",response:r.Object({redirectUrl:r.String()})}),LB=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],kB=r.Object({id:r.String(),name:r.String(),type:r.Enum(LB),createdAt:A(),ruleCount:r.Number(),creator:r.Optional(pe)}),$Le=d({tags:["notification-integrations"],url:`${In}/integrations`,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(kB)}),jLe=d({tags:["notification-integrations"],url:`${eR}/callback`,method:"GET",query:r.Object({code:u()}),response:r.Object({success:r.Boolean()})}),Rd=["POST","PUT"],MB=r.Record(r.String(),r.String()),DB=r.Record(r.String(),r.Unknown()),GB=r.Record(r.String(),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))])),$B=C("type",[r.Object({type:r.Literal("json"),value:DB}),r.Object({type:r.Literal("form"),value:GB})]),jB=r.Object({ok:r.String(),alert:r.String()}),Cd=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(Rd),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(MB),payloadTemplate:$B,eventNameMapping:r.Optional(jB)}),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}),qB=r.Object({type:r.Literal("webhook"),url:u({type:"uri"}),method:r.Enum(Rd),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})}))}),rR=r.Object({type:r.Literal("incident-io"),alertSourceConfigId:u(),token:u()}),nR=r.Object({type:r.Literal("grafana-irm"),url:u({type:"uri"})}),oR=r.Object({type:r.Literal("pagerduty"),integrationKey:u()}),iR=r.Object({type:r.Literal("microsoft-teams"),webhookUrl:u({type:"uri"})}),FB=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})}),BB=r.Object({type:r.Literal("google-chat"),webhookUrl:u({type:"uri"})}),HB=r.Object({type:r.Literal("squadcast"),webhookUrl:u({type:"uri"})}),KB=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."})}),zB=r.Object({name:u(),setting:C("type",[rR,nR,oR,iR,qB,FB,BB,HB,KB]),tags:Xe}),YB=r.Object({type:r.Literal("webhook"),url:r.Optional(u({type:"uri"})),method:r.Optional(r.Enum(Rd)),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}))}))}),VB=r.Object({type:r.Literal("servicenow"),instanceName:r.Optional(u({allowEmpty:!1})),username:r.Optional(u({allowEmpty:!1})),password:r.Optional(u({allowEmpty:!1}))}),QB=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}))}),WB=r.Object({type:r.Literal("google-chat"),webhookUrl:u({type:"uri"})}),ZB=r.Object({type:r.Literal("squadcast"),webhookUrl:u({type:"uri"})}),XB=r.Object({name:r.Optional(u()),setting:r.Optional(C("type",[rR,nR,oR,iR,YB,VB,WB,ZB,QB]))}),qLe=d({tags:["notification-integrations"],url:Ja,method:"POST",body:zB,response:Cd}),FLe=d({tags:["notification-integrations"],url:`${Ja}/:id`,method:"GET",params:r.Object({id:u()}),response:Cd}),BLe=d({tags:["notification-integrations"],url:`${Ja}/:id`,method:"PUT",params:r.Object({id:u()}),body:XB,response:Cd}),HLe=d({tags:["notification-integrations"],url:`${Ja}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),JB=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."}),KLe=d({tags:["notification-integrations"],url:`${Ja}/:id/jira-metadata`,method:"GET",params:r.Object({id:u()}),response:JB}),zLe=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(wB),tryCount:r.Number(),nextTryAt:A(),createdAt:A(),updatedAt:A(),sentAt:r.Optional(A())})),isTruncated:r.Boolean()})}),eH=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],YLe=d({tags:["notification-rules"],url:`${In}/test`,method:"POST",body:r.Object({notificationRule:ts,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(eH,{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 tH=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."}),rH=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."}),nH=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."}),oH=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."}),iH=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."}),aR=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."}),aH=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."}),sH=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."}),cH=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."}),gi=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:es.properties.config,rateLimit:es.properties.rateLimit,createdAt:A({description:"Timestamp when user created this service target."}),updatedAt:A({description:"Timestamp when user last updated this service target."})}),Pd=r.Object({config:mi.properties.config,rateLimit:mi.properties.rateLimit}),Ud=r.Object({config:mi.properties.config,rateLimit:r.Union([Ad,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."})}),rs=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(tH,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:r.Array(rH,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:r.Array(nH,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:r.Array(oH,{description:"Programming languages observed for this service."}),runtimes:r.Array(iH,{description:"Runtime values observed for this service."}),serverProtocols:r.Array(aR,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:r.Array(aR,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:r.Array(aH,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:r.Array(sH,{description:"Cloud platforms this service is running on"}),cloudProviders:r.Array(cH,{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(gi,{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."})}),oke=d({tags:["service-catalog"],query:r.Object({...ge,clusterId:r.Optional(u())}),method:"GET",paginated:!0,url:`${Dt}/services`,response:r.Array(rs)}),pH=r.Object({spanKind:r.Enum(rx),count:r.Number()}),wd=r.Object({...rs.properties,spanKindCounts:r.Array(pH),envs:r.Object({primaryEnv:r.String(),allEnvs:r.Array(r.String())})}),ike=d({tags:["service-catalog"],query:r.Object({...ge,clusterId:r.Optional(u()),env:r.Optional(u())}),method:"GET",paginated:!0,url:`${Dt}/v2/services`,response:r.Array(wd)}),uH=["serviceName","envs","lastDeploy","traceErrorRate","traceRequestRate","logErrorRate","logRequestRate","teams","api","frameworks","languages","pagingDestination"],lH=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"})}),mH=r.Partial(r.Object({...ge,clusterId:u(),filters:r.Partial(lH,{description:"Optional filters applied to narrow the returned services"}),sort:r.Object({by:r.Enum(uH,{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"})})),ake=d({tags:["service-catalog"],url:`${Dt}/v2/services/query`,method:"POST",paginated:!0,body:mH,response:r.Array(wd)}),ske=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}),cke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId`,params:r.Object({serviceId:u()}),response:rs}),pke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId/targets`,params:r.Object({serviceId:u()}),response:r.Array(gi)}),uke=d({tags:["service-catalog"],method:"POST",url:`${Dt}/services/:serviceId/targets`,params:r.Object({serviceId:u()}),body:Pd,response:gi}),lke=d({tags:["service-catalog"],method:"PUT",url:`${Dt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:u(),targetId:u()}),body:Ud,response:gi}),mke=d({tags:["service-catalog"],method:"DELETE",url:`${Dt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:u(),targetId:u()}),response:N}),dH=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var sR=r.Object({id:r.String(),hostName:r.String(),env:r.Optional(r.String()),cpuUtilizationAverage:r.Number(),hostType:r.Enum(dH),teams:r.Array(r.String()),tags:r.Array(r.String()),firstSeenAt:A(),lastSeenAt:A(),clusterId:r.String()}),dke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/hosts`,response:r.Array(sR)}),fke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/hosts/:hostId`,params:r.Object({hostId:u()}),response:sR}),fH=["http","rpc","messaging","genai","object_store"],cR={name:r.String({description:"Service or inferred dependency name shown in the graph."}),env:r.Optional(r.String({description:"Environment observed from spans."}))},vd=r.Object({...cR,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."})}),pR={...cR,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"}))},Nd=r.Object({...pR,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`."})}),Ld=r.Object({...pR,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(fH,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),gH=C("nodeType",[vd,Nd,Ld]),kd=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."}),gke=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(gH),edges:r.Array(kd)})}),hH=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(Jp,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"})}))}),hke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId/related-resources`,params:r.Object({serviceId:u()}),response:hH}),yke=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 ru=`/${"v1"}/services`,Md=r.Pick(rs,["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)."}),yH={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(Md,{examples:[yH]});var uR=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:ru,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(Md)}),lR=d({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${ru}/: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:Md}),TH=r.Pick(vd,["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."}),EH=r.Pick(Ld,["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."}),_H=r.Pick(Nd,["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."}),IH=C("nodeType",[TH,_H,EH]),bH=r.Pick(kd,["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."}),SH=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."})),AH=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."})),OH=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."}),mR=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:`${ru}/: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:SH,to:AH,query:r.Optional(OH)},{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(IH,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:r.Array(bH,{description:"Directed dependency edges between graph nodes."})})}),nu=`${ru}/:serviceId/notification-targets`,ou=r.Pick(gi,["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)."}),Dd={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",...Dd};Object.assign(ou,{examples:[xH]});var iu=u({allowEmpty:!1,description:"Identifier of the service the notification target belongs to. Use the `id` returned by service list or get responses."}),xke=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:nu,method:"GET",params:r.Object({serviceId:iu}),response:r.Array(ou)}),RH=r.Pick(Pd,["config","rateLimit"],{description:"Service notification target create request. Provide the delivery destination and an optional per-target rate limit.",examples:[Dd]}),CH=r.Pick(Ud,["config","rateLimit"],{description:"Service notification target update request. The submitted destination and rate limit overwrite the stored ones.",examples:[Dd]}),Rke=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:nu,method:"POST",params:r.Object({serviceId:iu}),body:RH,response:ou}),Cke=d({description:"Updates one notification target attached to a service.",operationId:"updateServiceNotificationTarget",tags:["services"],url:`${nu}/:targetId`,method:"PUT",params:r.Object({serviceId:iu,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:CH,response:ou}),Pke=d({description:"Detaches a notification target from a service. Notification rules stop paging this destination for the service.",operationId:"deleteServiceNotificationTarget",tags:["services"],url:`${nu}/:targetId`,method:"DELETE",params:r.Object({serviceId:iu,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 dR(e,t){let n=t??Gr(e);return n===void 0?void 0:hc(n)}function Gd(e){let t=Gr(e);return t===void 0?"":` (default: ${t})`}function fR(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}${Gd("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Gd("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${Gd("query")}`).action(async(o,i)=>{let a={},c=dR("from",i.from),l=dR("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()(mR,{params:{serviceId:o},query:a});J(m)})}var PH=`/${"v1"}/grok`,UH=25,wH=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:UH,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:wH,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."}),vH={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:[vH]});var hR=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."}),NH={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(hR,{examples:[NH]});var yR=d({url:`${PH}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:gR,response:hR,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 TR=tn(require("node:fs"));function hi(e){if(e.file){let t=TR.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 $d(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 ir(e){return s.IsObject(e)&&!s.IsArray(e)}function au(e){return s.IsBoolean(e)}function q(e){return ir(e)||au(e)}function jd(e){return s.HasPropertyKey(e,"additionalItems")&&q(e.additionalItems)}function Br(e){return s.HasPropertyKey(e,"additionalProperties")&&q(e.additionalProperties)}function qd(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(t=>q(t))}function ns(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function Fd(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>q(t))}function Bd(e){return s.HasPropertyKey(e,"const")}function po(e){return s.HasPropertyKey(e,"contains")&&q(e.contains)}function Ht(e){return s.HasPropertyKey(e,"default")}function Hd(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 Kd(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 zd(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>q(t))}function bn(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function Yd(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function Vd(e){return s.HasPropertyKey(e,"else")&&q(e.else)}function Qd(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function Wd(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function Hr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function os(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Kr(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function Zd(e){return s.HasPropertyKey(e,"if")&&q(e.if)}function yi(e){return s.HasPropertyKey(e,"items")&&(q(e.items)||s.IsArray(e.items)&&e.items.every(t=>q(t)))}function Xd(e){return yi(e)&&s.IsArray(e.items)}function Jd(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function ef(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function su(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function tf(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function rf(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function zr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function uo(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function Ti(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function is(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function as(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function nf(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function of(e){return s.HasPropertyKey(e,"not")&&q(e.not)}function af(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>q(t))}function ss(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function cs(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>q(t))}function Ei(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>q(t))}function ps(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>q(t))}function sf(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||q(e.propertyNames))}function LH(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function cu(e){return LH(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function cf(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function pf(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function lo(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function uf(e){return s.HasPropertyKey(e,"then")&&q(e.then)}function lf(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function _i(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function pu(e){return s.HasPropertyKey(e,"unevaluatedItems")&&q(e.unevaluatedItems)}function uu(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}},us=class extends xt{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}},st=class extends us{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}};function ER(e,t,n,o){return s.Every(n["~refine"],0,(i,a)=>i.check(o))}function _R(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 IR(e){return yi(e)&&s.IsArray(e.items)}function bR(e,t,n,o){return IR(n)?s.Every(o,0,(a,c)=>s.IsLessThan(c,n.items.length)||Kt(e,t,n.additionalItems,a)&&t.AddIndex(c)):!0}function SR(e,t,n,o,i,a){return IR(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 kH(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function AR(e){let t=[];return cs(e)&&t.push(...s.Keys(e.patternProperties)),ps(e)&&t.push(...s.Keys(e.properties).map(kH)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function OR(e,t,n,o){let i=new RegExp(AR(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||Kt(e,t,n.additionalProperties,o[c])&&t.AddKey(c))}function xR(e,t,n,o,i,a){let c=new RegExp(AR(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 RR(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 CR(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 PR(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 UR(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 df(e,t,n,o){return n}function wR(e,t,n,o,i,a){return df(e,t,i,a)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function ff(e,t,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function vR(e,t,n,o,i,a){return ff(e,t,i,a)||t.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function MH(e){return!(uo(e)&&s.IsEqual(e.minContains,0))}function gf(e,t,n,o){return MH(n)?!s.IsEqual(o.length,0)&&s.SomeAll(o,(i,a)=>ne(e,t,n.contains,i)&&t.AddIndex(a)):!0}function NR(e,t,n,o,i,a){return gf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function LR(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 kR(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 MR(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 DR(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 GR(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 $R(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 jR(e,t,n,o){let i=e.DynamicRef(n)??!1;return q(i)&&ne(e,t,i,o)}function qR(e,t,n,o,i,a){let c=e.DynamicRef(i)??!1;return q(c)&&Ie(e,t,"#",o,c,a)}function Tf(e,t,n,o){return s.Some(n.enum,i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function FR(e,t,n,o,i,a){return Tf(e,t,i,a)||t.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function Ef(e,t,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function BR(e,t,n,o,i,a){return Ef(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 HR(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 Ai={};Yt(Ai,{Clear:()=>tC,Entries:()=>I2,Get:()=>A2,Has:()=>S2,IsDate:()=>bi,IsDateTime:()=>lu,IsDuration:()=>mu,IsEmail:()=>du,IsHostname:()=>gu,IsIPv4:()=>Tu,IsIPv6:()=>Eu,IsIdnEmail:()=>hu,IsIdnHostname:()=>yu,IsIri:()=>Iu,IsIriReference:()=>_u,IsJsonPointer:()=>Su,IsJsonPointerUriFragment:()=>bu,IsRegex:()=>Au,IsRelativeJsonPointer:()=>Ou,IsTime:()=>Si,IsUri:()=>Pu,IsUriReference:()=>xu,IsUriTemplate:()=>Ru,IsUrl:()=>Uu,IsUuid:()=>wu,Reset:()=>rC,Set:()=>b2,Test:()=>O2});var DH=[0,31,28,31,30,31,30,31,31,30,31,30,31],GH=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function $H(e){return e%4===0&&(e%100!==0||e%400===0)}function bi(e){let t=GH.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&&$H(n)?29:DH[o])}var jH=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Si(e,t=!0){let n=jH.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 lu(e,t=!0){let n=e.split(/T/i);return n.length===2&&bi(n[0])&&Si(n[1],t)}var qH=/^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 mu(e){return qH.test(e)}var FH=/^(?!.*\.\.)[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 du(e){return FH.test(e)}var mo=36,fu=1,If=26,BH=38,HH=700,KH=72,zH=128;function YH(e,t,n){e=n?Math.floor(e/HH):e>>1,e+=Math.floor(e/t);let o=0;for(;e>(mo-fu)*If>>1;)e=Math.floor(e/(mo-fu)),o+=mo;return o+Math.floor((mo-fu+1)*e/(e+BH))}function KR(e){let t=[],n=zH,o=0,i=KH,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=mo;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)fe();else throw new Error("Invalid punycode: bad digit character");o+=I*m;let g=f<=i?fu:f>=i+If?If:f-i;if(I<g)break;m*=mo-g,f+=mo}let h=t.length+1;i=YH(o-l,h,l===0),n+=Math.floor(o/h),o%=h,t.splice(o,0,n),o++}return globalThis.String.fromCodePoint(...t)}function QH(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function WH(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function ZH(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function XH(e){return QH(e)||WH(e)||ZH(e)}var JH=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),e2=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 t2(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function r2(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function n2(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function o2(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function i2(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function a2(e){return e>=1632&&e<=1641}function s2(e){return e>=1776&&e<=1785}function zR(e){return e2.has(e)}function YR(e){if(e.length===0)return fe();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||XH(t[0]))return!1;let o=!1,i=!1,a=!1;for(let c=0;c<n;c++){let l=t[c];if(JH.has(l))return!1;(n2(l)||o2(l)||i2(l))&&(o=!0),a2(l)&&(i=!0),s2(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||!t2(f))return!1;break;case 1523:case 1524:if(m===void 0||!r2(m))return!1;break;case 8204:if(m===void 0||m<128&&!zR(m))return!1;break;case 8205:if(m===void 0||!zR(m))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o||i&&a)}function c2(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 VR(e){return e.toLowerCase().startsWith("xn--")}function QR(e){try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let o=KR(t);return o?YR(o):!1}catch{return!1}}function WR(e){return e.length===0||e.length>63?!1:VR(e)?QR(e):YR(e)}function ZR(e){return e.length===0||e.length>63?!1:VR(e)?QR(e):c2(e)}function gu(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(let t of e.split("."))if(!ZR(t))return!1;return!0}var u2=/^(?!.*\.\.)[\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 hu(e){return u2.test(e)}function yu(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(!WR(n))return!1;return!0}function bf(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 Tu(e){return bf(e,0,e.length)}function l2(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Eu(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&&l2(e.charCodeAt(i));)i++,a++;if(a===0)return!1;let l=e.charCodeAt(i);if(l===46){if(!bf(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 XR(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function _u(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))?XR(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:XR(e)}function Iu(e){try{return new URL(e),!0}catch{return!1}}var m2=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function bu(e){return m2.test(e)}var d2=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function Su(e){return d2.test(e)}function Au(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var f2=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Ou(e){return f2.test(e)}var g2=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function xu(e){return g2.test(e)}var h2=/^(?:(?:[^\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 Ru(e){return h2.test(e)}function JR(e){return e>=97&&e<=122||e>=65&&e<=90}function eC(e){return JR(e)||e>=48&&e<=57}function Cu(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function y2(e){return eC(e)||e===43||e===45||e===46}function Sf(e){return eC(e)||e===45||e===46||e===95||e===126}function Af(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 T2(e){return Sf(e)||Af(e)||e===58||e===64}function Pu(e){let t=e.length;if(t===0||!JR(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){let o=e.charCodeAt(n);if(o===58)break;if(!y2(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||!Cu(e.charCodeAt(a+1))||!Cu(e.charCodeAt(a+2)))return!1;a+=2}else if(!Sf(c)&&!Af(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&&!Sf(a)&&!Af(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||!Cu(e.charCodeAt(n+1))||!Cu(e.charCodeAt(n+2)))return!1;n+=2}else{if(o>127)return!1;if(!(T2(o)||o===47||o===63||o===35))return!1}n++}return!0}var E2=/^(?: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 Uu(e){return E2.test(e)}var _2=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function wu(e){return _2.test(e)}var Oe=new Map;function tC(){Oe.clear()}function I2(){return[...Oe.entries()]}function b2(e,t){Oe.set(e,t)}function S2(e){return Oe.has(e)}function A2(e){return Oe.get(e)}function O2(e,t){return Oe.get(e)?.(t)??!0}function rC(){tC(),Oe.set("date-time",lu),Oe.set("date",bi),Oe.set("duration",mu),Oe.set("email",du),Oe.set("hostname",gu),Oe.set("idn-email",hu),Oe.set("idn-hostname",yu),Oe.set("ipv4",Tu),Oe.set("ipv6",Eu),Oe.set("iri-reference",_u),Oe.set("iri",Iu),Oe.set("json-pointer-uri-fragment",bu),Oe.set("json-pointer",Su),Oe.set("regex",Au),Oe.set("relative-json-pointer",Ou),Oe.set("time",Si),Oe.set("uri-reference",xu),Oe.set("uri-template",Ru),Oe.set("uri",Pu),Oe.set("url",Uu),Oe.set("uuid",wu)}rC();function Of(e,t,n,o){return Ai.Test(n.format,o)}function nC(e,t,n,o,i,a){return Of(e,t,i,a)||t.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function oC(e,t,n,o){let i=uf(n)?n.then:!0,a=Vd(n)?n.else:!0;return ne(e,t,n.if,o)?ne(e,t,i,o):ne(e,t,a,o)}function iC(e,t,n,o,i,a){let c=uf(i)?i.then:!0,l=Vd(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 R2(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 C2(e,t,n,o){let i=Ei(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>Kt(e,t,n.items,a)&&t.AddIndex(c))}function P2(e,t,n,o,i,a){let c=Ei(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 aC(e,t,n,o){return Xd(n)?x2(e,t,n,o):C2(e,t,n,o)}function sC(e,t,n,o,i,a){return Xd(i)?R2(e,t,n,o,i,a):P2(e,t,n,o,i,a)}function U2(e){return po(e)}function xf(e,t,n,o){if(!U2(n))return!0;let i=s.Counted(o,a=>ne(e,t,n.contains,a));return s.IsLessEqualThan(i,n.maxContains)}function cC(e,t,n,o,i,a){let c=uo(i)?i.minContains:1;return xf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function Rf(e,t,n,o){return s.IsLessEqualThan(o,n.maximum)}function pC(e,t,n,o,i,a){return Rf(e,t,i,a)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function Cf(e,t,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function uC(e,t,n,o,i,a){return Cf(e,t,i,a)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function Pf(e,t,n,o){return s.IsMaxLength(o,n.maxLength)}function lC(e,t,n,o,i,a){return Pf(e,t,i,a)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function Uf(e,t,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function mC(e,t,n,o,i,a){return Uf(e,t,i,a)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function w2(e){return po(e)}function wf(e,t,n,o){if(!w2(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 dC(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 vf(e,t,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function fC(e,t,n,o,i,a){return vf(e,t,i,a)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function Nf(e,t,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function gC(e,t,n,o,i,a){return Nf(e,t,i,a)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function Lf(e,t,n,o){return s.IsMinLength(o,n.minLength)}function hC(e,t,n,o,i,a){return Lf(e,t,i,a)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function kf(e,t,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function yC(e,t,n,o,i,a){return kf(e,t,i,a)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function Mf(e,t,n,o){return s.IsMultipleOf(o,n.multipleOf)}function TC(e,t,n,o,i,a){return Mf(e,t,i,a)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function Df(e,t,n,o){let i=new xt;return!ne(e,i,n.not,o)&&t.Merge([i])}function EC(e,t,n,o,i,a){return Df(e,t,i,a)||t.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function _C(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 IC(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 Gf(e,t,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(o)}function bC(e,t,n,o,i,a){return Gf(e,t,i,a)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function SC(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 AC(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 OC(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 xC(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 $f(e,t){return e.includes(t)||rt.Get().exactOptionalPropertyTypes}function jf(e,t){return s.IsUndefined(e[t])}function RC(e,t,n,o){let i=lo(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 $f(i,c)?m:jf(o,c)||m})}function CC(e,t,n,o,i,a){let c=lo(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 $f(c,m)?I():jf(a,m)||I()})}function PC(e,t,n,o){return s.Every(s.Keys(o),0,(i,a)=>ne(e,t,n.propertyNames,i))}function UC(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 wC(e,t,n,o){let i=e.RecursiveRef(n)??!1;return q(i)&&ne(e,t,i,o)}function vC(e,t,n,o,i,a){let c=e.RecursiveRef(i)??!1;return q(c)&&Ie(e,t,"#",o,c,a)}function NC(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 LC(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 kC(e,t,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function MC(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 qf(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 DC(e,t,n,o,i){return s.Some(n,a=>qf(e,t,a,o,i))}function GC(e,t,n,o){return s.IsArray(n.type)?DC(e,t,n.type,n,o):qf(e,t,n.type,n,o)}function $C(e,t,n,o,i,a){return(s.IsArray(i.type)?DC(e,t,i.type,i,a):qf(e,t,i.type,i,a))||t.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function jC(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 qC(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 FC(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 BC(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 HC(e){return!s.IsEqual(e.uniqueItems,!1)}function KC(e,t,n,o){if(!HC(n))return!0;let i=new Set(o.map(qn.Hash)).size,a=o.length;return s.IsEqual(i,a)}function zC(e,t,n,o,i,a){if(!HC(i))return!0;let c=new Set,l=a.reduce((f,h,E)=>{let I=qn.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=au(n)?df(e,t,n,o):(!lf(n)||GC(e,t,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!lo(n)||kC(e,t,n,o))&&(!Br(n)||OR(e,t,n,o))&&(!Hd(n)||LR(e,t,n,o))&&(!Kd(n)||MR(e,t,n,o))&&(!zd(n)||GR(e,t,n,o))&&(!cs(n)||SC(e,t,n,o))&&(!ps(n)||RC(e,t,n,o))&&(!sf(n)||PC(e,t,n,o))&&(!as(n)||kf(e,t,n,o))&&(!rf(n)||Uf(e,t,n,o)))&&(!s.IsArray(o)||(!jd(n)||bR(e,t,n,o))&&(!po(n)||gf(e,t,n,o))&&(!yi(n)||aC(e,t,n,o))&&(!ef(n)||xf(e,t,n,o))&&(!su(n)||Cf(e,t,n,o))&&(!uo(n)||wf(e,t,n,o))&&(!Ti(n)||Nf(e,t,n,o))&&(!Ei(n)||OC(e,t,n,o))&&(!_i(n)||KC(e,t,n,o)))&&(!s.IsString(o)||(!tf(n)||Pf(e,t,n,o))&&(!is(n)||Lf(e,t,n,o))&&(!os(n)||Of(e,t,n,o))&&(!ss(n)||Gf(e,t,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!Wd(n)||Ef(e,t,n,o))&&(!Hr(n)||_f(e,t,n,o))&&(!Jd(n)||Rf(e,t,n,o))&&(!zr(n)||vf(e,t,n,o))&&(!nf(n)||Mf(e,t,n,o)))&&(!pf(n)||NC(e,t,n,o))&&(!cf(n)||wC(e,t,n,o))&&(!Yd(n)||jR(e,t,n,o))&&(!Bd(n)||ff(e,t,n,o))&&(!Qd(n)||Tf(e,t,n,o))&&(!Zd(n)||oC(e,t,n,o))&&(!of(n)||Df(e,t,n,o))&&(!qd(n)||RR(e,t,n,o))&&(!Fd(n)||PR(e,t,n,o))&&(!af(n)||_C(e,t,n,o))&&(!pu(n)||!s.IsArray(o)||jC(e,t,n,o))&&(!uu(n)||!s.IsObject(o)||FC(e,t,n,o))&&(!$d(n)||ER(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=au(i)?wR(e,t,n,o,i,a):!!(+(!lf(i)||$C(e,t,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!lo(i)||MC(e,t,n,o,i,a))&+(!Br(i)||xR(e,t,n,o,i,a))&+(!Hd(i)||kR(e,t,n,o,i,a))&+(!Kd(i)||DR(e,t,n,o,i,a))&+(!zd(i)||$R(e,t,n,o,i,a))&+(!cs(i)||AC(e,t,n,o,i,a))&+(!ps(i)||CC(e,t,n,o,i,a))&+(!sf(i)||UC(e,t,n,o,i,a))&+(!as(i)||yC(e,t,n,o,i,a))&+(!rf(i)||mC(e,t,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!jd(i)||SR(e,t,n,o,i,a))&+(!po(i)||NR(e,t,n,o,i,a))&+(!yi(i)||sC(e,t,n,o,i,a))&+(!ef(i)||cC(e,t,n,o,i,a))&+(!su(i)||uC(e,t,n,o,i,a))&+(!uo(i)||dC(e,t,n,o,i,a))&+(!Ti(i)||gC(e,t,n,o,i,a))&+(!Ei(i)||xC(e,t,n,o,i,a))&+(!_i(i)||zC(e,t,n,o,i,a))))&+(!s.IsString(a)||!!(+(!tf(i)||lC(e,t,n,o,i,a))&+(!is(i)||hC(e,t,n,o,i,a))&+(!os(i)||nC(e,t,n,o,i,a))&+(!ss(i)||bC(e,t,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!Wd(i)||BR(e,t,n,o,i,a))&+(!Hr(i)||HR(e,t,n,o,i,a))&+(!Jd(i)||pC(e,t,n,o,i,a))&+(!zr(i)||fC(e,t,n,o,i,a))&+(!nf(i)||TC(e,t,n,o,i,a))))&+(!pf(i)||LC(e,t,n,o,i,a))&+(!cf(i)||vC(e,t,n,o,i,a))&+(!Yd(i)||qR(e,t,n,o,i,a))&+(!Bd(i)||vR(e,t,n,o,i,a))&+(!Qd(i)||FR(e,t,n,o,i,a))&+(!Zd(i)||iC(e,t,n,o,i,a))&+(!of(i)||EC(e,t,n,o,i,a))&+(!qd(i)||CR(e,t,n,o,i,a))&+(!Fd(i)||UR(e,t,n,o,i,a))&+(!af(i)||IC(e,t,n,o,i,a))&+(!pu(i)||!s.IsArray(a)||qC(e,t,n,o,i,a))&+(!uu(i)||!s.IsObject(a)||BC(e,t,n,o,i,a)))&&(!$d(i)||_R(e,t,n,o,i,a));return e.Pop(i),c}var Sn={};Yt(Sn,{DynamicRef:()=>z2,Ref:()=>Bf});var Oi={};Yt(Oi,{Delete:()=>$2,Get:()=>D2,Has:()=>M2,Indices:()=>ds,Set:()=>G2});function YC(e){if(e.length===0)throw Error("Cannot set root")}function VC(e){if(!s.IsObject(e))throw Error("Cannot set value")}function v2(e){if(s.IsUnsafePropertyKey(e))throw Error("Pointer contains unsafe property key")}function QC(e){for(let t of e)v2(t)}function N2(e){return/^(0|[1-9]\d*)$/.test(e)}function WC(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function L2(e,t){return s.IsObject(t)&&s.HasPropertyKey(t,e)}function k2(e,t){return s.IsObject(t)&&!s.IsUnsafePropertyKey(e)?t[e]:void 0}function Ff(e,t){return e.reduce((n,o)=>k2(o,n),t)}function ds(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 M2(e,t){let n=e;return ds(t).every(o=>L2(o,n)?(n=n[o],!0):!1)}function D2(e,t){let n=ds(t);return Ff(n,e)}function G2(e,t,n){let o=ds(t);YC(o),QC(o);let[i,a]=WC(o),c=Ff(i,e);return VC(c),c[a]=n,e}function $2(e,t){let n=ds(t);YC(n),QC(n);let[o,i]=WC(n),a=Ff(o,e);return VC(a),s.IsArray(a)&&N2(i)?a.splice(+i,1):delete a[i],e}function j2(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("#")?ZC(e,t,n):e}function q2(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 F2(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 ZC(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 Oi.Get(e,o)}function B2(e,t,n){if(Kr(e)){let o=j2(e,t,n);if(!s.IsUndefined(o))return o}if(ns(e)){let o=q2(e,t,n);if(!s.IsUndefined(o))return o}if(bn(e)){let o=F2(e,t,n);if(!s.IsUndefined(o))return o}return ZC(e,t,n)}function H2(e,t,n){return e.reduce((o,i)=>{let a=Hf(i,t,n);return s.IsUndefined(a)?o:a},void 0)}function K2(e,t,n){return s.Keys(e).reduce((o,i)=>{let a=Hf(e[i],t,n);return s.IsUndefined(a)?o:a},void 0)}function Hf(e,t,n){let o=ir(e)&&Kr(e)?new URL(e.$id,t.href):t;if(ir(e)){let i=B2(e,o,n);if(!s.IsUndefined(i))return i}if(s.IsArray(e))return H2(e,o,n);if(s.IsObject(e))return K2(e,o,n)}function Bf(e,t){let n=new URL("http://unknown/"),o=Kr(e)?new URL(e.$id,n.href):n,i=new URL(t,o.href);return Hf(e,o,i)}function z2(e,t,n,o){let i=n.$dynamicRef.startsWith("#")?Bf(t,n.$dynamicRef):Bf(e,n.$dynamicRef);return s.IsUndefined(i)?void 0:!ir(i)||!bn(i)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?i:o.find(l=>l.$dynamicAnchor===i.$dynamicAnchor)??i}var xi=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)},An,XC,JC,eP,tP,fo=class{constructor(t,n){An.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){ir(t)&&(Kr(t)&&(this.ids.push(t),xi(this,An,"m",XC).call(this,t)),ns(t)&&this.anchors.push(t),cu(t)&&this.recursiveAnchors.push(t),bn(t)&&this.dynamicAnchors.push(t))}Pop(t){ir(t)&&(Kr(t)&&(this.ids.pop(),xi(this,An,"m",JC).call(this,t)),ns(t)&&this.anchors.pop(),cu(t)&&this.recursiveAnchors.pop(),bn(t)&&this.dynamicAnchors.pop())}Ref(t){return xi(this,An,"m",eP).call(this,t)??xi(this,An,"m",tP).call(this,t)}RecursiveRef(t){return cu(this.Base())?Sn.Ref(this.recursiveAnchors[0],t.$recursiveRef):Sn.Ref(this.Base(),t.$recursiveRef)}DynamicRef(t){let n=this.schema;return Sn.DynamicRef(n,this.Base(),t,this.dynamicAnchors)}};An=new WeakSet,XC=function e(t,n=!0){if(!ir(t))return;let o=t;if(!(!n&&Kr(o))){!n&&bn(o)&&this.dynamicAnchors.push(o);for(let i of s.Keys(o))xi(this,An,"m",e).call(this,o[i],!1)}},JC=function e(t,n=!0){if(!ir(t))return;let o=t;if(!(!n&&Kr(o))){!n&&bn(o)&&this.dynamicAnchors.pop();for(let i of s.Keys(o))xi(this,An,"m",e).call(this,o[i],!1)}},eP=function(t){return s.HasPropertyKey(this.context,t.$ref)?this.context[t.$ref]:void 0},tP=function(t){let n=this.schema;return t.$ref.startsWith("#")?Sn.Ref(this.Base(),t.$ref):Sn.Ref(n,t.$ref)};function vu(...e){let[t,n,o]=oe.Match(e,{3:(h,E,I)=>[h,E,I],2:(h,E)=>[{},h,E]}),i=rt.Get(),a=Qy(),c=[],l=new fo(t,n),m=new us(h=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...h,message:a(h)})});return[Ie(l,m,"#","",n,o),c]}function zf(...e){let[t,n,o]=oe.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),i=new fo(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 zf(t,n,o)}function On(...e){let[t,n,o]=oe.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),[i,a]=vu(t,n,o);return a}var xn=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 rP(e,t,n){return s.IsArray(n)?n.map(o=>ct(e,t.items,o)):n}function nP(e,t,n){return ct({...e,...t.$defs},nt(t.$ref),n)}function Q2(e,t){let n=s.HasPropertyKey(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},o=Qt(e,t),i=ft(o);return D(i)?Up(i,n):i}function oP(e,t,n){let o=Q2(e,t);return ct(e,o,n)}function Nu(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function iP(e,t,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=Nu(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 aP(e,t,n){if(!s.IsObject(n))return n;let o=Nu(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 sP(e,t,n){return s.HasPropertyKey(e,t.$ref)?ct(e,e[t.$ref],n):n}function cP(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 Gn(e)}function pP(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)?rP(e,t,n):Te(t)?nP(e,t,n):M(t)?oP(e,t,n):D(t)?iP(e,t,n):de(t)?aP(e,t,n):ce(t)?sP(e,t,n):Y(t)?cP(e,t,n):R(t)?pP(e,t,n):n}function W2(e,t){for(let n of Oc.Keys(e))Oc.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function Z2(e){let t={};for(let n of Oc.Keys(e))t[n]=fs(e[n]);return t}function X2(e){return Yf($A(e))}function Yf(e){return e.map(t=>fs(t))}function fs(e){let t=Z(e)?Pt(fs(e.items),Po(e)):M(e)?ut(Yf(e.allOf)):R(e)?F(X2(e.anyOf)):D(e)?k(Z2(e.properties)):de(e)?Go(pn(e),fs(Se(e))):Y(e)?ke(Yf(e.items)):e;return W2(e,t)}function Ri(e){return fs(e)}function Ar(...e){let[t,n,o]=oe.Match(e,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]}),i=rt.Get().unionPrioritySort?Ri(n):n;return ct(t,i,o)}var ie={};Yt(ie,{Fail:()=>ho,IsOk:()=>Vf,Ok:()=>L,TryArray:()=>J2,TryBigInt:()=>Qf,TryBoolean:()=>lK,TryNull:()=>hK,TryNumber:()=>_K,TryString:()=>IK,TryUndefined:()=>xK});function Vf(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function L(e){return{value:e}}function ho(){}function J2(e){return s.IsArray(e)?L(e):L([e])}function eK(e){return s.IsEqual(e,!0)?L(BigInt(1)):L(BigInt(0))}var tK=/^-?(0|[1-9]\d*)n$/,rK=/^-?(0|[1-9]\d*)\.\d+$/,nK=/^-?(0|[1-9]\d*)$/;function oK(e){return tK.test(e)}function iK(e){return rK.test(e)}function aK(e){return nK.test(e)}function sK(e){let t=e.toLowerCase();return oK(e)?L(BigInt(e.slice(0,e.length-1))):iK(e)?L(BigInt(e.split(".")[0])):aK(e)?L(BigInt(e)):s.IsEqual(t,"false")?L(BigInt(0)):s.IsEqual(t,"true")?L(BigInt(1)):void 0}function Qf(e){return s.IsBigInt(e)?L(e):s.IsBoolean(e)?eK(e):s.IsNumber(e)?L(BigInt(Math.trunc(e))):s.IsNull(e)?L(BigInt(0)):s.IsString(e)?sK(e):s.IsUndefined(e)?L(BigInt(0)):void 0}function cK(e){return s.IsEqual(e,BigInt(0))?L(!1):s.IsEqual(e,BigInt(1))?L(!0):void 0}function pK(e){return s.IsEqual(e,0)?L(!1):s.IsEqual(e,1)?L(!0):void 0}function uK(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 lK(e){return s.IsBigInt(e)?cK(e):s.IsBoolean(e)?L(e):s.IsNumber(e)?pK(e):s.IsNull(e)?L(!1):s.IsString(e)?uK(e):s.IsUndefined(e)?L(!1):void 0}function mK(e){return s.IsEqual(e,BigInt(0))?L(null):void 0}function dK(e){return s.IsEqual(e,!1)?L(null):void 0}function fK(e){return s.IsEqual(e,0)?L(null):void 0}function gK(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 hK(e){return s.IsBigInt(e)?mK(e):s.IsBoolean(e)?dK(e):s.IsNumber(e)?fK(e):s.IsNull(e)?L(null):s.IsString(e)?gK(e):s.IsUndefined(e)?L(null):void 0}var uP=BigInt(Number.MAX_SAFE_INTEGER),lP=BigInt(Number.MIN_SAFE_INTEGER);function yK(e){return e<=uP&&e>=lP?L(Number(e)):void 0}function TK(e){return L(e?1:0)}function EK(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=Qf(e);return Vf(o)?o.value<=uP&&o.value>=lP?L(Number(o.value)):void 0:void 0}function _K(e){return s.IsBigInt(e)?yK(e):s.IsBoolean(e)?TK(e):s.IsNumber(e)?L(e):s.IsNull(e)?L(0):s.IsString(e)?EK(e):s.IsUndefined(e)?L(0):void 0}function IK(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 bK(e){return s.IsEqual(e,BigInt(0))?L(void 0):void 0}function SK(e){return s.IsEqual(e,!1)?L(void 0):void 0}function AK(e){return s.IsEqual(e,0)?L(void 0):void 0}function OK(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)?bK(e):s.IsBoolean(e)?SK(e):s.IsNumber(e)?AK(e):s.IsNull(e)?L(void 0):s.IsString(e)?OK(e):s.IsUndefined(e)?L(e):void 0}function mP(e,t,n){return ie.TryArray(n).value.map(i=>je(e,t.items,i))}function dP(e,t,n){let o=ie.TryBigInt(n);return ie.IsOk(o)?o.value:n}function fP(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 hP(e,t,n){return je(e,ft(t),n)}function yP(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)?Math.trunc(o.value):n}function TP(e,t,n){let o=Qt(e,t),i=ft(o);return je(e,i,n)}function RK(e,t,n){let o=ie.TryBigInt(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function CK(e,t,n){let o=ie.TryBoolean(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function PK(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function UK(e,t,n){let o=ie.TryString(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function EP(e,t,n){return s.IsEqual(t.const,n)?n:oT(t)?RK(e,t,n):iT(t)?CK(e,t,n):Lc(t)?PK(e,t,n):kc(t)?UK(e,t,n):fe()}function _P(e,t,n){let o=ie.TryNull(n);return ie.IsOk(o)?o.value:n}function IP(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)?o.value:n}function Lu(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 gs(e,t,n){return Je(e)&&s.IsUndefined(n[t])}function wK(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)||gs(c,l,n)||(n[l]=je(e,c,n[l]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?Lu(e,o,t.additionalProperties,n):n}function bP(e,t,n){return s.IsObjectNotArray(n)?wK(e,t,n):n}function vK(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)?Lu(e,o,t.additionalProperties,n):n}function SP(e,t,n){return s.IsObjectNotArray(n)?vK(e,t,n):n}function AP(e,t,n){return s.HasPropertyKey(e,t.$ref)?je(e,e[t.$ref],n):n}function OP(e,t,n){let o=ie.TryString(n);return ie.IsOk(o)?o.value:n}function xP(e,t,n){return je(e,ft(t),n)}function RP(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 CP(e,t,n){let o=ie.TryUndefined(n);return ie.IsOk(o)?o.value:n}function PP(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 UP(e,t,n){let o=ie.TryUndefined(n);return ie.IsOk(o)?void 0:n}function je(e,t,n){return Z(t)?mP(e,t,n):vt(t)?dP(e,t,n):_t(t)?fP(e,t,n):Te(t)?gP(e,t,n):ze(t)?hP(e,t,n):ot(t)?yP(e,t,n):M(t)?TP(e,t,n):Q(t)?EP(e,t,n):gr(t)?_P(e,t,n):Ce(t)?IP(e,t,n):D(t)?bP(e,t,n):de(t)?SP(e,t,n):ce(t)?AP(e,t,n):We(t)?OP(e,t,n):Ee(t)?xP(e,t,n):Y(t)?RP(e,t,n):nr(t)?CP(e,t,n):R(t)?PP(e,t,n):kt(t)?UP(e,t,n):n}function Rn(...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 wP(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 vP(e,t,n){return pt({...e,...t.$defs},nt(t.$ref),n)}function NP(e,t){return s.IsUndefined(t)?s.IsFunction(e.default)?e.default():$e(e.default):t}function LP(e,t,n){let o=Qt(e,t),i=ft(o);return pt(e,i,n)}function kP(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)&&(Je(t.properties[i])||!s.HasPropertyKey(t.properties[i],"default"))||(n[i]=a)}if(!Br(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 MP(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(!Br(t))return n;for(let a of s.Keys(n))o.test(a)||(n[a]=pt(e,t.additionalProperties,n[a]));return n}function DP(e,t,n){return s.HasPropertyKey(e,t.$ref)?pt(e,e[t.$ref],n):n}function GP(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 $P(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)?NP(t,n):n;return Z(t)?wP(e,t,o):Te(t)?vP(e,t,o):M(t)?LP(e,t,o):D(t)?kP(e,t,o):de(t)?MP(e,t,o):ce(t)?DP(e,t,o):Y(t)?GP(e,t,o):R(t)?$P(e,t,o):o}function yo(...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 Ci(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 NK(e,t,n){return t["~codec"].decode(n)}function LK(e,t,n){return t["~codec"].encode(n)}function xe(e,t,n,o){return Fn(n)?s.IsEqual(e,"Decode")?NK(t,n,o):LK(t,n,o):o}function kK(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 MK(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 jP(e,t,n,o){return s.IsEqual(e,"Decode")?kK(e,t,n,o):MK(e,t,n,o)}function qP(e,t,n,o){return o=Pe(e,{...t,...n.$defs},nt(n.$ref),o),xe(e,t,n,o)}function FP(e){return e.reduce((t,n)=>({...t,...n}),{})}function BP(e,t){for(let n of t)if(!s.IsDeepEqual(e,n))return n;return e}function DK(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,Ar(l,$e(o)))),c=i.every(l=>s.IsObject(l))?FP(i):BP(o,i);return xe(e,t,n,c)}function GK(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,Ar(l,$e(i))));return a.every(l=>s.IsObject(l))?FP(a):BP(i,a)}function HP(e,t,n,o){return s.IsEqual(e,"Decode")?DK(e,t,n,o):GK(e,t,n,o)}function $K(e,t,n,o){if(!s.IsObjectNotArray(o))return o;for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||gs(n.properties[i],i,o)||(o[i]=Pe(e,t,n.properties[i],o[i]));return xe(e,t,n,o)}function jK(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)||gs(n.properties[a],a,i)||(i[a]=Pe(e,t,n.properties[a],i[a]));return i}function KP(e,t,n,o){return s.IsEqual(e,"Decode")?$K(e,t,n,o):jK(e,t,n,o)}function qK(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 FK(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 zP(e,t,n,o){return s.IsEqual(e,"Decode")?qK(e,t,n,o):FK(e,t,n,o)}function YP(e,t,n,o){return s.HasPropertyKey(t,n.$ref)?Pe(e,t,t[n.$ref],o):o}function VP(e,t,n,o){return s.IsEqual(e,"Decode")?xe(e,t,n,YP(e,t,n,o)):YP(e,t,n,xe(e,t,n,o))}function BK(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 HK(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 QP(e,t,n,o){return s.IsEqual(e,"Decode")?BK(e,t,n,o):HK(e,t,n,o)}function KK(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 zK(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 WP(e,t,n,o){return s.IsEqual(e,"Decode")?KK(e,t,n,o):zK(e,t,n,o)}function Pe(e,t,n,o){return Z(n)?jP(e,t,n,o):Te(n)?qP(e,t,n,o):M(n)?HP(e,t,n,o):D(n)?KP(e,t,n,o):de(n)?zP(e,t,n,o):ce(n)?VP(e,t,n,o):Y(n)?QP(e,t,n,o):R(n)?WP(e,t,n,o):xe(e,t,n,o)}var Wf=class extends xn{constructor(t,n){super("Decode",t,n)}};function YK(e,t,n){if(!he(e,t,n))throw new Wf(n,On(e,t,n));return n}function VK(e,t,n){let o=rt.Get().unionPrioritySort?Ri(t):t;return Pe("Decode",e,o,n)}var RYe=Ci([(e,t,n)=>$e(n),(e,t,n)=>yo(e,t,n),(e,t,n)=>Rn(e,t,n),(e,t,n)=>Ar(e,t,n),(e,t,n)=>YK(e,t,n),(e,t,n)=>VK(e,t,n)]);var Zf=class extends xn{constructor(t,n){super("Encode",t,n)}};function QK(e,t,n){if(!he(e,t,n))throw new Zf(n,On(e,t,n));return n}function WK(e,t,n){let o=rt.Get().unionPrioritySort?Ri(t):t;return Pe("Encode",e,o,n)}var jYe=Ci([(e,t,n)=>$e(n),(e,t,n)=>WK(e,t,n),(e,t,n)=>yo(e,t,n),(e,t,n)=>Rn(e,t,n),(e,t,n)=>Ar(e,t,n),(e,t,n)=>QK(e,t,n)]);var Zt=class extends Error{constructor(t,n){super(n),this.type=t}};function ZP(e,t){return s.IsFunction(t.default)?t.default(t):s.IsObject(t.default)?$e(t.default):t.default}function XP(e,t){if(_i(t)&&!Ht(t))throw new Zt(t,"Arrays with uniqueItems constraints must specify a default annotation");let n=Ti(t)?t.minItems:0;return Array.from({length:n},()=>qe(e,t.items))}function JP(e,t){return Hr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):zr(t)?BigInt(t.minimum):BigInt(0)}function eU(e,t){return!1}function tU(e,t){let n=qe(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function rU(e,t){return qe({...e,...t.$defs},nt(t.$ref))}function nU(e,t){return qe(e,ft(t))}function oU(e,t){let n=qe(e,t.returnType);return()=>n}function iU(e,t){return Hr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:zr(t)?t.minimum:0}function aU(e,t){let n=Qt(e,t),o=ft(n);return qe(e,o)}function sU(e,t){return t.const}function cU(e,t){throw new Zt(t,"Cannot create TNever types")}function pU(e,t){return null}function uU(e,t){return Hr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:zr(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 mU(e,t){if(as(t)&&!Ht(t))throw new Zt(t,"Record with the minProperties constraint must have a default annotation");return{}}function dU(e,t){return s.HasPropertyKey(e,t.$ref)?qe(e,e[t.$ref]):(()=>{throw new Zt(t,"Unable to deref Ref")})()}function fU(e,t){if((ss(t)||os(t))&&!Ht(t))throw Error("Strings with format or pattern constraints must specify default");let o=is(t)?t.minLength:0;return"".padEnd(o)}function gU(e,t){return Symbol()}function hU(e,t){let n=ha(t.pattern);if(We(n))throw new Zt(t,"Unable to create TemplateLiteral due to infinite type expansion");return qe(e,n)}function yU(e,t){return Array.from({length:t.minItems},(n,o)=>qe(e,t.items[o]))}function TU(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)?ZP(e,t):Z(t)?XP(e,t):vt(t)?JP(e,t):_t(t)?eU(e,t):Be(t)?tU(e,t):Te(t)?rU(e,t):ze(t)?nU(e,t):He(t)?oU(e,t):ot(t)?iU(e,t):M(t)?aU(e,t):Q(t)?sU(e,t):tr(t)?cU(e,t):gr(t)?pU(e,t):Ce(t)?uU(e,t):D(t)?lU(e,t):de(t)?mU(e,t):ce(t)?dU(e,t):We(t)?fU(e,t):hr(t)?gU(e,t):Ee(t)?hU(e,t):Y(t)?yU(e,t):nr(t)?void 0:R(t)?TU(e,t):kt(t)?void 0:void 0}function Or(...e){let[t,n]=oe.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return qe(t,n)}var Xf=class extends xn{constructor(t,n){super("Parse",t,n)}};function ZK(e,t,n){if(!he(e,t,n))throw new Xf(n,On(e,t,n));return n}var s6e=Ci([(e,t,n)=>$e(n),(e,t,n)=>yo(e,t,n),(e,t,n)=>Rn(e,t,n),(e,t,n)=>Ar(e,t,n),(e,t,n)=>ZK(e,t,n)]);var JK=k({type:z("insert"),path:It(),value:Qe()}),ez=Object({type:z("update"),path:It(),value:Qe()}),tz=k({type:z("delete"),path:It()}),f6e=F([JK,ez,tz]);function Pi(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]:Or(t)}function Qr(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){J(Pi(o));return}let c=hi(a),l=await i()(o,{body:c});J(l)})}function IU(e,t){let n=e.command("grok").description("Test and preview grok parsing rules");Qr(n,"parse","Parse sample log lines with grok rules and return the extracted fields",yR,t)}var bU=require("node:child_process"),SU=require("node:fs"),AU=require("node:os"),Du=require("node:path");var To=require("node:fs");function hs(e,t){let n=`${e}.tmp.${process.pid}`;(0,To.writeFileSync)(n,t),(0,To.renameSync)(n,e)}function ys(e){try{return(0,To.readFileSync)(e,"utf8")}catch(t){if(t.code==="ENOENT")return;throw t}}function Ts(e,t){if(t===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,To.writeFileSync)(n,t),n}function Eo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Jf="tsuga-dev/agent-plugins",ku="tsuga";function Mu(e,t){V(` $ ${e} ${t.join(" ")}`);try{(0,bU.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 oz(e,t){V("Claude Code \u2192 installing Tsuga plugin"),Mu("claude",["plugin","marketplace","add",Jf]),Mu("claude",["plugin","install",`tsuga@${ku}`]),t.autoUpdate&&iz(e)}function iz(e){let t=(0,Du.join)(e,".claude","settings.json");V(`Claude Code \u2192 ${t} (autoUpdate)`),(0,SU.mkdirSync)((0,Du.dirname)(t),{recursive:!0});let n=ys(t),o=JSON.parse(n??"{}");if(!Eo(o))throw new Error(`${t} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!Eo(i))throw new Error(`${t} "extraKnownMarketplaces" must be a JSON object`);let a=i[ku],c=Eo(a)?a:{};o.extraKnownMarketplaces={...i,[ku]:{source:{source:"github",repo:Jf},...c,autoUpdate:!0}};let l=Ts(t,n);hs(t,`${JSON.stringify(o,null,2)}
|
|
139
|
+
`),V(l===void 0?" created":` patched (backup: ${l})`)}function az(){V("Codex \u2192 installing Tsuga plugin"),Mu("codex",["plugin","marketplace","add",Jf]),Mu("codex",["plugin","add",`tsuga@${ku}`])}function OU(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=>{oz((0,AU.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(()=>{az(),V("Restart your codex session to load the new plugins.")})}var sz=10,cz=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."})}),tg=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."})}),rg=r.Object({scope:r.Array(cz,{minItems:1,maxItems:sz,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."})}),m8e=d({tags:["interesting-fields"],url:"/v0/interesting-fields",method:"POST",body:rg,response:tg});var pz=`/${"v1"}/interesting-fields`,uz={scope:[{key:"context.service.name",value:"payments"},{key:"context.env",value:"prod",valueMustMatch:!0}]},lz=r.Object(rg.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:[uz]}),xU=d({url:pz,method:"POST",operationId:"getInterestingFields",tags:["public","interesting-fields"],body:lz,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 RU(e,t){let n=e.command("interesting-fields").description("Discover the telemetry fields an org already uses for a scope");Qr(n,"list","Rank the log, trace and metric fields most relevant to a scope, mined from dashboards and monitors",xU,t)}var ar="/v0/kubernetes-explorer",mz="^[a-z0-9.-]+$",dz="^[A-Za-z0-9._-]+$",CU=256,PU=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 xr=e=>r.Optional(r.Array(u({allowEmpty:!1}),{description:e})),UU={clusterId:PU,search:r.Optional(r.String({pattern:mz,minLength:1,maxLength:CU,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."}))},wU={clusterId:PU,search:r.Optional(r.String({pattern:dz,minLength:1,maxLength:CU,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."}))},vU=r.Object(UU),NU=r.Object(wU),Es={...UU,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:xr("Restrict results to these Kubernetes cluster names."),namespaces:xr("Restrict results to these namespaces."),teams:xr("Restrict results to these team names."),envs:xr("Restrict results to these environments."),...ge},LU=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],fz={...Es,nodes:xr("Restrict results to pods scheduled on these nodes."),deployments:xr("Restrict results to pods owned by these Deployments."),statefulsets:xr("Restrict results to pods owned by these StatefulSets."),daemonsets:xr("Restrict results to pods owned by these DaemonSets."),podStatus:r.Optional(r.Array(r.Enum(LU),{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."}))},Ui=r.Enum(["asc","desc"],{description:"Sort direction. Defaults to ascending."}),gz=["deployment","statefulset","daemonset"],kU=r.Object({kind:r.Enum(gz,{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."}),MU=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(LU,{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."}))}),ng=r.Object({...MU.properties,workload:r.Optional(kU),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."}))}),hz=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],O8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/pods`,query:r.Object({...fz,sortBy:r.Optional(r.Enum(hz,{description:"Field to sort pods by."})),sortDirection:r.Optional(Ui)}),paginated:!0,response:r.Array(ng)}),og=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."}))}),yz=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],x8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/clusters`,query:r.Object({...wU,teams:xr("Restrict to clusters that host workloads from these team names."),envs:xr("Restrict to clusters that host workloads in these environments."),sortBy:r.Optional(r.Enum(yz,{description:"Field to sort clusters by."})),sortDirection:r.Optional(Ui),...ge}),paginated:!0,response:r.Array(og)}),ig=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."}))}),Tz=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],R8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/namespaces`,query:r.Object({...Es,sortBy:r.Optional(r.Enum(Tz,{description:"Field to sort namespaces by."})),sortDirection:r.Optional(Ui)}),paginated:!0,response:r.Array(ig)}),ag=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."}))}),Ez=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],C8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/deployments`,query:r.Object({...Es,sortBy:r.Optional(r.Enum(Ez,{description:"Field to sort deployments by."})),sortDirection:r.Optional(Ui)}),paginated:!0,response:r.Array(ag)}),sg=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."}))}),_z=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],P8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/statefulsets`,query:r.Object({...Es,sortBy:r.Optional(r.Enum(_z,{description:"Field to sort StatefulSets by."})),sortDirection:r.Optional(Ui)}),paginated:!0,response:r.Array(sg)}),cg=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."}))}),Iz=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],U8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/daemonsets`,query:r.Object({...Es,sortBy:r.Optional(r.Enum(Iz,{description:"Field to sort DaemonSets by."})),sortDirection:r.Optional(Ui)}),paginated:!0,response:r.Array(cg)}),pg=r.Object({overview:r.Object({...MU.properties,workload:r.Optional(kU)},{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."})}),DU=r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),podName:u({allowEmpty:!1})}),w8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/pod-details`,query:DU,response:pg}),ug=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."}))}),v8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/pod-manifest`,query:DU,response:ug}),lg=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."}),mg=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(lg,{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."})}),N8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/deployment-details`,query:r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),deploymentName:u({allowEmpty:!1})}),response:mg}),bz=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(lg,{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())}))}),L8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/statefulset-details`,query:r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),statefulSetName:u({allowEmpty:!1})}),response:bz}),Sz=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(lg,{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())}))}),k8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/daemonset-details`,query:r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),daemonSetName:u({allowEmpty:!1})}),response:Sz});var Wr=`/${"v1"}/kubernetes-explorer`,GU=r.Pick(ng,["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."}),Az={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(GU,{examples:[Az]});var $U=r.Pick(og,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),Oz={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($U,{examples:[Oz]});var jU=r.Pick(ig,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),xz={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(jU,{examples:[xz]});var qU=r.Pick(ag,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),Rz={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(qU,{examples:[Rz]});var FU=r.Pick(sg,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),Cz={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(FU,{examples:[Cz]});var BU=r.Pick(cg,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),Pz={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(BU,{examples:[Pz]});var HU=r.Pick(pg,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),Uz={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(HU,{examples:[Uz]});var KU=r.Pick(ug,["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."}),wz={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(KU,{examples:[wz]});var zU=r.Pick(mg,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),vz={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(zU,{examples:[vz]});var YU=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."}))}),_s=r.Pick(vU,["clusterId","search"]),Nz=r.Pick(NU,["clusterId","search"]),VU=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:`${Wr}/pods`,query:_s,response:r.Array(GU)}),QU=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:`${Wr}/clusters`,query:Nz,response:r.Array($U)}),WU=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:`${Wr}/namespaces`,query:_s,response:r.Array(jU)}),ZU=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:`${Wr}/deployments`,query:_s,response:r.Array(qU)}),XU=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:`${Wr}/statefulsets`,query:_s,response:r.Array(FU)}),JU=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:`${Wr}/daemonsets`,query:_s,response:r.Array(BU)}),ew=r.Object({...YU.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."})}),tw=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:`${Wr}/pod-details`,query:ew,response:HU}),rw=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:`${Wr}/pod-manifest`,query:ew,response:KU}),nw=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:`${Wr}/deployment-details`,query:r.Object({...YU.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:zU});var Lz="clusterId";function ow(e,t,n){let o=t.query.properties??{},i=Object.keys(o).filter(a=>a!==Lz);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 wi(e,t,n,o){let i=e.command(t).description(n.description??`List Kubernetes ${t}`),a=ow(i,n,!1);i.action(async c=>{let l={};for(let m of a)c[m]!==void 0&&(l[m]=c[m]);J(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function dg(e,t,n,o){let i=e.command(t).description(n.description??`Get Kubernetes ${t}`),a=ow(i,n,!0);i.action(async c=>{let l={};for(let m of a)l[m]=c[m];J(await o()(n,{query:l}))})}function iw(e,t){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");wi(n,"pods",VU,t),wi(n,"clusters",QU,t),wi(n,"namespaces",WU,t),wi(n,"deployments",ZU,t),wi(n,"statefulsets",XU,t),wi(n,"daemonsets",JU,t),dg(n,"pod-details",tw,t),dg(n,"pod-manifest",rw,t),dg(n,"deployment-details",nw,t)}var kz=r.Union([r.Literal("scalar"),r.Literal("timeseries")]),Mz="/v0/promql",Gu=r.Object({query:u({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:oi,step:u({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:r.Optional(kz),executionOptions:Jm,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."}))}),Dz={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(Gu,{examples:[Dz]});var X8e=d({tags:["promql"],url:Mz,method:"POST",body:Gu,response:Dp});var aw=`/${"v1"}/aggregation`,sw=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."})}),cw=r.Object({results:r.Array(r.Object({...sw.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."}),Gz={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(cw,{examples:[Gz]});var $u=r.Object({series:r.Array(r.Object({...sw.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."}),$z={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign($u,{examples:[$z]});var jz=r.Omit(Wa.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),qz=r.Optional(jr),pw={timeRange:bt,queries:r.Array(jz,{maxItems:Qa,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 ${Qa} 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:qz,dataSource:MO,formula:r.Optional(io)},uw=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."}))}),lw=r.Object(pw,{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."}),Fz={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(lw,{examples:[Fz]});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:`${aw}/multi-query/scalar`,method:"POST",body:lw,query:uw,response:cw}),dw=r.Object({...pw,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."}),Bz={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:[Bz]});var fw=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:`${aw}/multi-query/timeseries`,method:"POST",body:dw,query:uw,response:$u});var Hz=`/${"v1"}/promql`,Kz=r.Object({...r.Pick(Gu,["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"}]}),zz=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."}))}),gw=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:Hz,method:"POST",body:Kz,query:zz,response:$u});function hw(e,t){let n=e.command("promql").description("Run PromQL queries over metric data");Qr(n,"query","Run a PromQL range query over metric data",gw,t)}var Ni="/v0/dashboard-folders",Li=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"}),fg=r.Object({...Li.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."})}),ju=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}),qu=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"})),vi={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},gg=[vi.OWNER,vi.TAGS,vi.DASHBOARD_COUNT,vi.UPDATED_AT,vi.NAME],Yz=r.Partial(r.Object({...ge,filters:qu,sort:r.Object({by:r.Enum([...gg,vi.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"})})),AWe=d({tags:["dashboard-folders"],url:`${Ni}/query`,method:"POST",paginated:!0,body:Yz,response:r.Array(fg)}),OWe=d({tags:["dashboard-folders"],url:`${Ni}/:id`,method:"GET",params:r.Object({id:u()}),response:Li}),xWe=d({tags:["dashboard-folders"],url:Ni,method:"POST",body:ju,response:Li}),RWe=d({tags:["dashboard-folders"],url:`${Ni}/:id`,method:"PUT",params:r.Object({id:u()}),body:ju,response:Li}),CWe=d({tags:["dashboard-folders"],url:`${Ni}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),PWe=d({tags:["dashboard-folders"],url:`${Ni}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(qu,["tags"]))}),response:Ft});var Is=`/${"v1"}/dashboard-folders`,Fu=r.Pick(Li,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),yw={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(Fu,{examples:[yw]});var Tw=r.Pick(fg,["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."}),Vz={...yw,dashboardCount:10};Object.assign(Tw,{examples:[Vz]});var hg=r.Pick(ju,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),Qz={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(hg,{examples:[Qz]});var Wz=r.Object({by:r.Enum(gg,{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"}),Ew=r.Object({...Ze,filters:r.Optional(r.Pick(qu,["owners","searchQuery","tags","parentFolderId"])),sort:r.Optional(Wz)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),Zz={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(Ew,{examples:[Zz]});var _w=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:`${Is}/query`,method:"POST",paginated:!0,body:Ew,response:r.Array(Tw)}),Iw=d({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${Is}/: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:Fu}),bw=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:Is,method:"POST",body:hg,response:Fu}),Sw=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:`${Is}/: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:hg,response:Fu}),Aw=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:`${Is}/: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 Rr="/v0/dashboards",xw=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],Xz=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],QWe=[...Xz,"note"];var Jz=["ns","us","ms","s","m","h","days"];var e4=["B","KB","MB","GB","TB","PB"];var t4=20;var Rw=r.Object({type:r.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),Cw=r.Object({type:r.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:r.Enum(Jz,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),Pw=r.Object({type:r.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:r.Enum(e4,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),Uw=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"}),ww=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"}),vw=r.Object({type:r.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),Nw=r.Object({type:r.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),Lw=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"}),r4=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"}),n4=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:t4})},{$id:"InputDataNormalizerCustom",title:"Custom"}),Rt=C("type",[Cw,Pw,Uw,ww,vw,Nw,Rw,Lw,r4],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Ct=C("type",[Cw,Pw,Uw,ww,vw,Nw,Rw,Lw,n4],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),yg=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."}),Tg=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."}),ki=["background","no-background"],o4=["table","legend-only","no-legend"];var i4=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],kw=["alert","warning","success"],Cr=r.Object({operator:r.Enum(i4,{description:"Comparator used to evaluate the metric value"}),value:r.Number({description:"Threshold value used when evaluating the operator"}),color:r.Enum(kw,{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."}),a4=r.Object({value:r.Number({description:"Y-axis value where the threshold marker is placed"}),level:r.Enum(kw,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),s4=["sec","min","hour","day"],Pn=r.Object({time:r.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:r.Enum(s4,{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 Cn=r.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),Mi=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."}),Di=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."}),Hu={source:or,queries:WO,formula:r.Optional(qp),aliases:r.Optional(Mi),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},Ku={source:or,queries:Wa,formula:r.Optional(io),aliases:r.Optional(Di),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},Gi={...Hu,groupBy:r.Optional(ii)},$i={...Ku,groupBy:r.Optional(jr)},Fe=r.Enum(o4,{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."})),Xt=r.Optional(r.Array(a4,{description:"Threshold markers displayed on the chart"})),c4=r.Object({name:r.String({description:"Display name of the table column"}),...Hu,source:or,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`."}),p4=r.Object({name:u({description:"Display name of the table column"}),...Ku,source:or,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`."}),u4=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."}),l4=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."}),Eg=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."}),Mw=["horizontal","vertical"],m4=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(yg,{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(Eg)},{$id:"GraphVisualizationList",title:"List"}),d4=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(Tg,{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"}),Bu=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"}),ji=r.Object({min:Bu,max:Bu,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."}),qi=r.Object({min:Bu,max:Bu,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."}),f4=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"}),g4=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 h4=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:Xt,yAxisSettings:r.Optional(ji)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),y4=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:Xt,yAxisSettings:r.Optional(qi)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),T4=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(yg,{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(Eg)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),E4=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(Tg,{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"}),_4=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"}),I4=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"}),b4=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"}),S4=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"}),A4=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:Xt,yAxisSettings:r.Optional(ji)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),O4=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:Xt,yAxisSettings:r.Optional(qi)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),x4=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(ki,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Cr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Rt),legendMode:r.Optional(Fe)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),R4=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(ki,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Cr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Ct),legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),C4=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(Mw,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),P4=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(Mw,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),U4=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(yg,{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(Eg)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),w4=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(Tg,{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"}),bs=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."}),Ss=r.Array(u({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),v4=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:bs,aliases:r.Optional(Mi),timeBucket:r.Optional(Pn),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe),thresholds:Xt,yAxisSettings:r.Optional(ji),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),N4=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:Ss,aliases:r.Optional(Di),timeBucket:r.Optional(Pn),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe),thresholds:Xt,yAxisSettings:r.Optional(qi),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),L4=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:bs,aliases:r.Optional(Mi),backgroundMode:r.Optional(r.Enum(ki,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Cr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Rt),legendMode:r.Optional(Fe)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),k4=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:Ss,aliases:r.Optional(Di),backgroundMode:r.Optional(r.Enum(ki,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Cr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Ct),legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),M4=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:bs,aliases:r.Optional(Mi),normalizer:r.Optional(Rt),precision:ye,conditions:r.Optional(r.Array(Cr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),D4=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:Ss,aliases:r.Optional(Di),normalizer:r.Optional(Ct),precision:ye,conditions:r.Optional(r.Array(Cr,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),G4=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:bs,aliases:r.Optional(Mi),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),$4=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Ss,aliases:r.Optional(Di),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),j4=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:bs,aliases:r.Optional(Mi),timeBucket:r.Optional(Pn),precision:ye,normalizer:r.Optional(Rt),thresholds:Xt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(ji)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),q4=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Ss,aliases:r.Optional(Di),timeBucket:r.Optional(Pn),precision:ye,normalizer:r.Optional(Ct),thresholds:Xt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(qi)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),F4=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...Gi,timeBucket:r.Optional(Pn),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe),thresholds:Xt,yAxisSettings:r.Optional(ji),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),B4=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...$i,timeBucket:r.Optional(Pn),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe),thresholds:Xt,yAxisSettings:r.Optional(qi),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),Dw="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.",H4=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...Gi,normalizer:r.Optional(Rt),precision:ye,conditions:r.Optional(r.Array(Cr,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:r.Optional(r.Boolean({description:Dw}))},{$id:"GraphVisualizationTopList",title:"TopList"}),K4=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...$i,normalizer:r.Optional(Ct),precision:ye,conditions:r.Optional(r.Array(Cr,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:r.Optional(r.Boolean({description:Dw}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),z4=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...Gi,normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe)},{$id:"GraphVisualizationPie",title:"Pie"}),Y4=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...$i,normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationPie",title:"Pie"}),V4=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Hu,backgroundMode:r.Optional(r.Enum(ki,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Cr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Rt),legendMode:r.Optional(Fe)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),Q4=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Ku,backgroundMode:r.Optional(r.Enum(ki,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:r.Optional(r.Array(Cr,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:r.Optional(Ct),legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),W4=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...Gi,timeBucket:r.Optional(Pn),precision:ye,normalizer:r.Optional(Rt),thresholds:Xt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(ji)},{$id:"GraphVisualizationBar",title:"Bar"}),Z4=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...$i,timeBucket:r.Optional(Pn),precision:ye,normalizer:r.Optional(Ct),thresholds:Xt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(qi)},{$id:"InputGraphVisualizationBar",title:"Bar"}),Gw='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.',$w=r.String({description:Gw}),jw=u({description:Gw}),X4=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...Gi,group:r.Optional($w),precision:ye,normalizer:r.Optional(Rt),percentileMarkers:r.Optional(f4),boundsScale:r.Optional(jp)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),J4=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...$i,group:r.Optional(jw),precision:ye,normalizer:r.Optional(Ct),percentileMarkers:r.Optional(g4),boundsScale:r.Optional(jp)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),qw=["red","pink","violet","blue","cyan","green","yellow","orange"],Fw=r.Enum(qw,{description:"Color palette used to render the heatmap intensity gradient"}),e3=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...Gi,group:r.Optional($w),precision:ye,normalizer:r.Optional(Rt),palette:r.Optional(Fw)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),t3=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...$i,group:r.Optional(jw),precision:ye,normalizer:r.Optional(Ct),palette:r.Optional(Fw)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),Bw=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(qw,{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."}),r3=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Hu,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(Bw,{description:"Color thresholds inside the gauge range"})),precision:ye,normalizer:r.Optional(Rt)},{$id:"GraphVisualizationGauge",title:"Gauge"}),n3=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Ku,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(Bw,{description:"Color thresholds inside the gauge range"})),precision:ye,normalizer:r.Optional(Ct)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),o3=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(c4,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(ii),defaultSorting:r.Optional(u4),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"}),i3=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(p4,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(jr),defaultSorting:r.Optional(l4),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"}),a3=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(xw,{description:"Background color used to render the note"})),noteAlign:r.Optional(Cn),noteJustifyContent:r.Optional(Cn)},{$id:"GraphVisualizationNote",title:"Note"}),s3=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(xw,{description:"Background color used to render the note"})),noteAlign:r.Optional(Cn),noteJustifyContent:r.Optional(Cn)},{$id:"InputGraphVisualizationNote",title:"Note"}),c3=C("type",[h4,T4,_4,b4,A4,x4,v4,L4,M4,G4,j4,F4,H4,z4,V4,r3,W4,X4,e3,o3,m4,a3,C4,U4],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),p3=C("type",[y4,E4,I4,S4,O4,R4,N4,k4,D4,$4,q4,B4,K4,Y4,Q4,n3,Z4,J4,t3,i3,d4,s3,P4,w4],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),zu=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(Cn),descriptionJustifyContent:r.Optional(Cn),visualization:c3,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 ${nd}\xD7${od} (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."}),Yu=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(Cn),descriptionJustifyContent:r.Optional(Cn),visualization:p3,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 ${nd}\xD7${od} (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."}),Ow=10,u3=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."}),l3=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:Ow,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${Ow} filters are allowed.`}),Fi=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(zu,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(u3),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(xl,{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."}))}),Vu=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(Yu,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(l3),tags:Xe,timePreset:r.Optional(r.Enum(xl,{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."}))}),sr={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},Hw=[sr.OWNER,sr.TAGS,sr.WIDGET_COUNT,sr.UPDATED_AT,sr.NAME],As=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"})),m3=r.Partial(r.Object({...ge,filters:As,sort:r.Object({by:r.Enum([sr.IS_FAVORITE,sr.OWNER,sr.TAGS,sr.WIDGET_COUNT,sr.UPDATED_AT,sr.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"})})),WWe=d({tags:["dashboards"],url:`${Rr}/query`,method:"POST",paginated:!0,response:r.Array(Fi),body:m3}),ZWe=d({tags:["dashboards"],url:`${Rr}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(As,["tags"]))}),response:Ft}),XWe=d({tags:["dashboards"],url:`${Rr}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(As))}),response:r.Object({all:r.Integer({description:"Total number of dashboards matching the filters that the user can read."})})}),JWe=d({tags:["dashboards"],url:`${Rr}/:id`,method:"GET",params:r.Object({id:u()}),response:Fi}),e7e=d({tags:["dashboards"],url:Rr,method:"POST",body:Vu,response:Fi}),t7e=d({tags:["dashboards"],url:`${Rr}/:id`,method:"PUT",params:r.Object({id:u()}),body:r.Partial(Vu),response:Fi}),r7e=d({tags:["dashboards"],url:`${Rr}/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({})}),n7e=d({tags:["dashboards"],url:`${Rr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),o7e=d({tags:["dashboards"],url:`${Rr}/:id/graphs/:graphId`,method:"PUT",params:r.Object({id:u({allowEmpty:!1}),graphId:u({allowEmpty:!1})}),body:r.Omit(Yu,["id"]),response:zu}),i7e=d({tags:["dashboards"],url:`${Rr}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})});var Bi=`/${"v1"}/dashboards`,Os=r.Pick(Fi,["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)."}),d3={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(Os,{examples:[d3]});var f3=r.Object({by:r.Enum([...Hw],{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"}),Kw=r.Object({...Ze,filters:r.Optional(r.Pick(As,["owners","searchQuery","tags","folderId"])),sort:r.Optional(f3)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),g3={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(Kw,{examples:[g3]});var zw=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:`${Bi}/query`,method:"POST",paginated:!0,body:Kw,response:r.Array(Os)}),Yw=d({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${Bi}/: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:Os}),Ig=r.Pick(Vu,["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."}),h3={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(Ig,{examples:[h3]});var y3=r.Omit(Yu,["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."}),Vw=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:Bi,method:"POST",body:Ig,response:Os}),Qw=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:`${Bi}/: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(Ig),response:Os}),T3=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."})}),Ww=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:`${Bi}/:id`,method:"DELETE",params:T3,response:N}),d7e=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:`${Bi}/: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:y3,response:zu});var Zw=100,Xw=3,Hi=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."})}),xs=r.Object({name:r.String({format:Zo,minLength:1,maxLength:Zw,description:`Kebab-case name for the ingestion API key. Maximum length is ${Zw} 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:Xw,description:`Array form. Up to ${Xw} 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."})}),Ki="/v0/ingestion-api-keys",b7e=d({tags:["ingestion-api-keys"],url:Ki,method:"POST",body:xs,response:r.Intersect([Hi,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."})})])}),S7e=d({tags:["ingestion-api-keys"],url:Ki,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(Hi)}),A7e=d({tags:["ingestion-api-keys"],url:`${Ki}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1})}),response:Hi}),O7e=d({tags:["ingestion-api-keys"],url:`${Ki}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1})}),body:xs,response:Hi}),x7e=d({tags:["ingestion-api-keys"],url:`${Ki}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1})}),response:N}),R7e=d({tags:["ingestion-api-keys"],url:`${Ki}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u({allowEmpty:!1}))}),response:r.Object({})});var Rs=`/${"v1"}/ingestion-api-keys`,Cs=r.Pick(Hi,["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)."}),Jw={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(Cs,{examples:[Jw]});var ev=r.Pick(xs,["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."}),tv=r.Pick(xs,["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."}),rv={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(ev,{examples:[rv]});Object.assign(tv,{examples:[rv]});var E3={...Jw,key:"tsuga_in:v1:abc123xyx7Qm"},nv=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:Rs,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Cs)}),k7e=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:`${Rs}/: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:Cs}),_3=r.Intersect([r.Pick(Cs,["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:E3}),ov=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:Rs,method:"POST",body:ev,response:_3}),iv=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:`${Rs}/: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:tv,response:Cs}),av=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:`${Rs}/: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 I3={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"]}},[$7e,Qu,Ps]=b3(I3),j7e=Object.fromEntries(Qu.map(e=>[e,e]));function b3(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 Sg=r.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),S3=r.Object({versioningStatus:r.Optional(r.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),A3=r.Object({domainName:r.Optional(r.String()),origins:r.Optional(r.Array(r.String()))}),O3=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())}),x3=r.Object({version:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),subnets:r.Optional(r.Array(r.String()))}),R3=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())}),C3=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()))}),P3=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())}),U3=r.Object({isEncrypted:r.Optional(r.Boolean()),ownerId:r.Optional(r.String()),state:r.Optional(r.Enum(["creating","available","deleting","deleted","error","updating"]))}),w3=r.Object({type:r.Optional(r.String()),osType:r.Optional(r.String()),subnetIds:r.Optional(r.Array(r.String())),nbContainers:r.Optional(r.Number())}),v3=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())}),N3=r.Object({url:r.Optional(r.String()),maxMessageSizeBytes:r.Optional(r.Number()),messageRetentionHours:r.Optional(r.Number())}),L3=r.Object({runtime:r.Optional(r.String()),memoryAllocationMib:r.Optional(r.Number()),timeoutMs:r.Optional(r.Number()),codeSha256:r.Optional(r.String())}),k3=r.Object({kind:r.Optional(r.String())}),M3=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())}),D3=r.Object({id:r.Optional(r.String()),ipCidrBlocks:r.Array(r.String())}),G3=r.Object({protocol:r.Optional(Sg),port:r.Optional(r.Number()),instanceProtocol:r.Optional(Sg),instancePort:r.Optional(r.Number())}),$3=r.Object({protocol:r.Optional(r.String()),ports:r.Optional(r.Array(r.String())),portRange:r.Optional(r.String()),allPorts:r.Optional(r.Boolean())}),j3=r.Object({name:r.String(),ip:r.Optional(r.String()),type:r.Enum(["public","private"])}),q3=r.Object({type:r.String(),name:r.String()}),F3=r.Object({frontendIp:r.Optional(j3),backendIpPools:r.Array(q3)}),B3=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())}),H3=r.Object({protocol:r.Optional(Sg),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(B3)),targetCount:r.Optional(r.Number()),healthyTargetCount:r.Optional(r.Number()),loadBalancerArns:r.Optional(r.Array(r.String()))}),K3=r.Object({first:r.Optional(r.String()),last:r.Optional(r.String()),scope:r.Optional(r.Number())}),z3=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(),K3]))),target:r.Optional(r.String()),weight:r.Optional(r.Number()),priority:r.Optional(r.Number()),status:r.Optional(r.String())}),Y3=r.Object({instanceId:r.Optional(r.String()),state:r.Optional(r.String()),reasonCode:r.Optional(r.String()),description:r.Optional(r.String())}),V3=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(G3),r.Array($3)])),targets:r.Optional(r.Union([r.Array(r.String()),r.Array(Y3),r.Array(z3)])),azureLoadBalancingRules:r.Optional(r.Array(F3))}),Q3=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())}),W3=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"]))}),Z3=r.Object({osType:r.Optional(r.Enum(["Windows","Linux"]))}),X3=r.Object({state:r.Optional(r.String()),volumeType:r.Optional(r.String())}),J3=r.Intersect([r.Object({isEncrypted:r.Optional(r.Boolean()),sizeGib:r.Optional(r.Number())}),r.Union([W3,X3,Z3])]),eY=r.Object({instanceCount:r.Optional(r.Number()),hostnames:r.Optional(r.Array(r.String())),runtime:r.Optional(r.String())}),Wu=r.Union([r.Object({category:r.Literal("application"),resourceType:r.Literal("webService"),attributes:r.Optional(eY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("bucket"),attributes:r.Optional(S3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("messagingService"),attributes:r.Optional(N3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("fileSystem"),attributes:r.Optional(U3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("contentDeliveryNetwork"),attributes:r.Optional(A3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("database"),attributes:r.Optional(O3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("storageAccount"),attributes:r.Optional(k3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("volume"),attributes:r.Optional(J3)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("virtualMachine"),attributes:r.Optional(M3)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("serverless"),attributes:r.Optional(L3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("kubernetesCluster"),attributes:r.Optional(x3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerRepository"),attributes:r.Optional(R3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerCluster"),attributes:r.Optional(C3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerServiceTask"),attributes:r.Optional(P3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerService"),attributes:r.Optional(w3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerImage"),attributes:r.Optional(v3)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("virtualNetwork"),attributes:r.Optional(D3)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("loadBalancer"),attributes:V3}),r.Object({category:r.Literal("network"),resourceType:r.Literal("targetGroup"),attributes:r.Optional(H3)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("certificate"),attributes:r.Optional(Q3)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var _o="/v0/inventory",sv=["scan_in_progress","success","failure","partial"],Og=r.Object({id:r.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:r.Enum(Tn,{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"},cv=r.Object({cloudPlatforms:_e(r.Enum(Tn),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:Tn.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(Ps),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:Ps.length}),resourceTypes:_e(r.Enum(Qu),{description:"Restrict results to resources of any of these normalized resource types",maxItems:Qu.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"}),xg=r.Partial(r.Object({...ge,filters:r.Partial(cv,{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."})})),Q7e=d({tags:["inventory"],method:"POST",url:`${_o}/resources/query`,paginated:!0,body:xg,response:r.Array(r.Intersect([Og,Wu]))}),tY=["resourceType","cloudAccount","isIacManaged"],W7e=d({tags:["inventory"],method:"POST",url:`${_o}/resources/counts`,body:r.Object({filters:r.Optional(r.Partial(cv)),groupBy:r.Enum(tY,{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."})}))}),Z7e=d({tags:["inventory"],method:"GET",url:`${_o}/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})}),X7e=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."})})]),rY="^[0-9]{12}$",nY="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",oY="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",iY="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",aY="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",Ag="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",sY=r.Object({type:r.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:r.String({pattern:rY,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:nY,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"}),cY=r.Object({type:r.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:r.String({pattern:oY,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:iY,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:aY,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"}),pY=r.Object({type:r.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:r.String({pattern:Ag,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:r.String({pattern:Ag,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:r.String({pattern:Ag,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),pv=C("type",[sY,cY,pY],{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`."}),Yi=r.Object({id:r.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:r.Enum(Tn,{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(sv,{description:"Status of the most recent inventory scan."}))}),Rg=r.Object({cloudType:r.Enum(Tn,{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:pv,lastScanStatus:r.Optional(r.Enum(sv,{description:"Status of the most recent inventory scan."}))}),Io=`${_o}/cloud-accounts`,J7e=d({tags:["inventory"],url:Io,method:"GET",response:r.Array(Yi)}),eZe=d({tags:["inventory"],url:`${Io}/:id`,method:"GET",params:r.Object({id:u()}),response:Yi}),tZe=d({tags:["inventory"],url:Io,method:"POST",body:Rg,response:Yi}),Cg=r.Object({accountFriendlyName:u({description:"Human-readable name for the account shown in Tsuga."})}),rZe=d({tags:["inventory"],url:`${Io}/:id`,method:"PUT",params:r.Object({id:u()}),body:Cg,response:Yi}),nZe=d({tags:["inventory"],url:`${Io}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),oZe=d({tags:["inventory"],url:`${_o}/trigger-scan`,method:"POST",body:r.Object({}),response:r.Object({success:r.Literal(!0)})}),iZe=d({tags:["inventory"],url:`${Io}/azure/onboarding`,method:"POST",body:r.Object({tenantId:u()}),response:r.Object({subjectId:r.String(),audience:r.String()})}),aZe=d({tags:["inventory"],method:"POST",url:`${Io}/validate/:type`,params:r.Object({type:u()}),body:r.Object({data:pv,id:r.Optional(u())}),response:r.Object({areAccountSettingsValid:r.Boolean(),message:r.Optional(r.String())})}),uv=`${_o}/settings`,sZe=d({tags:["inventory"],url:uv,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())}))}))})}),uY=50,cZe=d({tags:["inventory"],url:uv,method:"POST",body:r.Object({infrastructureIdentifiers:r.Array(r.Object({name:u({allowEmpty:!1}),value:r.Optional(u({allowEmpty:!1}))}),{maxItems:uY})}),response:r.Object({})}),pZe=d({tags:["inventory"],url:`${_o}/iac-tags-proposal`,method:"GET",response:r.Array(r.Object({name:r.String(),value:r.Optional(r.String())}))});var lv=`/${"v1"}/inventory`,lY=r.Omit(Og,["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([lY,Wu],{$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)."}),mY={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:[mY]});var dv=r.Object({...xg.properties,...Ze},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),dY={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:[dY]});var fv=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:`${lv}/resources/query`,method:"POST",paginated:!0,body:dv,response:r.Array(mv)}),Us=`${lv}/cloud-accounts`,ws=r.Pick(Yi,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),fY={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(ws,{examples:[fY]});var gv=r.Pick(Rg,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),gY={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(gv,{examples:[gY]});var hY=r.Pick(Cg,["accountFriendlyName"]),TZe=d({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:Us,method:"GET",response:r.Array(ws)}),EZe=d({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${Us}/: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:ws}),_Ze=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:Us,method:"POST",body:gv,response:ws}),IZe=d({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${Us}/: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:hY,response:ws}),bZe=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:`${Us}/: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 vs="/v0/investigations",yY=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],TY=r.Object({type:r.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:r.String({description:"Identifier of the linked asset"})}),EY=r.Object({type:r.Enum(yY,{description:"Kind of linked asset"}),id:u({allowEmpty:!1,description:"Identifier of the linked asset"})}),Zr=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(TY,{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"}),Zu=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(EY,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),Pg=r.Object(r.Omit(Zu,["slug"]).properties),UZe=d({tags:["investigations"],url:vs,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(Zr)}),wZe=d({tags:["investigations"],url:`${vs}/:id`,params:r.Object({id:u()}),method:"GET",response:Zr}),vZe=d({tags:["investigations"],url:vs,method:"POST",body:Zu,response:Zr}),NZe=d({tags:["investigations"],url:`${vs}/:id`,method:"PUT",body:Pg,params:r.Object({id:u()}),response:Zr}),LZe=d({tags:["investigations"],url:`${vs}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N});var Ns=`/${"v1"}/investigations`,hv=d({description:"Retrieve all investigations",tags:["private"],url:Ns,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Zr)}),yv=d({description:"Retrieve an investigation by its id",tags:["private"],url:`${Ns}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1})}),response:Zr}),Tv=d({description:"Create a new investigation",tags:["private"],url:Ns,method:"POST",body:Zu,response:Zr}),Ev=d({description:"Update an investigation by its id",tags:["private"],url:`${Ns}/:id`,method:"PUT",body:Pg,params:r.Object({id:u({allowEmpty:!1})}),response:Zr}),_v=d({description:"Delete an investigation by its id",tags:["private"],url:`${Ns}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1})}),response:N});var Iv=15,Xu={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."}))},Ju={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."}))},bv={...Xu,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},Sv={...Ju,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},_Y=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."}),IY=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:Iv,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."}),bY=r.Object({...bv,params:_Y}),SY=r.Object({...Sv,params:IY}),Av={...Xu,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},Ov={...Ju,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},AY=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."}),OY=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."}),xY=r.Object({...Ov,params:OY}),RY=r.Object({...Av,params:AY}),xv={...Xu,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},Rv={...Ju,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},Cv=5,CY=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."}),PY=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:Cv,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."}),UY=r.Object({...xv,params:CY}),wY=r.Object({...Rv,params:PY}),vY=r.Object({...Sv,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:Iv,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")})])}),NY=r.Object({...Ov,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")})}),LY=r.Object({...Rv,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:Cv,description:"Example log lines for validating the Grok rules."})),subtype:r.Literal("grok")})}),YZe=C("type",[NY,LY,vY]),kY=r.Object({...bv,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")})])}),MY=r.Object({...Av,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")})}),DY=r.Object({...xv,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")})}),VZe=C("type",[MY,DY,kY]),GY=11,Pv=r.Cyclic({OutputProcessor:r.Union([RY,UY,bY,r.Object({...Xu,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"}),Uv=r.Cyclic({InputProcessor:r.Union([xY,wY,SY,r.Object({...Ju,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:GY,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 $Y="/v0/logs",Un=`${$Y}/routes`,wn=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(Pv,{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"}),Ls=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(Uv,{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 nXe=d({tags:["routes"],url:Un,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(wn)}),oXe=d({tags:["routes"],url:`${Un}/:id`,params:r.Object({id:u()}),method:"GET",response:wn}),iXe=d({tags:["routes"],url:Un,method:"POST",body:Ls,response:wn}),aXe=d({tags:["routes"],url:`${Un}/:id`,method:"PUT",body:Ls,params:r.Object({id:u()}),response:wn}),sXe=d({tags:["routes"],url:`${Un}/:id/clone`,method:"POST",params:r.Object({id:u()}),body:Ls,response:wn}),cXe=d({tags:["routes"],url:`${Un}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),pXe=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:`${Un}/: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({})}),uXe=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:`${Un}/: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:wn});var ks=`/${"v1"}/routes`,wv={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}"]}}]},vv={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}}]},Ms=r.Pick(wn,["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)."}),jY={id:"123-456-abc",...wv},qY={id:"456-789-def",...vv};Object.assign(Ms,{examples:[jY,qY]});var Nv=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:ks,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Ms)}),Lv=d({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${ks}/: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:Ms}),Ug=r.Pick(Ls,["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(Ug,{examples:[wv,vv]});var kv=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:ks,method:"POST",body:Ug,response:Ms}),Mv=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:`${ks}/:id`,method:"PUT",body:Ug,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:Ms}),Dv=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:`${ks}/: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 Ds=`/${"v1"}/monitors`,Gs=r.Pick(qr,["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)."}),$v={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:[]},jv={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:[]},qv={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:[]},Fv={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:[]},FY={id:"123-456-abc",...$v},BY={id:"234-567-bcd",...jv},HY={id:"345-678-cde",...qv},KY={id:"456-789-def",...Fv};Object.assign(Gs,{examples:[FY,BY,HY,KY]});var Gv=r.Pick(yd,["filters","sort","limit","offset"]),Bv=r.Object({...Gv.properties,...Ze,filters:Gv.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),zY={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(Bv,{examples:[zY]});var Hv=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:`${Ds}/query`,method:"POST",paginated:!0,body:Bv,response:r.Array(Gs)}),Kv=d({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${Ds}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:Gs}),zv=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],Yv=r.Pick(Xa,zv,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),Vv=r.Pick(Xa,zv,{$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."}),Qv=$v,Wv=jv,Zv=qv,Xv=Fv;Object.assign(Yv,{examples:[Qv,Wv,Zv,Xv]});Object.assign(Vv,{examples:[Qv,Wv,Zv,Xv]});var Jv=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:Ds,method:"POST",body:Yv,response:Gs}),eN=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:`${Ds}/: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:Vv,response:Gs}),YY=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."})}),tN=d({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${Ds}/:id`,method:"DELETE",params:YY,response:N});var $s=`/${"v1"}/notification-rules`,js=r.Pick(di,["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)."}),rN={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}}}]},VY={id:"123-456-abc",...rN};Object.assign(js,{examples:[VY]});var nN=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:$s,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(js)}),oN=d({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${$s}/: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:js}),wg=r.Pick(ts,["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."}),QY=rN;Object.assign(wg,{examples:[QY]});var iN=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:$s,method:"POST",body:wg,response:js}),aN=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:`${$s}/: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:js}),WY=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."})}),sN=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:`${$s}/:id`,method:"DELETE",params:WY,response:N});var Vi=`${li}/silences`,cN=r.Union([r.Literal("monday"),r.Literal("tuesday"),r.Literal("wednesday"),r.Literal("thursday"),r.Literal("friday"),r.Literal("saturday"),r.Literal("sunday")]),ZY=r.Partial(r.Record(cN,r.Array(r.Object({startTime:r.String({format:$m,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:r.String({format:$m,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`."}),XY=r.Partial(r.Record(cN,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`."}),el='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',pN="One-time silence schedule with specific start and end times",uN="Recurring weekly silence schedule",JY=C("type",[r.Object({type:r.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:r.String({format:jm,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:r.String({format:jm,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:Gm,description:el}))},{$id:"InputSilenceScheduleOneTime",description:pN}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:ZY,timeZone:r.Optional(r.String({format:Gm,description:el}))},{$id:"InputSilenceScheduleRecurring",description:uN})],{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."}),e9=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:el}))},{$id:"OutputSilenceScheduleOneTime",description:pN}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:XY,timeZone:r.Optional(r.String({description:el}))},{$id:"OutputSilenceScheduleRecurring",description:uN})],{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."}),t9="monitor_id",lN=`Query on the alerting monitor tags and group-by dimensions, e.g. \`env:prod AND service:bridge\`. The monitor itself can be targeted with \`${t9}:<monitor id>\`.`,tl=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:JY,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:lN})),teamsFilter:xd,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(co),{maxItems:co.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),Qi=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:e9,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:lN})),teamsFilter:Od,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(co),{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)}),FXe=d({tags:["notification-silences"],url:Vi,method:"GET",response:r.Array(Qi)}),BXe=d({tags:["notification-silences"],url:`${Vi}/:id`,params:r.Object({id:u()}),method:"GET",response:Qi}),HXe=d({tags:["notification-silences"],url:Vi,method:"POST",body:tl,response:Qi}),KXe=d({tags:["notification-silences"],url:`${Vi}/:id`,method:"PUT",params:r.Object({id:u()}),body:tl,response:Qi}),zXe=d({tags:["notification-silences"],url:`${Vi}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),YXe=d({tags:["notification-silences"],url:`${Vi}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})});var qs=`/${"v1"}/notification-silences`,Fs=r.Pick(Qi,["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)."}),r9={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"]},n9={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(Fs,{examples:[r9,n9]});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:qs,method:"GET",response:r.Array(Fs)}),dN=d({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${qs}/: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:Fs}),vg=r.Pick(tl,["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."}),o9={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"]},i9={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(vg,{examples:[o9,i9]});var fN=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:qs,method:"POST",body:vg,response:Fs}),gN=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:`${qs}/: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:vg,response:Fs}),a9=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."})}),hN=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:`${qs}/:id`,method:"DELETE",params:a9,response:N});var s9={critical:3,important:2,normal:1},se=e=>({label:e,weight:s9[e]}),c9={"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:`${id} matches ${Fp}`,summary:`Detects logs and spans whose ${id} resource attribute names a different team than the ${Fp} resolved at ingestion.`,rationale:`${Fp} 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:`${Bp} present`,summary:`Logs and spans must populate ${Bp} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:se("critical"),recommendation:`Populate ${Bp} 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:`${Za} presence`,summary:`Logs and spans must populate ${Za} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:se("important"),recommendation:`Populate ${Za} 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 ${tx} 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"}},yN={"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_"]}},p9=Object.fromEntries(Object.keys(yN).map(e=>{let{label:t,receiver:n}=yN[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"}]})),u9=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),l9=Ps.filter(e=>e.startsWith("azure_")&&!u9.has(e)),TN={"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:l9,metricPrefixes:["azure_"]}},m9=Object.fromEntries(Object.keys(TN).map(e=>{let{label:t,source:n}=TN[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"}]})),d9={...c9,...p9,...m9},EN=Object.values(d9);var _N=["passed","failed","ignored"],f9=10,g9=r.Enum(_N,{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."}),h9=["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"],y9=["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"],Lg=["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",...y9,...h9],T9=r.Enum(Lg),E9=["log","metric","resource","span","api-key","dashboard","monitor","route"],_9=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],I9=["critical","important","normal"],b9=["team","global"],kg=r.Object({key:r.Enum(Lg),title:r.String(),summary:r.String(),rationale:r.String(),objectType:r.Enum(E9),category:r.Enum(_9),impact:r.Object({label:r.Enum(I9),weight:r.Number()}),recommendation:r.String(),scope:r.Optional(r.Enum(b9))}),Bs=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."})}),Ng=r.Intersect([kg,r.Object({id:r.Optional(r.String()),status:g9,normalizedScore:r.Number(),details:r.Optional(r.Record(r.String(),r.Unknown())),recommendation:r.Optional(r.String()),examples:r.Optional(r.Array(Bs)),exampleCount:r.Optional(r.Integer())})]),S9=r.Object({generatedAt:r.String(),overallScore:r.Optional(r.Number()),rules:r.Array(kg),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(Ng)})),globalResults:r.Optional(r.Object({score:r.Optional(r.Number()),ruleResults:r.Array(Ng)}))}),Mg=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(Lg,{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(_N,{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(Bs,{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 ${f9}; 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"})}),pJe=d({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:S9}),Dg=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."})),uJe=d({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:r.Object({clusterId:Dg,team:r.Optional(u({allowEmpty:!1}))}),response:r.Array(Mg,{description:"Latest persisted rule evaluation rows for the cluster"})}),lJe=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(Bs)})}),mJe=d({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:r.Object({ruleKey:T9,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:kg,result:Ng,teamId:r.Optional(r.String()),teamName:r.Optional(r.String())})}),dJe=new Map(EN.map(e=>[e.key,e]));var IN=`/${"v1"}/quality-reports`,bN=r.Pick(Mg,["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)."}),A9={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(bN,{examples:[A9]});var O9=r.Object({clusterId:Dg,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."}),SN=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:`${IN}/latest`,method:"GET",query:O9,response:r.Array(bN)}),_Je=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:`${IN}/: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(Bs,{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 Hs="/v0/admin-center";var Pr=`${Hs}/retention-policies`,AN=3650,x9=r.Integer({description:"Number of days Tsuga retains matching telemetry."}),ON=r.Integer({minimum:1,maximum:AN,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${AN}.`}),Xr=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(Ir,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:x9,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."})}),rl=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(Ir,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:ON,isEnabled:r.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),xN=r.Array(r.Object({env:u(),dataSource:r.Enum(Ir),durationDays:r.Union([ON,r.Null()]),isEnabled:r.Boolean()})),RN=r.Object({inserted:r.Array(Xr),updated:r.Array(Xr),deleted:r.Array(Xr)}),PJe=d({tags:["retention-policies"],url:Pr,method:"POST",body:rl,response:Xr}),UJe=d({tags:["retention-policies"],url:Pr,method:"GET",response:r.Array(Xr)}),wJe=d({tags:["retention-policies"],url:`${Pr}/:id`,method:"GET",params:r.Object({id:u()}),response:Xr}),vJe=d({tags:["retention-policies"],url:`${Pr}/:id`,method:"PUT",params:r.Object({id:u()}),body:rl,response:Xr}),NJe=d({tags:["retention-policies"],url:`${Pr}/bulk-update`,method:"POST",body:xN,response:RN}),LJe=d({tags:["retention-policies"],url:`${Pr}/bulk-update-for-team`,method:"POST",body:r.Object({teamId:u(),policies:xN}),response:RN}),kJe=d({tags:["retention-policies"],url:`${Pr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),Ks=["past-24-hours","past-7-days","past-30-days"],MJe=d({tags:["retention-policies"],url:`${Pr}/requested-history-percentile/:teamId`,method:"POST",params:r.Object({teamId:u()}),body:r.Object({percentile:r.Number({minimum:0,maximum:1}),observationWindow:r.Enum(Ks),dataSource:r.Enum(Ir)}),response:r.Object({percentile:r.Number(),observationWindow:r.Enum(Ks),dataSource:r.Enum(Ir),teamId:r.String(),requestedHistoryDays:r.Number()})}),R9=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var C9=r.Array(r.Object({bucket:r.Enum(R9),count:r.Number()})),DJe=d({tags:["retention-policies"],url:`${Pr}/requested-history-histogram/:teamId`,method:"POST",params:r.Object({teamId:u()}),body:r.Object({observationWindow:r.Enum(Ks),dataSource:r.Enum(Ir)}),response:r.Object({observationWindow:r.Enum(Ks),dataSource:r.Enum(Ir),teamId:r.String(),histogram:C9})}),GJe=d({tags:["retention-policies"],url:`${Pr}/top-teams-with-retention-surplus`,method:"POST",body:r.Object({dataSource:r.Enum(Ir),observationWindow:r.Enum(Ks),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 zs=`/${"v1"}/retention-policies`,Ys=r.Pick(Xr,["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)."}),P9={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Ys,{examples:[P9]});var CN=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:zs,method:"GET",response:r.Array(Ys)}),PN=d({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${zs}/: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:Ys}),Gg=r.Pick(rl,["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."}),U9={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Gg,{examples:[U9]});var UN=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:zs,method:"POST",body:Gg,response:Ys}),wN=d({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${zs}/: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:Gg,response:Ys}),vN=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:`${zs}/: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 Vs=`/${"v1"}/slos`,w9=r.Pick(Id,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),Qs=r.Object({...r.Pick(ui,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:r.Array(w9,{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"}),v9={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(Qs,{examples:[v9]});var NN=r.Pick(Sd,["filters","sort","limit","offset"]),LN=r.Object({...NN.properties,...Ze,filters:NN.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),N9={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(LN,{examples:[N9]});var kN=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:`${Vs}/query`,method:"POST",paginated:!0,body:LN,response:r.Array(Qs)}),MN=d({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${Vs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:Qs}),DN=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],GN=r.Pick(eu,DN,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),$N=r.Pick(bd,DN,{$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."}),jN={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(GN,{examples:[jN]});Object.assign($N,{examples:[jN]});var qN=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:Vs,method:"POST",body:GN,response:Qs}),FN=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:`${Vs}/: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:$N,response:Qs}),BN=d({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${Vs}/: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 bo=`${Hs}/tag-policies`;var L9=["logs","metrics","traces"],$g=r.Array(r.Enum(L9,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),k9=r.Union([Np,$g]),M9=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."}),D9=C("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:$g,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:Np},{title:"TsugaAssetTagPolicy"})]),G9=C("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:$g,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:Np},{title:"TsugaAssetTagPolicy"})]),HN="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",$9=r.Unsafe({...D9,description:HN}),j9=r.Unsafe({...G9,description:HN}),Wi=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(M9),configuration:$9,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 Ws=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:j9,owner:u({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),set=d({tags:["tag-policies"],url:bo,method:"GET",query:r.Object({teamIds:r.Optional(r.Array(u(),{maxItems:100})),assetTypes:r.Optional(k9),searchQuery:r.Optional(u())}),response:r.Array(Wi)}),cet=d({tags:["tag-policies"],url:`${bo}/:id`,method:"GET",params:r.Object({id:u()}),response:Wi}),pet=d({tags:["tag-policies"],url:bo,method:"POST",body:Ws,response:Wi}),uet=d({tags:["tag-policies"],url:`${bo}/:id`,method:"PUT",params:r.Object({id:u()}),body:Ws,response:Wi}),met=d({tags:["tag-policies"],url:`${bo}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),det=d({tags:["tag-policies"],url:`${Hs}/applicable-tag-rules`,method:"GET",query:r.Object({assetType:r.Enum(ja),teamId:u()}),response:r.Array(r.Object({tagKey:r.String(),allowedTagValues:r.Array(r.String()),isRequired:r.Boolean(),tagPolicyId:r.String()}))}),KN=r.Object({total:r.Number(),totalNonCompliant:r.Number(),idsNonCompliant:r.Array(r.String())}),zN=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")]),q9=r.Object({total:r.Number(),totalNonCompliant:r.Number(),byAssetType:r.Record(zN,KN)}),F9=r.Omit(KN,["total"]),B9=r.Object({totalNonCompliant:r.Number(),byAssetType:r.Record(zN,F9)}),YN=r.Object({totals:q9,byTeam:r.Record(r.String(),B9)}),fet=d({tags:["tag-policies"],url:`${bo}/:id/stats`,method:"GET",params:r.Object({id:u()}),response:YN}),get=d({tags:["tag-policies"],url:`${bo}/new-policy-stats`,method:"POST",body:Ws,response:YN});var Zs=`/${"v1"}/tag-policies`,VN={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"},QN={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"},H9={id:"123-456-abc",...VN},K9={id:"456-789-def",...QN},Xs=r.Pick(Wi,["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)."}),z9=H9,Y9=K9;Object.assign(Xs,{examples:[z9,Y9]});var jg=r.Pick(Ws,["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."}),V9=VN,Q9=QN;Object.assign(jg,{examples:[V9,Q9]});var WN=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:Zs,method:"GET",response:r.Array(Xs)}),ZN=d({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${Zs}/: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:Xs}),XN=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:Zs,method:"POST",body:jg,response:Xs}),JN=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:`${Zs}/: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:jg,response:Xs}),eL=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:`${Zs}/: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 Js=`/${"v1"}/teams`,ec=r.Pick(si,["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)."}),W9={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(ec,{examples:[W9]});var tL=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:Js,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(ec)}),rL=d({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${Js}/: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:ec}),qg=r.Pick(Wp,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),Z9={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(qg,{examples:[Z9]});var nL=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:Js,method:"POST",body:qg,response:ec}),oL=d({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${Js}/: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:qg,response:ec}),iL=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:`${Js}/: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 X9(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function aL(e,t){let n=Number(t);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${t})`);return n}function sL(e){let t={};return e.limit!==void 0&&(t.limit=aL("limit",e.limit)),e.offset!==void 0&&(t.offset=aL("offset",e.offset)),t}function Fg(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 cL(e,t,n){let o=e.command(t.commandName).description(t.description),i=t.singularOverride??nx(t.commandName).replace(/-/g," "),a=t.pluralOverride??t.commandName.replace(/-/g," "),c=X9(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 ${Jo} (default: ${vp})`).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){J(Pi(t.endpoints.list));return}let f=m.data?hi({data:m.data}):{},h=await n()(t.endpoints.list,{body:{...f,...sL(m)}});J(h)}):l.action(async m=>{let f=sL(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);J(h)}),t.endpoints.get){let m=t.endpoints.get,f=Fg(m);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});J(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){J(Pi(m));return}let h=hi(f),E=await n()(m,{body:h});J(E)})}if(t.endpoints.update){let m=t.endpoints.update,f=Fg(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){J(Pi(m));return}let I=hi(E),g=await n()(m,{params:{[f]:h},body:I});J(g)})}if(t.endpoints.delete){let m=t.endpoints.delete,f=Fg(m);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async h=>{let E=await n()(m,{params:{[f]:h}});J(E)})}}var J9=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:fv},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:_w,get:Iw,create:bw,update:Sw,delete:Aw},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:zw,get:Yw,create:Vw,update:Qw,delete:Ww},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:nv,create:ov,update:iv,delete:av}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:hv,get:yv,create:Tv,update:Ev,delete:_v}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:Hv,get:Kv,create:Jv,update:eN,delete:tN},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:nN,get:oN,create:iN,update:aN,delete:sN}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:mN,get:dN,create:fN,update:gN,delete:hN}},{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:SN},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:CN,get:PN,create:UN,update:wN,delete:vN}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:Nv,get:Lv,create:kv,update:Mv,delete:Dv}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:uR,get:lR}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:kN,get:MN,create:qN,update:FN,delete:BN},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:WN,get:ZN,create:XN,update:JN,delete:eL}},{commandName:"teams",description:"Manage teams",endpoints:{list:tL,get:rL,create:nL,update:oL,delete:iL}}];function pL(e,t){for(let n of J9)cL(e,n,t)}var uL=require("node:child_process");var nl="@tsuga/cli@latest";function eV(){V(`Updating ${nl}`),V(` $ npm install -g ${nl}`);try{(0,uL.execFileSync)("npm",["install","-g",nl],{stdio:["ignore","inherit","inherit"]})}catch(e){let t=e.status??1;throw new Error(`npm install -g ${nl} exited ${t}`,{cause:e})}V("Updated. Run `tsuga --version` to confirm the new version.")}function lL(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{eV()})}var Qg=require("node:fs"),Vg=require("node:os"),Xi=require("node:path");var tV=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,tc=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(tV);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 rV(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function nV(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
|
+
`,c===t&&(i+=" ".repeat(a+n+2),i+=`^
|
|
141
|
+
`))}return i}var X=class extends Error{line;column;codeblock;constructor(t,n){let[o,i]=rV(n.toml,n.ptr),a=nV(n.toml,o,i);super(`Invalid TOML document: ${t}
|
|
142
142
|
|
|
143
|
-
${a}`,n),this.line=o,this.column=i,this.codeblock=a}};function
|
|
144
|
-
|
|
143
|
+
${a}`,n),this.line=o,this.column=i,this.codeblock=a}};var oV=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,iV=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,aV=/^[+-]?0[0-9_]/;function ol(e,t){let n=e[t++],o=n,i=n==="'",a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
|
|
144
|
+
`?t++:e[t]==="\r"&&e[t+1]===`
|
|
145
|
+
`&&(t+=2));let c="",l=t,m=0;for(let f=t;f<e.length;f++)if(n=e[f],a&&(n===`
|
|
146
|
+
`||n==="\r"&&e[f+1]===`
|
|
147
|
+
`))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+=`
|
|
148
|
+
`;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 mL(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=oV.test(e);if(i||iV.test(e)){if(aV.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 tc(e);if(!a.isValid())throw new X("invalid value",{toml:t,ptr:n});return a}function il(e,t=0,n=e.length){let o=e.indexOf(`
|
|
149
|
+
`,t);return e[o-1]==="\r"&&o--,o<=n?o:-1}function Zi(e,t){for(let n=t;n<e.length;n++){let o=e[n];if(o===`
|
|
145
150
|
`)return n;if(o==="\r"&&e[n+1]===`
|
|
146
|
-
`)return n+1;if(o<" "&&o!==" "||o==="\x7F")throw new
|
|
147
|
-
`||i==="\r"&&e[
|
|
148
|
-
`);)
|
|
151
|
+
`)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 Ur(e,t,n,o){let i;for(;;){for(;(i=e[t])===" "||i===" "||!n&&(i===`
|
|
152
|
+
`||i==="\r"&&e[t+1]===`
|
|
153
|
+
`);)t++;if(o||i!=="#")break;t=Zi(e,t)}return t}function dL(e,t,n,o,i=!1){if(!o)return t=il(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let c=e[a];if(c==="#"){if(a=il(e,a),a<0)break}else{if(c===n)return a+1;if(c===o||i&&(c===`
|
|
149
154
|
`||c==="\r"&&e[a+1]===`
|
|
150
|
-
`))return a}}throw new
|
|
151
|
-
|
|
152
|
-
`&&r
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
`&&a!=="\r"){let c=js(e,r-1,"]",n-1,o);i.push(c[0]),r=c[1]}}if(!a)throw new z("unfinished array encountered",{toml:e,ptr:r});return[i,r]}function Vw(e,r,n,o){let i=r,a=n,c,l=!1,d;for(let f=0;f<e.length;f++){if(f){if(i=l?i[c]:i[c]={},a=(d=a[c]).c,o===0&&(d.t===1||d.t===2))return null;if(d.t===2){let g=i.length-1;i=i[g],a=a[g].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(d=a[c],d.t!==o&&!(o===1&&d.t===3)||(o===2&&(d.d||(d.d=!0,i[c]=[]),i[c].push(i={}),d.c[d.i++]=d={t:1,d:!1,i:0,c:{}}),d.d))return null;if(d.d=!0,o===1)i=l?i[c]:i[c]={};else if(o===0&&l)return null;return[c,i,d.c]}function Af(e,{maxDepth:r=1e3,integersAsBigInt:n}={}){let o={},i={},a=o,c=i;for(let l=Dt(e,0);l<e.length;){if(e[l]==="["){let d=e[++l]==="[",f=Wp(e,l+=+d,"]");if(d){if(e[f[1]-1]!=="]")throw new z("expected end of table declaration",{toml:e,ptr:f[1]-1});f[1]++}let g=Vw(f[0],o,i,d?2:1);if(!g)throw new z("trying to redefine an already defined table or value",{toml:e,ptr:l});c=g[2],a=g[1],l=f[1]}else{let d=Wp(e,l),f=Vw(d[0],a,c,0);if(!f)throw new z("trying to redefine an already defined table or value",{toml:e,ptr:l});let g=js(e,d[1],void 0,r,n);f[1][f[0]]=g[0],l=g[1]}if(l=Dt(e,l,!0),e[l]&&e[l]!==`
|
|
160
|
-
`&&e[l]!=="\r")throw new z("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=Dt(e,l)}return o}var Qw=/^[a-z0-9-_]+$/i;function Bs(e){let r=typeof e;if(r==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return r}function l9(e){for(let r=0;r<e.length;r++)if(Bs(e[r])!=="object")return!1;return e.length!=0}function xf(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function Rf(e,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");if(r==="number")return isNaN(e)?"nan":e===1/0?"inf":e===-1/0?"-inf":o&&Number.isInteger(e)?e.toFixed(1):e.toString();if(r==="bigint"||r==="boolean")return e.toString();if(r==="string")return xf(e);if(r==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(r==="object")return m9(e,n,o);if(r==="array")return d9(e,n,o)}function m9(e,r,n){let o=Object.keys(e);if(o.length===0)return"{}";let i="{ ";for(let a=0;a<o.length;a++){let c=o[a];a&&(i+=", "),i+=Qw.test(c)?c:xf(c),i+=" = ",i+=Rf(e[c],Bs(e[c]),r-1,n)}return i+" }"}function d9(e,r,n){if(e.length===0)return"[]";let o="[ ";for(let i=0;i<e.length;i++){if(i&&(o+=", "),e[i]===null||e[i]===void 0)throw new TypeError("arrays cannot contain null or undefined values");o+=Rf(e[i],Bs(e[i]),r-1,n)}return o+" ]"}function f9(e,r,n,o){if(n===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let i="";for(let a=0;a<e.length;a++)i+=`${i&&`
|
|
161
|
-
`}[[${r}]]
|
|
162
|
-
`,i+=Cf(0,e[a],r,n,o);return i}function Cf(e,r,n,o,i){if(o===0)throw new Error("Could not stringify the object: maximum object depth exceeded");let a="",c="",l=Object.keys(r);for(let d=0;d<l.length;d++){let f=l[d];if(r[f]!==null&&r[f]!==void 0){let g=Bs(r[f]);if(g==="symbol"||g==="function")throw new TypeError(`cannot serialize values of type '${g}'`);let T=Qw.test(f)?f:xf(f);if(g==="array"&&l9(r[f]))c+=(c&&`
|
|
163
|
-
`)+f9(r[f],n?`${n}.${T}`:T,o-1,i);else if(g==="object"){let _=n?`${n}.${T}`:T;c+=(c&&`
|
|
164
|
-
`)+Cf(_,r[f],_,o-1,i)}else a+=T,a+=" = ",a+=Rf(r[f],g,o,i),a+=`
|
|
155
|
+
`))return a}}throw new X("cannot find end of structure",{toml:e,ptr:t})}function sV(e,t,n){let o=e.slice(t,n),i=o.indexOf("#");return i>-1&&(Zi(e,i),o=o.slice(0,i)),[o.trimEnd(),i]}function rc(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==="["?gL(e,t,o,i):fL(e,t,o,i);if(n){if(f=Ur(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]=ol(e,t);if(n){if(f=Ur(e,f),e[f]&&e[f]!==","&&e[f]!==n&&e[f]!==`
|
|
156
|
+
`&&e[f]!=="\r")throw new X("unexpected character encountered",{toml:e,ptr:f});e[f]===","&&f++}return[m,f]}let c=dL(e,t,",",n),l=sV(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=Ur(e,t+l[1]),e[c]===","&&c++),[mL(l[0],e,t,i),c]}var cV=/^[a-zA-Z0-9-_]+[ \t]*$/;function al(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]=ol(e,t);o=e.indexOf(".",m);let f=e.slice(m,o<0||o>a?a:o),h=il(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(!cV.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,Ur(e,a+1,!0,!0)]}function fL(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=Zi(e,t);else if(c!==" "&&c!==" "&&c!==`
|
|
157
|
+
`&&c!=="\r"){let l,m=i,f=!1,[h,E]=al(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]=rc(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 gL(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=Zi(e,t);else if(a!==" "&&a!==" "&&a!==`
|
|
158
|
+
`&&a!=="\r"){let c=rc(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 hL(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 Bg(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let o={},i={},a=o,c=i;for(let l=Ur(e,0);l<e.length;){if(e[l]==="["){let m=e[++l]==="[",f=al(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=hL(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=al(e,l),f=hL(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=rc(e,m[1],void 0,t,n);f[1][f[0]]=h[0],l=h[1]}if(l=Ur(e,l,!0),e[l]&&e[l]!==`
|
|
159
|
+
`&&e[l]!=="\r")throw new X("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=Ur(e,l)}return o}var yL=/^[a-z0-9-_]+$/i;function nc(e){let t=typeof e;if(t==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return t}function pV(e){for(let t=0;t<e.length;t++)if(nc(e[t])!=="object")return!1;return e.length!=0}function Hg(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function Kg(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 Hg(e);if(t==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(t==="object")return uV(e,n,o);if(t==="array")return lV(e,n,o)}function uV(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+=yL.test(c)?c:Hg(c),i+=" = ",i+=Kg(e[c],nc(e[c]),t-1,n)}return i+" }"}function lV(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+=Kg(e[i],nc(e[i]),t-1,n)}return o+" ]"}function mV(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&&`
|
|
160
|
+
`}[[${t}]]
|
|
161
|
+
`,i+=zg(0,e[a],t,n,o);return i}function zg(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=nc(t[f]);if(h==="symbol"||h==="function")throw new TypeError(`cannot serialize values of type '${h}'`);let E=yL.test(f)?f:Hg(f);if(h==="array"&&pV(t[f]))c+=(c&&`
|
|
162
|
+
`)+mV(t[f],n?`${n}.${E}`:E,o-1,i);else if(h==="object"){let I=n?`${n}.${E}`:E;c+=(c&&`
|
|
163
|
+
`)+zg(I,t[f],I,o-1,i)}else a+=E,a+=" = ",a+=Kg(t[f],h,o,i),a+=`
|
|
165
164
|
`}}return e&&(a||!c)&&(a=a?`[${e}]
|
|
166
165
|
${a}`:`[${e}]`),a&&c?`${a}
|
|
167
|
-
${c}`:a||c}function
|
|
166
|
+
${c}`:a||c}function Yg(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(nc(e)!=="object")throw new TypeError("stringify can only be called with an object");let o=zg(0,e,"",t,n);return o[o.length-1]!==`
|
|
168
167
|
`?o+`
|
|
169
|
-
`:o}var
|
|
170
|
-
`),q(f===void 0?" created":` patched (backup: ${f})`)}function h9(e,r,n){return{environment:"dev",log_user_prompt:n,exporter:{"otlp-http":{endpoint:`${e}/v1/logs`,protocol:"binary",headers:{Authorization:`Bearer ${r}`}}},trace_exporter:{"otlp-http":{endpoint:`${e}/v1/traces`,protocol:"binary",headers:{Authorization:`Bearer ${r}`}}}}}function T9(e,r,n,o){let i=(0,Li.join)(e,".codex"),a=(0,Li.join)(i,"config.toml");q(`Codex \u2192 ${a}`),(0,wf.mkdirSync)(i,{recursive:!0});let c=ts(a),l=c===void 0?{}:Af(c),d="otel"in l;delete l.otel,l.otel=h9(r,n,o);let f=rs(a,c);es(a,Pf(l)),q(f===void 0?" created":d?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function Ww(){return new yr("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function Zw(){return new yr("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var Xw="Restart your claude / codex session to load the new config.";function Jw(e){let r=e.command("setup").description("Configure local LLM CLIs to ship OTEL telemetry to Tsuga");r.command("claude-code").description("Patch ~/.claude/settings.json with Tsuga OTEL env").addOption(Ww()).addOption(Zw()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{y9((0,Uf.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),q(Xw)}),r.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(Ww()).addOption(Zw()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{T9((0,Uf.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),q(Xw)})}var Zp="/v0/logs";var Nf=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var qs=0,Lf=t.Object({__tsuga_metadata__:t.Object({id:t.String(),source:t.Optional(t.String())},{additionalProperties:!0}),context:t.Optional(t.Object({team:t.Optional(t.String({description:"Team name associated with this log."})),tag_policy_warnings:t.Optional(t.Record(t.String(),t.String()))},{additionalProperties:!0,description:"Context attributes attached to the log after ingestion and route processing. `team` comes from telemetry or route-enriched context when present."})),message:t.Optional(t.Unknown({description:"Log message after ingestion and route processing. It can be any JSON value because processors may map arbitrary data into `message`."})),timestamp:t.Number({description:"Log timestamp as a Unix timestamp in milliseconds."}),level:t.Enum(Nf,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[DS]:t.Optional(t.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),eN=100,E9="timestamp",_9=t.Union([t.Literal(E9)]),lo=t.Partial(t.Object({...Ve.properties,query:p({type:"tsuga-query",description:"Tsuga query used to filter logs in the selected time range."}),maxResults:t.Integer({minimum:1,maximum:1e3,description:"Maximum number of logs to return. Valid values are 1 through 1000."}),shouldRecommendAttributes:t.Boolean({description:"Whether Tsuga should return suggested attributes to highlight in results."}),triggeredBy:t.Literal("refresh",{description:"Indicates the query was triggered by a refresh action."}),startOffset:t.Number({minimum:qs,description:"Result offset used when fetching additional log rows."}),startOffsets:t.Array(t.Number({minimum:qs}),{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 ${qs} for every cluster.`}),clusterId:p({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:Na,sortBy:_9,sortDirection:t.Union([t.Literal("asc"),t.Literal("desc")],{description:"Timestamp sort direction for log results."})})),CWe=m({tags:["logs"],url:`${Zp}/count`,method:"GET",query:t.Pick(lo,["from","to","query","clusterId","clusterIds"]),response:t.Object({count:t.Number(),clusterResponses:t.Optional(Yo())})}),Fs=t.Object({value:t.String(),priority:t.Number()}),PWe=m({tags:["logs"],url:`${Zp}/search`,method:"GET",query:lo,response:t.Object({logs:t.Optional(t.Array(Lf)),attributesToHighlight:t.Optional(t.Array(Fs)),clusterResponses:t.Optional(Yo(t.Object({nextStartOffset:t.Number({description:"Number of logs consumed on this cluster so far. Echo it back at this cluster's position in `startOffsets` to fetch the next page."})})))},{additionalProperties:!0})}),I9=t.Cyclic({TokenOutput:t.Union([t.Object({type:t.Literal("top"),values:t.Array(t.String())}),t.Object({type:t.Literal("ip"),value:t.String()}),t.Object({type:t.Literal("range"),min:t.Number(),max:t.Number()}),t.Object({type:t.Literal("variable"),value:t.String()}),t.Object({type:t.Literal("text"),value:t.String()}),t.Object({type:t.Literal("date"),value:t.String()}),t.Object({type:t.Literal("url"),value:t.String()}),t.Object({type:t.Literal("structure"),key:t.Array(t.String()),value:t.Array(t.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),b9=t.Object({id:t.String(),pattern:t.Array(I9),size:t.Integer({description:"Number of logs that matched the pattern"}),examples:t.Array(t.Object({id:t.String(),timestampUnix:t.Number()})),timeDistribution:t.Array(t.Number()),staticFeatures:t.Array(t.Object({key:t.String(),value:t.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),UWe=m({tags:["logs"],url:`${Zp}/patterns`,method:"GET",query:t.Object({...Ve.properties,query:p({type:"tsuga-query"}),clusteringThreshold:t.Optional(t.Number()),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Object({patterns:t.Array(b9),sampleSize:t.Number()})}),wWe=m({tags:["logs"],url:`${Zp}/attributes`,method:"GET",query:t.Object({...Ve.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),clusterIds:t.Optional(Na)}),response:t.Object({attributes:t.Array(t.String()),clusterResponses:t.Optional(Yo())})});var Hs=`/${"v1"}/logs`,vf=t.Object({context:t.Optional(t.Object({team:t.Optional(t.String({description:"Team name associated with this log."}))},{additionalProperties:!0,$id:"LogContext",description:"Context attributes attached to the log after ingestion and route processing. `team` comes from telemetry or route-enriched context when present."})),...t.Pick(Lf,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),S9={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(vf,{examples:[S9]});var tN=t.Object({query:t.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting logs to return. Omit to search all logs with `*`."})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e3,default:eN,description:"Maximum number of logs to return. Defaults to 100. Valid values are 1 through 1000."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),...mt.properties},{description:"Log search query. Provide a time range, optional Tsuga query, and optional limit."}),O9={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(tN,{examples:[O9]});var rN=m({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:`${Hs}/search`,method:"GET",query:tN,response:t.Object({logs:t.Array(vf,{description:"Log events matching the query and time range."})})}),A9=t.Object({pattern:t.String({description:"Clustered log pattern formatted as a readable string."}),size:t.Integer({description:"Number of logs that matched the pattern"}),groups:t.Array(t.Object({key:t.String({description:"Attribute dot-path shared by all logs in the pattern."}),value:t.String({description:"Value of the attribute identified by `key`, common to all logs in the pattern."})},{description:"Attribute key-value pair that is constant across every log matching this pattern, e.g. a shared `level` or `context.team`."}))}),nN=t.Object({patterns:t.Array(A9,{description:"Log patterns clustered from logs matching the query."}),sampleSize:t.Number({description:"Number of logs sampled while computing patterns."})},{}),x9={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(nN,{examples:[x9]});var oN=m({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:`${Hs}/patterns`,method:"GET",query:t.Object({...mt.properties,query:p({type:"tsuga-query",description:"Tsuga query selecting logs to cluster into patterns."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:nN}),R9=t.Object({exampleLog:t.Optional(vf),team:t.String({description:"Team associated with the new error pattern."}),env:t.String({description:"Environment associated with the new error pattern."}),service:t.String({description:"Service associated with the new error pattern."}),firstSeen:t.Number({description:"Unix timestamp in seconds when this pattern was first seen."}),lastSeen:t.Number({description:"Unix timestamp in seconds when this pattern was last seen."})}),iN=t.Object({newErrorPatterns:t.Array(R9,{description:"Error patterns first seen in the requested time range."})},{}),C9={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(iN,{examples:[C9]});var aN=m({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:`${Hs}/patterns/new`,method:"GET",query:t.Object({...mt.properties,team:t.Optional(p({description:"Team name to restrict pattern detection to."})),env:t.Optional(p({description:"Environment to restrict pattern detection to."})),service:t.Optional(p({description:"Service name to restrict pattern detection to."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:iN}),P9=t.Object({team:t.String({description:"Team associated with the error pattern."}),env:t.String({description:"Environment associated with the error pattern."}),pattern:t.String({description:"Error pattern formatted as a readable string."}),increaseTimestamps:t.Array(t.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."}))}),sN=t.Object({errorPatternIncreases:t.Array(P9,{description:"Error patterns with increased occurrence in the requested time range."})},{}),U9={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(sN,{examples:[U9]});var cN=m({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:`${Hs}/patterns/increase`,method:"GET",query:t.Object({...mt.properties,team:p({description:"Team name to analyze for pattern increases."}),env:t.Optional(p({description:"Environment to restrict the analysis to."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))}),response:sN}),pN=t.Object({attributes:t.Array(t.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),w9={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(pN,{examples:[w9]});var N9=t.Object({...mt.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Log attribute discovery query. Provide a time range and optional cluster ID."}),uN=m({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:`${Hs}/attributes`,method:"GET",query:N9,response:pN});var Gr="/v0/metrics",L9=t.Object({__tsuga_metadata__:t.Object({},{additionalProperties:!0}),context:t.Optional(t.Object({},{additionalProperties:!0})),message:t.Optional(t.String()),timestamp:t.Number(),level:t.Enum(Nf)},{additionalProperties:!0}),KWe=m({tags:["metrics"],url:`${Gr}/count`,method:"GET",query:t.Pick(lo,["from","to","query","clusterId"]),response:t.Object({count:t.Number()})}),zWe=m({tags:["metrics"],url:`${Gr}/search`,method:"GET",query:lo,response:t.Object({logs:t.Optional(t.Array(L9)),totalHits:t.Optional(t.Number()),attributesToHighlight:t.Optional(t.Array(Fs))},{additionalProperties:!0})}),Xp=t.Enum(["counter","gauge","histogram","summary","composite_histogram"],{description:"Metric instrument type, set by the reporting instrumentation. `counter` accumulates a monotonically increasing total (aggregate with `sum` or `increase`); `gauge` reports a point-in-time value that can go up or down (aggregate with `average`, `max`, `min`, or `last`); `histogram`, `composite_histogram`, and `summary` report a distribution of values, from which percentiles can be computed. Tsuga displays `composite_histogram` metrics as Histogram in the app."}),kf=t.Enum(["delta","cumulative","none"],{description:"Metric temporality. `delta` reports changes per collection interval, `cumulative` reports running totals, and `none` means temporality is not applicable or unknown."}),lN=t.Number({description:"Timestamp of the most recent data point recorded for this metric, in milliseconds since the Unix epoch. Omitted when Tsuga has no record of it. Computed from a periodically refreshed metadata snapshot, so it can lag ingestion by a few minutes and should not be used to detect sub-minute gaps."}),v9=t.Object({capabilities:t.Optional(t.Array(t.String(),{description:"Aggregate function types (such as `max`, `min`, `sum`) supported when querying or graphing this metric. If this field is omitted or empty, all aggregate types are supported."})),description:t.Optional(t.String({description:"Human-readable description of the metric"})),tags:t.Optional(t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping this metric. Exposed publicly as `attributes`."})),temporality:t.Optional(kf),type:t.Optional(Xp),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:t.Optional(lN)}),YWe=m({url:`${Gr}/metadata`,method:"GET",query:t.Object({...Ve.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:v9}),VWe=m({tags:["metrics"],url:Gr,method:"GET",query:t.Object({...Ve.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Array(t.String())}),Jp=t.Array(t.Object({name:t.String({description:"Metric name observed by Tsuga."}),type:Xp,lastSeen:t.Optional(lN)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),k9=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Jp,{examples:[k9]});var QWe=m({tags:["metrics"],url:`${Gr}/names-and-types`,method:"GET",query:t.Object({...Ve.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Jp}),Ks=t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),M9=["service","env","host","method","status_code"];Object.assign(Ks,{examples:[M9]});var WWe=m({tags:["metrics"],url:`${Gr}/attributes`,method:"GET",query:t.Object({...Ve.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Ks}),ZWe=m({tags:["metrics"],url:`${Gr}/attributes/batch`,method:"GET",query:t.Object({...Ve.properties,metricNames:t.Array(p({allowEmpty:!1}),{minItems:1,description:"Metric names to fetch attributes for"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Ks}),Mf=t.Object({assets:t.Array(t.Object({type:t.Enum(["dashboard","monitor"],{description:"Kind of asset referencing the metric."}),id:t.String({description:"Dashboard or monitor ID for the asset that queries this metric."}),name:t.String({description:"Display name of the referencing dashboard or monitor."}),owner:t.String({description:"Team ID that owns the referencing dashboard or monitor."})},{description:"A dashboard or monitor that queries this metric."}),{description:"Dashboards and monitors that currently query this metric."})}),XWe=m({tags:["metrics"],url:`${Gr}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1})}),response:Mf}),JWe=m({url:`${Gr}/per-attribute`,method:"GET",query:t.Object({from:t.Optional(t.Number()),to:t.Optional(t.Number()),attribute:p(),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Array(t.String())});var Df=`/${"v1"}/metrics`,D9=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Jp,{examples:[D9]});var Gf=t.Object({name:t.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:Xp,description:t.Optional(t.String({description:"Human-readable description of what the metric measures, set by the reporting instrumentation. Omitted when the instrumentation did not provide one."})),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."})),temporality:t.Optional(kf),capabilities:t.Optional(t.Array(t.String(),{description:"Aggregate function types (such as `max`, `min`, `sum`) supported when querying or graphing this metric. An empty or omitted array means all aggregate types are supported."})),attributes:t.Optional(t.Array(t.String(),{description:"Metric attribute names available as dimensions for filtering or grouping."}))}),G9={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(Gf,{examples:[G9]});var mN=t.Object({...mt.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Metric metadata query. Provide the time range to inspect and optionally a cluster ID."}),dN=m({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:Df,method:"GET",query:mN,response:t.Array(Gf)}),fN=m({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:`${Df}/:name`,method:"GET",params:t.Object({name:p({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:mN,response:Gf}),$9=["service","env","host","method","status_code"];Object.assign(Ks,{examples:[$9]});var gN=t.Pick(Mf,["assets"]),j9={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(gN,{examples:[j9]});var yN=m({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${Df}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:gN});var vi="/v0/traces",d7e=m({tags:["traces"],url:`${vi}/count`,method:"GET",query:t.Pick(lo,["from","to","query","clusterId"]),response:t.Object({count:t.Number()})}),B9=["unset","ok","error"],q9=t.Enum(B9),F9=["unspecified","internal","server","client","producer","consumer"],H9=t.Enum(F9),TN=t.Object({__tsuga_metadata__:t.Optional(t.Object({},{additionalProperties:!0})),context:t.Optional(t.Object({telemetry:t.Optional(t.Object({sdk:t.Optional(t.Object({language:t.Optional(t.String())},{additionalProperties:!0}))},{additionalProperties:!0})),tag_policy_warnings:t.Optional(t.Record(t.String(),t.String())),service:t.Optional(t.Object({name:t.Optional(t.String()),version:t.Optional(t.String())},{additionalProperties:!0})),env:t.Optional(t.String())},{additionalProperties:!0})),parent_span_id:t.Optional(t.String()),resource_attributes:t.Object({},{additionalProperties:!0}),span_attributes:t.Object({},{additionalProperties:!0}),duration:t.Number({description:"In milliseconds."}),duration_ns:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),start_time:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),end_time:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:t.Optional(t.Object({message:t.String()})),events:t.Optional(t.Array(t.Object({event_attributes:t.Object({},{additionalProperties:!0}),event_name:t.String(),event_timestamp_nanos:t.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."})}))),links:t.Optional(t.Array(t.Object({},{additionalProperties:!0}))),span_id:t.String(),span:t.Object({kind:H9,name:t.String()}),status_code:t.Optional(q9),trace_id:t.String()}),EN=100,K9="start_time",z9="duration_ns",Y9=t.Union([t.Literal(K9),t.Literal(z9)]),V9={...Ve.properties,query:t.Optional(p({type:"tsuga-query"})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4})),shouldRecommendAttributes:t.Optional(t.Boolean()),startOffset:t.Optional(t.Number({minimum:qs})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),sortBy:t.Optional(Y9),sortDirection:t.Optional(t.Union([t.Literal("asc"),t.Literal("desc")]))},f7e=m({tags:["traces"],url:`${vi}/search`,method:"GET",query:t.Object(V9),response:t.Object({spans:t.Optional(t.Array(TN)),attributesToHighlight:t.Optional(t.Array(Fs))})});var Q9=t.Object({groupByAttributes:t.Array(p({allowEmpty:!1}),{description:'Glob patterns of span_attributes keys to use as additional grouping dimensions (e.g. "db.*"). Matches against flattened dotted keys of span_attributes only.'}),minLeafSpansToAggregate:t.Integer({minimum:2,description:"Minimum leaf-group size before aggregation occurs. Default 5."}),maxParentDepth:t.Integer({minimum:-1,description:"Max depth of recursive parent aggregation. 0 = leaves only, -1 = unlimited (default)."}),aggregationHistogramBucketsSeconds:t.Array(t.Number({minimum:0}),{description:"Upper bounds for the latency histogram in seconds. Empty array disables the histogram attributes."}),sortSpans:t.Boolean({description:"Whether to sort the returned spans by start_time (span_id tie-breaker). Set false when the caller reconstructs the trace tree and does not need ordering. Default true."})}),W9=t.Object({...Ve.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),...t.Partial(Q9).properties}),g7e=m({tags:["traces"],url:`${vi}/summarize`,method:"GET",query:W9,response:t.Object({spans:t.Array(TN)})}),y7e=m({tags:["traces"],url:`${vi}/attributes`,method:"GET",query:t.Object({...Ve.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Object({attributes:t.Array(t.String())})}),Z9=t.Object({key:t.String({description:"Opaque stable key identifying this contributing service within the response. Tsuga assigns it while building the summary; `ranges[].contributions[].serviceKey` and `serviceTotals[].serviceKey` reference this value."}),name:t.String({description:"Observed service name that contributed leaf-span time to the trace. Comes from trace service context and is returned for every contributing service."}),env:t.Optional(t.String({description:"Observed service environment for this contributing service. Comes from trace service context and is absent when the spans do not carry an environment."})),id:t.Optional(t.String({description:"Service catalog ID for this contributing service. Tsuga sets it when exactly one catalog entry matches the observed service and environment; absent when the service is not cataloged or matches ambiguously."})),namespace:t.Optional(t.String({description:"Service namespace from the matched service catalog entry. Returned only when Tsuga can resolve the contributing service to one catalog entry with a namespace."}))}),X9=t.Object({fromNs:t.String({description:"Range start time in nanoseconds since Unix epoch. Tsuga sets it from the trace timeline split where active leaf spans change. Transmitted as a string to avoid losing precision."}),toNs:t.String({description:"Range end time in nanoseconds since Unix epoch. Tsuga sets it from the trace timeline split where active leaf spans change. Transmitted as a string to avoid losing precision."}),durationNs:t.String({description:"Range duration in nanoseconds, computed as `toNs - fromNs`. Transmitted as a string to avoid losing precision."}),contributions:t.Array(t.Object({serviceKey:t.String({description:"Contributing service key for this range. References `services[].key` in the same response."}),weight:t.Number({description:"Share of this range attributed to the service, from `0` through `1`. Tsuga computes the weight from active leaf spans in the range; weights inside one range sum to `1`."}),durationNs:t.String({description:"Estimated duration attributed to this service in the range, computed as `weight` times the range's own `durationNs` and rounded to whole nanoseconds. Use `serviceTotals` as authoritative when rounded range values do not add up exactly."})}),{description:"Services contributing active leaf-span time to this range, with weighted shares for the range duration."}),spanIds:t.Array(t.String(),{description:"Leaf span IDs that produced this range. Tsuga returns IDs from the leaf-only attribution set, including merged sub-ranges after short-range collapsing."})}),J9=t.Object({serviceKey:t.String({description:"Contributing service key for this aggregate total. References `services[].key` in the same response."}),durationNs:t.String({description:"Total wall-clock contribution of this service across the trace, in nanoseconds. Sum of `weight * durationNs` over every range the service contributes to; authoritative when it disagrees with rounded per-range values. Transmitted as a string to avoid losing precision."}),share:t.Number({description:"Share of total trace duration attributed to this service, from `0` through `1`. Computed as `durationNs / totalDurationNs`; multiply by 100 for a percentage."})}),$f=t.Optional(t.Number({minimum:0,description:"Minimum range duration in milliseconds. Shorter ranges are collapsed (absorbed into a neighbor or blended with adjacent shorts) to keep the timeline readable. When omitted, the default depends on the trace: max(1ms, 1% of the total trace duration), so e.g. a 10s trace collapses ranges shorter than 100ms. Pass 0 to disable collapsing."})),jf=t.Optional(t.Boolean({default:!0,description:"When false, omits the per-range timeline (returns `ranges: []`) and returns only `services` and `serviceTotals`. Cuts payload size for callers that only need the headline. Defaults to true."})),eu=t.Object({traceId:t.String({description:"Trace ID summarized by the response. Echoes the required `traceId` query parameter."}),startTimeNs:t.String({description:"Earliest `start_time` across fetched spans, in nanoseconds since Unix epoch. If the request window does not cover the full trace, this reflects the fetched subset, not necessarily the trace's true start. Transmitted as a string to avoid losing precision."}),endTimeNs:t.String({description:"Latest `end_time` across fetched spans, in nanoseconds since Unix epoch. If the request window does not cover the full trace, this reflects the fetched subset, not necessarily the trace's true end. Transmitted as a string to avoid losing precision."}),totalDurationNs:t.String({description:"Total fetched trace duration in nanoseconds, computed as `endTimeNs - startTimeNs`. Transmitted as a string to avoid losing precision."}),truncated:t.Boolean({description:"Whether the underlying span fetch hit its result cap. When true, the latency summary may be incomplete because not every span in the trace was available."}),services:t.Array(Z9,{description:"Unique services that contributed leaf-span time to the trace, enriched with catalog IDs when Tsuga can resolve them. Referenced by `serviceKey` from `ranges` and `serviceTotals`."}),ranges:t.Array(X9,{description:"Sequential trace timeline split into ranges wherever the active leaf-span set changes. Empty when the request sets `includeRanges` to false."}),serviceTotals:t.Array(J9,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),e4={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(eu,{examples:[e4]});var h7e=m({tags:["traces"],url:`${vi}/latency-summary`,method:"GET",query:t.Object({...Ve.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),minRangeDurationMs:$f,includeRanges:jf}),response:eu}),hN=t.Object({filter:p({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:Vo}),t4=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number()}),r4=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number(),lift:t.Union([t.Number(),t.Null()]),pValue:t.Number()}),n4=t.Object({attr:t.String(),values:t.Array(r4),otherValues:t.Array(t4)}),T7e=m({tags:["traces"],url:`${vi}/contrast-sets`,method:"POST",body:t.Object({groupA:hN,groupB:hN,candidateAttrs:t.Optional(t.Array(p({allowEmpty:!1}))),topK:t.Optional(t.Integer({minimum:1,maximum:100})),minLift:t.Optional(t.Number({minimum:1})),minSupport:t.Optional(t.Number({minimum:0,maximum:100})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Object({contrastSets:t.Array(n4),groupACount:t.Number(),groupBCount:t.Number()})});var Bf=`/${"v1"}/traces`,qf=t.Object({context:t.Optional(t.Object({service:t.Optional(t.Object({name:t.Optional(t.String({description:"Service name associated with the span."})),version:t.Optional(t.String({description:"Service version associated with the span."}))},{additionalProperties:!0,description:"Service identity associated with the span, from OpenTelemetry service resource attributes."}))},{additionalProperties:!0,description:"OpenTelemetry resource context resolved for the span, holding the identity of the emitting service."})),parentSpanId:t.Optional(t.String({description:"`spanId` of this span's parent within the same trace. Absent for the root span."})),resourceAttributes:t.Object({},{additionalProperties:!0,description:"OpenTelemetry resource attributes describing the process/host that emitted the span (e.g. `host.name`, `k8s.pod.name`), as a flat key-value map set by the instrumented service or its SDK."}),spanAttributes:t.Object({},{additionalProperties:!0,description:"OpenTelemetry span attributes describing this operation (e.g. HTTP method, DB statement), as a flat key-value map set by the instrumented code or auto-instrumentation."}),duration:t.Number({description:"Span duration in milliseconds, derived from the nanosecond `startTime` and `endTime` values."}),startTime:t.String({description:"Span start time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),endTime:t.String({description:"Span end time as a Unix epoch timestamp in nanoseconds, encoded as a string to preserve precision."}),error:t.Optional(t.Object({message:t.String({description:"Error message associated with the span."})},{description:"Error details associated with the span, separate from the OpenTelemetry `statusCode` field."})),events:t.Optional(t.Array(t.Object({event_attributes:t.Object({},{additionalProperties:!0,description:"Key-value attributes recorded with this event, set by the instrumented code when the event was added to the span (e.g. exception details)."}),event_name:t.String({description:"Name of the span event."}),event_timestamp_nanos:t.String({description:"Event timestamp in nanoseconds, transmitted as a string for precision."})},{description:"A single timestamped event recorded on the span, with its name and attributes."}),{description:"Events recorded on the span."})),spanId:t.String({description:"Unique span ID within the trace."}),span:t.Object({kind:t.String({description:"OpenTelemetry span kind describing the relationship to remote calls: `unspecified`, `internal`, `server`, `client`, `producer`, or `consumer`."}),name:t.String({description:"Operation name recorded on the span."})},{description:"Operation identity for the span, combining the recorded operation name and the OpenTelemetry span kind."}),statusCode:t.Optional(t.String({description:"OpenTelemetry span status set by the instrumented code: `unset` (default, no explicit status), `ok`, or `error`. Absent if the source span never set a status."})),traceId:t.String({description:"Trace ID shared by all spans in the trace."})},{additionalProperties:!0,$id:"SpanEvent",description:"Distributed tracing span including timing, identifiers, OpenTelemetry attributes, events, and status metadata."}),o4={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(qf,{examples:[o4]});var i4={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},_N=t.Object({...mt.properties,query:t.Optional(p({type:"tsuga-query",default:"*",description:"Tsuga query selecting spans to return. Omit to search all spans in the range with `*`."})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4,default:EN,description:"Maximum number of spans to return. Defaults to 100. Valid values are 1 through 10000."})),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."}))},{description:"Span search query. Provide a time range, optional Tsuga query, and optional limit."});Object.assign(_N,{examples:[i4]});var IN=m({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:`${Bf}/search`,method:"GET",query:_N,response:t.Object({spans:t.Array(qf,{description:"Spans matching the query and time range."})})}),a4={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},bN=t.Object({...mt.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize. Use the `traceId` returned by span search, the trace details page, or your tracing instrumentation. Required; the requested time range must include the trace."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),groupByAttributes:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Glob patterns of span attribute keys to use as additional grouping dimensions. Use this when spans should be summarized separately for matching attributes, such as `db.*`. Matches flattened dotted span attribute keys; omitted by default."})),minLeafSpansToAggregate:t.Optional(t.Integer({minimum:2,default:5,description:"Minimum number of similar leaf spans in a group before Tsuga replaces them with one synthetic summary span. Use higher values for less aggressive summarization. Optional; defaults to 5 and must be at least 2."})),maxParentDepth:t.Optional(t.Integer({minimum:-1,default:-1,description:"Maximum depth of recursive parent aggregation after leaf spans are summarized. Use this to limit parent-level aggregation. Use `0` to aggregate leaf spans only or `-1` for unlimited depth; defaults to `-1`."})),aggregationHistogramBucketsSeconds:t.Optional(t.Array(t.Number({minimum:0}),{description:"Upper-bound bucket values, in seconds, for the latency histogram recorded on synthetic summary spans. Provide custom buckets when the default latency buckets are not suitable. Pass an empty array to omit histogram attributes; omitted values use Tsuga defaults from 5 ms through 10 s."})),sortSpans:t.Optional(t.Boolean({default:!0,description:"Whether Tsuga sorts returned spans by start time, using span ID as the tie-breaker for identical start times. Defaults to `true`; set to `false` only when reconstructing the trace tree yourself, in which case summary spans are appended after surviving spans."}))},{description:"Trace summarization query. Provide a trace ID, a time range covering the trace, and optional aggregation tuning."});Object.assign(bN,{examples:[a4]});var SN=m({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:`${Bf}/summarize`,method:"GET",query:bN,response:t.Object({spans:t.Array(qf,{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`."})})}),s4={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},ON=t.Object({...mt.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize. Use the `traceId` returned by span search, the trace details page, or your tracing instrumentation. Required; the requested time range must include the trace."}),clusterId:t.Optional(p({allowEmpty:!1,description:"Telemetry cluster to target. Required when the organization has multiple clusters; omit only for single-cluster organizations."})),minRangeDurationMs:$f,includeRanges:jf},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(ON,{examples:[s4]});var AN=m({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:`${Bf}/latency-summary`,method:"GET",query:ON,response:eu});var CN=["timestamp","level","message"],PN=["count","ratio","team","level","pattern"];function it(e,r){let n=r??Ir(e);if(!n)throw new Error(`--${e} is required`);return Xs(n)}function xN(e){let r={from:it("from",e.from),to:it("to",e.to)},n=e.query??Ir("query");n!==void 0&&(r.query=n);let o=e.maxResults??Ir("max-results");if(o!==void 0){let i=Number(o);if(Number.isNaN(i))throw new Error(`--max-results must be a number (got: ${o})`);r.maxResults=i}return r}function Ie(e){let r=Ir(e);return r===void 0?"":` (default: ${r})`}function c4(e){let r=fu(e.output),n=e.fields===void 0?void 0:gu(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??CN}}function p4(e){let r=fu(e.output),n=e.fields===void 0?void 0:gu(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??PN}}function RN(e,r){let n={count:e.size,ratio:r>0?e.size/r:0,pattern:e.pattern};for(let{key:o,value:i}of e.groups)o==="context.team"?n.team=i:n[o]=i;return n}function u4(e,r){if(r.format==="json"){if(r.fields===void 0){Q(e);return}let{fields:i}=r;Q({patterns:e.patterns.map(a=>RN(a,e.sampleSize)).map(a=>yu(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>RN(i,e.sampleSize)),o=hu(r.format,n,r.fields);o.length>0&&q(o)}function l4(e,r){if(r.format==="json"){if(r.fields===void 0){Q(e);return}let{fields:o}=r;Q({logs:e.logs.map(i=>yu(i,o))});return}let n=hu(r.format,e.logs,r.fields);n.length>0&&q(n)}function UN(e,r){let n=e.command("logs").description("Search and analyze logs");n.command("search").description("Search logs").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs${Ie("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-1000${Ie("max-results")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each log (default for --output=tsv|csv: ${CN.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=c4(c),d=await r()(rN,{query:xN(c)});l4(d,l)}),n.command("attributes").description("List log attribute dot-paths observed in the time range").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).action(async c=>{let l=await r()(uN,{query:{from:it("from",c.from),to:it("to",c.to)}});Q(l)}),n.command("patterns").description("List log patterns").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs before clustering into patterns${Ie("query")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each pattern (default for --output=tsv|csv: ${PN.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=p4(c),d={from:it("from",c.from),to:it("to",c.to)},f=c.query??Ir("query");f!==void 0&&(d.query=f);let g=await r()(oN,{query:d});u4(g,l)}),n.command("new-error-patterns").description("List error patterns first seen in this time range").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("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:it("from",c.from),to:it("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 d=await r()(aN,{query:l});Q(d)}),n.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).requiredOption("--team <TEAM_NAME>","Team to query").option("--env <ENV_NAME>","Filter by environment").action(async c=>{let l={from:it("from",c.from),to:it("to",c.to),team:c.team};c.env!==void 0&&(l.env=c.env);let d=await r()(cN,{query:l});Q(d)});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${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).action(async c=>{let l=await r()(dN,{query:{from:it("from",c.from),to:it("to",c.to)}});Q(l)}),o.command("get <METRIC_NAME>").description("Retrieve a metric by name with its metadata").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).action(async(c,l)=>{let d=await r()(fN,{params:{name:c},query:{from:it("from",l.from),to:it("to",l.to)}});Q(d)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await r()(yN,{query:{metricName:c}});Q(l)});let i=e.command("traces").description("Search and summarize traces");i.command("search").description("Search spans").option("--from <TIMESTAMP>",`Start of time range${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter spans${Ie("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-10000${Ie("max-results")}`).action(async c=>{let l=await r()(IN,{query:xN(c)});Q(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${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("to")}`).action(async c=>{let l=await r()(SN,{query:{traceId:c.traceId,from:it("from",c.from),to:it("to",c.to)}});Q(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${Ce}${Ie("from")}`).option("--to <TIMESTAMP>",`End of time range${Ce}${Ie("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:it("from",c.from),to:it("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 d=await r()(AN,{query:l});Q(d)});let a=e.command("aggregation").description("Run aggregation queries");io(a,"scalar","Run aggregation queries and return scalar results",zC,r),io(a,"timeseries","Run aggregation queries and return timeseries results",VC,r)}var m4="x-tsuga-session-id",Ff="x-tsuga-source",Hf="x-tsuga-source-version",Kf="x-tsuga-source-commit",zf="x-tsuga-source-date",Yf="x-tsuga-rationale",d4="x-tsuga-dashboard-id",f4="x-tsuga-widget-id",g4="x-request-id",D7e={[m4]:"Session identifier for request correlation",[Ff]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[Hf]:"SDK version",[Kf]:"SDK commit hash",[zf]:"SDK commit date",[Yf]:"Optional caller-supplied rationale for this request, recorded for telemetry",[d4]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[f4]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[g4]:"Unique identifier for this API request, useful for debugging and support"};var bn=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 wN(e){if(e instanceof bn){let r=[`Error: ${e.message}`];return e.code&&r.push(`Code: ${e.code}`),e.statusCode&&r.push(`Status: ${e.statusCode}`),e.requestId&&r.push(`Request ID: ${e.requestId}`),e.details&&r.push(`Details: ${JSON.stringify(e.details,null,2)}`),r.join(`
|
|
171
|
-
`)}return e instanceof Error?`Error: ${e.message}`:String(e)}function
|
|
168
|
+
`:o}var dV={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 fV(e,t,n,o){let i=(0,Xi.join)(e,".claude","settings.json");V(`Claude Code \u2192 ${i}`),(0,Qg.mkdirSync)((0,Xi.dirname)(i),{recursive:!0});let a=ys(i),c;try{c=JSON.parse(a??"{}")}catch{throw new Error(`${i} is not valid JSON. Fix or remove it before re-running.`)}if(!Eo(c))throw new Error(`${i} must contain a JSON object at the top level.`);let l=c.env??{};if(!Eo(l))throw new Error(`${i} "env" must be a JSON object.`);let m=o?"1":"0";c.env={...l,...dV,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=Ts(i,a);hs(i,`${JSON.stringify(c,null,2)}
|
|
169
|
+
`),V(f===void 0?" created":` patched (backup: ${f})`)}function gV(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 hV(e,t,n,o){let i=(0,Xi.join)(e,".codex"),a=(0,Xi.join)(i,"config.toml");V(`Codex \u2192 ${a}`),(0,Qg.mkdirSync)(i,{recursive:!0});let c=ys(a),l=c===void 0?{}:Bg(c),m="otel"in l;delete l.otel,l.otel=gV(t,n,o);let f=Ts(a,c);hs(a,Yg(l)),V(f===void 0?" created":m?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function TL(){return new Lr("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function EL(){return new Lr("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var _L="Restart your claude / codex session to load the new config.";function IL(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(TL()).addOption(EL()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{fV((0,Vg.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),V(_L)}),t.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(TL()).addOption(EL()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{hV((0,Vg.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),V(_L)})}var So="/v0/logs";var Wg=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var oc=0,Zg=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(Wg,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[RO]:r.Optional(r.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),bL=100,yV="timestamp",TV=r.Union([r.Literal(yV)]),vn=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:oc,description:"Result offset used when fetching additional log rows."}),startOffsets:r.Array(r.Number({minimum:oc}),{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 ${oc} for every cluster.`}),clusterId:u({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:Ya,sortBy:TV,sortDirection:r.Union([r.Literal("asc"),r.Literal("desc")],{description:"Timestamp sort direction for log results."})})),qtt=d({tags:["logs"],url:`${So}/count`,method:"GET",query:r.Pick(vn,["from","to","query","clusterId","clusterIds"]),response:r.Object({count:r.Number(),clusterResponses:r.Optional(ni())})}),ic=r.Object({value:r.String(),priority:r.Number()}),Ftt=d({tags:["logs"],url:`${So}/search`,method:"GET",query:vn,response:r.Object({logs:r.Optional(r.Array(Zg)),attributesToHighlight:r.Optional(r.Array(ic)),clusterResponses:r.Optional(ni(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})}),EV=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"}),_V=r.Object({id:r.String(),pattern:r.Array(EV),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"}))}),Btt=d({tags:["logs"],url:`${So}/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(_V),sampleSize:r.Number()})}),Htt=d({tags:["logs"],url:`${So}/attributes`,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),clusterIds:r.Optional(Ya)}),response:r.Object({attributes:r.Array(r.String()),clusterResponses:r.Optional(ni())})});var IV=["pending","running","completed","incomplete","failed"],SL=r.Object({id:r.String({description:"ID of the export."}),status:r.Enum(IV,{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."}))}),Ktt=d({tags:["logs"],url:`${So}/exports`,method:"POST",body:r.Object({...r.Pick(vn,["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({...SL.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."})})}),ztt=d({tags:["logs"],url:`${So}/exports/:exportId`,method:"GET",params:r.Object({exportId:r.String()}),response:SL}),Ytt=d({tags:["logs"],url:`${So}/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 ac=`/${"v1"}/logs`,Xg=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(Zg,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),bV={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(Xg,{examples:[bV]});var AL=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:bL,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."}),SV={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(AL,{examples:[SV]});var OL=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:`${ac}/search`,method:"GET",query:AL,response:r.Object({logs:r.Array(Xg,{description:"Log events matching the query and time range."})})}),AV=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`."}))}),xL=r.Object({patterns:r.Array(AV,{description:"Log patterns clustered from logs matching the query."}),sampleSize:r.Number({description:"Number of logs sampled while computing patterns."})},{}),OV={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(xL,{examples:[OV]});var RL=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:`${ac}/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:xL}),xV=r.Object({exampleLog:r.Optional(Xg),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."})}),CL=r.Object({newErrorPatterns:r.Array(xV,{description:"Error patterns first seen in the requested time range."})},{}),RV={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(CL,{examples:[RV]});var PL=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:`${ac}/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:CL}),CV=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."}))}),UL=r.Object({errorPatternIncreases:r.Array(CV,{description:"Error patterns with increased occurrence in the requested time range."})},{}),PV={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(UL,{examples:[PV]});var wL=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:`${ac}/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:UL}),vL=r.Object({attributes:r.Array(r.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),UV={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(vL,{examples:[UV]});var wV=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."}),NL=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:`${ac}/attributes`,method:"GET",query:wV,response:vL});var Jr="/v0/metrics",vV=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(Wg)},{additionalProperties:!0}),srt=d({tags:["metrics"],url:`${Jr}/count`,method:"GET",query:r.Pick(vn,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),crt=d({tags:["metrics"],url:`${Jr}/search`,method:"GET",query:vn,response:r.Object({logs:r.Optional(r.Array(vV)),totalHits:r.Optional(r.Number()),attributesToHighlight:r.Optional(r.Array(ic))},{additionalProperties:!0})}),sl=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."}),Jg=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."}),LL=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."}),NV=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(Jg),type:r.Optional(sl),unit:r.Optional(r.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:r.Optional(LL)}),prt=d({url:`${Jr}/metadata`,method:"GET",query:r.Object({...at.properties,metricName:u({allowEmpty:!1}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:NV}),urt=d({tags:["metrics"],url:Jr,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:r.Array(r.String())}),cl=r.Array(r.Object({name:r.String({description:"Metric name observed by Tsuga."}),type:sl,lastSeen:r.Optional(LL)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),LV=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(cl,{examples:[LV]});var lrt=d({tags:["metrics"],url:`${Jr}/names-and-types`,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:cl}),sc=r.Array(r.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),kV=["service","env","host","method","status_code"];Object.assign(sc,{examples:[kV]});var mrt=d({tags:["metrics"],url:`${Jr}/attributes`,method:"GET",query:r.Object({...at.properties,metricName:u({allowEmpty:!1}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:sc}),drt=d({tags:["metrics"],url:`${Jr}/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:sc}),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."})}),frt=d({tags:["metrics"],url:`${Jr}/assets-usage`,method:"GET",query:r.Object({metricName:u({allowEmpty:!1})}),response:eh}),grt=d({url:`${Jr}/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 th=`/${"v1"}/metrics`,MV=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(cl,{examples:[MV]});var rh=r.Object({name:r.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:sl,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(Jg),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."}))}),DV={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(rh,{examples:[DV]});var kL=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."}),ML=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:th,method:"GET",query:kL,response:r.Array(rh)}),DL=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:`${th}/:name`,method:"GET",params:r.Object({name:u({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:kL,response:rh}),GV=["service","env","host","method","status_code"];Object.assign(sc,{examples:[GV]});var GL=r.Pick(eh,["assets"]),$V={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(GL,{examples:[$V]});var $L=d({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${th}/assets-usage`,method:"GET",query:r.Object({metricName:u({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:GL});var Ji="/v0/traces",Prt=d({tags:["traces"],url:`${Ji}/count`,method:"GET",query:r.Pick(vn,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),jV=["unset","ok","error"],qV=r.Enum(jV),FV=["unspecified","internal","server","client","producer","consumer"],BV=r.Enum(FV),qL=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:BV,name:r.String()}),status_code:r.Optional(qV),trace_id:r.String()}),FL=100,HV="start_time",KV="duration_ns",zV=r.Union([r.Literal(HV),r.Literal(KV)]),YV={...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:oc})),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),sortBy:r.Optional(zV),sortDirection:r.Optional(r.Union([r.Literal("asc"),r.Literal("desc")]))},Urt=d({tags:["traces"],url:`${Ji}/search`,method:"GET",query:r.Object(YV),response:r.Object({spans:r.Optional(r.Array(qL)),attributesToHighlight:r.Optional(r.Array(ic))})});var VV=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."})}),QV=r.Object({...at.properties,traceId:u({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),...r.Partial(VV).properties}),wrt=d({tags:["traces"],url:`${Ji}/summarize`,method:"GET",query:QV,response:r.Object({spans:r.Array(qL)})}),vrt=d({tags:["traces"],url:`${Ji}/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())})}),WV=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."}))}),ZV=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."})}),XV=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."})}),nh=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."})),pl=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(WV,{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(ZV,{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(XV,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),JV={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(pl,{examples:[JV]});var Nrt=d({tags:["traces"],url:`${Ji}/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:nh,includeRanges:oh}),response:pl}),jL=r.Object({filter:u({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:oi}),e6=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number()}),t6=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number(),lift:r.Union([r.Number(),r.Null()]),pValue:r.Number()}),r6=r.Object({attr:r.String(),values:r.Array(t6),otherValues:r.Array(e6)}),Lrt=d({tags:["traces"],url:`${Ji}/contrast-sets`,method:"POST",body:r.Object({groupA:jL,groupB:jL,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(r6),groupACount:r.Number(),groupBCount:r.Number()})});var ih=`/${"v1"}/traces`,ah=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."}),n6={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(ah,{examples:[n6]});var o6={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},BL=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:FL,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(BL,{examples:[o6]});var HL=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:`${ih}/search`,method:"GET",query:BL,response:r.Object({spans:r.Array(ah,{description:"Spans matching the query and time range."})})}),i6={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},KL=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(KL,{examples:[i6]});var zL=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:`${ih}/summarize`,method:"GET",query:KL,response:r.Object({spans:r.Array(ah,{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`."})})}),a6={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},YL=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:nh,includeRanges:oh},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(YL,{examples:[a6]});var VL=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:`${ih}/latency-summary`,method:"GET",query:YL,response:pl});var ZL=["timestamp","level","message"],XL=["count","ratio","team","level","pattern"];function gt(e,t){let n=t??Gr(e);if(!n)throw new Error(`--${e} is required`);return hc(n)}function QL(e){let t={from:gt("from",e.from),to:gt("to",e.to)},n=e.query??Gr("query");n!==void 0&&(t.query=n);let o=e.maxResults??Gr("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=Gr(e);return t===void 0?"":` (default: ${t})`}function s6(e){let t=Rl(e.output),n=e.fields===void 0?void 0:Cl(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??ZL}}function c6(e){let t=Rl(e.output),n=e.fields===void 0?void 0:Cl(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??XL}}function WL(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 p6(e,t){if(t.format==="json"){if(t.fields===void 0){J(e);return}let{fields:i}=t;J({patterns:e.patterns.map(a=>WL(a,e.sampleSize)).map(a=>Pl(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>WL(i,e.sampleSize)),o=Ul(t.format,n,t.fields);o.length>0&&V(o)}function u6(e,t){if(t.format==="json"){if(t.fields===void 0){J(e);return}let{fields:o}=t;J({logs:e.logs.map(i=>Pl(i,o))});return}let n=Ul(t.format,e.logs,t.fields);n.length>0&&V(n)}function JL(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: ${ZL.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=s6(c),m=await t()(OL,{query:QL(c)});u6(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()(NL,{query:{from:gt("from",c.from),to:gt("to",c.to)}});J(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: ${XL.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=c6(c),m={from:gt("from",c.from),to:gt("to",c.to)},f=c.query??Gr("query");f!==void 0&&(m.query=f);let h=await t()(RL,{query:m});p6(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()(PL,{query:l});J(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()(wL,{query:l});J(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()(ML,{query:{from:gt("from",c.from),to:gt("to",c.to)}});J(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()(DL,{params:{name:c},query:{from:gt("from",l.from),to:gt("to",l.to)}});J(m)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await t()($L,{query:{metricName:c}});J(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()(HL,{query:QL(c)});J(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()(zL,{query:{traceId:c.traceId,from:gt("from",c.from),to:gt("to",c.to)}});J(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()(VL,{query:l});J(m)});let a=e.command("aggregation").description("Run aggregation queries");Qr(a,"scalar","Run aggregation queries and return scalar results",mw,t),Qr(a,"timeseries","Run aggregation queries and return timeseries results",fw,t)}var l6="x-tsuga-session-id",sh="x-tsuga-source",ch="x-tsuga-source-version",ph="x-tsuga-source-commit",uh="x-tsuga-source-date",lh="x-tsuga-rationale",m6="x-tsuga-dashboard-id",d6="x-tsuga-widget-id",f6="x-request-id",Jrt={[l6]:"Session identifier for request correlation",[sh]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[ch]:"SDK version",[ph]:"SDK commit hash",[uh]:"SDK commit date",[lh]:"Optional caller-supplied rationale for this request, recorded for telemetry",[m6]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[d6]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[f6]:"Unique identifier for this API request, useful for debugging and support"};var Nn=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 ek(e){if(e instanceof Nn){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(`
|
|
170
|
+
`)}return e instanceof Error?`Error: ${e.message}`:String(e)}function g6(e){return e.replace(/\s+/g," ").replace(/[^\x20-\x7e\x80-\xff]/g,"").trim()}function tk(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 Nn("Internal error: params required for this endpoint");h=a.buildUrl(m)}else throw new Nn("Internal error: endpoint has neither url nor buildUrl");let E=n===void 0?f:{clusterId:n,...f},I=WA(`${e}${h}`,E),g={Accept:"application/json",Authorization:`Bearer ${t}`,[sh]:"cli",[ch]:"1.19.0",[ph]:"f1e8db271",[uh]:"2026-08-27T08:03:51.192Z"};l&&(g["Content-Type"]="application/json");let T=o?.(),S=T?g6(T):"";S&&(g[lh]=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 Nn(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 Nn.fromErrorResponse(x.error,x.requestId);return y6(x,h6(c)),x.data}}function h6({body:e,query:t}){let n=t?.offset??e?.offset;return typeof n=="number"?n:0}function y6(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||ny(`Showing ${e.data.length} of ${n.totalCount} (offset ${t}). Use --limit (max ${Jo}) and --offset ${o} for the next page.`)}function mh(e,t=n=>{process.exit(n)}){e.on("error",n=>{if(n.code==="EPIPE"){t(process.exitCode);return}throw n})}var T6=3e3,E6="https://registry.npmjs.org/@tsuga/cli/latest";function _6(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 rk(e){try{let t=gO();if(t&&Date.now()-new Date(t).getTime()<gc)return;let n=await fetch(E6,{signal:AbortSignal.timeout(T6)});if(!n.ok)return;let i=(await n.json()).version;_6(i,e)&&(process.stderr.write(`
|
|
172
171
|
Update available: ${e} \u2192 ${i}
|
|
173
|
-
`),process.stderr.write("Run `tsuga self-update` to update\n")),
|
|
174
|
-
`).configureHelp({sortSubcommands:!0}).helpOption("-h, --help","Display help for command").helpCommand("help [command]","Display help for command").option("--operation-api-key <OPERATION_API_KEY>","Operation API key (overrides config and TSUGA_OPERATION_API_KEY)").option("--cluster <CLUSTER_ID>","Target cluster (overrides config and TSUGA_CLUSTER_ID)"),
|
|
172
|
+
`),process.stderr.write("Run `tsuga self-update` to update\n")),hO(new Date().toISOString())}catch{}}mh(process.stdout);mh(process.stderr);var Re=new Ao().name("tsuga").description("Manage Tsuga resources, telemetry, and configuration from the command line").version("1.19.0").addHelpText("before",()=>`${bh()}
|
|
173
|
+
`).configureHelp({sortSubcommands:!0}).helpOption("-h, --help","Display help for command").helpCommand("help [command]","Display help for command").option("--operation-api-key <OPERATION_API_KEY>","Operation API key (overrides config and TSUGA_OPERATION_API_KEY)").option("--cluster <CLUSTER_ID>","Target cluster (overrides config and TSUGA_CLUSTER_ID)"),ul,nk;function wr(){if(ul)return ul;let e=Re.opts(),t=ti({operationApiKey:e.operationApiKey,clusterId:e.cluster});lc(t.credential,new Date)&&(console.error("Your session expired. Run `tsuga auth login` to sign in again."),process.exit(1));let n=aO(t);return 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>"),console.error(" tsuga --operation-api-key <OPERATION_API_KEY> <COMMAND>"),process.exit(1)),ul=tk(t.apiUrl,n,t.clusterId,()=>nk),ul}var ok="Setup & config:",ik="Documentation, help & feedback:";Re.commandsGroup(ok);EO(Re);dx(Re);var I6=new Set(Re.commands);Re.commandsGroup("Resources:");pL(Re,wr);Re.commandsGroup("Query & explore:");JL(Re,wr);fR(Re,wr);IU(Re,wr);RU(Re,wr);iw(Re,wr);hw(Re,wr);Re.commandsGroup(ik);Ex(Re,wr);Sx(Re,wr);Re.commandsGroup(ok);px(Re,wr);IL(Re);OU(Re);lL(Re);mx(Re);Re.commandsGroup(ik).helpCommand("help [command]");function ak(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)ak(t)}var b6=new Set(["completion","self-update","install","setup","feedback"]);for(let e of Re.commands)!I6.has(e)&&!b6.has(e.name())&&ak(e);Re.hook("preAction",(e,t)=>{let{rationale:n}=t.opts();nk=n});Re.parseAsync().then(()=>rk("1.19.0")).catch(e=>{console.error(ek(e)),process.exitCode=1});
|
|
175
174
|
/**
|
|
176
175
|
* The following is a list of HTTP status codes and their meanings.
|
|
177
176
|
*
|
|
@@ -181,10 +180,10 @@ Update available: ${e} \u2192 ${i}
|
|
|
181
180
|
*/
|
|
182
181
|
/*! Bundled license information:
|
|
183
182
|
|
|
184
|
-
smol-toml/dist/error.js:
|
|
185
|
-
smol-toml/dist/util.js:
|
|
186
183
|
smol-toml/dist/date.js:
|
|
184
|
+
smol-toml/dist/error.js:
|
|
187
185
|
smol-toml/dist/primitive.js:
|
|
186
|
+
smol-toml/dist/util.js:
|
|
188
187
|
smol-toml/dist/extract.js:
|
|
189
188
|
smol-toml/dist/struct.js:
|
|
190
189
|
smol-toml/dist/parse.js:
|