@tsuga/cli 1.18.0 → 1.20.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 +3 -1
- package/dist/cli.js +77 -76
- package/package.json +3 -1
package/dist/cli.js
CHANGED
|
@@ -1,54 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var GL=Object.create;var Xu=Object.defineProperty;var $L=Object.getOwnPropertyDescriptor;var jL=Object.getOwnPropertyNames;var qL=Object.getPrototypeOf,BL=Object.prototype.hasOwnProperty;var FL=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),zt=(e,r)=>{for(var n in r)Xu(e,n,{get:r[n],enumerable:!0})},HL=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of jL(r))!BL.call(e,i)&&i!==n&&Xu(e,i,{get:()=>r[i],enumerable:!(o=$L(r,i))||o.enumerable});return e};var tn=(e,r,n)=>(n=e!=null?GL(qL(e)):{},HL(r||!e||!e.__esModule?Xu(n,"default",{value:e,enumerable:!0}):n,e));var aO=FL((iO,Tp)=>{(function(e){"use strict";let r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},o=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",c="(?:[0-9a-f]+::?)+",l={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${c})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${c})|(?:::)(?:${c})?)${r}\\.${r}\\.${r}\\.${r}(${a})?$`,"i")};function d(g,E){if(g.indexOf("::")!==g.lastIndexOf("::"))return null;let O=0,S=-1,x=(g.match(l.zoneIndex)||[])[0],P,ue;for(x&&(x=x.substring(1),g=g.replace(/%.+$/,""));(S=g.indexOf(":",S+1))>=0;)O++;if(g.substr(0,2)==="::"&&O--,g.substr(-2,2)==="::"&&O--,O>=E)return null;for(ue=E-O,P=":";ue--;)P+="0:";return g=g.replace("::",P),g[0]===":"&&(g=g.slice(1)),g[g.length-1]===":"&&(g=g.slice(0,-1)),E=(function(){let en=g.split(":"),Pr=[];for(let Ur=0;Ur<en.length;Ur++)Pr.push(en[Ur].length>4?NaN:parseInt(en[Ur],16));return Pr})(),{parts:E,zoneId:x}}function f(g,E,O,S){if(g.length!==E.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,P;for(;S>0;){if(P=O-S,P<0&&(P=0),g[x]>>P!==E[x]>>P)return!1;S-=O,x+=1}return!0}function y(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 _(g,E){for(;g.length<E;)g=`0${g}`;return g}let I={};I.IPv4=(function(){function g(E){if(E.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let O,S;for(O=0;O<E.length;O++)if(S=E[O],!(0<=S&&S<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=E}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(E,O){let S;if(O===void 0&&(S=E,E=S[0],O=S[1]),E.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,E.octets,8,O)},g.prototype.prefixLengthFromSubnetMask=function(){let E=0,O=!1,S={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 S){if(ue=S[P],O&&ue!==0)return null;ue!==8&&(O=!0),E+=ue}else return null;return 32-E},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 E=this.parseCIDR(g),O=E[0].toByteArray(),S=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),x=[],P=0;for(;P<4;)x.push(parseInt(O[P],10)|parseInt(S[P],10)^255),P++;return new this(x)}catch(E){throw new Error("ipaddr: the address does not have IPv4 CIDR format",{cause:E})}},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 E=g.match(/^(.+)\/(\d+)$/);return!I.IPv4.isValidCIDR(g)||!E?!1:I.IPv4.isValidFourPartDecimal(E[1])},I.IPv4.networkAddressFromCIDR=function(g){let E,O,S,x,P;try{for(E=this.parseCIDR(g),S=E[0].toByteArray(),P=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),x=[],O=0;O<4;)x.push(parseInt(S[O],10)&parseInt(P[O],10)),O++;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 E=this.parser(g);if(E===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(E)},I.IPv4.parseCIDR=function(g){let E;if(E=g.match(/^(.+)\/(\d+)$/)){let O=parseInt(E[2]);if(O>=0&&O<=32){let S=[this.parse(E[1]),O];return Object.defineProperty(S,"toString",{value:function(){return this.join("/")}}),S}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},I.IPv4.parser=function(g){let E,O,S;if(E=g.match(n.fourOctet))return(function(){let x=E.slice(1,6),P=[];for(let ue=0;ue<x.length;ue++)O=x[ue],P.push(y(O));return P})();if(E=g.match(n.longValue)){if(S=y(E[1]),S>4294967295||S<0)throw new Error("ipaddr: address outside defined range");return(function(){let x=[],P;for(P=0;P<=24;P+=8)x.push(S>>P&255);return x})().reverse()}else return(E=g.match(n.twoOctet))?(function(){let x=E.slice(1,4),P=[];if(S=y(x[1]),S>16777215||S<0)throw new Error("ipaddr: address outside defined range");return P.push(y(x[0])),P.push(S>>16&255),P.push(S>>8&255),P.push(S&255),P})():(E=g.match(n.threeOctet))?(function(){let x=E.slice(1,5),P=[];if(S=y(x[2]),S>65535||S<0)throw new Error("ipaddr: address outside defined range");return P.push(y(x[0])),P.push(y(x[1])),P.push(S>>8&255),P.push(S&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 E=[0,0,0,0],O=0,S=Math.floor(g/8);for(;O<S;)E[O]=255,O++;return S<4&&(E[S]=Math.pow(2,g%8)-1<<8-g%8),new this(E)},I.IPv6=(function(){function g(E,O){let S,x;if(E.length===16)for(this.parts=[],S=0;S<=14;S+=2)this.parts.push(E[S]<<8|E[S+1]);else if(E.length===8)this.parts=E;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(S=0;S<this.parts.length;S++)if(x=this.parts[S],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");O&&(this.zoneId=O)}return g.prototype.SpecialRanges={unspecified:[new g([0,0,0,0,0,0,0,0]),128],linkLocal:[new g([65152,0,0,0,0,0,0,0]),10],multicast:[new g([65280,0,0,0,0,0,0,0]),8],loopback:[new g([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new g([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new g([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new g([65216,0,0,0,0,0,0,0]),10],discard:[new g([256,0,0,0,0,0,0,0]),64],rfc6145:[new g([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new g([100,65435,0,0,0,0,0,0]),96],[new g([100,65435,1,0,0,0,0,0]),48]],"6to4":[new g([8194,0,0,0,0,0,0,0]),16],teredo:[new g([8193,0,0,0,0,0,0,0]),32],benchmarking:[new g([8193,2,0,0,0,0,0,0]),48],amt:[new g([8193,3,0,0,0,0,0,0]),32],as112v6:[[new g([8193,4,274,0,0,0,0,0]),48],[new g([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new g([8193,16,0,0,0,0,0,0]),28],orchid2:[new g([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new g([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new g([24320,0,0,0,0,0,0,0]),16],reserved:[[new g([8193,0,0,0,0,0,0,0]),23],[new g([8193,3512,0,0,0,0,0,0]),32],[new g([16383,0,0,0,0,0,0,0]),20]]},g.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},g.prototype.kind=function(){return"ipv6"},g.prototype.match=function(E,O){let S;if(O===void 0&&(S=E,E=S[0],O=S[1]),E.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,E.parts,16,O)},g.prototype.prefixLengthFromSubnetMask=function(){let E=0,O=!1,S={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 S){if(P=S[x],O&&P!==0)return null;P!==16&&(O=!0),E+=P}else return null;return 128-E},g.prototype.range=function(){return I.subnetMatch(this,this.SpecialRanges)},g.prototype.toByteArray=function(){let E,O=[],S=this.parts;for(let x=0;x<S.length;x++)E=S[x],O.push(E>>8),O.push(E&255);return O},g.prototype.toFixedLengthString=function(){let E=(function(){let S=[];for(let x=0;x<this.parts.length;x++)S.push(_(this.parts[x].toString(16),4));return S}).call(this).join(":"),O="";return this.zoneId&&(O=`%${this.zoneId}`),E+O},g.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let E=this.parts.slice(-2),O=E[0],S=E[1];return new I.IPv4([O>>8,O&255,S>>8,S&255])},g.prototype.toNormalizedString=function(){let E=(function(){let S=[];for(let x=0;x<this.parts.length;x++)S.push(this.parts[x].toString(16));return S}).call(this).join(":"),O="";return this.zoneId&&(O=`%${this.zoneId}`),E+O},g.prototype.toRFC5952String=function(){let E=/((^|:)(0(:|$)){2,})/g,O="";this.zoneId&&(O=`%${this.zoneId}`);let S=this.toNormalizedString(),x=S.slice(0,S.length-O.length),P=0,ue=-1,en=-1,Pr;for(;Pr=E.exec(x);){let Ur=(Pr[0].match(/0/g)||[]).length;Ur>en&&(en=Ur,P=Pr.index,ue=Pr[0].length)}return ue<0?x+O:`${x.substring(0,P)}::${x.substring(P+ue)}${O}`},g.prototype.toString=function(){return this.toRFC5952String()},g})(),I.IPv6.broadcastAddressFromCIDR=function(g){try{let E=this.parseCIDR(g),O=E[0].toByteArray(),S=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),x=[],P=0;for(;P<16;)x.push(parseInt(O[P],10)|parseInt(S[P],10)^255),P++;return new this(x)}catch(E){throw new Error("ipaddr: the address does not have IPv6 CIDR format",{cause:E})}},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 E=this.parser(g);return new this(E.parts,E.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 E,O,S,x,P;try{for(E=this.parseCIDR(g),S=E[0].toByteArray(),P=this.subnetMaskFromPrefixLength(E[1]).toByteArray(),x=[],O=0;O<16;)x.push(parseInt(S[O],10)&parseInt(P[O],10)),O++;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 E=this.parser(g);if(E===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(E.parts,E.zoneId)},I.IPv6.parseCIDR=function(g){let E,O,S;if((O=g.match(/^(.+)\/(\d+)$/))&&(E=parseInt(O[2]),E>=0&&E<=128))return S=[this.parse(O[1]),E],Object.defineProperty(S,"toString",{value:function(){return this.join("/")}}),S;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},I.IPv6.parser=function(g){let E,O,S,x,P,ue;if(S=g.match(l.deprecatedTransitional))return this.parser(`::ffff:${S[1]}`);if(l.native.test(g))return d(g,8);if((S=g.match(l.transitional))&&(ue=S[6]||"",E=S[1],S[1].endsWith("::")||(E=E.slice(0,-1)),E=d(E+ue,6),E&&E.parts)){for(P=[parseInt(S[2]),parseInt(S[3]),parseInt(S[4]),parseInt(S[5])],O=0;O<P.length;O++)if(x=P[O],!(0<=x&&x<=255))return null;return E.parts.push(P[0]<<8|P[1]),E.parts.push(P[2]<<8|P[3]),{parts:E.parts,zoneId:E.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 E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=0,S=Math.floor(g/8);for(;O<S;)E[O]=255,O++;return S<16&&(E[S]=Math.pow(2,g%8)-1<<8-g%8),new this(E)},I.fromByteArray=function(g){let E=g.length;if(E===4)return new I.IPv4(g);if(E===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(E){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format",{cause:E})}}},I.process=function(g){let E=this.parse(g);return E.kind()==="ipv6"&&E.isIPv4MappedAddress()?E.toIPv4Address():E},I.subnetMatch=function(g,E,O){let S,x,P,ue;O==null&&(O="unicast");for(x in E)if(Object.prototype.hasOwnProperty.call(E,x)){for(P=E[x],P[0]&&!(P[0]instanceof Array)&&(P=[P]),S=0;S<P.length;S++)if(ue=P[S],g.kind()===ue[0].kind()&&g.match.apply(g,ue))return x}return O},typeof Tp<"u"&&Tp.exports?Tp.exports=I:e.ipaddr=I})(iO)});var rn=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}},vn=class extends rn{constructor(r){super(1,"commander.invalidArgument",r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var Hi=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 vn(`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 Xs(e){let r=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+r+">":"["+r+"]"}var uy=require("node:events"),ec=tn(require("node:child_process"),1),ar=tn(require("node:path"),1),zi=tn(require("node:fs"),1),le=tn(require("node:process"),1),ly=require("node:util");var ay=require("node:util"),Ki=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=>Xs(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(_,I){return n.formatItem(_,o,I,n)}let c=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(r))}`,""],l=n.commandDescription(r);l.length>0&&(c=c.concat([n.boxWrap(n.styleCommandDescription(l),i),""]));let d=n.visibleArguments(r).map(_=>a(n.styleArgumentTerm(n.argumentTerm(_)),n.styleArgumentDescription(n.argumentDescription(_))));if(c=c.concat(this.formatItemList("Arguments:",d,n)),this.groupItems(r.options,n.visibleOptions(r),_=>_.helpGroupHeading??"Options:").forEach((_,I)=>{let g=_.map(E=>a(n.styleOptionTerm(n.optionTerm(E)),n.styleOptionDescription(n.optionDescription(E))));c=c.concat(this.formatItemList(I,g,n))}),n.showGlobalOptions){let _=n.visibleGlobalOptions(r).map(I=>a(n.styleOptionTerm(n.optionTerm(I)),n.styleOptionDescription(n.optionDescription(I))));c=c.concat(this.formatItemList("Global Options:",_,n))}return this.groupItems(r.commands,n.visibleCommands(r),_=>_.helpGroup()||"Commands:").forEach((_,I)=>{let g=_.map(E=>a(n.styleSubcommandTerm(n.subcommandTerm(E)),n.styleSubcommandDescription(n.subcommandDescription(E))));c=c.concat(this.formatItemList(I,g,n))}),c.join(`
|
|
3
|
-
`)}displayWidth(
|
|
4
|
-
`+" ".repeat(n+
|
|
5
|
-
${c}`)}boxWrap(
|
|
6
|
-
`)}};var
|
|
2
|
+
"use strict";var Ok=Object.create;var fl=Object.defineProperty;var xk=Object.getOwnPropertyDescriptor;var Rk=Object.getOwnPropertyNames;var Ck=Object.getPrototypeOf,Pk=Object.prototype.hasOwnProperty;var Uk=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yt=(e,t)=>{for(var n in t)fl(e,n,{get:t[n],enumerable:!0})},wk=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Rk(t))!Pk.call(e,i)&&i!==n&&fl(e,i,{get:()=>t[i],enumerable:!(o=xk(t,i))||o.enumerable});return e};var tn=(e,t,n)=>(n=e!=null?Ok(Ck(e)):{},wk(t||!e||!e.__esModule?fl(n,"default",{value:e,enumerable:!0}):n,e));var ZA=Uk((WA,vp)=>{(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 vp<"u"&&vp.exports?vp.exports=I:e.ipaddr=I})(WA)});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}},kn=class extends rn{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var ra=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 kn(`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 pc(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}var Oh=require("node:events"),lc=tn(require("node:child_process"),1),cr=tn(require("node:path"),1),oa=tn(require("node:fs"),1),le=tn(require("node:process"),1),xh=require("node:util");var Ih=require("node:util"),na=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=>pc(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,Ih.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=vk(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 kn(`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?bh(this.name().replace(/^no-/,"")):bh(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}},uc=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 bh(e){return e.split("-").reduce((t,n)=>t+n[0].toUpperCase()+n.slice(1))}function vk(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 Nk(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 gl(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=Nk(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 Oo=class e extends Oh.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:()=>Ah()??(le.default.stdout.isTTY&&le.default.stdout.hasColors?.()),getErrHasColors:()=>Ah()??(le.default.stderr.isTTY&&le.default.stderr.hasColors?.()),stripColor:n=>(0,xh.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 na,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 ra(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(oa.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(oa.default.existsSync(I))return I;if(o.includes(cr.default.extname(E)))return;let g=o.find(T=>oa.default.existsSync(`${I}${T}`));if(g)return`${I}${g}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=t._executableFile||`${this._name}-${t._name}`,c=this._executableDir||"";if(this._scriptPath){let h;try{h=oa.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=Sh(le.default.execArgv).concat(n),m=lc.default.spawn(le.default.argv[0],n,{stdio:"inherit"})):m=lc.default.spawn(a,n,{stdio:"inherit"}):(this._checkForMissingExecutable(a,c,t._name),n.unshift(a),n=Sh(le.default.execArgv).concat(n),m=lc.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 uc(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=gl(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=gl(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=>pc(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 Sh(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 Ah(){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 i5=new Oo;function tt(e){throw new Error(`assertUnreachable: ${JSON.stringify(e,null,2)}`)}function ia(e){return`\u2022\u2022\u2022\u2022${e.slice(-4)}`}function Rh(e){return{accessToken:e.accessToken,accessExpiresAt:e.expiresAt.toISOString()}}function Ch(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 Ph(e){if(e)switch(e.kind){case"operation-api-key":return e.token;case"user-session":return e.userAuth.accessToken;default:tt(e)}}function mc(e,t){return e?.kind==="user-session"&&new Date(e.userAuth.accessExpiresAt)<=t}var hl={r:8,g:203,b:0},yl={r:0,g:130,b:0},Tl=["\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 El(e,t,n){return Math.round(e+(t-e)*n)}function Lk(e,t){let n=El(hl.r,yl.r,t),o=El(hl.g,yl.g,t),i=El(hl.b,yl.b,t);return`\x1B[38;2;${n};${o};${i}m${e}\x1B[0m`}function kk(e){if(!e)return`
|
|
28
28
|
|
|
29
|
-
${
|
|
30
|
-
`)}`;let
|
|
29
|
+
${Tl.join(`
|
|
30
|
+
`)}`;let t=Tl.length-1;return`
|
|
31
31
|
|
|
32
|
-
${
|
|
33
|
-
`)}`}function gy(){return VL(process.stdout.isTTY&&!process.env.NO_COLOR)}var LO=require("node:crypto");var Vi=require("node:crypto");function QL(e){return(0,Vi.createHash)("sha256").update(e).digest("base64url")}function yy(){let e=(0,Vi.randomBytes)(32).toString("base64url");return{verifier:e,challenge:QL(e)}}var Ay=require("node:child_process"),xy=require("node:http"),fl=require("node:os");var WL={"&":"&","<":"<",">":">",'"':""","'":"'"};function ol(e){return e.replace(/[&<>"']/g,r=>WL[r]??r)}var ZL=[":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(""),XL=['<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 il(e,r){let n=ol(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>${ZL}</style></head><body><main>`,`<span class="tile">${XL}</span>`,`<div class="copy"><h1>${n}</h1><p>${ol(r)}</p></div>`,"</main></body></html>"].join("")}var e6=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 u6=60*1e3;var z6=1/1e6,sl=1e3,cl=60*sl,ok=60*cl,nc=24*ok,Y6=7*nc,V6=30*nc;var pl=["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 ik={s:1,m:60,h:3600,d:86400};function Ey(e){for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n<48||n>57)return!1}return!0}function Ty(){return Math.floor(Date.now()/1e3)}function oc(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?ik[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 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 V(e){process.stdout.write(`${e}
|
|
34
|
-
`)}function J(e){V(JSON.stringify(e,null,2))}function
|
|
35
|
-
`)}var
|
|
36
|
-
`)}var Ry="/oauth/callback",uk=5*cl,lk=il("Login complete","You can close this tab and return to the terminal."),ic=il("Login failed","Return to the terminal for details.");function mk(e){return(0,fl.platform)()==="darwin"?["open",[e]]:(0,fl.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function dk(e){let[r,n]=mk(e),o=(0,Ay.spawnSync)(r,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function fk(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)."))},uk),c=(l,d,f,y)=>{l.writeHead(d,{"Content-Type":"text/html"}),l.end(f),clearTimeout(a),y()};e.on("request",(l,d)=>{let f=new URL(l.url??"/",n);if(f.pathname!==Ry){d.writeHead(404,{"Content-Type":"text/html"}),d.end(ic);return}let y=f.searchParams.get("error");if(y){let I=f.searchParams.get("error_description")??"";c(d,400,ic,()=>i(new Error(`Authorization failed: ${y}${I?` (${I})`:""}`)));return}if(f.searchParams.get("state")!==r){c(d,400,ic,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let _=f.searchParams.get("code");if(!_){c(d,400,ic,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(d,200,lk,()=>o(_))})})}async function Cy(e){let r=(0,xy.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}${Ry}`;try{let a=e.buildAuthorizeUrl(i);return dk(a)?V("Opening your browser to complete login..."):(V("Visit this URL in your browser to complete login:"),V(` ${a}`)),{code:await fk(r,e.state,o),redirectUri:i}}finally{r.close()}}var h={};zt(h,{Assign:()=>gk,Clone:()=>kn,Create:()=>bM,Discard:()=>SM,Metrics:()=>Xt,Update:()=>OM});var Xt={assign:0,create:0,clone:0,discard:0,update:0};function gk(e,r){return Xt.assign+=1,{...e,...r}}var s={};zt(s,{Counted:()=>kk,Entries:()=>Gk,EntriesRegExp:()=>Dk,Every:()=>wk,EveryAll:()=>vk,GraphemeCount:()=>Ck,HasPropertyKey:()=>Mk,IsArray:()=>Wi,IsBigInt:()=>Qi,IsBoolean:()=>Dy,IsClassInstance:()=>Rk,IsConstructor:()=>Ik,IsDeepEqual:()=>El,IsEqual:()=>te,IsFunction:()=>Gy,IsGreaterEqualThan:()=>jy,IsGreaterThan:()=>Ok,IsInteger:()=>yl,IsLessEqualThan:()=>$y,IsLessThan:()=>Ak,IsMaxLength:()=>Pk,IsMinLength:()=>Uk,IsMultipleOf:()=>xk,IsNull:()=>pc,IsNumber:()=>uc,IsObject:()=>Zi,IsObjectNotArray:()=>bk,IsString:()=>lc,IsSymbol:()=>Sk,IsUndefined:()=>hl,IsUnsafePropertyKey:()=>By,IsValueLike:()=>qy,Keys:()=>cc,ShiftLeft:()=>mc,Some:()=>Nk,SomeAll:()=>Lk,Symbols:()=>$k,Values:()=>jk});function Nn(e,r,n){return e>=r&&e<=n}function yk(e){return e===8205}function hk(e){return Nn(e,55296,56319)}function Py(e){return Nn(e,127462,127487)}function wy(e){return Nn(e,65024,65039)}function vy(e){return Nn(e,768,879)||Nn(e,6832,6911)||Nn(e,7616,7679)||Nn(e,65056,65071)}function sc(e){return e>65535?2:1}function Uy(e,r){for(;r<e.length;){let n=e.codePointAt(r);if(vy(n)||wy(n))r+=sc(n);else break}return r}function gl(e,r){let n=e.codePointAt(r),o=r+sc(n);for(o=Uy(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+sc(i),o=Uy(e,o)}return Py(n)&&o<e.length&&Py(e.codePointAt(o))&&(o+=sc(e.codePointAt(o))),o}function Ny(e){return hk(e)||vy(e)||wy(e)||yk(e)}function Ly(e){let r=0,n=0;for(;n<e.length;)n=gl(e,n),r++;return r}function Ek(e,r){if(r===0)return!0;let n=0,o=0;for(;o<e.length;)if(o=gl(e,o),n++,n>=r)return!0;return!1}function Tk(e,r){let n=0,o=0;for(;o<e.length;)if(o=gl(e,o),n++,n>r)return!1;return!0}function ky(e,r){if(r===0)return!0;let n=0;for(;n<e.length;){if(Ny(e.charCodeAt(n)))return Ek(e,r);if(n++,n>=r)return!0}return!1}function My(e,r){let n=0;for(;n<e.length;){if(Ny(e.charCodeAt(n)))return Tk(e,r);if(n++,n>r)return!1}return!0}function Wi(e){return Array.isArray(e)}function Qi(e){return te(typeof e,"bigint")}function Dy(e){return te(typeof e,"boolean")}function Ik(e){if(hl(e)||!Gy(e))return!1;let r=Function.prototype.toString.call(e);return!!(/^class\s/.test(r)||/\[native code\]/.test(r))}function Gy(e){return te(typeof e,"function")}function yl(e){return Number.isInteger(e)}function pc(e){return te(e,null)}function uc(e){return Number.isFinite(e)}function bk(e){return Zi(e)&&!Wi(e)}function Zi(e){return te(typeof e,"object")&&!pc(e)}function lc(e){return te(typeof e,"string")}function Sk(e){return te(typeof e,"symbol")}function hl(e){return te(e,void 0)}function te(e,r){return e===r}function Ok(e,r){return e>r}function Ak(e,r){return e<r}function $y(e,r){return e<=r}function jy(e,r){return e>=r}function xk(e,r){if(Qi(e)||Qi(r))return BigInt(e)%BigInt(r)===0n;let n=1e-10;if(!uc(e)||yl(e)&&1/r%1===0)return!0;let o=e%r;return Math.min(Math.abs(o),Math.abs(o-r),Math.abs(o+r))<n}function Rk(e){if(!Zi(e))return!1;let r=globalThis.Object.getPrototypeOf(e);return pc(r)?!1:te(typeof r.constructor,"function")&&!(te(r.constructor,globalThis.Object)||te(r.constructor.name,"Object"))}function qy(e){return Qi(e)||Dy(e)||pc(e)||uc(e)||lc(e)||hl(e)}function Ck(e){return Ly(e)}function Pk(e,r){return My(e,r)}function Uk(e,r){return ky(e,r)}function wk(e,r,n){for(let o=r;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function vk(e,r,n){let o=!0;for(let i=r;i<e.length;i++)n(e[i],i)||(o=!1);return o}function Nk(e,r){for(let n=0;n<e.length;n++)if(r(e[n],n))return!0;return!1}function Lk(e,r){let n=!1;for(let o=0;o<e.length;o++)r(e[o],o)&&(n=!0);return n}function kk(e,r){return e.reduce((n,o,i)=>r(o,i)?++n:n,0)}function mc(e,r,n){return te(e.length,0)?n():r(e[0],e.slice(1))}function By(e){return te(e,"__proto__")||te(e,"constructor")||te(e,"prototype")}function Mk(e,r){return By(r)?Object.prototype.hasOwnProperty.call(e,r):r in e}function Dk(e){return cc(e).map(r=>[new RegExp(`^${r}$`),e[r]])}function Gk(e){return Object.entries(e)}function cc(e){return Object.getOwnPropertyNames(e)}function $k(e){return Object.getOwnPropertySymbols(e)}function jk(e){return Object.values(e)}function qk(e,r){if(!Zi(r))return!1;let n=cc(e);return te(n.length,cc(r).length)&&n.every(o=>El(e[o],r[o]))}function Bk(e,r){return Wi(r)&&te(e.length,r.length)&&e.every((n,o)=>El(e[o],r[o]))}function El(e,r){return Wi(e)?Bk(e,r):Zi(e)?qk(e,r):te(e,r)}var ht={};zt(ht,{IsBigInt64Array:()=>rM,IsBigUint64Array:()=>nM,IsBoolean:()=>Fk,IsDate:()=>iM,IsFloat32Array:()=>eM,IsFloat64Array:()=>tM,IsInt16Array:()=>Wk,IsInt32Array:()=>Xk,IsInt8Array:()=>Yk,IsMap:()=>sM,IsNumber:()=>Hk,IsRegExp:()=>oM,IsSet:()=>aM,IsString:()=>Kk,IsTypeArray:()=>zk,IsUint16Array:()=>Zk,IsUint32Array:()=>Jk,IsUint8Array:()=>Vk,IsUint8ClampedArray:()=>Qk});function Fk(e){return e instanceof Boolean}function Hk(e){return e instanceof Number}function Kk(e){return e instanceof String}function zk(e){return globalThis.ArrayBuffer.isView(e)}function Yk(e){return e instanceof globalThis.Int8Array}function Vk(e){return e instanceof globalThis.Uint8Array}function Qk(e){return e instanceof globalThis.Uint8ClampedArray}function Wk(e){return e instanceof globalThis.Int16Array}function Zk(e){return e instanceof globalThis.Uint16Array}function Xk(e){return e instanceof globalThis.Int32Array}function Jk(e){return e instanceof globalThis.Uint32Array}function eM(e){return e instanceof globalThis.Float32Array}function tM(e){return e instanceof globalThis.Float64Array}function rM(e){return e instanceof globalThis.BigInt64Array}function nM(e){return e instanceof globalThis.BigUint64Array}function oM(e){return e instanceof globalThis.RegExp}function iM(e){return e instanceof globalThis.Date}function aM(e){return e instanceof globalThis.Set}function sM(e){return e instanceof globalThis.Map}var dc=s;function pM(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function uM(e){let r={};for(let n of Object.getOwnPropertyNames(e)){if(s.IsUnsafePropertyKey(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=Ln(o.value),s.IsEqual(o.enumerable,!0)?r[n]=o.value:Object.defineProperty(r,n,o)}return r}function lM(e){let r={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(r[n]=Ln(e[n]));for(let n of s.Symbols(e))r[n]=Ln(e[n]);return r}function mM(e){return s.IsClassInstance(e)?e:pM(e)?uM(e):lM(e)}function dM(e){return e.map(r=>Ln(r))}function fM(e){return e.slice()}function gM(e){return new RegExp(e.source,e.flags)}function yM(e){return new Map(Ln([...e.entries()]))}function hM(e){return new Set(Ln([...e.values()]))}function Ln(e){return ht.IsTypeArray(e)?fM(e):ht.IsRegExp(e)?gM(e):ht.IsMap(e)?yM(e):ht.IsSet(e)?hM(e):s.IsArray(e)?dM(e):s.IsObject(e)?mM(e):e}function kn(e){return Xt.clone+=1,Ln(e)}var tt={};zt(tt,{Get:()=>_M,Reset:()=>EM,Set:()=>TM});var sr={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function EM(){sr.immutableTypes=!1,sr.maxErrors=8,sr.maxInstantiationCount=128,sr.useAcceleration=!0,sr.exactOptionalPropertyTypes=!1,sr.enumerableKind=!1,sr.correctiveParse=!1,sr.unionPrioritySort=!0}function TM(e){for(let r of s.Keys(e)){let n=e[r];n!==void 0&&Object.defineProperty(sr,r,{value:n})}}function _M(){return sr}function IM(e,r){for(let n of Object.keys(r))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:r[n]});return e}function Fy(e,r){return{...e,...r}}function bM(e,r,n={}){Xt.create+=1;let o=tt.Get(),i=Fy(r,n),a=o.enumerableKind?Fy(i,e):IM(i,e);return o.immutableTypes?Object.freeze(a):a}function SM(e,r){Xt.discard+=1;let n={};for(let o of Object.getOwnPropertyNames(e)){if(r.includes(o))continue;let i=Object.getOwnPropertyDescriptor(e,o);i.value=kn(i.value),Object.defineProperty(n,o,i)}return n}function OM(e,r,n){Xt.update+=1;let o=tt.Get(),i=kn(e);for(let a of Object.keys(r))Object.defineProperty(i,a,{configurable:!0,writable:!0,enumerable:o.enumerableKind,value:r[a]});for(let a of Object.keys(n))Object.defineProperty(i,a,{configurable:!0,enumerable:!0,writable:!0,value:n[a]});return i}function w(e,r){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],r)}function Pe(e){return s.IsObject(e)}function v(e,r,n){return h.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:r,options:n},{})}function nn(e){return w(e,"Deferred")}function AM(e){return h.Update(e,{"~readonly":!0},{})}function Xi(e,r){return h.Update(AM(e),{},r)}function Hy(e,r,n,o){let i=A(e,r,n);return Xi(i,o)}function xM(e){return h.Update(e,{"~optional":!0},{})}function Ji(e,r){return h.Update(xM(e),{},r)}function Ky(e,r,n,o){let i=A(e,r,n);return Ji(i,o)}function Ct(e,r){return h.Create({"~kind":"Array"},{type:"array",items:e},r)}function Z(e){return w(e,"Array")}function Io(e){return h.Discard(e,["~kind","type","items"])}function cr(e,r,n={}){return h.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:r},n)}function Fe(e){return w(e,"Constructor")}function zy(e){return h.Discard(e,["~kind","type","parameters","instanceType"])}function pr(e,r,n={}){return h.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:r},n)}function He(e){return w(e,"Function")}function Yy(e){return h.Discard(e,["~kind","type","parameters","returnType"])}function rt(e,r){return h.Create({"~kind":"Ref"},{$ref:e},r)}function ce(e){return w(e,"Ref")}function on(e,r){return h.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:r})}function bo(e){return w(e,"Generic")}function So(e){return h.Create({"~kind":"Any"},{},e)}function Ye(e){return w(e,"Any")}var Vy="(?!)";function me(e){return h.Create({"~kind":"Never"},{not:{}},e)}function Jt(e){return w(e,"Never")}function ur(e,r={}){return v("AddOptional",[e],r)}function Mn(e,r={}){return Ji(e,r)}function Qy(e){return Mn(e)}function Je(e){return Pe(e)&&s.HasPropertyKey(e,"~optional")}function Wy(e){return s.Keys(e).filter(r=>!Je(e[r]))}function fc(e){return s.Keys(e)}function gc(e){return s.Values(e)}function k(e,r={}){let n=Wy(e),o=n.length>0?{required:n}:{};return h.Create({"~kind":"Object"},{type:"object",...o,properties:e},r)}function D(e){return w(e,"Object")}function Zy(e){return h.Discard(e,["~kind","type","properties","required"])}function Ve(e){return h.Create({"~kind":"Unknown"},{},e)}function et(e){return w(e,"Unknown")}function lr(e,r,n){let o=s.Keys(e).reduce((i,a)=>({...i,[a]:h.Update(e[a],{},{$id:a})}),{});return h.Create({"~kind":"Cyclic"},{$defs:o,$ref:r},n)}function he(e){return w(e,"Cyclic")}function Xy(e){return h.Update(e,{"~unsafe":null},{})}function yc(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var oe={};zt(oe,{Match:()=>RM});function RM(e,r){return r[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function ea(...e){let[r,n]=oe.Match(e,{2:(o,i)=>[o,i,i],1:o=>[o,Ve(),Ve()]});return h.Create({"~kind":"Infer"},{type:"infer",name:r,extends:n},{})}function Ke(e){return w(e,"Infer")}function Dn(e,r,n,o={}){return h.Create({"~kind":"Dependent"},{if:e,then:r,else:n},o)}function Ne(e){return w(e,"Dependent")}function Jy(e){return h.Discard(e,["~kind","if","then","else"])}function eh(e){return s.IsObjectNotArray(e)}function th(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function rh(e){return s.IsString(e)||s.IsNumber(e)}function nh(e,r){let n=eh(e)?th(e):e;return h.Create({"~kind":"Enum"},{enum:n},r)}function ze(e){return w(e,"Enum")}function ut(e,r={}){return h.Create({"~kind":"Intersect"},{allOf:e},r)}function M(e){return w(e,"Intersect")}function oh(e){return h.Discard(e,["~kind","allOf"])}var Gn={};zt(Gn,{Hash:()=>KM,HashCode:()=>lh});function fe(){throw new Error("Unreachable")}function CM(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 PM(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 Oo=BigInt("14695981039346656037"),[UM,wM]=[BigInt("1099511628211"),BigInt("18446744073709551616")],vM=Array.from({length:256}).map((e,r)=>BigInt(r)),ch=new Float64Array(1),ph=new DataView(ch.buffer),uh=new Uint8Array(ch.buffer);function lt(e){Oo=Oo^vM[e],Oo=Oo*UM%wM}function NM(e){lt(Et.Array);for(let r of e)an(r)}function LM(e){lt(Et.BigInt),ph.setBigInt64(0,e);for(let r of uh)lt(r)}function ah(e){lt(Et.Boolean),lt(e?1:0)}function kM(e){lt(Et.Constructor),an(e.toString())}function MM(e){lt(Et.Date),an(e.getTime())}function DM(e){lt(Et.Function),an(e.toString())}function GM(e){lt(Et.Null)}function sh(e){lt(Et.Number),ph.setFloat64(0,e,!0);for(let r of uh)lt(r)}function $M(e){lt(Et.Object);for(let r of CM(e).sort())an(r),an(e[r])}function jM(e){lt(Et.RegExp),Tl(e.toString())}var qM=new TextEncoder;function Tl(e){lt(Et.String);for(let r of qM.encode(e))lt(r)}function BM(e){lt(Et.Symbol),an(e.toString())}function FM(e){lt(Et.TypeArray);let r=new Uint8Array(e.buffer);for(let n=0;n<r.length;n++)lt(r[n])}function HM(e){return lt(Et.Undefined)}function an(e){return ht.IsTypeArray(e)?FM(e):ht.IsDate(e)?MM(e):ht.IsRegExp(e)?jM(e):ht.IsBoolean(e)?ah(e.valueOf()):ht.IsString(e)?Tl(e.valueOf()):ht.IsNumber(e)?sh(e.valueOf()):PM(e)?sh(e):s.IsArray(e)?NM(e):s.IsBoolean(e)?ah(e):s.IsBigInt(e)?LM(e):s.IsConstructor(e)?kM(e):s.IsNull(e)?GM(e):s.IsObject(e)?$M(e):s.IsString(e)?Tl(e):s.IsSymbol(e)?BM(e):s.IsUndefined(e)?HM(e):s.IsFunction(e)?DM(e):fe()}function lh(e){return Oo=BigInt("14695981039346656037"),an(e),Oo}function KM(e){return lh(e).toString(16).padStart(16,"0")}function mh(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 zM=mh;function dh(){return zM}var ta=class{constructor(r,n){this.type=r,this.decode=n}Encode(r){let n=this.type,o=$n(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=$n(n)?c=>n["~codec"].encode(r(c)):r,a={decode:o,encode:i};return h.Update(this.type,{"~codec":a},{})}},ra=class{constructor(r){this.type=r}Decode(r){return new ta(this.type,r)}};function hc(e){return new ra(e)}function gh(e,r){return hc(e).Decode(r).Encode(()=>{throw Error("Encode not implemented")})}function yh(e,r){return hc(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(r)}function $n(e){return Pe(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function hh(e){return Ao(e)}function jn(e){return Pe(e)&&s.HasPropertyKey(e,"~immutable")}function mr(e,r={}){return v("AddReadonly",[e],r)}function qn(e,r={}){return Xi(e,r)}function Eh(e){return qn(e)}function Bn(e){return Pe(e)&&s.HasPropertyKey(e,"~readonly")}function VM(e,r){let n=Ec(e)?[...e["~refine"],r]:[r];return h.Update(e,{"~refine":n},{})}function Th(...e){let[r,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,()=>"Refine Error"]});return VM(r,{check:n,error:o})}function QM(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function Ec(e){return Pe(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,r=>QM(r))}var _h="-?(?:0|[1-9][0-9]*)n";function na(e){return h.Create({"~kind":"BigInt"},{type:"bigint"},e)}function wt(e){return w(e,"BigInt")}function Tc(e){return h.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Tt(e){return w(e,"Boolean")}function oa(e){return h.Create({"~kind":"Identifier"},{name:e})}function Ih(e){return w(e,"Identifier")}var _c="-?(?:0|[1-9][0-9]*)";function Fn(e){return h.Create({"~kind":"Integer"},{type:"integer"},e)}function nt(e){return w(e,"Integer")}var _l=class extends Error{constructor(r){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:r},writable:!1,configurable:!1,enumerable:!1})}};function WM(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new _l(e)})()}function z(e,r){return h.Create({"~kind":"Literal"},{type:WM(e),const:e},r)}function Ic(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function bh(e){return Q(e)&&s.IsBigInt(e.const)}function Sh(e){return Q(e)&&s.IsBoolean(e.const)}function bc(e){return Q(e)&&s.IsNumber(e.const)}function Sc(e){return Q(e)&&s.IsString(e.const)}function Q(e){return w(e,"Literal")}function xo(e){return h.Create({"~kind":"Null"},{type:"null"},e)}function dr(e){return w(e,"Null")}var Oc="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function vt(e){return h.Create({"~kind":"Number"},{type:"number"},e)}function Re(e){return w(e,"Number")}function Ro(e){return h.Create({"~kind":"Symbol"},{type:"symbol"},e)}function fr(e){return w(e,"Symbol")}function Hn(...e){let[r,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,a],1:i=>[i,Ve(),Ve()]});return h.Create({"~kind":"Parameter"},{name:r,extends:n,equals:o},{})}function Oh(e){return w(e,"Parameter")}var Ac=".*";function _t(e){return h.Create({"~kind":"String"},{type:"string"},e)}function Qe(e){return w(e,"String")}function B(e,r={}){return h.Create({"~kind":"Union"},{anyOf:e},r)}function R(e){return w(e,"Union")}function Ah(e){return h.Discard(e,["~kind","anyOf"])}function ia(e){let r=xh(e);return s.IsEqual(r.length,2)?r[0]:[]}function ZM(e){return!0}function Rh(e){return s.ShiftLeft(e,(r,n)=>XM(r)?Rh(n):!1,()=>!0)}function Ch(e){return s.IsEqual(e.length,0)?!1:Rh(e)}function XM(e){return R(e)?Ch(e.anyOf):Q(e)?ZM(e.const):!1}function xc(e){return Ch(e)}function Rc(e){return h.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Ph(e,r,n=[]){return s.ShiftLeft(e,(o,i)=>Ph(i,r,[...n,`${o}${r}`]),()=>n)}function JM(e,r){return s.IsEqual(e.length,0)?[`${r}`]:Ph(e,r)}function Uh(e,r,n=[]){return s.ShiftLeft(r,(o,i)=>Uh(e,i,[...n,...wh(e,o)]),()=>n)}function wh(e,r){return R(r)?Uh(e,r.anyOf):Q(r)?JM(e,r.const):fe()}function vh(e,r){return s.ShiftLeft(r,(n,o)=>vh(wh(e,n),o),()=>e)}function e0(e){return e.map(r=>z(r))}function t0(e){let r=vh([],e),n=e0(r);return B(n)}function r0(e){return s.IsEqual(e.length,0)?fe():s.IsEqual(e.length,1)&&Q(e[0])?e[0]:t0(e)}function Il(e){let r=ia(e);return s.IsEqual(r.length,0)?_t():xc(r)?r0(r):Rc(e)}function aa(e){let r=Il(e);return Ee(r)?_t():r}function Pt(e,r){let n="object",o={[e]:r};return h.Create({"~kind":"Record"},{type:n,patternProperties:o})}function Nh(e){return Pt(Dt,e)}function Lh(e){return k({true:e,false:e})}function Le(e,r={}){let[n,o,i]=[e,e.length,!1];return h.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:o},r)}function Y(e){return w(e,"Tuple")}function kh(e){return h.Discard(e,["~kind","type","items","minItems","additionalItems"])}function n0(e){return h.Discard(e,["~readonly"])}function bl(e,r){return h.Update(n0(e),{},r)}function Mh(e,r,n,o){let i=A(e,r,n);return bl(i,o)}function Dh(e,r={}){return v("RemoveReadonly",[e],r)}function Gh(e,r={}){return bl(e,r)}function o0(e){return h.Discard(e,["~optional"])}function Sl(e,r){return h.Update(o0(e),{},r)}function $h(e,r,n,o){let i=A(e,r,n);return Sl(i,o)}function jh(e,r={}){return v("RemoveOptional",[e],r)}function Cc(e,r={}){return Sl(e,r)}function Ol(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function qh(e){let r=Ol(e.items);return k(r)}function i0(e,r){return Bn(e)?!!Bn(r):!1}function a0(e,r){return Je(e)?!!Je(r):!1}function s0(e,r){let n=i0(e,r),o=a0(e,r),i=Ue([e,r]),a=Gh(Cc(i));return n&&o?qn(Mn(a)):n&&!o?qn(a):!n&&o?Mn(a):a}function c0(e,r,n){return n in e?n in r?s0(e[n],r[n]):e[n]:n in r?r[n]:me()}function p0(e,r){return[...new Set([...s.Keys(r),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:c0(e,r,i)}),{})}function Bh(e){return D(e)?e.properties:Y(e)?Ol(e.items):fe()}function Fh(e,r){let n=Bh(e),o=Bh(r),i=p0(n,o);return k(i)}function Hh(e,r){let n=Kn(e,r);return s.IsEqual(n,ca)?e:s.IsEqual(n,pa)||s.IsEqual(n,sa)?r:me()}function Kh(e){return D(e)||Y(e)}function u0(e,r){let n=R(e),o=R(r);return n||o}function l0(e,r){let n=Yt(e),o=Yt(r),i=u0(n,o),a=Kh(n),c=Kh(o);return i?Ue([n,o]):a&&c?Fh(n,o):a&&!c?n:!a&&c?o:Hh(n,o)}function zh(e,r,n=[]){return s.ShiftLeft(r,(o,i)=>zh(e,i,[...n,l0(e,o)]),()=>s.IsEqual(n.length,0)?[e]:n)}function Yh(e,r,n=[]){return s.ShiftLeft(e,(o,i)=>Yh(i,r,[...n,...ua([o],r)]),()=>n)}function ua(e,r=[]){return s.ShiftLeft(e,(n,o)=>R(n)?ua(o,Yh(n.anyOf,r)):ua(o,zh(n,r)),()=>r)}function m0(e,r){let n=dt({},e,r);return G.IsExtendsTrueLike(n)?[]:[e]}function d0(e,r){return e.reduce((n,o)=>[...n,...m0(o,r)],[])}function Pc(e,r){let n=Yt(e),o=R(n)?n.anyOf:[n],i=d0(o,r);return Nt(i)}function er(e,r,n){let o=ut([e,r]),i=Pc(n,e);return Nt([o,i])}function Ut(e){let r=e.map(n=>z(n));return Nt(r)}function Ue(e){let r=ua(e),n=Al(r);return vr(n)}function yt(e){let r=aa(e);return Yt(r)}function Nt(e){let r=Al(e);return vr(r)}function Yt(e){return Ne(e)?er(e.if,e.then,e.else):ze(e)?Ut(e.enum):M(e)?Ue(e.allOf):Ee(e)?yt(e.pattern):R(e)?Nt(e.anyOf):e}function vr(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?me():B(e)}function Vh(e,r){let n=Ut(e);return sn(n,r)}function Qh(e,r){return Pt(cn,r)}function Wh(e,r){let n=Ue(e);return sn(n,r)}function Zh(e,r){return s.IsString(e)||s.IsNumber(e)?k({[e]:r}):s.IsEqual(e,!1)?k({false:r}):s.IsEqual(e,!0)?k({true:r}):k({})}function Xh(e,r){return Pt(Co,r)}function Jh(e,r){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?Pt(e.pattern.toString(),r):Pt(Dt,r)}function eE(e,r){let n=ia(e);return xc(n)?sn(yt(e),r):Pt(e,r)}function f0(e){return R(e)?Po(e.anyOf):[e]}function Po(e){return e.reduce((r,n)=>[...r,...f0(n)],[])}function g0(e){return e.some(r=>Qe(r)||Re(r)||nt(r))}function y0(e,r){return s.IsEqual(g0(e),!0)?Pt(Dt,r):void 0}function h0(e,r){return e.reduce((n,o)=>Q(o)&&(s.IsString(o.const)||s.IsNumber(o.const))?{...n,[o.const]:r}:n,{})}function E0(e,r){let n=h0(e,r);return k(n)}function tE(e,r){let n=Po(e),o=y0(n,r);return Pe(o)?o:E0(n,r)}function sn(e,r){return Ye(e)?Nh(r):Tt(e)?Lh(r):ze(e)?Vh(e.enum,r):nt(e)?Qh(e,r):M(e)?Wh(e.allOf,r):Q(e)?Zh(e.const,r):Re(e)?Xh(e,r):R(e)?tE(e.anyOf,r):Qe(e)?Jh(e,r):Ee(e)?eE(e.pattern,r):k({})}function xl(e,r,n){return K([e])?h.Update(sn(e,r),{},n):Uc(e,r,n)}function rE(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return xl(a,c,i)}var cn=`^${_c}$`,Co=`^${Oc}$`,Dt=`^${Ac}$`;function Uc(e,r,n={}){return v("Record",[e,r],n)}function Uo(e,r,n={}){return xl(e,r,n)}function wc(e,r){return Pt(e,r)}function vc(e){return s.IsEqual(e,Dt)?_t():s.IsEqual(e,cn)?Fn():s.IsEqual(e,Co)?vt():Il(e)}function ot(e){return s.Keys(e.patternProperties)[0]}function pn(e){let r=ot(e);return vc(r)}function be(e){return e.patternProperties[ot(e)]}function de(e){return w(e,"Record")}function zn(e){return h.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function un(e){return w(e,"Rest")}function Nc(e){return h.Create({"~kind":"This"},{$ref:"#"},e)}function Lc(e){return w(e,"This")}function wo(e){return h.Create({"~kind":"Undefined"},{type:"undefined"},e)}function tr(e){return w(e,"Undefined")}function kc(e){return h.Create({"~kind":"Void"},{type:"void"},e)}function Lt(e){return w(e,"Void")}function _0(e,r){return s.IsEqual(e,"Array")?Ct(r[0]):s.IsEqual(e,"Capitalize")?Dc(r[0]):s.IsEqual(e,"ConstructorParameters")?Bc(r[0]):s.IsEqual(e,"Evaluate")?n_(r[0]):s.IsEqual(e,"Exclude")?Fc(r[0],r[1]):s.IsEqual(e,"Extract")?Hc(r[0],r[1]):s.IsEqual(e,"Index")?fa(r[0],r[1]):s.IsEqual(e,"InstanceType")?Kc(r[0]):s.IsEqual(e,"Lowercase")?Gc(r[0]):s.IsEqual(e,"NonNullable")?zc(r[0]):s.IsEqual(e,"Omit")?Yc(r[0],r[1]):s.IsEqual(e,"Parameters")?Vc(r[0]):s.IsEqual(e,"Partial")?Qc(r[0]):s.IsEqual(e,"Pick")?Wc(r[0],r[1]):s.IsEqual(e,"Readonly")?Zc(r[0]):s.IsEqual(e,"KeyOf")?ga(r[0]):s.IsEqual(e,"Record")?Uc(r[0],r[1]):s.IsEqual(e,"Required")?Xc(r[0]):s.IsEqual(e,"ReturnType")?Jc(r[0]):s.IsEqual(e,"Uncapitalize")?$c(r[0]):s.IsEqual(e,"Uppercase")?jc(r[0]):da(rt(e),r)}function Yn(){throw Error("Unreachable")}function sE(e,r=[]){return s.ShiftLeft(e,(n,o)=>sE(o,[...r,n[1]]),()=>r)}function Nr(e){return s.IsEqual(e.length,3)?[e[0],...sE(e[1])]:[]}function cE(e){return Hn(e[0],e[2],e[4])}function pE(e){return Hn(e[0],e[2],e[2])}function uE(e){return Hn(e[0],Ve(),e[2])}function lE(e){return Hn(e,Ve(),Ve())}function mE(e){return Nr(e)}function dE(e){return e[1]}function fE(e){return Nr(e)}function gE(e){return e[1]}function yE(e){return _0(e[0],e[1])}function hE(e){return null}function EE(e){return _t()}function TE(e){return vt()}function _E(e){return Tc()}function IE(e){return wo()}function bE(e){return xo()}function SE(e){return Fn()}function OE(e){return na()}function AE(e){return Ve()}function xE(e){return So()}function RE(e){return k({})}function CE(e){return me()}function PE(e){return Ro()}function UE(e){return kc()}function wE(e){return Nc()}function vE(e){return z(BigInt(e))}function NE(e){return z(s.IsEqual(e,"true"))}function LE(e){return z(parseFloat(e))}function kE(e){return z(e)}function ME(e){return e[1]}function DE(e){return z(e)}function GE(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function $E(e){return e[1]}function jE(e){return Mc(e)}function qE(e){return s.IsEqual(e.length,6)?Dn(e[1],e[3],e[5]):Dn(e[1],e[3],Ve())}function BE(e){return e.length>0}function FE(e){return e.reduce((r,n)=>s.IsEqual(n.length,3)?[...r,[n[1]]]:[...r,[]],[])}function HE(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function KE(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function zE(e){return s.IsEqual(e.length,2)?e[1]:[]}function nE(e,r){return r.reduce((n,o)=>{let i=o;return s.IsEqual(i.length,1)?fa(n,i[0]):s.IsEqual(i.length,0)?Ct(n):Yn()},e)}function oE(e,r){return s.IsEqual(r.length,3)?qc(e,r[0],r[1],r[2]):e}function I0(e,r){return s.IsArray(r)&&s.IsEqual(r.length,0)?e:ep(e,r)}function YE(e){let[r,n,o,i,a]=e;return I0(oE(r?ga(nE(n,o)):nE(n,o),i),a)}function Rl(e,r){return s.IsEqual(r.length,3)?(()=>{let[n,o,i]=r,a=Rl(o,i);if(s.IsEqual(n,"&"))return M(a)?ut([e,...a.allOf]):ut([e,a]);if(s.IsEqual(n,"|"))return R(a)?B([e,...a.anyOf]):B([e,a]);Yn()})():e}function VE(e){let[r,n]=e;return Rl(r,n)}function QE(e){let[r,n]=e;return Rl(r,n)}function WE(e){return r_(e[1])}function ZE(e){return e[1]}function XE(e){return on(e[0],e[2])}function JE(e){return s.IsEqual(e.length,4)?ea(e[1],e[3]):s.IsEqual(e.length,2)?ea(e[1],Ve()):Yn()}function eT(e){return`${e}`}function tT(e){return nt(e[3])?cn:Re(e[3])?Co:fr(e[3])?Dt:Qe(e[3])?Dt:Yn()}function rT(e){return e.length>0}function nT(e){return e.length>0}function oT(e){let[r,n,o,i,a]=e;return{[n]:r&&o?mr(ur(a)):r&&!o?mr(a):!r&&o?ur(a):a}}function iT(e){return Nr(e)}function aT(e){return e.reduce((r,n)=>s.HasPropertyKey(n,cn)||s.HasPropertyKey(n,Co)||s.HasPropertyKey(n,Dt)?[r[0],h.Assign(r[1],n)]:[h.Assign(r[0],n),r[1]],[{},{}])}function sT(e){return aT(e[1])}function cT(e){let[r,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return k(r,o)}function pT(e){return s.IsEqual(e.length,5)?mr(ur(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?mr(e[3]):ur(e[3]):Yn()}function uT(e){if(!s.IsArray(e)||!s.IsEqual(e.length,3))return e;let[r,n,o]=e;return r&&o?mr(ur(n)):r&&!o?mr(n):!r&&o?ur(n):n}function lT(e){return s.IsEqual(e.length,2)?zn(e[1]):s.IsEqual(e.length,1)?e[0]:Yn()}function mT(e){return Nr(e)}function dT(e){return Le(e[1])}function fT(e){return mr(ur(e[4]))}function gT(e){return mr(e[3])}function yT(e){return ur(e[3])}function hT(e){return e[2]}function ET(e){return s.IsEqual(e.length,2)?zn(e[1]):s.IsEqual(e.length,1)?e[0]:Yn()}function TT(e){return Nr(e)}function _T(e){return pr(e[1],e[4])}function IT(e){return cr(e[2],e[5])}function iE(e,r){return s.IsEqual(e,"remove")?Dh(r):s.IsEqual(e,"add")?mr(r):r}function bT(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function aE(e,r){return s.IsEqual(e,"remove")?jh(r):s.IsEqual(e,"add")?ur(r):r}function ST(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 OT(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function AT(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?la(oa(e[3]),e[5],e[6][0],iE(e[1],aE(e[8],e[10]))):la(oa(e[3]),e[5],rt(e[3]),iE(e[1],aE(e[8],e[10])))}function xT(e){return rt(e)}function RT(e){return BigInt(e)}function CT(e){return parseFloat(e)}function PT(e){return s.IsEqual(e,"true")}function UT(e){return null}function wT(e){return{[e[0]]:e[2]}}function vT(e){return Nr(e)}function b0(e){return e.reduce((r,n)=>h.Assign(r,n),{})}function NT(e){return b0(e[1])}function LT(e){return Nr(e)}function kT(e){return e[1]}function MT(e){return na()}function DT(e){return _t()}function GT(e){return vt()}function $T(e){return Fn()}function jT(e){return me()}function qT(e){return z(e)}function BT(e){return B(e[1])}function FT(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function HT(e){return[e[0],...e[1]]}function KT(e){return e[1]}function zT(e){return Nr(e)}function YT(e){return s.IsEqual(e.length,2)?e[1]:[]}function VT(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]]:on(r,ma(n,o,a))}}function QT(e){let r=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:ma(r,n,i)}}function WT(e){return{[e[1]]:on(e[2],e[4])}}function ZT(e){return{[e[1]]:e[3]}}function XT(e){return null}function JT(e){return Nr(e)}function e_(e){return e[1]}function t_(e){let[r,n]=[e[0],e[1]];return o_(h.Assign(r,aT(n)[0]))}function ya(e){return te(e.length,2)}function W(e,r,n){return ya(e)?r(e[0],e[1]):n()}function A0(e,r){return te(r.indexOf(e),0)?[e,r.slice(e.length)]:[]}function we(e,r){for(let n=0;n<e.length;n++){let o=A0(e[n],r);if(ya(o))return o}return[]}function Cl(e,r){return Array.from({length:r-e+1},(n,o)=>String.fromCharCode(e+o))}var i_=[...Cl(97,122),...Cl(65,90)],Pl="0",Ul=Cl(49,57),vo=[Pl,...Ul],a_=" ",No=`
|
|
37
|
-
`;var ln="_",
|
|
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]),eI=(e,r=[])=>u(u(J_(e),([n,o])=>u(jl(o),([i,a])=>[[n,i],a])),([n,o])=>eI(o,[...r,n]),()=>[r,e]),SG=e=>u(u(u(jl(e),([r,n])=>u(eI(n),([o,i])=>u(u(J_(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[r,o,a],c]))),([r,n])=>[r,n],()=>u([[],e],([r,n])=>[r,n],()=>[])),([r,n])=>[JT(r),n]),jl=e=>u(u(bG(e),([r,n])=>u(u(EG(n),([o,i])=>[o,i],()=>u(TG(n),([o,i])=>[o,i],()=>u(_G(n),([o,i])=>[o,i],()=>u(IG(n),([o,i])=>[o,i],()=>[])))),([o,i])=>u(A_(i),([a,c])=>[[r,o,a],c]))),([r,n])=>[e_(r),n]),OG=e=>u(u(jl(e),([r,n])=>u(SG(n),([o,i])=>[[r,o],i])),([r,n])=>[t_(r),n]),tI=e=>u(u(OG(e),([r,n])=>[r,n],()=>u(vD(e),([r,n])=>[r,n],()=>u(re(e),([r,n])=>[r,n],()=>[]))),([r,n])=>[r,n]);function rI(e){let r=Ml(`\`${e}\``);return s.IsEqual(r.length,2)?r[0]:fe()}function xG(e){return e.join("|")}function RG(e){return e.slice(1,e.length-1)}function CG(e,r,n){return dn(r,`${n}${e}`)}function PG(e,r){return dn(e,`${r}${_h}`)}function UG(e,r){return dn(e,`${r}${_c}`)}function wG(e,r){return dn(e,`${r}${Oc}`)}function vG(e,r){return ha(B([z("false"),z("true")]),e,r)}function NG(e,r){return dn(e,`${r}${Ac}`)}function LG(e,r,n){return dn(r,`${n}${RG(e)}`)}function kG(e,r,n){let o=Ea(e,{});return ha(o,r,n)}function MG(e,r,n){let o=Ut(e);return ha(o,r,n)}function nI(e,r,n,o=[]){return s.ShiftLeft(e,(i,a)=>nI(a,r,n,[...o,ha(i,[],"")]),()=>dn(r,`${n}(${xG(o)})`))}function ha(e,r,n){return ze(e)?MG(e.enum,r,n):nt(e)?UG(r,n):Q(e)?CG(e.const,r,n):wt(e)?PG(r,n):Tt(e)?vG(r,n):Re(e)?wG(r,n):Qe(e)?NG(r,n):Ee(e)?LG(e.pattern,r,n):iI(e)?kG(e.parameters[0],r,n):R(e)?nI(e.anyOf,r,n):Vy}function dn(e,r){return s.ShiftLeft(e,(n,o)=>ha(n,o,r),()=>r)}function DG(e){return`^${dn(e,"")}$`}function oI(e){let r=DG(e);return Rc(r)}function Ea(e,r){return K(e)?h.Update(oI(e),{},r):Mc(e,r)}function aI(e,r,n,o){let i=Gt(e,r,n);return Ea(i,o)}function Mc(e,r={}){return v("TemplateLiteral",[e],r)}function iI(e){return Pe(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function sI(e){return Ea(e,{})}function GG(e){let r=rI(e);return sI(r)}function cI(e,r={}){let n=s.IsString(e)?GG(e):sI(e);return h.Update(n,{},r)}function Ee(e){return w(e,"TemplateLiteral")}var G={};zt(G,{ExtendsFalse:()=>F,ExtendsTrue:()=>U,ExtendsUnion:()=>ql,IsExtendsFalse:()=>$G,IsExtendsTrue:()=>uI,IsExtendsTrueLike:()=>ko,IsExtendsUnion:()=>pI,Match:()=>Se});function ql(e){return h.Create({"~kind":"ExtendsUnion"},{inferred:e})}function pI(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 h.Create({"~kind":"ExtendsTrue"},{inferred:e})}function uI(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 h.Create({"~kind":"ExtendsFalse"},{})}function $G(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function ko(e){return pI(e)||uI(e)}function Se(e,r,n){return ko(e)?r(e.inferred):n()}function jG(e,r,n,o){return Se(ee(e,n,o),i=>U(h.Assign(h.Assign(e,i),{[r]:n})),()=>F())}function qG(e,r){return U(e)}function BG(e,r,n,o,i){return Se(ee(e,r,n),a=>Se(ee(a,r,o),c=>U(c),()=>F()),()=>Se(ee(e,r,i),a=>U(a),()=>F()))}function FG(e,r,n){let o=Ut(n);return ee(e,r,o)}function lI(e,r,n){return s.ShiftLeft(n,(o,i)=>Se(ee(e,r,o),a=>lI(a,r,i),()=>F()),()=>U(e))}function HG(e,r,n){let o=yt(n);return ee(e,r,o)}function mI(e,r,n){return s.ShiftLeft(n,(o,i)=>Se(ee(e,r,o),a=>U(a),()=>mI(e,r,i)),()=>F())}function ae(e,r,n){return Ye(n)?qG(e,r):Ne(n)?BG(e,r,n.if,n.then,n.else):ze(n)?FG(e,r,n.enum):Ke(n)?jG(e,n.name,r,n.extends):M(n)?lI(e,r,n.allOf):Ee(n)?HG(e,r,n.pattern):R(n)?mI(e,r,n.anyOf):et(n)?U(e):F()}function dI(e,r,n){return Ke(n)?ae(e,r,n):Ye(n)?U(e):et(n)?U(e):ql(e)}function KG(e,r){let n=jn(e),o=jn(r);return n&&o||!n&&o?!0:!(n&&!o)}function fI(e,r,n,o){return Z(o)?KG(r,o)?ee(e,n,o.items):F():ae(e,r,o)}function gI(e,r,n){return wt(n)?U(e):ae(e,r,n)}function yI(e,r,n){return Tt(n)?U(e):ae(e,r,n)}function zG(e,r,n,o,i){let a=Ke(o)?r:o,c=Ke(o)?o:r,l=Je(r),d=Je(o);return!l&&d?F():Se(ee(e,a,c),f=>Ta(f,n,i),()=>F())}function YG(e,r,n,o){return s.ShiftLeft(o,(i,a)=>zG(e,r,n,i,a),()=>Je(r)?U(e):F())}function VG(e,r,n){return s.ShiftLeft(r,(o,i)=>YG(e,o,i,n),()=>U(e))}function Ta(e,r,n){return VG(e,r,n)}function up(e,r,n){return Lt(n)?U(e):ee(e,r,n)}function hI(e,r,n,o){return Ye(o)?U(e):et(o)?U(e):Fe(o)?Se(Ta(e,r,o.parameters),i=>up(i,n,o.instanceType),()=>F()):F()}function EI(e,r,n,o,i){return Se(ee(e,r,i),()=>ee(e,n,i),()=>ee(e,o,i))}function TI(e,r,n){let o=Ut(r);return ee(e,o,n)}function _I(e,r,n,o){return Ye(o)?U(e):et(o)?U(e):He(o)?Se(Ta(e,r,o.parameters),i=>up(i,n,o.returnType),()=>F()):F()}function II(e,r,n){return nt(n)?U(e):Re(n)?U(e):ae(e,r,n)}function bI(e,r,n){let o=Ue(r);return ee(e,o,n)}function lp(e,r,n){return r===n?U(e):F()}function QG(e,r,n){return Q(n)?lp(e,r,n.const):wt(n)?U(e):ae(e,z(r),n)}function WG(e,r,n){return Q(n)?lp(e,r,n.const):Tt(n)?U(e):ae(e,z(r),n)}function ZG(e,r,n){return Q(n)?lp(e,r,n.const):Re(n)?U(e):ae(e,z(r),n)}function XG(e,r,n){return Q(n)?lp(e,r,n.const):Qe(n)?U(e):ae(e,z(r),n)}function SI(e,r,n){return s.IsBigInt(r.const)?QG(e,r.const,n):s.IsBoolean(r.const)?WG(e,r.const,n):s.IsNumber(r.const)?ZG(e,r.const,n):s.IsString(r.const)?XG(e,r.const,n):fe()}function OI(e,r,n){return Ke(n)?ae(e,r,n):U(e)}function AI(e,r,n){return dr(n)?U(e):ae(e,r,n)}function xI(e,r,n){return Re(n)?U(e):ae(e,r,n)}function JG(e,r,n){return Je(r)?Je(n)?U(e):F():U(e)}function e$(e,r,n){return Ke(n)&&Jt(n.extends)?F():Se(ee(e,r,n),o=>JG(o,r,n),()=>F())}function t$(e,r){return e.reduce((n,o)=>o in r?ko(r[o])?{...n,...r[o].inferred}:fe():fe(),{})}function r$(e,r,n){let o={};for(let c of s.Keys(n))o[c]=c in r?e$({},r[c],n[c]):Je(n[c])?Ke(n[c])?U(h.Assign(e,{[n[c].name]:n[c].extends})):U(e):F();let i=s.Values(o).every(c=>ko(c)),a=i?t$(s.Keys(o),o):{};return i?U(a):F()}function n$(e,r,n){let o=r$(e,r,n);return ko(o)?U(h.Assign(e,o.inferred)):F()}function o$(e,r,n){return n$(e,r,n)}function i$(e,r){return s.Keys(r).reduce((n,o)=>({...n,[o]:s.HasPropertyKey(e,o)?R(n[o])?B([...n[o].anyOf,r[o]]):B([e[o],r[o]]):r[o]}),e)}function RI(e,r,n,o){return s.ShiftLeft(r,(i,a)=>Se(ee({},e[i],n),c=>RI(e,a,n,i$(o,c)),()=>F()),()=>U(o))}function a$(e,r,n,o){let i=s.Keys(r);return RI(r,i,o,e)}function CI(e,r,n){return de(n)?a$(e,r,ot(n),be(n)):D(n)?o$(e,r,n.properties):ae(e,k(r),n)}function s$(e,r){return s.IsEqual(s.Keys(r).length,0)?U(e):F()}function c$(e,r,n,o,i){return ee(e,n,i)}function PI(e,r,n,o){return de(o)?c$(e,vc(r),n,vc(ot(o)),be(o)):D(o)?s$(e,o.properties):Ye(o)?U(e):et(o)?U(e):F()}function UI(e,r,n){return Qe(n)?U(e):ae(e,r,n)}function wI(e,r,n){return fr(n)?U(e):ae(e,r,n)}function vI(e,r,n){let o=yt(r);return ee(e,o,n)}function Bl(e,r){return h.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 Fl(e){return un(e)?Ke(e.items)?Z(e.items.extends)?Bl(e.items.name,e.items.extends.items):et(e.items.extends)?Bl(e.items.name,e.items.extends):void 0:fe():void 0}function mp(e){return Ke(e)?Bl(e.name,e.extends):void 0}function Hl(e,r,n=[]){return s.ShiftLeft(e,(o,i)=>Se(ee({},o,r),()=>Hl(i,r,[...n,o]),()=>{}),()=>n)}function NI(e,r,n,o){let i=Hl(n,o);return s.IsArray(i)?U(h.Assign(e,{[r]:Le(i)})):F()}function dp(e,r,n,o){let i=Hl(n,o);return s.IsArray(i)?U(h.Assign(e,{[r]:B(i)})):F()}function p$(e){return[...e].reverse()}function Kl(e,r){return r?p$(e):e}function u$(e){let r=e.length>0?e[0]:void 0,n=Pe(r)?Fl(r):void 0;return Pe(n)}function l$(e,r,n,o,i,a){return Se(ee(e,n,i),c=>LI(c,r,o,a),()=>F())}function m$(e,r,n,o,i){let a=Fl(o);return _a(a)?NI(e,a.name,Kl(n,r),a.type):s.ShiftLeft(n,(c,l)=>l$(e,r,c,l,o,i),()=>F())}function d$(e,r,n,o){return s.ShiftLeft(o,(i,a)=>m$(e,r,n,i,a),()=>s.IsEqual(n.length,0)?U(e):F())}function LI(e,r,n,o){return d$(e,r,n,o)}function f$(e,r,n){let o=fn(e,Ie([],[]),n),i=u$(o);return LI(e,i,Kl(r,i),Kl(o,i))}function kI(e,r,n){let o=mp(n);return _a(o)?dp(e,o.name,r,o.type):s.ShiftLeft(r,(i,a)=>Se(ee(e,i,n),c=>kI(c,a,n),()=>F()),()=>U(e))}function MI(e,r,n){let o=fn(e,Ie([],[]),r);return Y(n)?f$(e,o,n.items):Z(n)?kI(e,o,n.items):ae(e,Le(o),n)}function DI(e,r,n){return Lt(n)?U(e):tr(n)?U(e):ae(e,r,n)}function GI(e,r,n){return s.ShiftLeft(n,(o,i)=>Se(ee(e,r,o),a=>U(a),()=>GI(e,r,i)),()=>F())}function zl(e,r,n){return s.ShiftLeft(r,(o,i)=>Se(GI(e,o,n),a=>zl(a,i,n),()=>F()),()=>U(e))}function $I(e,r,n){let o=mp(n);return _a(o)?dp(e,o.name,r,o.type):R(n)?zl(e,r,n.anyOf):zl(e,r,[n])}function jI(e,r,n){return Ke(n)?ae(e,r,n):Ye(n)?U(e):et(n)?U(e):F()}function qI(e,r,n){return Lt(n)?U(e):ae(e,r,n)}function ee(e,r,n){return Ye(r)?dI(e,r,n):Z(r)?fI(e,r,r.items,n):wt(r)?gI(e,r,n):Tt(r)?yI(e,r,n):Fe(r)?hI(e,r.parameters,r.instanceType,n):Ne(r)?EI(e,r.if,r.then,r.else,n):ze(r)?TI(e,r.enum,n):He(r)?_I(e,r.parameters,r.returnType,n):nt(r)?II(e,r,n):M(r)?bI(e,r.allOf,n):Q(r)?SI(e,r,n):Jt(r)?OI(e,r,n):dr(r)?AI(e,r,n):Re(r)?xI(e,r,n):D(r)?CI(e,r.properties,n):de(r)?PI(e,ot(r),be(r),n):Qe(r)?UI(e,r,n):fr(r)?wI(e,r,n):Ee(r)?vI(e,r.pattern,n):Y(r)?MI(e,r.items,n):tr(r)?DI(e,r,n):R(r)?$I(e,r.anyOf,n):et(r)?jI(e,r,n):Lt(r)?qI(e,r,n):F()}function g$(e,r){return Ue([...e,k(r)])}function Yl(e,r,n){return K(e)?h.Update(g$(e,r),{},n):ma(e,r,n)}function BI(e,r,n,o,i){let a=Gt(e,r,n),c=Ia(e,r,o);return Yl(a,c,i)}function ma(e,r,n={}){return v("Interface",[e,r],n)}function Mo(e){return Pe(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function FI(e,r,n={}){return Yl(e,r,n)}function y$(e,r,n){return e.includes(n)?!0:ba([...e,n],r,r[n])}function HI(e,r,n){let o=gc(n);return Vn(e,r,o)}function Vn(e,r,n){return s.ShiftLeft(n,(o,i)=>ba(e,r,o)?!0:Vn(e,r,i),()=>!1)}function ba(e,r,n){return ce(n)?y$(e,r,n.$ref):Z(n)?ba(e,r,n.items):Fe(n)?Vn(e,r,[...n.parameters,n.instanceType]):He(n)?Vn(e,r,[...n.parameters,n.returnType]):Mo(n)?HI(e,r,n.parameters[1]):M(n)?Vn(e,r,n.allOf):D(n)?HI(e,r,n.properties):R(n)?Vn(e,r,n.anyOf):Y(n)?Vn(e,r,n.items):de(n)?ba(e,r,be(n)):!1}function KI(e,r,n){return ba(e,r,n)}function h$(e,r){return r.reduce((n,o)=>KI([o],e,e[o])?[...n,o]:n,[])}function zI(e){let r=fc(e);return h$(e,r)}function E$(e,r,n){return n.includes(r)?n:r in e?Sa(e,e[r],[...n,r]):fe()}function YI(e,r,n){let o=gc(r);return Do(e,o,n)}function Do(e,r,n){return r.reduce((o,i)=>Sa(e,i,o),n)}function Sa(e,r,n){return ce(r)?E$(e,r.$ref,n):Z(r)?Sa(e,r.items,n):Fe(r)?Do(e,[...r.parameters,r.instanceType],n):He(r)?Do(e,[...r.parameters,r.returnType],n):Mo(r)?YI(e,r.parameters[1],n):M(r)?Do(e,r.allOf,n):D(r)?YI(e,r.properties,n):R(r)?Do(e,r.anyOf,n):Y(r)?Do(e,r.items,n):de(r)?Sa(e,be(r),n):n}function VI(e,r,n){return Sa(e,n,[r])}function T$(e){return So()}function _$(e){return s.Keys(e).reduce((r,n)=>({...r,[n]:Qn(e[n])}),{})}function Oa(e){return e.reduce((r,n)=>[...r,Qn(n)],[])}function Qn(e){return ce(e)?T$(e.$ref):Z(e)?Ct(Qn(e.items),Io(e)):Fe(e)?cr(Oa(e.parameters),Qn(e.instanceType)):He(e)?pr(Oa(e.parameters),Qn(e.returnType)):M(e)?ut(Oa(e.allOf)):D(e)?k(_$(e.properties)):de(e)?Uo(pn(e),Qn(be(e))):R(e)?B(Oa(e.anyOf)):Y(e)?Le(Oa(e.items)):e}function I$(e,r){return r in e?Qn(e[r]):Ve()}function QI(e){return I$(e.$defs,e.$ref)}function b$(e,r,n){let o=Gt(e,Ie([],[]),r),i=Ia({},Ie([],[]),n);return Ue([...o,k(i)])}function S$(e,r){return s.Keys(e).filter(o=>r.includes(o)).reduce((o,i)=>{let a=e[i],c=Mo(a)?b$(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function WI(e,r,n){let o=VI(e,r,n),i=S$(e,o);return lr(i,r)}function ZI(e,r){return r in e?ce(e[r])?ZI(e,e[r].$ref):e[r]:me()}function gr(e,r){return ZI(e,r)}function XI(e){return he(e)?QI(e):yc(e)?Ve():e}function dt(e,r,n){let o=XI(r),i=XI(n);return ee(e,o,i)}var sa="equal",O$="disjoint",ca="left-inside",pa="right-inside";function Kn(e,r){let n=[et(e)?G.ExtendsFalse():dt({},e,r),et(e)?G.ExtendsTrue({}):dt({},r,e)];return G.IsExtendsTrueLike(n[0])&&G.IsExtendsTrueLike(n[1])?sa:G.IsExtendsTrueLike(n[0])&&G.IsExtendsFalse(n[1])?ca:G.IsExtendsFalse(n[0])&&G.IsExtendsTrueLike(n[1])?pa:O$}function A$(e,r){return r.filter(n=>Kn(e,n)!==pa)}function x$(e,r){let n=r.some(o=>{let i=Kn(e,o);return s.IsEqual(i,ca)||s.IsEqual(i,sa)});return s.IsEqual(n,!1)}function R$(e,r){let n=Yt(e);return Ye(n)?[n]:x$(n,r)?[...A$(n,r),n]:r}function C$(e){return e.reduce((r,n)=>D(n)?[...r,n]:Jt(n)?r:R$(n,r),[])}function Al(e){let r=C$(e);return Po(r)}function Vl(e,r){return h.Update(Yt(e),{},r)}function JI(e,r,n,o){let i=A(e,r,n);return Vl(i,o)}function Aa(e,r=[]){return nn(e)&&s.IsEqual(e.action,"Conditional")?ce(e.parameters[0])?Aa(e.parameters[2],Aa(e.parameters[3],[...r,e.parameters[0].$ref])):Aa(e.parameters[2],Aa(e.parameters[3],r)):nn(e)&&s.IsEqual(e.action,"Mapped")&&nn(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&ce(e.parameters[1].parameters[0])?[...r,e.parameters[1].parameters[0].$ref]:r}function P$(e,r){return e.reduce((n,o)=>[...n,r.includes(o.name)],[])}function rb(e,r,n=[]){return s.ShiftLeft(e,(o,i)=>s.ShiftLeft(r,(a,c)=>rb(i,c,[...n,[a,o]]),()=>n),()=>n)}function U$(e){return Ee(e)?yt(e.pattern):ze(e)?Ut(e.enum):e}function w$(e){let r=U$(e);return R(r)?[...r.anyOf]:[r]}function v$(e,r){return e.reduce((n,o)=>[...n,[...o,r]],[])}function eb(e,r){return r.reduce((n,o)=>[...n,...v$(e,o)],[])}function tb(e){return e.reduce((r,n)=>s.IsEqual(n[0],!0)?eb(r,w$(n[1])):eb(r,[n[1]]),[[]])}function nb(e,r,n){let o=Aa(n),i=P$(e,o),a=rb(r,i);return nn(n)&&s.IsEqual(n.action,"Conditional")||nn(n)&&s.IsEqual(n.action,"Mapped")?tb(a):[r]}function N$(){return["(not-resolvable)",me()]}function L$(){return["(not-generic)",me()]}function k$(e,r,n){return[e,on(r,n)]}function M$(e,r,n){return r in e?ob(e,r,e[r],n):N$()}function ob(e,r,n,o){return bo(n)?k$(r,n.parameters,n.expression):ce(n)?M$(e,n.$ref,o):L$()}function ib(e,r,n){return ob(e,"(anonymous)",r,n)}function D$(e,r,n){if(Ke(r)||Go(r)||G.IsExtendsTrueLike(dt({},r,n)))return;let o={parameter:e,expect:n,actual:r};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:o})}function ab(e,r,n,o,i){let a=A(e,r,i);return D$(n,a,o),h.Assign(e,{[n]:a})}function G$(e,r,n,o,i){let a=A(e,r,n.extends),c=A(e,r,n.equals);return s.ShiftLeft(i,(l,d)=>Ql(ab(e,r,n.name,a,l),r,o,d),()=>Ql(ab(e,r,n.name,a,c),r,o,[]))}function Ql(e,r,n,o){return s.ShiftLeft(n,(i,a)=>G$(e,r,i,a,o),()=>e)}function sb(e,r,n,o){return Ql(e,r,n,o)}var Wl=0,Zl=0;function $$(){if(!s.IsLessThan(Zl,tt.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function j$(){$$(),Zl++,Wl++}function q$(){Wl--,s.IsEqual(Wl,0)&&(Zl=0)}function B$(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function F$(e,r){return s.IsEqual(B$(e),r)}function H$(e,r,n,o,i,a){j$();try{let c=sb(e,r,o,a),l=A(c,Ie([...r.callstack,n.$ref],r.visited),i);return A(c,Ie([],[]),l)}finally{q$()}}function K$(e,r,n,o,i,a){return a.reduce((c,l)=>{let d=H$(e,r,n,o,i,l);return[...c,d]},[])}function z$(e,r,n,o,i,a){let c=nb(o,a,i),l=K$(e,r,n,o,i,c);return s.IsEqual(l.length,1)?l[0]:Nt(l)}function fp(e,r,n,o){let i=Gt(e,r,o),a=ib(e,n,o),c=a[0],l=a[1];return bo(l)?F$(r,c)?da(rt(c),i):z$(e,r,rt(c),l.parameters,l.expression,i):da(n,i)}function da(e,r){return h.Create({"~kind":"Call"},{type:"call",target:e,arguments:r},{})}function cb(e,r){return fp({},Ie([],[]),e,r)}function Go(e){return w(e,"Call")}function Y$(e){return h.Discard(e,["~immutable"])}function pb(e,r){return h.Update(Y$(e),{},r)}function ub(e,r,n,o){let i=A(e,r,n);return pb(i,o)}function lb(e,r){return e(r)}function mb(e,r){return s.IsString(r)?z(lb(e,r)):z(r)}function db(e,r){let n=yt(r);return Lr(e,n)}function fb(e,r){let n=r.map(o=>Lr(e,o));return B(n)}function Lr(e,r){return Q(r)?mb(e,r.const):Ee(r)?db(e,r.pattern):R(r)?fb(e,r.anyOf):r}function Dc(e,r={}){return v("Capitalize",[e],r)}function gb(e,r={}){return Xl(e,r)}function Gc(e,r={}){return v("Lowercase",[e],r)}function yb(e,r={}){return Jl(e,r)}function $c(e,r={}){return v("Uncapitalize",[e],r)}function hb(e,r={}){return em(e,r)}function jc(e,r={}){return v("Uppercase",[e],r)}function Eb(e,r={}){return tm(e,r)}var V$=e=>e[0].toUpperCase()+e.slice(1),Q$=e=>e.toLowerCase(),W$=e=>e[0].toLowerCase()+e.slice(1),Z$=e=>e.toUpperCase();function Xl(e,r){return K([e])?h.Update(Lr(V$,e),{},r):Dc(e,r)}function Jl(e,r){return K([e])?h.Update(Lr(Q$,e),{},r):Gc(e,r)}function em(e,r){return K([e])?h.Update(Lr(W$,e),{},r):$c(e,r)}function tm(e,r){return K([e])?h.Update(Lr(Z$,e),{},r):jc(e,r)}function Tb(e,r,n,o){let i=A(e,r,n);return Xl(i,o)}function _b(e,r,n,o){let i=A(e,r,n);return Jl(i,o)}function Ib(e,r,n,o){let i=A(e,r,n);return em(i,o)}function bb(e,r,n,o){let i=A(e,r,n);return tm(i,o)}function qc(e,r,n,o,i={}){return v("Conditional",[e,r,n,o],i)}function Sb(e,r,n,o,i={}){return rm({},Ie([],[]),e,r,n,o,i)}function X$(e,r,n,o,i,a){let c=dt(e,n,o);return G.IsExtendsUnion(c)?B([A(c.inferred,r,i),A(e,r,a)]):G.IsExtendsTrue(c)?A(c.inferred,r,i):A(e,r,a)}function rm(e,r,n,o,i,a,c){return K([n,o])?h.Update(X$(e,r,n,o,i,a),{},c):qc(n,o,i,a,c)}function Ob(e,r,n,o,i,a,c){let l=A(e,r,n),d=A(e,r,o);return rm(e,r,l,d,i,a,c)}function Bc(e,r={}){return v("ConstructorParameters",[e],r)}function Ab(e,r={}){return nm(e,r)}function J$(e){let r=Fe(e)?e.parameters:[],n=fn({},Ie([],[]),r);return Le(n)}function nm(e,r){return K([e])?h.Update(J$(e),{},r):Bc(e,r)}function xb(e,r,n,o){let i=A(e,r,n);return nm(i,o)}function Fc(e,r,n={}){return v("Exclude",[e,r],n)}function Rb(e,r,n={}){return xa(e,r,n)}function xa(e,r,n){return K([e,r])?h.Update(Pc(e,r),{},n):Fc(e,r,n)}function Cb(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return xa(a,c,i)}function Hc(e,r,n={}){return v("Extract",[e,r],n)}function Pb(e,r,n={}){return om(e,r,n)}function e1(e,r){let n=dt({},e,r);return G.IsExtendsTrueLike(n)?[e]:[]}function t1(e,r){return e.reduce((n,o)=>[...n,...e1(o,r)],[])}function Ub(e,r){let n=Yt(e),o=R(n)?n.anyOf:[n],i=t1(o,r);return Nt(i)}function om(e,r,n){return K([e,r])?h.Update(Ub(e,r),{},n):Hc(e,r,n)}function wb(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return om(a,c,i)}function r1(e){return e.reduce((r,n)=>Ic(n)?[...r,z(n)]:r,[])}function $o(e){let r=r1(e);return B(r)}function fa(e,r,n={}){return v("Index",[e,r],n)}function vb(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return im(e,o,n)}function Nb(e,r){let n=gr(e,r);return $t(n)}function Lb(e,r,n){let o=er(e,r,n);return $t(o)}function n1(e,r){let n=s.Keys(e).filter(y=>!s.HasPropertyKey(r,y)),o=s.Keys(r).filter(y=>!s.HasPropertyKey(e,y)),i=s.Keys(e).filter(y=>s.HasPropertyKey(r,y)),a=n.reduce((y,_)=>({...y,[_]:e[_]}),{}),c=o.reduce((y,_)=>({...y,[_]:r[_]}),{}),l=i.reduce((y,_)=>({...y,[_]:Ue([e[_],r[_]])}),{}),d=h.Assign(a,c);return h.Assign(d,l)}function kb(e){return e.reduce((r,n)=>n1(r,$t(n)),{})}function Mb(e){let r=qh(Le(e));return $t(r)}function o1(e,r){return s.Keys(e).filter(i=>i in r).reduce((i,a)=>({...i,[a]:Nt([e[a],r[a]])}),{})}function Db(e,r){return s.ShiftLeft(e,(n,o)=>Db(o,o1(r,$t(n))),()=>r)}function Gb(e){return s.ShiftLeft(e,(r,n)=>Db(n,$t(r)),()=>fe())}function $t(e){return he(e)?Nb(e.$defs,e.$ref):Ne(e)?Lb(e.if,e.then,e.else):M(e)?kb(e.allOf):R(e)?Gb(e.anyOf):Y(e)?Mb(e.items):D(e)?e.properties:{}}function jo(e){let r=$t(e);return k(r)}var i1=new RegExp("^(?:0|[1-9][0-9]*)$");function qo(e){let r=`${e}`;return i1.test(r)?parseInt(r):e}function a1(e){return z(qo(e))}function $b(e){return e.map(r=>jb(r))}function jb(e){return M(e)?ut($b(e.allOf)):R(e)?B($b(e.anyOf)):Q(e)?a1(e.const):e}function qb(e,r){let n=jb(r),o=dt({},n,vt());return G.IsExtendsTrueLike(o)?e:Q(r)&&s.IsEqual(r.const,"length")?vt():me()}function Bb(e,r){let n=gr(e,r);return kt(n)}function Fb(e,r,n){let o=er(e,r,n);return kt(o)}function Hb(e){let r=Ut(e);return kt(r)}function Kb(e){let r=Ue(e);return kt(r)}function zb(e){return[`${e}`]}function Yb(e){let r=yt(e);return kt(r)}function Vb(e){return e.reduce((r,n)=>[...r,...kt(n)],[])}function kt(e){return he(e)?Bb(e.$defs,e.$ref):Ne(e)?Fb(e.if,e.then,e.else):ze(e)?Hb(e.enum):M(e)?Kb(e.allOf):Q(e)?zb(e.const):Ee(e)?Yb(e.pattern):R(e)?Vb(e.anyOf):[]}function Bo(e){return kt(e)}function Ra(e,r){return r.map(n=>Ca(e,n))}function Ca(e,r){return Z(r)?Ct(Ca(e,r.items)):Fe(r)?cr(Ra(e,r.parameters),Ca(e,r.instanceType)):He(r)?pr(Ra(e,r.parameters),Ca(e,r.returnType)):Y(r)?Le(Ra(e,r.items)):R(r)?B(Ra(e,r.anyOf)):M(r)?ut(Ra(e,r.allOf)):Lc(r)?k(e):r}function Qb(e,r){return Ca(e,r)}function s1(e,r){let n=r in e?e[r]:me();return Qb(e,n)}function Wb(e,r){return r.reduce((n,o)=>[...n,s1(e,o)],[])}function c1(e,r){let n=Bo(r),o=Wb(e,n);return Nt(o)}var p1=new RegExp(cn);function u1(e){return e.filter(n=>p1.test(n))}function l1(e){let r=fc(e),n=u1(r),o=Wb(e,n);return Nt(o)}function Zb(e,r){return Re(r)?l1(e):c1(e,r)}function m1(e){return z(qo(e))}function Xb(e){return e.map(r=>am(r))}function am(e){return M(e)?ut(Xb(e.allOf)):R(e)?B(Xb(e.anyOf)):Q(e)?m1(e.const):e}function d1(e,r){return e.reduceRight((n,o,i)=>{let a=dt({},z(i),r);return G.IsExtendsTrueLike(a)?[o,...n]:n},[])}function f1(e,r){let n=am(r),o=d1(e,n);return vr(o)}function g1(e){return vr(e)}function Jb(e,r){return Q(r)&&s.IsEqual(r.const,"length")?z(e.length):Re(r)||nt(r)?g1(e):f1(e,r)}function eS(e,r){return Z(e)?qb(e.items,r):D(e)?Zb(e.properties,r):Y(e)?Jb(e.items,r):me()}function y1(e){return he(e)||Ne(e)||M(e)||R(e)?jo(e):e}function im(e,r,n){return K([e,r])?h.Update(eS(y1(e),r),{},n):fa(e,r,n)}function tS(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return im(a,c,i)}function Kc(e,r={}){return v("InstanceType",[e],r)}function rS(e,r={}){return sm(e,r)}function h1(e){return Fe(e)?e.instanceType:me()}function sm(e,r){return K([e])?h.Update(h1(e),{},r):Kc(e,r)}function nS(e,r,n,o={}){let i=A(e,r,n);return sm(i,o)}function ga(e,r={}){return v("KeyOf",[e],r)}function oS(e,r={}){return cm(e,r)}function iS(){return B([vt(),_t(),Ro()])}function aS(e){return vt()}function E1(e){return e.reduce((n,o)=>Ic(o)?[...n,z(qo(o))]:fe(),[])}function sS(e){let r=s.Keys(e),n=E1(r);return vr(n)}function cS(e){return pn(e)}function pS(e){let r=e.map((n,o)=>z(o));return vr(r)}function uS(e){return Ye(e)?iS():Z(e)?aS(e.items):D(e)?sS(e.properties):de(e)?cS(e):Y(e)?pS(e.items):me()}function T1(e){return he(e)||Ne(e)||M(e)||R(e)?jo(e):e}function cm(e,r){return K([e])?h.Update(uS(T1(e)),{},r):ga(e,r)}function lS(e,r,n,o){let i=A(e,r,n);return cm(i,o)}function la(e,r,n,o,i={}){return v("Mapped",[e,r,n,o],i)}function mS(e,r,n,o,i={}){return pm({},Ie([],[]),e,r,n,o,i)}function _1(e){let r=yt(e);return gp(r)}function I1(e){return e.reduce((r,n)=>[...r,...gp(n)],[])}function b1(e){let r=Ut(e);return gp(r)}function S1(e){return s.IsNumber(e)?[z(`${e}`)]:[z(e)]}function gp(e){return ze(e)?b1(e.enum):Q(e)?S1(e.const):Ee(e)?_1(e.pattern):R(e)?I1(e.anyOf):[e]}function dS(e){return gp(e)}function O1(e){return Ee(e)?yt(e.pattern):e}function A1(e,r,n,o,i,a){let c=h.Assign(e,{[n.name]:o}),l=A(c,r,i),d=O1(l),f=A(c,r,a);return bc(d)||Sc(d)?{[d.const]:f}:{}}function x1(e,r,n,o,i,a){return o.reduce((c,l)=>[...c,A1(e,r,n,l,i,a)],[])}function R1(e){return e.reduce((r,n)=>[...r,k(n)],[])}function fS(e,r,n,o,i,a){let c=dS(o),l=x1(e,r,n,c,i,a),d=R1(l);return Ue(d)}function pm(e,r,n,o,i,a,c){return K([o])?h.Update(fS(e,r,n,o,i,a),{},c):la(n,o,i,a,c)}function gS(e,r,n,o,i,a,c){let l=A(e,r,o);return pm(e,r,n,l,i,a,c)}function C1(e,r,n){let o=h.Assign(e,r);return s.Keys(r).filter(a=>n.includes(a)).reduce((a,c)=>({...a,[c]:WI(o,c,r[c])}),{})}function P1(e,r,n){let o=h.Assign(e,r);return s.Keys(r).filter(a=>!n.includes(a)).reduce((a,c)=>({...a,[c]:A(o,Ie([],[]),r[c])}),{})}function U1(e,r,n){let o=zI(r),i=C1(e,r,o),a=P1(e,r,o),c={...i,...a};return h.Update(c,{},n)}function yp(e,r,n,o){return U1(e,n,o)}function zc(e,r={}){return v("NonNullable",[e],r)}function yS(e,r={}){return um(e,r)}function w1(e){let r=B([xo(),wo()]);return xa(e,r,{})}function um(e,r){return K([e])?h.Update(w1(e),{},r):zc(e,r)}function hS(e,r,n,o){let i=A(e,r,n);return um(i,o)}function Yc(e,r,n={}){return v("Omit",[e,r],n)}function ES(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return lm(e,o,n)}function hp(e){let r=jo(e);return D(r)?r.properties:fe()}function v1(e,r){return s.Keys(e).reduce((o,i)=>r.includes(i)?o:{...o,[i]:e[i]},{})}function TS(e,r){let n=hp(e),o=Bo(r),i=v1(n,o);return k(i)}function lm(e,r,n){return K([e,r])?h.Update(TS(e,r),{},n):Yc(e,r,n)}function _S(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return lm(a,c,i)}function Vc(e,r={}){return v("Parameters",[e],r)}function IS(e,r={}){return mm(e,r)}function N1(e){let r=He(e)?e.parameters:[],n=fn({},Ie([],[]),r);return Le(n)}function mm(e,r){return K([e])?h.Update(N1(e),{},r):Vc(e,r)}function bS(e,r,n,o){let i=A(e,r,n);return mm(i,o)}function Qc(e,r={}){return v("Partial",[e],r)}function SS(e,r={}){return dm(e,r)}function OS(e,r){let n=gr(e,r),o=yr(n);return lr(h.Assign(e,{[r]:o}),r)}function AS(e,r,n){let o=er(e,r,n);return yr(o)}function xS(e){let r=Ue(e);return yr(r)}function RS(e){let r=e.map(n=>yr(n));return B(r)}function CS(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:Mn(e[i])}),{});return k(r)}function yr(e){return he(e)?OS(e.$defs,e.$ref):Ne(e)?AS(e.if,e.then,e.else):M(e)?xS(e.allOf):R(e)?RS(e.anyOf):D(e)?CS(e.properties):k({})}function dm(e,r){return K([e])?h.Update(yr(e),{},r):Qc(e,r)}function PS(e,r,n,o){let i=A(e,r,n);return dm(i,o)}function Wc(e,r,n={}){return v("Pick",[e,r],n)}function US(e,r,n={}){let o=s.IsArray(r)?$o(r):r;return fm(e,o,n)}function L1(e,r){return s.Keys(e).reduce((o,i)=>r.includes(i)?h.Assign(o,{[i]:e[i]}):o,{})}function wS(e,r){let n=hp(e),o=Bo(r),i=L1(n,o);return k(i)}function fm(e,r,n){return K([e,r])?h.Update(wS(e,r),{},n):Wc(e,r,n)}function vS(e,r,n,o,i){let a=A(e,r,n),c=A(e,r,o);return fm(a,c,i)}function Zc(e,r={}){return v("ReadonlyObject",[e],r)}function gm(e,r={}){return ym(e,r)}var NS=gm;function LS(e){return Ao(Ct(e))}function kS(e,r){let n=gr(e,r),o=hr(n);return lr(h.Assign(e,{[r]:o}),r)}function MS(e,r,n){let o=er(e,r,n);return hr(o)}function DS(e){let r=Ue(e);return hr(r)}function GS(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:qn(e[i])}),{});return k(r)}function $S(e){return Ao(Le(e))}function jS(e){let r=e.map(n=>hr(n));return B(r)}function hr(e){return Z(e)?LS(e.items):he(e)?kS(e.$defs,e.$ref):Ne(e)?MS(e.if,e.then,e.else):M(e)?DS(e.allOf):D(e)?GS(e.properties):Y(e)?$S(e.items):R(e)?jS(e.anyOf):e}function ym(e,r){return K([e])?h.Update(hr(e),{},r):Zc(e)}function qS(e,r,n,o){let i=A(e,r,n);return ym(i,o)}function BS(e,r,n,o){return r.visited.includes(o)?n:o in e?A(e,Ie(r.callstack,[...r.visited,o]),e[o]):n}function FS(e,r){let n=gr(e,r),o=Er(n);return lr(h.Assign(e,{[r]:o}),r)}function HS(e,r,n){let o=er(e,r,n);return Er(o)}function KS(e){let r=Ue(e);return Er(r)}function zS(e){let r=e.map(n=>Er(n));return B(r)}function YS(e){let r=s.Keys(e).reduce((o,i)=>({...o,[i]:Cc(e[i])}),{});return k(r)}function Er(e){return he(e)?FS(e.$defs,e.$ref):Ne(e)?HS(e.if,e.then,e.else):M(e)?KS(e.allOf):R(e)?zS(e.anyOf):D(e)?YS(e.properties):k({})}function Xc(e,r={}){return v("Required",[e],r)}function VS(e,r={}){return hm(e,r)}function hm(e,r){return K([e])?h.Update(Er(e),{},r):Xc(e,r)}function QS(e,r,n,o){let i=A(e,r,n);return hm(i,o)}function Jc(e,r={}){return v("ReturnType",[e],r)}function WS(e,r={}){return Em(e,r)}function k1(e){return He(e)?e.returnType:me()}function Em(e,r){return K([e])?h.Update(k1(e),{},r):Jc(e,r)}function ZS(e,r,n,o={}){let i=A(e,r,n);return Em(i,o)}function ep(e,r){return v("With",[e,r],{})}function Ep(e,r){return Tm(e,r)}function Tm(e,r){return K([e])?h.Update(e,{},r):ep(e,r)}function XS(e,r,n,o){let i=A(e,r,n);return Tm(i,o)}function M1(e){return un(e)?Y(e.items)?_m(e.items.items):Ke(e.items)?[e]:ce(e.items)?[e]:[me()]:[e]}function _m(e){return e.reduce((n,o)=>[...n,...M1(o)],[])}function Ie(e,r){return{callstack:e,visited:r}}function K(e){return s.ShiftLeft(e,(r,n)=>ce(r)?!1:K(n),()=>!0)}function Ia(e,r,n){return s.Keys(n).reduce((o,i)=>({...o,[i]:A(e,r,n[i])}),{})}function fn(e,r,n){let o=Gt(e,r,n);return _m(o)}function Gt(e,r,n){return n.map(o=>A(e,r,o))}function D1(e,r){let n=Je(e)?Ji(r,{}):r,o=Bn(e)?Xi(n,{}):n;return jn(e)?Pa(o,{}):o}function G1(e,r,n,o,i){return s.IsEqual(n,"AddImmutable")?JS(e,r,o[0],i):s.IsEqual(n,"RemoveImmutable")?ub(e,r,o[0],i):s.IsEqual(n,"AddReadonly")?Hy(e,r,o[0],i):s.IsEqual(n,"RemoveReadonly")?Mh(e,r,o[0],i):s.IsEqual(n,"AddOptional")?Ky(e,r,o[0],i):s.IsEqual(n,"RemoveOptional")?$h(e,r,o[0],i):s.IsEqual(n,"Capitalize")?Tb(e,r,o[0],i):s.IsEqual(n,"Conditional")?Ob(e,r,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?xb(e,r,o[0],i):s.IsEqual(n,"Evaluate")?JI(e,r,o[0],i):s.IsEqual(n,"Exclude")?Cb(e,r,o[0],o[1],i):s.IsEqual(n,"Extract")?wb(e,r,o[0],o[1],i):s.IsEqual(n,"Index")?tS(e,r,o[0],o[1],i):s.IsEqual(n,"InstanceType")?nS(e,r,o[0],i):s.IsEqual(n,"Interface")?BI(e,r,o[0],o[1],i):s.IsEqual(n,"KeyOf")?lS(e,r,o[0],i):s.IsEqual(n,"Lowercase")?_b(e,r,o[0],i):s.IsEqual(n,"Mapped")?gS(e,r,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?yp(e,r,o[0],i):s.IsEqual(n,"NonNullable")?hS(e,r,o[0],i):s.IsEqual(n,"Pick")?vS(e,r,o[0],o[1],i):s.IsEqual(n,"Parameters")?bS(e,r,o[0],i):s.IsEqual(n,"Partial")?PS(e,r,o[0],i):s.IsEqual(n,"Omit")?_S(e,r,o[0],o[1],i):s.IsEqual(n,"ReadonlyObject")?qS(e,r,o[0],i):s.IsEqual(n,"Record")?rE(e,r,o[0],o[1],i):s.IsEqual(n,"Required")?QS(e,r,o[0],i):s.IsEqual(n,"ReturnType")?ZS(e,r,o[0],i):s.IsEqual(n,"TemplateLiteral")?aI(e,r,o[0],i):s.IsEqual(n,"Uncapitalize")?Ib(e,r,o[0],i):s.IsEqual(n,"Uppercase")?bb(e,r,o[0],i):s.IsEqual(n,"With")?XS(e,r,o[0],o[1]):v(n,o,i)}function $1(e,r,n){let o=ce(n)?BS(e,r,n,n.$ref):Z(n)?Ct(A(e,r,n.items),Io(n)):Go(n)?fp(e,r,n.target,n.arguments):Fe(n)?cr(Gt(e,r,n.parameters),A(e,r,n.instanceType),zy(n)):He(n)?pr(Gt(e,r,n.parameters),A(e,r,n.returnType),Yy(n)):Ne(n)?Dn(A(e,r,n.if),A(e,r,n.then),A(e,r,n.else),Jy(n)):M(n)?ut(Gt(e,r,n.allOf),oh(n)):D(n)?k(Ia(e,r,n.properties),Zy(n)):de(n)?wc(ot(n),A(e,r,be(n))):un(n)?zn(A(e,r,n.items)):Y(n)?Le(fn(e,r,n.items),kh(n)):R(n)?B(Gt(e,r,n.anyOf),Ah(n)):n;return D1(n,o)}function A(e,r,n){return nn(n)?G1(e,r,n.action,n.parameters,n.options):$1(e,r,n)}function Vt(e,r){return A(e,Ie([],[]),r)}function j1(e){return h.Update(e,{"~immutable":!0},{})}function Pa(e,r){return h.Update(j1(e),{},r)}function JS(e,r,n,o){let i=A(e,r,n);return Pa(i,o)}function r_(e,r={}){return v("AddImmutable",[e],r)}function Ao(e,r={}){return Pa(e,r)}function n_(e,r={}){return v("Evaluate",[e],r)}function ft(e,r={}){return Vl(e,r)}function o_(e,r={}){return v("Module",[e],r)}function eO(e,r={}){return yp({},Ie([],[]),e,r)}function q1(e,r){let n=Kn(e,r);return s.IsEqual(n,"right-inside")||s.IsEqual(n,"disjoint")?1:0}function tO(e,r,n=[]){return s.ShiftLeft(r,(o,i)=>s.IsEqual(q1(e,o),1)?tO(e,i,[...n,o]):[...n,e,...r],()=>[...n,e])}function rO(e,r=[]){return s.ShiftLeft(e,(n,o)=>rO(o,tO(n,r)),()=>r)}function nO(e){return rO(e)}function oO(...e){let[r,n,o]=oe.Match(e,{2:(c,l)=>s.IsString(c)?[{},c,l]:[c,l,{}],3:(c,l,d)=>[c,l,d],1:c=>[{},c,{}]}),i=tI(n),a=s.IsArray(i)&&s.IsEqual(i.length,2)?A(r,Ie([],[]),i[0]):me();return h.Update(a,{},o)}var t={};zt(t,{Any:()=>So,Array:()=>Ct,BigInt:()=>na,Boolean:()=>Tc,Call:()=>cb,Capitalize:()=>gb,Codec:()=>hc,Conditional:()=>Sb,Constructor:()=>cr,ConstructorParameters:()=>Ab,Cyclic:()=>lr,Decode:()=>gh,DecodeBuilder:()=>ra,Dependent:()=>Dn,Encode:()=>yh,EncodeBuilder:()=>ta,Enum:()=>nh,Evaluate:()=>ft,Exclude:()=>Rb,Extends:()=>dt,ExtendsResult:()=>G,Extract:()=>Pb,Function:()=>pr,Generic:()=>on,Identifier:()=>oa,Immutable:()=>hh,Index:()=>vb,Infer:()=>ea,InstanceType:()=>rS,Instantiate:()=>Vt,Integer:()=>Fn,Interface:()=>FI,Intersect:()=>ut,IsAny:()=>Ye,IsArray:()=>Z,IsBigInt:()=>wt,IsBoolean:()=>Tt,IsCall:()=>Go,IsCodec:()=>$n,IsConstructor:()=>Fe,IsCyclic:()=>he,IsDependent:()=>Ne,IsEnum:()=>ze,IsEnumValue:()=>rh,IsFunction:()=>He,IsGeneric:()=>bo,IsIdentifier:()=>Ih,IsImmutable:()=>jn,IsInfer:()=>Ke,IsInteger:()=>nt,IsIntersect:()=>M,IsKind:()=>w,IsLiteral:()=>Q,IsNever:()=>Jt,IsNull:()=>dr,IsNumber:()=>Re,IsObject:()=>D,IsOptional:()=>Je,IsParameter:()=>Oh,IsReadonly:()=>Bn,IsRecord:()=>de,IsRef:()=>ce,IsRefine:()=>Ec,IsRest:()=>un,IsSchema:()=>Pe,IsString:()=>Qe,IsSymbol:()=>fr,IsTemplateLiteral:()=>Ee,IsThis:()=>Lc,IsTuple:()=>Y,IsUndefined:()=>tr,IsUnion:()=>R,IsUnknown:()=>et,IsUnsafe:()=>yc,IsVoid:()=>Lt,KeyOf:()=>oS,Literal:()=>z,Lowercase:()=>yb,Mapped:()=>mS,Module:()=>eO,Never:()=>me,NonNullable:()=>yS,Null:()=>xo,Number:()=>vt,Object:()=>k,Omit:()=>ES,Optional:()=>Qy,Parameter:()=>Hn,Parameters:()=>IS,Partial:()=>SS,Pick:()=>US,Readonly:()=>Eh,ReadonlyObject:()=>gm,ReadonlyType:()=>NS,Record:()=>Uo,RecordKey:()=>pn,RecordPattern:()=>ot,RecordValue:()=>be,Ref:()=>rt,Refine:()=>Th,Required:()=>VS,Rest:()=>zn,ReturnType:()=>WS,Script:()=>oO,String:()=>_t,Symbol:()=>Ro,TemplateLiteral:()=>cI,This:()=>Nc,Tuple:()=>Le,Uncapitalize:()=>hb,Undefined:()=>wo,Union:()=>B,Unknown:()=>Ve,Unsafe:()=>Xy,Uppercase:()=>Eb,Void:()=>kc,With:()=>Ep});var B1=tn(aO());var sO="lowercase-email",Im="iana-timezone",bm="simple-time",Sm="simple-date-time";var F1=(e,r)=>RegExp(`^${e.source}(${r.source}${e.source})*$`),H1=/[a-zA-Z0-9-_]+/,K1=/\./,GOe=F1(H1,K1);var cO="lowercase-domain";var Fo="kebab-case";var pO="camel-case";var z1=new Set;function C(e,r,n={}){let o=r.map(i=>{let a=i;return a.$id?(z1.add(i),t.Ref(a.$id)):i});return t.Unsafe({...n,type:"object",discriminator:{propertyName:e},required:[e],oneOf:o})}function Me(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 Ko=1e3,_p=100,Te={limit:t.Optional(t.Integer({minimum:1,maximum:Ko,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."}))},We={...Te,limit:t.Optional(t.Integer({minimum:1,maximum:Ko,default:_p,description:`Maximum number of items to return in this page. Omit to use the public API default of ${_p}.`}))},Y1=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."}),FOe=t.Object({pagination:Y1},{$id:"ResponseMetadata",description:"Metadata accompanying `data` on paginated operations, describing the full result set the page was taken from."});function b(e={}){return t.Unsafe({...e,type:"string"})}var Ho=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:pO,minLength:i,maxLength:Ho,...a});case"kebab-case":return t.String({format:Fo,minLength:i,maxLength:Ho,...a});case"email":return t.String({format:sO,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return t.String({format:cO,minLength:i,maxLength:Ho,...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:Ho,...a});case"long":return t.String({minLength:i,maxLength:5e4,...a});case"short":return t.String({minLength:i,maxLength:Ho,...a});case"tsuga-formula":return t.String({format:"tsuga-formula",minLength:i,maxLength:Ho,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:pt(r)}}var Ua=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],Ip=t.Array(t.Enum(Ua,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var Om=["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"],tAe=t.Enum(Om),V1=["CLUSTER_AGGREGATION_STRUCTURE"],rAe=t.Object({code:t.Enum(Om),message:t.String()}),uO=[...Om,...V1,"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"],lO=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var Q1=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],W1=[...uO,...lO,...Q1],Z1=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(Ua,{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."}),X1=C("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`."}),J1=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:X1},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),mO=C("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(Z1,{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(J1,{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."}),nAe=t.Object({code:t.Optional(t.Enum(W1,{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(mO)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),oAe=t.Object({code:t.Optional(t.Enum(uO,{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(mO)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),iAe=t.Object({code:t.Optional(t.Enum(lO,{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"}),aAe=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"}),sAe=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:_=>f.replace(/:[a-zA-Z_]+/g,I=>_[I.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 dO(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 N=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 Am="tsuga-cli";var Wn="/v0/oauth",fO=m({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${Wn}/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)"})}),gO=m({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${Wn}/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()})}),SAe=m({description:"Resolve a signed authorization request handle for the consent page",url:`${Wn}/authorization-request`,method:"GET",query:t.Object({handle:t.String()}),response:t.Object({clientId:t.String(),clientName:t.String(),redirectUri:t.String()})}),OAe=m({description:"Approve or deny an OAuth authorization request from the consent page",url:`${Wn}/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"})})}),AAe=m({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${Wn}/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())})}),ej=["pending","active","revoked"],tj=t.Object({id:t.String(),createdAt:b(),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(ej),lastUsedAt:t.Optional(b())}),xAe=m({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${Wn}/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(tj)}),RAe=m({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${Wn}/grants/:id`,method:"DELETE",params:t.Object({id:t.String()}),response:N});function yO(e,r){let n=new URL(fO.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:Am,redirect_uri:r.redirectUri,code_challenge:r.challenge,code_challenge_method:"S256",state:r.state}).toString(),n.href}function rj(e){if(!e)return{};try{let r=JSON.parse(e);return typeof r=="object"&&r!==null?r:{}}catch{return{}}}async function nj(e,r){let n=await fetch(new URL(gO.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=rj(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*sl)}}async function hO(e,r){return nj(e,{grant_type:"authorization_code",client_id:Am,code:r.code,code_verifier:r.verifier,redirect_uri:r.redirectUri})}var Qt=require("node:fs"),Rm=require("node:os"),Xn=require("node:path");var TO=tn(require("os"),1),wa=tn(require("path"),1),gn=TO.default.homedir(),{env:Zn}=process,EO=Zn.XDG_DATA_HOME||(gn?wa.default.join(gn,".local","share"):void 0),bp=Zn.XDG_CONFIG_HOME||(gn?wa.default.join(gn,".config"):void 0),vAe=Zn.XDG_STATE_HOME||(gn?wa.default.join(gn,".local","state"):void 0),_O=Zn.XDG_CACHE_HOME||(gn?wa.default.join(gn,".cache"):void 0),NAe=Zn.XDG_RUNTIME_DIR||void 0,oj=(Zn.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");EO&&oj.unshift(EO);var ij=(Zn.XDG_CONFIG_DIRS||"/etc/xdg").split(":");bp&&ij.unshift(bp);var IO=(0,Xn.join)(bp??(0,Xn.join)((0,Rm.homedir)(),".config"),"tsuga"),va=(0,Xn.join)(IO,"config.json"),bO=(0,Xn.join)(_O??(0,Xn.join)((0,Rm.homedir)(),".cache"),"tsuga"),xm=(0,Xn.join)(bO,"update-check.json"),Na="https://api.tsuga.com";function SO(e){return fy(e.credential)}function Sp(){if(!(0,Qt.existsSync)(va))return{};try{let e=JSON.parse((0,Qt.readFileSync)(va,"utf-8")),{operationApiKey:r,userAuth:n,...o}=e;return!r&&!n?e:{...o,credentials:{...e.credentials??{},[Na]:{...r?{operationApiKey:r}:{},...n?{userAuth:n}:{},...e.credentials?.[Na]??{}}}}}catch{throw new Error(`Config file corrupted: ${va}
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
${Tl.map((o,i)=>Lk(o,t===0?0:i/t)).join(`
|
|
33
|
+
`)}`}function Uh(){return kk(process.stdout.isTTY&&!process.env.NO_COLOR)}var vO=require("node:crypto");var Mk=Math.pow(10,8)*24*60*60*1e3,l5=-Mk;var wh=864e5,vh=6e4,Nh=36e5;var Dk=3600;var Lh=Dk*24,m5=Lh*7,Gk=Lh*365.2425,$k=Gk/12,d5=$k*3,_l=Symbol.for("constructDateFrom");function Jt(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&_l in e?e[_l](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ye(e,t){return Jt(t||e,e)}function kh(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 Mh(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 xo(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?Mh(h,i+o*12):h,I=c||a?kh(E,c+a*7):E,g=m+l*60,S=(f+g*60)*1e3;return Jt(n?.in||e,+I+S)}var jk={};function Dh(){return jk}function Il(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 bl(e,t){let n=Ye(e,t?.in);return n.setHours(0,0,0,0),n}function Gh(e,t,n){let[o,i]=yt(n?.in,e,t),a=bl(o),c=bl(i),l=+a-Il(a),m=+c-Il(c);return Math.round((l-m)/wh)}function Mn(e,t){let n=+Ye(e)-+Ye(t);return n<0?-1:n>0?1:n}function $h(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 jh(e,t,n){let[o,i]=yt(n?.in,e,t);return o.getFullYear()-i.getFullYear()}function Fh(e,t,n){let[o,i]=yt(n?.in,e,t),a=qh(o,i),c=Math.abs(Gh(o,i));o.setDate(o.getDate()-a*c);let l=+(qh(o,i)===-a),m=a*(c-l);return m===0?0:m}function qh(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 Ro(e){return t=>{let o=(e?Math[e]:Math.trunc)(t);return o===0?0:o}}function Bh(e,t,n){let[o,i]=yt(n?.in,e,t),a=(+o-+i)/Nh;return Ro(n?.roundingMethod)(a)}function dc(e,t){return+Ye(e)-+Ye(t)}function Hh(e,t,n){let o=dc(e,t)/vh;return Ro(n?.roundingMethod)(o)}function Kh(e,t){let n=Ye(e,t?.in);return n.setHours(23,59,59,999),n}function zh(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 Yh(e,t){let n=Ye(e,t?.in);return+Kh(n,t)==+zh(n,t)}function Vh(e,t,n){let[o,i,a]=yt(n?.in,e,e,t),c=Mn(i,a),l=Math.abs($h(i,a));if(l<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-c*l);let m=Mn(i,a)===-c;Yh(o)&&l===1&&Mn(o,a)===1&&(m=!1);let f=c*(l-+m);return f===0?0:f}function Qh(e,t,n){let o=dc(e,t)/1e3;return Ro(n?.roundingMethod)(o)}function Wh(e,t,n){let[o,i]=yt(n?.in,e,t),a=Mn(o,i),c=Math.abs(jh(o,i));o.setFullYear(1584),i.setFullYear(1584);let l=Mn(o,i)===-a,m=a*(c-+l);return m===0?0:m}function Zh(e,t){let[n,o]=yt(e,t.start,t.end);return{start:n,end:o}}var qk={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Xh=(e,t,n)=>{let o,i=qk[e];return typeof i=="string"?o=i:t===1?o=i.one:o=i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+o:o+" ago":o};function fc(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var Fk={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Bk={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Hk={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Jh={date:fc({formats:Fk,defaultWidth:"full"}),time:fc({formats:Bk,defaultWidth:"full"}),dateTime:fc({formats:Hk,defaultWidth:"full"})};var Kk={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ey=(e,t,n,o)=>Kk[e];function Co(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 zk={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Yk={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Vk={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"]},Qk={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"]},Wk={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"}},Zk={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"}},Xk=(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"},ty={ordinalNumber:Xk,era:Co({values:zk,defaultWidth:"wide"}),quarter:Co({values:Yk,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Co({values:Vk,defaultWidth:"wide"}),day:Co({values:Qk,defaultWidth:"wide"}),dayPeriod:Co({values:Wk,defaultWidth:"wide",formattingValues:Zk,defaultFormattingWidth:"wide"})};function Po(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)?eM(l,E=>E.test(c)):Jk(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 Jk(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function eM(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function ry(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 tM=/^(\d+)(th|st|nd|rd)?/i,rM=/\d+/i,nM={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},oM={any:[/^b/i,/^(a|c)/i]},iM={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aM={any:[/1/i,/2/i,/3/i,/4/i]},sM={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},cM={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},pM={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},uM={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},lM={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},mM={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}},ny={ordinalNumber:ry({matchPattern:tM,parsePattern:rM,valueCallback:e=>parseInt(e,10)}),era:Po({matchPatterns:nM,defaultMatchWidth:"wide",parsePatterns:oM,defaultParseWidth:"any"}),quarter:Po({matchPatterns:iM,defaultMatchWidth:"wide",parsePatterns:aM,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Po({matchPatterns:sM,defaultMatchWidth:"wide",parsePatterns:cM,defaultParseWidth:"any"}),day:Po({matchPatterns:pM,defaultMatchWidth:"wide",parsePatterns:uM,defaultParseWidth:"any"}),dayPeriod:Po({matchPatterns:lM,defaultMatchWidth:"any",parsePatterns:mM,defaultParseWidth:"any"})};var Sl={code:"en-US",formatDistance:Xh,formatLong:Jh,formatRelative:ey,localize:ty,match:ny,options:{weekStartsOn:0,firstWeekContainsDate:1}};var dM=["years","months","weeks","days","hours","minutes","seconds"];function oy(e,t){let n=Dh(),o=t?.locale??n.locale??Sl,i=t?.format??dM,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 iy(e,t){let{start:n,end:o}=Zh(t?.in,e),i={},a=Wh(o,n);a&&(i.years=a);let c=xo(n,{years:i.years}),l=Vh(o,c);l&&(i.months=l);let m=xo(c,{months:i.months}),f=Fh(o,m);f&&(i.days=f);let h=xo(m,{days:i.days}),E=Bh(o,h);E&&(i.hours=E);let I=xo(h,{hours:i.hours}),g=Hh(o,I);g&&(i.minutes=g);let T=xo(I,{minutes:i.minutes}),S=Qh(o,T);return S&&(i.seconds=S),i}var aa=require("node:crypto");function fM(e){return(0,aa.createHash)("sha256").update(e).digest("base64url")}function ay(){let e=(0,aa.randomBytes)(32).toString("base64url");return{verifier:e,challenge:fM(e)}}var gy=require("node:child_process"),hy=require("node:http"),Ll=require("node:os");var gM={"&":"&","<":"<",">":">",'"':""","'":"'"};function Al(e){return e.replace(/[&<>"']/g,t=>gM[t]??t)}var hM=[":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(""),yM=['<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 Ol(e,t){let n=Al(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>${hM}</style></head><body><main>`,`<span class="tile">${yM}</span>`,`<div class="copy"><h1>${n}</h1><p>${Al(t)}</p></div>`,"</main></body></html>"].join("")}var g8=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 O8=60*1e3;var sW=1/1e6,Rl=1e3,Cl=60*Rl,SM=60*Cl,hc=24*SM,cW=7*hc,pW=30*hc;var Pl=["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 AM={s:1,m:60,h:3600,d:86400};function cy(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return!0}function py(){return Math.floor(Date.now()/1e3)}function yc(e){if(typeof e=="number")return e;if(e==="now")return py();if(e.startsWith("-")&&e.length>=3){let n=e.at(-1),o=n?AM[n]:void 0;if(o){let i=e.slice(1,-1);if(i.length>0&&cy(i))return py()-parseInt(i,10)*o}}if(cy(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 ly(e){process.stderr.write(`${e}
|
|
35
|
+
`)}var uy=["json","tsv","csv"];function Ul(e){let t=uy.find(n=>n===e);if(t!==void 0)return t;throw new Error(`--output must be one of: ${uy.join(", ")} (got: ${e})`)}function wl(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 my(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 vl(e,t){let n=Object.create(null);for(let o of t){let i=my(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 dy(e){return e==null?null:typeof e=="string"?e:JSON.stringify(e)}var OM={"\\":"\\\\"," ":"\\t","\r":"\\r","\n":"\\n"};function xM(e){let t=dy(e);return t===null?"":t.replace(/[\\\t\r\n]/g,n=>OM[n]??n)}function RM(e){let t=dy(e);return t===null?"":/[,"\n\r]/.test(t)?`"${t.replaceAll('"','""')}"`:t}function Nl(e,t,n){if(t.length===0)return"";let o=e==="csv"?",":" ",i=e==="csv"?RM:xM,a=n.map(l=>i(l)).join(o),c=t.map(l=>n.map(m=>i(my(l,m))).join(o));return[a,...c].join(`
|
|
36
|
+
`)}var yy="/oauth/callback",PM=5*Cl,UM=Ol("Login complete","You can close this tab and return to the terminal."),Tc=Ol("Login failed","Return to the terminal for details.");function wM(e){return(0,Ll.platform)()==="darwin"?["open",[e]]:(0,Ll.platform)()==="win32"?["rundll32",["url.dll,FileProtocolHandler",e]]:["xdg-open",[e]]}function vM(e){let[t,n]=wM(e),o=(0,gy.spawnSync)(t,n,{stdio:"ignore"});return o.error===void 0&&o.status===0}async function NM(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)."))},PM),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!==yy){m.writeHead(404,{"Content-Type":"text/html"}),m.end(Tc);return}let h=f.searchParams.get("error");if(h){let I=f.searchParams.get("error_description")??"";c(m,400,Tc,()=>i(new Error(`Authorization failed: ${h}${I?` (${I})`:""}`)));return}if(f.searchParams.get("state")!==t){c(m,400,Tc,()=>i(new Error("State mismatch on OAuth callback; aborting for safety.")));return}let E=f.searchParams.get("code");if(!E){c(m,400,Tc,()=>i(new Error("OAuth callback did not include an authorization code.")));return}c(m,200,UM,()=>o(E))})})}async function Ty(e){let t=(0,hy.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}${yy}`;try{let a=e.buildAuthorizeUrl(i);return vM(a)?V("Opening your browser to complete login..."):(V("Visit this URL in your browser to complete login:"),V(` ${a}`)),{code:await NM(t,e.state,o),redirectUri:i}}finally{t.close()}}var y={};Yt(y,{Assign:()=>LM,Clone:()=>$n,Create:()=>q0,Discard:()=>F0,Metrics:()=>er,Update:()=>B0});var er={assign:0,create:0,clone:0,discard:0,update:0};function LM(e,t){return er.assign+=1,{...e,...t}}var s={};Yt(s,{Counted:()=>e0,Entries:()=>n0,EntriesRegExp:()=>r0,Every:()=>WM,EveryAll:()=>ZM,GraphemeCount:()=>YM,HasPropertyKey:()=>t0,IsArray:()=>ca,IsBigInt:()=>sa,IsBoolean:()=>Ry,IsClassInstance:()=>zM,IsConstructor:()=>jM,IsDeepEqual:()=>Gl,IsEqual:()=>te,IsFunction:()=>Cy,IsGreaterEqualThan:()=>Uy,IsGreaterThan:()=>BM,IsInteger:()=>Ml,IsLessEqualThan:()=>Py,IsLessThan:()=>HM,IsMaxLength:()=>VM,IsMinLength:()=>QM,IsMultipleOf:()=>KM,IsNull:()=>bc,IsNumber:()=>Sc,IsObject:()=>pa,IsObjectNotArray:()=>qM,IsString:()=>Ac,IsSymbol:()=>FM,IsUndefined:()=>Dl,IsUnsafePropertyKey:()=>vy,IsValueLike:()=>wy,Keys:()=>Ic,ShiftLeft:()=>Oc,Some:()=>XM,SomeAll:()=>JM,Symbols:()=>o0,Values:()=>i0});function Dn(e,t,n){return e>=t&&e<=n}function kM(e){return e===8205}function MM(e){return Dn(e,55296,56319)}function Ey(e){return Dn(e,127462,127487)}function Iy(e){return Dn(e,65024,65039)}function by(e){return Dn(e,768,879)||Dn(e,6832,6911)||Dn(e,7616,7679)||Dn(e,65056,65071)}function _c(e){return e>65535?2:1}function _y(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(by(n)||Iy(n))t+=_c(n);else break}return t}function kl(e,t){let n=e.codePointAt(t),o=t+_c(n);for(o=_y(e,o);o<e.length-1&&e[o]==="\u200D";){let i=e.codePointAt(o+1);o+=1+_c(i),o=_y(e,o)}return Ey(n)&&o<e.length&&Ey(e.codePointAt(o))&&(o+=_c(e.codePointAt(o))),o}function Sy(e){return MM(e)||by(e)||Iy(e)||kM(e)}function Ay(e){let t=0,n=0;for(;n<e.length;)n=kl(e,n),t++;return t}function DM(e,t){if(t===0)return!0;let n=0,o=0;for(;o<e.length;)if(o=kl(e,o),n++,n>=t)return!0;return!1}function GM(e,t){let n=0,o=0;for(;o<e.length;)if(o=kl(e,o),n++,n>t)return!1;return!0}function Oy(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Sy(e.charCodeAt(n)))return DM(e,t);if(n++,n>=t)return!0}return!1}function xy(e,t){let n=0;for(;n<e.length;){if(Sy(e.charCodeAt(n)))return GM(e,t);if(n++,n>t)return!1}return!0}function ca(e){return Array.isArray(e)}function sa(e){return te(typeof e,"bigint")}function Ry(e){return te(typeof e,"boolean")}function jM(e){if(Dl(e)||!Cy(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Cy(e){return te(typeof e,"function")}function Ml(e){return Number.isInteger(e)}function bc(e){return te(e,null)}function Sc(e){return Number.isFinite(e)}function qM(e){return pa(e)&&!ca(e)}function pa(e){return te(typeof e,"object")&&!bc(e)}function Ac(e){return te(typeof e,"string")}function FM(e){return te(typeof e,"symbol")}function Dl(e){return te(e,void 0)}function te(e,t){return e===t}function BM(e,t){return e>t}function HM(e,t){return e<t}function Py(e,t){return e<=t}function Uy(e,t){return e>=t}function KM(e,t){if(sa(e)||sa(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!Sc(e)||Ml(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 zM(e){if(!pa(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return bc(t)?!1:te(typeof t.constructor,"function")&&!(te(t.constructor,globalThis.Object)||te(t.constructor.name,"Object"))}function wy(e){return sa(e)||Ry(e)||bc(e)||Sc(e)||Ac(e)||Dl(e)}function YM(e){return Ay(e)}function VM(e,t){return xy(e,t)}function QM(e,t){return Oy(e,t)}function WM(e,t,n){for(let o=t;o<e.length;o++)if(!n(e[o],o))return!1;return!0}function ZM(e,t,n){let o=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(o=!1);return o}function XM(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function JM(e,t){let n=!1;for(let o=0;o<e.length;o++)t(e[o],o)&&(n=!0);return n}function e0(e,t){return e.reduce((n,o,i)=>t(o,i)?++n:n,0)}function Oc(e,t,n){return te(e.length,0)?n():t(e[0],e.slice(1))}function vy(e){return te(e,"__proto__")||te(e,"constructor")||te(e,"prototype")}function t0(e,t){return vy(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function r0(e){return Ic(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function n0(e){return Object.entries(e)}function Ic(e){return Object.getOwnPropertyNames(e)}function o0(e){return Object.getOwnPropertySymbols(e)}function i0(e){return Object.values(e)}function a0(e,t){if(!pa(t))return!1;let n=Ic(e);return te(n.length,Ic(t).length)&&n.every(o=>Gl(e[o],t[o]))}function s0(e,t){return ca(t)&&te(e.length,t.length)&&e.every((n,o)=>Gl(e[o],t[o]))}function Gl(e,t){return ca(e)?s0(e,t):pa(e)?a0(e,t):te(e,t)}var Tt={};Yt(Tt,{IsBigInt64Array:()=>I0,IsBigUint64Array:()=>b0,IsBoolean:()=>c0,IsDate:()=>A0,IsFloat32Array:()=>E0,IsFloat64Array:()=>_0,IsInt16Array:()=>g0,IsInt32Array:()=>y0,IsInt8Array:()=>m0,IsMap:()=>x0,IsNumber:()=>p0,IsRegExp:()=>S0,IsSet:()=>O0,IsString:()=>u0,IsTypeArray:()=>l0,IsUint16Array:()=>h0,IsUint32Array:()=>T0,IsUint8Array:()=>d0,IsUint8ClampedArray:()=>f0});function c0(e){return e instanceof Boolean}function p0(e){return e instanceof Number}function u0(e){return e instanceof String}function l0(e){return globalThis.ArrayBuffer.isView(e)}function m0(e){return e instanceof globalThis.Int8Array}function d0(e){return e instanceof globalThis.Uint8Array}function f0(e){return e instanceof globalThis.Uint8ClampedArray}function g0(e){return e instanceof globalThis.Int16Array}function h0(e){return e instanceof globalThis.Uint16Array}function y0(e){return e instanceof globalThis.Int32Array}function T0(e){return e instanceof globalThis.Uint32Array}function E0(e){return e instanceof globalThis.Float32Array}function _0(e){return e instanceof globalThis.Float64Array}function I0(e){return e instanceof globalThis.BigInt64Array}function b0(e){return e instanceof globalThis.BigUint64Array}function S0(e){return e instanceof globalThis.RegExp}function A0(e){return e instanceof globalThis.Date}function O0(e){return e instanceof globalThis.Set}function x0(e){return e instanceof globalThis.Map}var xc=s;function C0(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function P0(e){let t={};for(let n of Object.getOwnPropertyNames(e)){if(s.IsUnsafePropertyKey(n))continue;let o=Object.getOwnPropertyDescriptor(e,n);o.value=Gn(o.value),s.IsEqual(o.enumerable,!0)?t[n]=o.value:Object.defineProperty(t,n,o)}return t}function U0(e){let t={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(t[n]=Gn(e[n]));for(let n of s.Symbols(e))t[n]=Gn(e[n]);return t}function w0(e){return s.IsClassInstance(e)?e:C0(e)?P0(e):U0(e)}function v0(e){return e.map(t=>Gn(t))}function N0(e){return e.slice()}function L0(e){return new RegExp(e.source,e.flags)}function k0(e){return new Map(Gn([...e.entries()]))}function M0(e){return new Set(Gn([...e.values()]))}function Gn(e){return Tt.IsTypeArray(e)?N0(e):Tt.IsRegExp(e)?L0(e):Tt.IsMap(e)?k0(e):Tt.IsSet(e)?M0(e):s.IsArray(e)?v0(e):s.IsObject(e)?w0(e):e}function $n(e){return er.clone+=1,Gn(e)}var rt={};Yt(rt,{Get:()=>$0,Reset:()=>D0,Set:()=>G0});var pr={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function D0(){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 G0(e){for(let t of s.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(pr,t,{value:n})}}function $0(){return pr}function j0(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 Ny(e,t){return{...e,...t}}function q0(e,t,n={}){er.create+=1;let o=rt.Get(),i=Ny(t,n),a=o.enumerableKind?Ny(i,e):j0(i,e);return o.immutableTypes?Object.freeze(a):a}function F0(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=$n(i.value),Object.defineProperty(n,o,i)}return n}function B0(e,t,n){er.update+=1;let o=rt.Get(),i=$n(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 H0(e){return y.Update(e,{"~readonly":!0},{})}function ua(e,t){return y.Update(H0(e),{},t)}function Ly(e,t,n,o){let i=O(e,t,n);return ua(i,o)}function K0(e){return y.Update(e,{"~optional":!0},{})}function la(e,t){return y.Update(K0(e),{},t)}function ky(e,t,n,o){let i=O(e,t,n);return la(i,o)}function Pt(e,t){return y.Create({"~kind":"Array"},{type:"array",items:e},t)}function Z(e){return w(e,"Array")}function Uo(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 My(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 Dy(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 wo(e){return w(e,"Generic")}function vo(e){return y.Create({"~kind":"Any"},{},e)}function Ve(e){return w(e,"Any")}var Gy="(?!)";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 jn(e,t={}){return la(e,t)}function $y(e){return jn(e)}function Je(e){return Ue(e)&&s.HasPropertyKey(e,"~optional")}function jy(e){return s.Keys(e).filter(t=>!Je(e[t]))}function Rc(e){return s.Keys(e)}function Cc(e){return s.Values(e)}function k(e,t={}){let n=jy(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 qy(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 Fy(e){return y.Update(e,{"~unsafe":null},{})}function Pc(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var oe={};Yt(oe,{Match:()=>z0});function z0(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function ma(...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 qn(e,t,n,o={}){return y.Create({"~kind":"Dependent"},{if:e,then:t,else:n},o)}function Le(e){return w(e,"Dependent")}function By(e){return y.Discard(e,["~kind","if","then","else"])}function Hy(e){return s.IsObjectNotArray(e)}function Ky(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,o)=>[...n,e[o]],[])}function zy(e){return s.IsString(e)||s.IsNumber(e)}function Yy(e,t){let n=Hy(e)?Ky(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 Vy(e){return y.Discard(e,["~kind","allOf"])}var Fn={};Yt(Fn,{Hash:()=>uD,HashCode:()=>tT});function fe(){throw new Error("Unreachable")}function Y0(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 V0(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 No=BigInt("14695981039346656037"),[Q0,W0]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Z0=Array.from({length:256}).map((e,t)=>BigInt(t)),Xy=new Float64Array(1),Jy=new DataView(Xy.buffer),eT=new Uint8Array(Xy.buffer);function lt(e){No=No^Z0[e],No=No*Q0%W0}function X0(e){lt(Et.Array);for(let t of e)an(t)}function J0(e){lt(Et.BigInt),Jy.setBigInt64(0,e);for(let t of eT)lt(t)}function Wy(e){lt(Et.Boolean),lt(e?1:0)}function eD(e){lt(Et.Constructor),an(e.toString())}function tD(e){lt(Et.Date),an(e.getTime())}function rD(e){lt(Et.Function),an(e.toString())}function nD(e){lt(Et.Null)}function Zy(e){lt(Et.Number),Jy.setFloat64(0,e,!0);for(let t of eT)lt(t)}function oD(e){lt(Et.Object);for(let t of Y0(e).sort())an(t),an(e[t])}function iD(e){lt(Et.RegExp),$l(e.toString())}var aD=new TextEncoder;function $l(e){lt(Et.String);for(let t of aD.encode(e))lt(t)}function sD(e){lt(Et.Symbol),an(e.toString())}function cD(e){lt(Et.TypeArray);let t=new Uint8Array(e.buffer);for(let n=0;n<t.length;n++)lt(t[n])}function pD(e){return lt(Et.Undefined)}function an(e){return Tt.IsTypeArray(e)?cD(e):Tt.IsDate(e)?tD(e):Tt.IsRegExp(e)?iD(e):Tt.IsBoolean(e)?Wy(e.valueOf()):Tt.IsString(e)?$l(e.valueOf()):Tt.IsNumber(e)?Zy(e.valueOf()):V0(e)?Zy(e):s.IsArray(e)?X0(e):s.IsBoolean(e)?Wy(e):s.IsBigInt(e)?J0(e):s.IsConstructor(e)?eD(e):s.IsNull(e)?nD(e):s.IsObject(e)?oD(e):s.IsString(e)?$l(e):s.IsSymbol(e)?sD(e):s.IsUndefined(e)?pD(e):s.IsFunction(e)?rD(e):fe()}function tT(e){return No=BigInt("14695981039346656037"),an(e),No}function uD(e){return tT(e).toString(16).padStart(16,"0")}function rT(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 lD=rT;function nT(){return lD}var da=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,o=Bn(n)?c=>this.decode(n["~codec"].decode(c)):this.decode,i=Bn(n)?c=>n["~codec"].encode(t(c)):t,a={decode:o,encode:i};return y.Update(this.type,{"~codec":a},{})}},fa=class{constructor(t){this.type=t}Decode(t){return new da(this.type,t)}};function Uc(e){return new fa(e)}function iT(e,t){return Uc(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function aT(e,t){return Uc(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function Bn(e){return Ue(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function sT(e){return Lo(e)}function Hn(e){return Ue(e)&&s.HasPropertyKey(e,"~immutable")}function fr(e,t={}){return v("AddReadonly",[e],t)}function Kn(e,t={}){return ua(e,t)}function cT(e){return Kn(e)}function zn(e){return Ue(e)&&s.HasPropertyKey(e,"~readonly")}function dD(e,t){let n=wc(e)?[...e["~refine"],t]:[t];return y.Update(e,{"~refine":n},{})}function pT(...e){let[t,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[i,a,()=>"Refine Error"]});return dD(t,{check:n,error:o})}function fD(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function wc(e){return Ue(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>fD(t))}var uT="-?(?:0|[1-9][0-9]*)n";function ga(e){return y.Create({"~kind":"BigInt"},{type:"bigint"},e)}function vt(e){return w(e,"BigInt")}function vc(e){return y.Create({"~kind":"Boolean"},{type:"boolean"},e)}function _t(e){return w(e,"Boolean")}function ha(e){return y.Create({"~kind":"Identifier"},{name:e})}function lT(e){return w(e,"Identifier")}var Nc="-?(?:0|[1-9][0-9]*)";function Yn(e){return y.Create({"~kind":"Integer"},{type:"integer"},e)}function ot(e){return w(e,"Integer")}var jl=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function gD(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new jl(e)})()}function z(e,t){return y.Create({"~kind":"Literal"},{type:gD(e),const:e},t)}function Lc(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function mT(e){return Q(e)&&s.IsBigInt(e.const)}function dT(e){return Q(e)&&s.IsBoolean(e.const)}function kc(e){return Q(e)&&s.IsNumber(e.const)}function Mc(e){return Q(e)&&s.IsString(e.const)}function Q(e){return w(e,"Literal")}function ko(e){return y.Create({"~kind":"Null"},{type:"null"},e)}function gr(e){return w(e,"Null")}var Dc="-?(?: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 Mo(e){return y.Create({"~kind":"Symbol"},{type:"symbol"},e)}function hr(e){return w(e,"Symbol")}function Vn(...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 fT(e){return w(e,"Parameter")}var Gc=".*";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 gT(e){return y.Discard(e,["~kind","anyOf"])}function ya(e){let t=hT(e);return s.IsEqual(t.length,2)?t[0]:[]}function hD(e){return!0}function yT(e){return s.ShiftLeft(e,(t,n)=>yD(t)?yT(n):!1,()=>!0)}function TT(e){return s.IsEqual(e.length,0)?!1:yT(e)}function yD(e){return R(e)?TT(e.anyOf):Q(e)?hD(e.const):!1}function $c(e){return TT(e)}function jc(e){return y.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function ET(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>ET(i,t,[...n,`${o}${t}`]),()=>n)}function TD(e,t){return s.IsEqual(e.length,0)?[`${t}`]:ET(e,t)}function _T(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>_T(e,i,[...n,...IT(e,o)]),()=>n)}function IT(e,t){return R(t)?_T(e,t.anyOf):Q(t)?TD(e,t.const):fe()}function bT(e,t){return s.ShiftLeft(t,(n,o)=>bT(IT(e,n),o),()=>e)}function ED(e){return e.map(t=>z(t))}function _D(e){let t=bT([],e),n=ED(t);return F(n)}function ID(e){return s.IsEqual(e.length,0)?fe():s.IsEqual(e.length,1)&&Q(e[0])?e[0]:_D(e)}function ql(e){let t=ya(e);return s.IsEqual(t.length,0)?It():$c(t)?ID(t):jc(e)}function Ta(e){let t=ql(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 ST(e){return Ut($t,e)}function AT(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 OT(e){return y.Discard(e,["~kind","type","items","minItems","additionalItems"])}function bD(e){return y.Discard(e,["~readonly"])}function Fl(e,t){return y.Update(bD(e),{},t)}function xT(e,t,n,o){let i=O(e,t,n);return Fl(i,o)}function RT(e,t={}){return v("RemoveReadonly",[e],t)}function CT(e,t={}){return Fl(e,t)}function SD(e){return y.Discard(e,["~optional"])}function Bl(e,t){return y.Update(SD(e),{},t)}function PT(e,t,n,o){let i=O(e,t,n);return Bl(i,o)}function UT(e,t={}){return v("RemoveOptional",[e],t)}function qc(e,t={}){return Bl(e,t)}function Hl(e){return e.reduceRight((n,o,i)=>({[i]:o,...n}),{})}function wT(e){let t=Hl(e.items);return k(t)}function AD(e,t){return zn(e)?!!zn(t):!1}function OD(e,t){return Je(e)?!!Je(t):!1}function xD(e,t){let n=AD(e,t),o=OD(e,t),i=we([e,t]),a=CT(qc(i));return n&&o?Kn(jn(a)):n&&!o?Kn(a):!n&&o?jn(a):a}function RD(e,t,n){return n in e?n in t?xD(e[n],t[n]):e[n]:n in t?t[n]:me()}function CD(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((o,i)=>({...o,[i]:RD(e,t,i)}),{})}function vT(e){return D(e)?e.properties:Y(e)?Hl(e.items):fe()}function NT(e,t){let n=vT(e),o=vT(t),i=CD(n,o);return k(i)}function LT(e,t){let n=Qn(e,t);return s.IsEqual(n,_a)?e:s.IsEqual(n,Ia)||s.IsEqual(n,Ea)?t:me()}function kT(e){return D(e)||Y(e)}function PD(e,t){let n=R(e),o=R(t);return n||o}function UD(e,t){let n=Vt(e),o=Vt(t),i=PD(n,o),a=kT(n),c=kT(o);return i?we([n,o]):a&&c?NT(n,o):a&&!c?n:!a&&c?o:LT(n,o)}function MT(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>MT(e,i,[...n,UD(e,o)]),()=>s.IsEqual(n.length,0)?[e]:n)}function DT(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>DT(i,t,[...n,...ba([o],t)]),()=>n)}function ba(e,t=[]){return s.ShiftLeft(e,(n,o)=>R(n)?ba(o,DT(n.anyOf,t)):ba(o,MT(n,t)),()=>t)}function wD(e,t){let n=dt({},e,t);return G.IsExtendsTrueLike(n)?[]:[e]}function vD(e,t){return e.reduce((n,o)=>[...n,...wD(o,t)],[])}function Fc(e,t){let n=Vt(e),o=R(n)?n.anyOf:[n],i=vD(o,t);return Lt(i)}function rr(e,t,n){let o=ut([e,t]),i=Fc(n,e);return Lt([o,i])}function wt(e){let t=e.map(n=>z(n));return Lt(t)}function we(e){let t=ba(e),n=Kl(t);return kr(n)}function ht(e){let t=Ta(e);return Vt(t)}function Lt(e){let t=Kl(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 GT(e,t){let n=wt(e);return sn(n,t)}function $T(e,t){return Ut(cn,t)}function jT(e,t){let n=we(e);return sn(n,t)}function qT(e,t){return s.IsString(e)||s.IsNumber(e)?k({[e]:t}):s.IsEqual(e,!1)?k({false:t}):s.IsEqual(e,!0)?k({true:t}):k({})}function FT(e,t){return Ut(Do,t)}function BT(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?Ut(e.pattern.toString(),t):Ut($t,t)}function HT(e,t){let n=ya(e);return $c(n)?sn(ht(e),t):Ut(e,t)}function ND(e){return R(e)?Go(e.anyOf):[e]}function Go(e){return e.reduce((t,n)=>[...t,...ND(n)],[])}function LD(e){return e.some(t=>We(t)||Ce(t)||ot(t))}function kD(e,t){return s.IsEqual(LD(e),!0)?Ut($t,t):void 0}function MD(e,t){return e.reduce((n,o)=>Q(o)&&(s.IsString(o.const)||s.IsNumber(o.const))?{...n,[o.const]:t}:n,{})}function DD(e,t){let n=MD(e,t);return k(n)}function KT(e,t){let n=Go(e),o=kD(n,t);return Ue(o)?o:DD(n,t)}function sn(e,t){return Ve(e)?ST(t):_t(e)?AT(t):ze(e)?GT(e.enum,t):ot(e)?$T(e,t):M(e)?jT(e.allOf,t):Q(e)?qT(e.const,t):Ce(e)?FT(e,t):R(e)?KT(e.anyOf,t):We(e)?BT(e,t):Ee(e)?HT(e.pattern,t):k({})}function zl(e,t,n){return K([e])?y.Update(sn(e,t),{},n):Bc(e,t,n)}function zT(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return zl(a,c,i)}var cn=`^${Nc}$`,Do=`^${Dc}$`,$t=`^${Gc}$`;function Bc(e,t,n={}){return v("Record",[e,t],n)}function $o(e,t,n={}){return zl(e,t,n)}function Hc(e,t){return Ut(e,t)}function Kc(e){return s.IsEqual(e,$t)?It():s.IsEqual(e,cn)?Yn():s.IsEqual(e,Do)?Nt():ql(e)}function it(e){return s.Keys(e.patternProperties)[0]}function pn(e){let t=it(e);return Kc(t)}function Se(e){return e.patternProperties[it(e)]}function de(e){return w(e,"Record")}function Wn(e){return y.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function un(e){return w(e,"Rest")}function zc(e){return y.Create({"~kind":"This"},{$ref:"#"},e)}function Yc(e){return w(e,"This")}function jo(e){return y.Create({"~kind":"Undefined"},{type:"undefined"},e)}function nr(e){return w(e,"Undefined")}function Vc(e){return y.Create({"~kind":"Void"},{type:"void"},e)}function kt(e){return w(e,"Void")}function $D(e,t){return s.IsEqual(e,"Array")?Pt(t[0]):s.IsEqual(e,"Capitalize")?Wc(t[0]):s.IsEqual(e,"ConstructorParameters")?tp(t[0]):s.IsEqual(e,"Evaluate")?Y_(t[0]):s.IsEqual(e,"Exclude")?rp(t[0],t[1]):s.IsEqual(e,"Extract")?np(t[0],t[1]):s.IsEqual(e,"Index")?xa(t[0],t[1]):s.IsEqual(e,"InstanceType")?op(t[0]):s.IsEqual(e,"Lowercase")?Zc(t[0]):s.IsEqual(e,"NonNullable")?ip(t[0]):s.IsEqual(e,"Omit")?ap(t[0],t[1]):s.IsEqual(e,"Parameters")?sp(t[0]):s.IsEqual(e,"Partial")?cp(t[0]):s.IsEqual(e,"Pick")?pp(t[0],t[1]):s.IsEqual(e,"Readonly")?up(t[0]):s.IsEqual(e,"KeyOf")?Ra(t[0]):s.IsEqual(e,"Record")?Bc(t[0],t[1]):s.IsEqual(e,"Required")?lp(t[0]):s.IsEqual(e,"ReturnType")?mp(t[0]):s.IsEqual(e,"Uncapitalize")?Xc(t[0]):s.IsEqual(e,"Uppercase")?Jc(t[0]):Oa(nt(e),t)}function Zn(){throw Error("Unreachable")}function ZT(e,t=[]){return s.ShiftLeft(e,(n,o)=>ZT(o,[...t,n[1]]),()=>t)}function Mr(e){return s.IsEqual(e.length,3)?[e[0],...ZT(e[1])]:[]}function XT(e){return Vn(e[0],e[2],e[4])}function JT(e){return Vn(e[0],e[2],e[2])}function eE(e){return Vn(e[0],Qe(),e[2])}function tE(e){return Vn(e,Qe(),Qe())}function rE(e){return Mr(e)}function nE(e){return e[1]}function oE(e){return Mr(e)}function iE(e){return e[1]}function aE(e){return $D(e[0],e[1])}function sE(e){return null}function cE(e){return It()}function pE(e){return Nt()}function uE(e){return vc()}function lE(e){return jo()}function mE(e){return ko()}function dE(e){return Yn()}function fE(e){return ga()}function gE(e){return Qe()}function hE(e){return vo()}function yE(e){return k({})}function TE(e){return me()}function EE(e){return Mo()}function _E(e){return Vc()}function IE(e){return zc()}function bE(e){return z(BigInt(e))}function SE(e){return z(s.IsEqual(e,"true"))}function AE(e){return z(parseFloat(e))}function OE(e){return z(e)}function xE(e){return e[1]}function RE(e){return z(e)}function CE(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function PE(e){return e[1]}function UE(e){return Qc(e)}function wE(e){return s.IsEqual(e.length,6)?qn(e[1],e[3],e[5]):qn(e[1],e[3],Qe())}function vE(e){return e.length>0}function NE(e){return e.reduce((t,n)=>s.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function LE(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function kE(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function ME(e){return s.IsEqual(e.length,2)?e[1]:[]}function YT(e,t){return t.reduce((n,o)=>{let i=o;return s.IsEqual(i.length,1)?xa(n,i[0]):s.IsEqual(i.length,0)?Pt(n):Zn()},e)}function VT(e,t){return s.IsEqual(t.length,3)?ep(e,t[0],t[1],t[2]):e}function jD(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:dp(e,t)}function DE(e){let[t,n,o,i,a]=e;return jD(VT(t?Ra(YT(n,o)):YT(n,o),i),a)}function Yl(e,t){return s.IsEqual(t.length,3)?(()=>{let[n,o,i]=t,a=Yl(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]);Zn()})():e}function GE(e){let[t,n]=e;return Yl(t,n)}function $E(e){let[t,n]=e;return Yl(t,n)}function jE(e){return z_(e[1])}function qE(e){return e[1]}function FE(e){return on(e[0],e[2])}function BE(e){return s.IsEqual(e.length,4)?ma(e[1],e[3]):s.IsEqual(e.length,2)?ma(e[1],Qe()):Zn()}function HE(e){return`${e}`}function KE(e){return ot(e[3])?cn:Ce(e[3])?Do:hr(e[3])?$t:We(e[3])?$t:Zn()}function zE(e){return e.length>0}function YE(e){return e.length>0}function VE(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 WE(e){return e.reduce((t,n)=>s.HasPropertyKey(n,cn)||s.HasPropertyKey(n,Do)||s.HasPropertyKey(n,$t)?[t[0],y.Assign(t[1],n)]:[y.Assign(t[0],n),t[1]],[{},{}])}function ZE(e){return WE(e[1])}function XE(e){let[t,n]=e,o=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return k(t,o)}function JE(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]):Zn()}function e_(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 t_(e){return s.IsEqual(e.length,2)?Wn(e[1]):s.IsEqual(e.length,1)?e[0]:Zn()}function r_(e){return Mr(e)}function n_(e){return ke(e[1])}function o_(e){return fr(mr(e[4]))}function i_(e){return fr(e[3])}function a_(e){return mr(e[3])}function s_(e){return e[2]}function c_(e){return s.IsEqual(e.length,2)?Wn(e[1]):s.IsEqual(e.length,1)?e[0]:Zn()}function p_(e){return Mr(e)}function u_(e){return lr(e[1],e[4])}function l_(e){return ur(e[2],e[5])}function QT(e,t){return s.IsEqual(e,"remove")?RT(t):s.IsEqual(e,"add")?fr(t):t}function m_(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function WT(e,t){return s.IsEqual(e,"remove")?UT(t):s.IsEqual(e,"add")?mr(t):t}function d_(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 f_(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function g_(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?Sa(ha(e[3]),e[5],e[6][0],QT(e[1],WT(e[8],e[10]))):Sa(ha(e[3]),e[5],nt(e[3]),QT(e[1],WT(e[8],e[10])))}function h_(e){return nt(e)}function y_(e){return BigInt(e)}function T_(e){return parseFloat(e)}function E_(e){return s.IsEqual(e,"true")}function __(e){return null}function I_(e){return{[e[0]]:e[2]}}function b_(e){return Mr(e)}function qD(e){return e.reduce((t,n)=>y.Assign(t,n),{})}function S_(e){return qD(e[1])}function A_(e){return Mr(e)}function O_(e){return e[1]}function x_(e){return ga()}function R_(e){return It()}function C_(e){return Nt()}function P_(e){return Yn()}function U_(e){return me()}function w_(e){return z(e)}function v_(e){return F(e[1])}function N_(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function L_(e){return[e[0],...e[1]]}function k_(e){return e[1]}function M_(e){return Mr(e)}function D_(e){return s.IsEqual(e.length,2)?e[1]:[]}function G_(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,Aa(n,o,a))}}function $_(e){let t=e[2],[n,o]=e[3],i=s.IsEqual(s.Keys(o).length,0)?{}:{patternProperties:o};return{[e[1]]:Aa(t,n,i)}}function j_(e){return{[e[1]]:on(e[2],e[4])}}function q_(e){return{[e[1]]:e[3]}}function F_(e){return null}function B_(e){return Mr(e)}function H_(e){return e[1]}function K_(e){let[t,n]=[e[0],e[1]];return V_(y.Assign(t,WE(n)[0]))}function Ca(e){return te(e.length,2)}function W(e,t,n){return Ca(e)?t(e[0],e[1]):n()}function HD(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=HD(e[n],t);if(Ca(o))return o}return[]}function Vl(e,t){return Array.from({length:t-e+1},(n,o)=>String.fromCharCode(e+o))}var Q_=[...Vl(97,122),...Vl(65,90)],Ql="0",Wl=Vl(49,57),qo=[Ql,...Wl],W_=" ",Fo=`
|
|
37
|
+
`;var ln="_",fp=".",Z_="$",gp="-";var X_="//",J_="/*",zD="*/";function eI(e){let t=e.indexOf(zD);return te(t,-1)?"":e.slice(t+2)}function tI(e){let t=e.indexOf(Fo);return te(t,-1)?"":e.slice(t)}function YD(e){return e.replace(/^[ \t\r\f\v]+/,"")}function hp(e){let t=YD(e);return t.startsWith(J_)?hp(eI(t.slice(2))):t.startsWith(X_)?hp(tI(t.slice(2))):t}function mt(e){let t=e.trimStart();return t.startsWith(J_)?mt(eI(t.slice(2))):t.startsWith(X_)?mt(tI(t.slice(2))):t}function yp(e,t){return W(ve([e],t),(n,o)=>[n,o],()=>["",t])}function VD(e,t){return e.includes(t)}function Bo(e,t,n,o=""){return W(ve(e,n),(i,a)=>VD(t,i)?Bo(e,t,a,o):Bo(e,t,a,`${o}${i}`),()=>[o,n])}function QD(e){return ve(Wl,e)}var WD=[...qo,ln];function ZD(e){return Bo(WD,[ln],e)}function XD(e){return W(ve([Ql],e),(t,n)=>[t,n],()=>W(QD(e),(t,n)=>W(ZD(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[]))}function Tp(e){return XD(mt(e))}function JD(e){return yp(gp,e)}function eG(e){return W(JD(e),(t,n)=>W(Tp(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function rI(e){return eG(mt(e))}function tG(e){return W(rI(e),(t,n)=>W(ve(["n"],n),(o,i)=>[`${t}`,i],()=>[]),()=>[])}function Zl(e){return tG(e)}function Xl(e,t){return ve([e],t)}function _(e,t){return te(e,"")?["",t]:e.startsWith(Fo)?Xl(e,hp(t)):e.startsWith(W_)?Xl(e,t):Xl(e,mt(t))}var nI=[...Q_,ln,Z_];function rG(e){return ve(nI,e)}var nG=[...nI,...qo];function oI(e,t=""){return W(ve(nG,e),(n,o)=>oI(o,`${t}${n}`),()=>[t,e])}function oG(e){return W(rG(e),(t,n)=>W(oI(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function Me(e){return oG(mt(e))}var iG=[...qo,ln];function aG(e){return Ca(ve([fp],e))}function iI(e){return W(Bo(iG,[ln],e),(t,n)=>te(t,"")?[]:[t,n],()=>[])}function sG(e){return W(ve([fp],e),(t,n)=>W(iI(n),(o,i)=>[`0${t}${o}`,i],()=>[]),()=>[])}function cG(e){return W(Tp(e),(t,n)=>W(ve([fp],n),(o,i)=>W(iI(i),(a,c)=>[`${t}${o}${a}`,c],()=>[`${t}`,i]),()=>[`${t}`,n]),()=>[])}function pG(e){return aG(e)?sG(e):cG(e)}function aI(e){return pG(mt(e))}function uG(e){return yp(gp,e)}function lG(e){return W(uG(e),(t,n)=>W(aI(n),(o,i)=>[`${t}${o}`,i],()=>[]),()=>[])}function Ep(e){return lG(mt(e))}function mG(e){return te(e,"")?[]:[e.slice(0,1),e.slice(1)]}function sI(e,t){return Oc(e,(n,o)=>t.startsWith(n)?!0:sI(o,t),()=>!1)}function mn(e,t,n=""){return W(mG(t),(o,i)=>sI(e,t)?[n,t]:mn(e,i,`${n}${o}`),()=>[])}function dG(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 fG(e,t,n){return W(ve([e],n),(o,i)=>W(mn([Fo,t],i),(a,c)=>W(ve([t],c),(l,m)=>[`${a}`,m],()=>[]),()=>[]),()=>[])}function cI(e,t,n,o){return n?dG(e,t,mt(o)):fG(e,t,mt(o))}function gG(e,t){return ve(e,t)}function hG(e,t){return cI(e,e,!1,t)}function yG(e,t){return W(gG(e,t),(n,o)=>hG(n,`${n}${o}`),()=>[])}function _p(e,t){return yG(e,mt(t))}function pI(e,t){return W(mn(e,t),(n,o)=>te(n,"")?[]:[n,o],()=>[])}var p=(e,t,n=()=>[])=>e.length===2?t(e):n(),EG=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])=>[XT(t),n]),_G=e=>p(p(Me(e),([t,n])=>p(_("extends",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[JT(t),n]),IG=e=>p(p(Me(e),([t,n])=>p(_("=",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[eE(t),n]),bG=e=>p(Me(e),([t,n])=>[tE(t),n]),mI=e=>p(p(EG(e),([t,n])=>[t,n],()=>p(_G(e),([t,n])=>[t,n],()=>p(IG(e),([t,n])=>[t,n],()=>p(bG(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),dI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(mI(o),([i,a])=>[[n,i],a])),([n,o])=>dI(o,[...t,n]),()=>[t,e]),SG=e=>p(p(p(mI(e),([t,n])=>p(dI(n),([o,i])=>p(p(_(",",i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[rE(t),n]),tm=e=>p(p(_("<",e),([t,n])=>p(SG(n),([o,i])=>p(_(">",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[nE(t),n]),fI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(re(o),([i,a])=>[[n,i],a])),([n,o])=>fI(o,[...t,n]),()=>[t,e]),AG=e=>p(p(p(re(e),([t,n])=>p(fI(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])=>[oE(t),n]),OG=e=>p(p(_("<",e),([t,n])=>p(AG(n),([o,i])=>p(_(">",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[iE(t),n]),xG=e=>p(p(Me(e),([t,n])=>p(OG(n),([o,i])=>[[t,o],i])),([t,n])=>[aE(t),n]),gI=e=>p(p(p(_(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[sE(t),n]),hI=e=>p(_("string",e),([t,n])=>[cE(t),n]),yI=e=>p(_("number",e),([t,n])=>[pE(t),n]),RG=e=>p(_("boolean",e),([t,n])=>[uE(t),n]),CG=e=>p(_("undefined",e),([t,n])=>[lE(t),n]),PG=e=>p(_("null",e),([t,n])=>[mE(t),n]),TI=e=>p(_("integer",e),([t,n])=>[dE(t),n]),UG=e=>p(_("bigint",e),([t,n])=>[fE(t),n]),wG=e=>p(_("unknown",e),([t,n])=>[gE(t),n]),vG=e=>p(_("any",e),([t,n])=>[hE(t),n]),NG=e=>p(_("object",e),([t,n])=>[yE(t),n]),LG=e=>p(_("never",e),([t,n])=>[TE(t),n]),EI=e=>p(_("symbol",e),([t,n])=>[EE(t),n]),kG=e=>p(_("void",e),([t,n])=>[_E(t),n]),MG=e=>p(_("this",e),([t,n])=>[IE(t),n]),DG=e=>p(p(_("${",e),([t,n])=>p(re(n),([o,i])=>p(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[xE(t),n]),Jl=e=>p(mn(["${","`"],e),([t,n])=>[RE(t),n]),_I=e=>p(p(p(Jl(e),([t,n])=>p(DG(n),([o,i])=>p(_I(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p(p(Jl(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p(p(Jl(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[CE(t),n]),rm=e=>p(p(_("`",e),([t,n])=>p(_I(n),([o,i])=>p(_("`",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[PE(t),n]),GG=e=>p(rm(e),([t,n])=>[UE(t),n]),$G=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])=>[wE(t),n]),jG=e=>p(Zl(e),([t,n])=>[bE(t),n]),qG=e=>p(p(_("true",e),([t,n])=>[t,n],()=>p(_("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[SE(t),n]),FG=e=>p(Ep(e),([t,n])=>[AE(t),n]),BG=e=>p(_p(["'",'"'],e),([t,n])=>[OE(t),n]),HG=e=>p(p(p(_("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[vE(t),n]),II=(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])=>II(o,[...t,n]),()=>[t,e]),KG=e=>p(II(e),([t,n])=>[NE(t),n]),zG=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])=>[LE(t),n]),YG=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(hI(e),([t,n])=>[t,n],()=>p(yI(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(TI(e),([t,n])=>[t,n],()=>p(UG(e),([t,n])=>[t,n],()=>p(wG(e),([t,n])=>[t,n],()=>p(vG(e),([t,n])=>[t,n],()=>p(NG(e),([t,n])=>[t,n],()=>p(LG(e),([t,n])=>[t,n],()=>p(EI(e),([t,n])=>[t,n],()=>p(kG(e),([t,n])=>[t,n],()=>p(MG(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],()=>p(BG(e),([t,n])=>[t,n],()=>p(GG(e),([t,n])=>[t,n],()=>p($G(e),([t,n])=>[t,n],()=>p(o$(e),([t,n])=>[t,n],()=>p(s$(e),([t,n])=>[t,n],()=>p(d$(e),([t,n])=>[t,n],()=>p(m$(e),([t,n])=>[t,n],()=>p(y$(e),([t,n])=>[t,n],()=>p(xG(e),([t,n])=>[t,n],()=>p(T$(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[kE(t),n]),VG=e=>p(p(p(_("with",e),([t,n])=>p(GI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[ME(t),n]),bI=e=>p(p(HG(e),([t,n])=>p(YG(n),([o,i])=>p(KG(i),([a,c])=>p(zG(c),([l,m])=>p(VG(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[DE(t),n]),SI=e=>p(p(p(_("&",e),([t,n])=>p(bI(n),([o,i])=>p(SI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),AI=e=>p(p(bI(e),([t,n])=>p(SI(n),([o,i])=>[[t,o],i])),([t,n])=>[GE(t),n]),OI=e=>p(p(p(_("|",e),([t,n])=>p(AI(n),([o,i])=>p(OI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Ip=e=>p(p(AI(e),([t,n])=>p(OI(n),([o,i])=>[[t,o],i])),([t,n])=>[$E(t),n]),QG=e=>p(p(_("readonly",e),([t,n])=>p(Ip(n),([o,i])=>[[t,o],i])),([t,n])=>[jE(t),n]),WG=e=>p(p(_("|",e),([t,n])=>p(Ip(n),([o,i])=>[[t,o],i])),([t,n])=>[qE(t),n]),ZG=e=>p(p(tm(e),([t,n])=>p(_("=",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[FE(t),n]),XG=e=>p(p(p(_("infer",e),([t,n])=>p(Me(n),([o,i])=>p(_("extends",i),([a,c])=>p(Ip(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])=>[BE(t),n]),re=e=>p(p(XG(e),([t,n])=>[t,n],()=>p(WG(e),([t,n])=>[t,n],()=>p(QG(e),([t,n])=>[t,n],()=>p(Ip(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),JG=e=>p(Ep(e),([t,n])=>[HE(t),n]),e$=e=>p(Me(e),([t,n])=>[t,n]),t$=e=>p(_p(["'",'"'],e),([t,n])=>[t,n]),r$=e=>p(p(_("[",e),([t,n])=>p(Me(n),([o,i])=>p(_(":",i),([a,c])=>p(p(TI(c),([l,m])=>[l,m],()=>p(yI(c),([l,m])=>[l,m],()=>p(hI(c),([l,m])=>[l,m],()=>p(EI(c),([l,m])=>[l,m],()=>[])))),([l,m])=>p(_("]",m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[KE(t),n]),xI=e=>p(p(JG(e),([t,n])=>[t,n],()=>p(e$(e),([t,n])=>[t,n],()=>p(t$(e),([t,n])=>[t,n],()=>p(r$(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),RI=e=>p(p(p(_("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[zE(t),n]),CI=e=>p(p(p(_("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[YE(t),n]),PI=e=>p(p(RI(e),([t,n])=>p(xI(n),([o,i])=>p(CI(i),([a,c])=>p(_(":",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[VE(t),n]),bp=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]),UI=(e,t=[])=>p(p(bp(e),([n,o])=>p(PI(o),([i,a])=>[[n,i],a])),([n,o])=>UI(o,[...t,n]),()=>[t,e]),n$=e=>p(p(p(PI(e),([t,n])=>p(UI(n),([o,i])=>p(p(bp(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]),nm=e=>p(p(_("{",e),([t,n])=>p(n$(n),([o,i])=>p(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[ZE(t),n]),o$=e=>p(nm(e),([t,n])=>[XE(t),n]),i$=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])=>[JE(t),n]),uI=e=>p(p(i$(e),([t,n])=>[t,n],()=>p(p(RI(e),([t,n])=>p(re(n),([o,i])=>p(CI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>[])),([t,n])=>[e_(t),n]),wI=e=>p(p(p(_("...",e),([t,n])=>p(uI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(uI(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[t_(t),n]),vI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(wI(o),([i,a])=>[[n,i],a])),([n,o])=>vI(o,[...t,n]),()=>[t,e]),a$=e=>p(p(p(wI(e),([t,n])=>p(vI(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])=>[r_(t),n]),s$=e=>p(p(_("[",e),([t,n])=>p(a$(n),([o,i])=>p(_("]",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[n_(t),n]),c$=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])=>[o_(t),n]),p$=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])=>[i_(t),n]),u$=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])=>[a_(t),n]),l$=e=>p(p(Me(e),([t,n])=>p(_(":",n),([o,i])=>p(re(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[s_(t),n]),lI=e=>p(p(c$(e),([t,n])=>[t,n],()=>p(p$(e),([t,n])=>[t,n],()=>p(u$(e),([t,n])=>[t,n],()=>p(l$(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),NI=e=>p(p(p(_("...",e),([t,n])=>p(lI(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p(p(lI(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[c_(t),n]),LI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(NI(o),([i,a])=>[[n,i],a])),([n,o])=>LI(o,[...t,n]),()=>[t,e]),kI=e=>p(p(p(NI(e),([t,n])=>p(LI(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])=>[p_(t),n]),m$=e=>p(p(_("(",e),([t,n])=>p(kI(n),([o,i])=>p(_(")",i),([a,c])=>p(_("=>",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[u_(t),n]),d$=e=>p(p(_("new",e),([t,n])=>p(_("(",n),([o,i])=>p(kI(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])=>[l_(t),n]),f$=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])=>[m_(t),n]),g$=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])=>[d_(t),n]),h$=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])=>[f_(t),n]),y$=e=>p(p(_("{",e),([t,n])=>p(f$(n),([o,i])=>p(_("[",i),([a,c])=>p(Me(c),([l,m])=>p(_("in",m),([f,h])=>p(re(h),([E,I])=>p(h$(I),([g,T])=>p(_("]",T),([S,b])=>p(g$(b),([x,P])=>p(_(":",P),([ue,en])=>p(re(en),([vr,Nr])=>p(gI(Nr),([Ik,bk])=>p(_("}",bk),([Sk,Ak])=>[[t,o,a,l,f,E,g,S,x,ue,vr,Ik,Sk],Ak]))))))))))))),([t,n])=>[g_(t),n]),T$=e=>p(Me(e),([t,n])=>[h_(t),n]),E$=e=>p(Zl(e),([t,n])=>[y_(t),n]),_$=e=>p(Ep(e),([t,n])=>[T_(t),n]),I$=e=>p(p(_("true",e),([t,n])=>[t,n],()=>p(_("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[E_(t),n]),b$=e=>p(_p(['"',"'"],e),([t,n])=>[t,n]),S$=e=>p(_("null",e),([t,n])=>[__(t),n]),A$=e=>p(_("undefined",e),([t,n])=>[void 0,n]),MI=e=>p(p(xI(e),([t,n])=>p(_(":",n),([o,i])=>p(om(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[I_(t),n]),DI=(e,t=[])=>p(p(bp(e),([n,o])=>p(MI(o),([i,a])=>[[n,i],a])),([n,o])=>DI(o,[...t,n]),()=>[t,e]),O$=e=>p(p(p(MI(e),([t,n])=>p(DI(n),([o,i])=>p(p(bp(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[b_(t),n]),GI=e=>p(p(_("{",e),([t,n])=>p(O$(n),([o,i])=>p(_("}",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[S_(t),n]),$I=(e,t=[])=>p(p(_(",",e),([n,o])=>p(om(o),([i,a])=>[[n,i],a])),([n,o])=>$I(o,[...t,n]),()=>[t,e]),x$=e=>p(p(p(om(e),([t,n])=>p($I(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])=>[A_(t),n]),R$=e=>p(p(_("[",e),([t,n])=>p(x$(n),([o,i])=>p(_("]",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[O_(t),n]),om=e=>p(p(E$(e),([t,n])=>[t,n],()=>p(_$(e),([t,n])=>[t,n],()=>p(I$(e),([t,n])=>[t,n],()=>p(b$(e),([t,n])=>[t,n],()=>p(S$(e),([t,n])=>[t,n],()=>p(A$(e),([t,n])=>[t,n],()=>p(GI(e),([t,n])=>[t,n],()=>p(R$(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),C$=e=>p(_("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[x_(t),n]),P$=e=>p(_(".*",e),([t,n])=>[R_(t),n]),U$=e=>p(_("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[C_(t),n]),w$=e=>p(_("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[P_(t),n]),v$=e=>p(_("(?!)",e),([t,n])=>[U_(t),n]),N$=e=>p(pI(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[w_(t),n]),L$=e=>p(p(C$(e),([t,n])=>[t,n],()=>p(P$(e),([t,n])=>[t,n],()=>p(U$(e),([t,n])=>[t,n],()=>p(w$(e),([t,n])=>[t,n],()=>p(v$(e),([t,n])=>[t,n],()=>p(k$(e),([t,n])=>[t,n],()=>p(N$(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),k$=e=>p(p(_("(",e),([t,n])=>p(im(n),([o,i])=>p(_(")",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[v_(t),n]),jI=e=>p(p(p(em(e),([t,n])=>p(_("|",n),([o,i])=>p(jI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p(p(em(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[N_(t),n]),em=e=>p(p(L$(e),([t,n])=>p(im(n),([o,i])=>[[t,o],i])),([t,n])=>[L_(t),n]),im=e=>p(p(jI(e),([t,n])=>[t,n],()=>p(em(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),hT=e=>p(p(_("^",e),([t,n])=>p(im(n),([o,i])=>p(_("$",i),([a,c])=>[[t,o,a],c]))),([t,n])=>[k_(t),n]),qI=(e,t=[])=>p(p(_(",",e),([n,o])=>p(re(o),([i,a])=>[[n,i],a])),([n,o])=>qI(o,[...t,n]),()=>[t,e]),M$=e=>p(p(p(re(e),([t,n])=>p(qI(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])=>[M_(t),n]),FI=e=>p(p(p(_("extends",e),([t,n])=>p(M$(n),([o,i])=>[[t,o],i])),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[D_(t),n]),D$=e=>p(p(_("interface",e),([t,n])=>p(Me(n),([o,i])=>p(tm(i),([a,c])=>p(FI(c),([l,m])=>p(nm(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[G_(t),n]),G$=e=>p(p(_("interface",e),([t,n])=>p(Me(n),([o,i])=>p(FI(i),([a,c])=>p(nm(c),([l,m])=>[[t,o,a,l],m])))),([t,n])=>[$_(t),n]),$$=e=>p(p(_("type",e),([t,n])=>p(Me(n),([o,i])=>p(tm(i),([a,c])=>p(_("=",c),([l,m])=>p(re(m),([f,h])=>[[t,o,a,l,f],h]))))),([t,n])=>[j_(t),n]),j$=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])=>[q_(t),n]),q$=e=>p(p(p(_("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[F_(t),n]),BI=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]),HI=(e,t=[])=>p(p(BI(e),([n,o])=>p(am(o),([i,a])=>[[n,i],a])),([n,o])=>HI(o,[...t,n]),()=>[t,e]),F$=e=>p(p(p(am(e),([t,n])=>p(HI(n),([o,i])=>p(p(BI(i),([a,c])=>[[a],c],()=>[[],i]),([a,c])=>[[t,o,a],c]))),([t,n])=>[t,n],()=>p([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[B_(t),n]),am=e=>p(p(q$(e),([t,n])=>p(p(D$(n),([o,i])=>[o,i],()=>p(G$(n),([o,i])=>[o,i],()=>p($$(n),([o,i])=>[o,i],()=>p(j$(n),([o,i])=>[o,i],()=>[])))),([o,i])=>p(gI(i),([a,c])=>[[t,o,a],c]))),([t,n])=>[H_(t),n]),B$=e=>p(p(am(e),([t,n])=>p(F$(n),([o,i])=>[[t,o],i])),([t,n])=>[K_(t),n]),KI=e=>p(p(B$(e),([t,n])=>[t,n],()=>p(ZG(e),([t,n])=>[t,n],()=>p(re(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function zI(e){let t=rm(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:fe()}function K$(e){return e.join("|")}function z$(e){return e.slice(1,e.length-1)}function Y$(e,t,n){return dn(t,`${n}${e}`)}function V$(e,t){return dn(e,`${t}${uT}`)}function Q$(e,t){return dn(e,`${t}${Nc}`)}function W$(e,t){return dn(e,`${t}${Dc}`)}function Z$(e,t){return Pa(F([z("false"),z("true")]),e,t)}function X$(e,t){return dn(e,`${t}${Gc}`)}function J$(e,t,n){return dn(t,`${n}${z$(e)}`)}function e1(e,t,n){let o=Ua(e,{});return Pa(o,t,n)}function t1(e,t,n){let o=wt(e);return Pa(o,t,n)}function YI(e,t,n,o=[]){return s.ShiftLeft(e,(i,a)=>YI(a,t,n,[...o,Pa(i,[],"")]),()=>dn(t,`${n}(${K$(o)})`))}function Pa(e,t,n){return ze(e)?t1(e.enum,t,n):ot(e)?Q$(t,n):Q(e)?Y$(e.const,t,n):vt(e)?V$(t,n):_t(e)?Z$(t,n):Ce(e)?W$(t,n):We(e)?X$(t,n):Ee(e)?J$(e.pattern,t,n):QI(e)?e1(e.parameters[0],t,n):R(e)?YI(e.anyOf,t,n):Gy}function dn(e,t){return s.ShiftLeft(e,(n,o)=>Pa(n,o,t),()=>t)}function r1(e){return`^${dn(e,"")}$`}function VI(e){let t=r1(e);return jc(t)}function Ua(e,t){return K(e)?y.Update(VI(e),{},t):Qc(e,t)}function WI(e,t,n,o){let i=jt(e,t,n);return Ua(i,o)}function Qc(e,t={}){return v("TemplateLiteral",[e],t)}function QI(e){return Ue(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function ZI(e){return Ua(e,{})}function n1(e){let t=zI(e);return ZI(t)}function XI(e,t={}){let n=s.IsString(e)?n1(e):ZI(e);return y.Update(n,{},t)}function Ee(e){return w(e,"TemplateLiteral")}var G={};Yt(G,{ExtendsFalse:()=>B,ExtendsTrue:()=>U,ExtendsUnion:()=>sm,IsExtendsFalse:()=>o1,IsExtendsTrue:()=>eb,IsExtendsTrueLike:()=>Ho,IsExtendsUnion:()=>JI,Match:()=>Ae});function sm(e){return y.Create({"~kind":"ExtendsUnion"},{inferred:e})}function JI(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 eb(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 o1(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function Ho(e){return JI(e)||eb(e)}function Ae(e,t,n){return Ho(e)?t(e.inferred):n()}function i1(e,t,n,o){return Ae(ee(e,n,o),i=>U(y.Assign(y.Assign(e,i),{[t]:n})),()=>B())}function a1(e,t){return U(e)}function s1(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 c1(e,t,n){let o=wt(n);return ee(e,t,o)}function tb(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(ee(e,t,o),a=>tb(a,t,i),()=>B()),()=>U(e))}function p1(e,t,n){let o=ht(n);return ee(e,t,o)}function rb(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(ee(e,t,o),a=>U(a),()=>rb(e,t,i)),()=>B())}function ae(e,t,n){return Ve(n)?a1(e,t):Le(n)?s1(e,t,n.if,n.then,n.else):ze(n)?c1(e,t,n.enum):Ke(n)?i1(e,n.name,t,n.extends):M(n)?tb(e,t,n.allOf):Ee(n)?p1(e,t,n.pattern):R(n)?rb(e,t,n.anyOf):et(n)?U(e):B()}function nb(e,t,n){return Ke(n)?ae(e,t,n):Ve(n)?U(e):et(n)?U(e):sm(e)}function u1(e,t){let n=Hn(e),o=Hn(t);return n&&o||!n&&o?!0:!(n&&!o)}function ob(e,t,n,o){return Z(o)?u1(t,o)?ee(e,n,o.items):B():ae(e,t,o)}function ib(e,t,n){return vt(n)?U(e):ae(e,t,n)}function ab(e,t,n){return _t(n)?U(e):ae(e,t,n)}function l1(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=>wa(f,n,i),()=>B())}function m1(e,t,n,o){return s.ShiftLeft(o,(i,a)=>l1(e,t,n,i,a),()=>Je(t)?U(e):B())}function d1(e,t,n){return s.ShiftLeft(t,(o,i)=>m1(e,o,i,n),()=>U(e))}function wa(e,t,n){return d1(e,t,n)}function Sp(e,t,n){return kt(n)?U(e):ee(e,t,n)}function sb(e,t,n,o){return Ve(o)?U(e):et(o)?U(e):Be(o)?Ae(wa(e,t,o.parameters),i=>Sp(i,n,o.instanceType),()=>B()):B()}function cb(e,t,n,o,i){return Ae(ee(e,t,i),()=>ee(e,n,i),()=>ee(e,o,i))}function pb(e,t,n){let o=wt(t);return ee(e,o,n)}function ub(e,t,n,o){return Ve(o)?U(e):et(o)?U(e):He(o)?Ae(wa(e,t,o.parameters),i=>Sp(i,n,o.returnType),()=>B()):B()}function lb(e,t,n){return ot(n)?U(e):Ce(n)?U(e):ae(e,t,n)}function mb(e,t,n){let o=we(t);return ee(e,o,n)}function Ap(e,t,n){return t===n?U(e):B()}function f1(e,t,n){return Q(n)?Ap(e,t,n.const):vt(n)?U(e):ae(e,z(t),n)}function g1(e,t,n){return Q(n)?Ap(e,t,n.const):_t(n)?U(e):ae(e,z(t),n)}function h1(e,t,n){return Q(n)?Ap(e,t,n.const):Ce(n)?U(e):ae(e,z(t),n)}function y1(e,t,n){return Q(n)?Ap(e,t,n.const):We(n)?U(e):ae(e,z(t),n)}function db(e,t,n){return s.IsBigInt(t.const)?f1(e,t.const,n):s.IsBoolean(t.const)?g1(e,t.const,n):s.IsNumber(t.const)?h1(e,t.const,n):s.IsString(t.const)?y1(e,t.const,n):fe()}function fb(e,t,n){return Ke(n)?ae(e,t,n):U(e)}function gb(e,t,n){return gr(n)?U(e):ae(e,t,n)}function hb(e,t,n){return Ce(n)?U(e):ae(e,t,n)}function T1(e,t,n){return Je(t)?Je(n)?U(e):B():U(e)}function E1(e,t,n){return Ke(n)&&tr(n.extends)?B():Ae(ee(e,t,n),o=>T1(o,t,n),()=>B())}function _1(e,t){return e.reduce((n,o)=>o in t?Ho(t[o])?{...n,...t[o].inferred}:fe():fe(),{})}function I1(e,t,n){let o={};for(let c of s.Keys(n))o[c]=c in t?E1({},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=>Ho(c)),a=i?_1(s.Keys(o),o):{};return i?U(a):B()}function b1(e,t,n){let o=I1(e,t,n);return Ho(o)?U(y.Assign(e,o.inferred)):B()}function S1(e,t,n){return b1(e,t,n)}function A1(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 yb(e,t,n,o){return s.ShiftLeft(t,(i,a)=>Ae(ee({},e[i],n),c=>yb(e,a,n,A1(o,c)),()=>B()),()=>U(o))}function O1(e,t,n,o){let i=s.Keys(t);return yb(t,i,o,e)}function Tb(e,t,n){return de(n)?O1(e,t,it(n),Se(n)):D(n)?S1(e,t,n.properties):ae(e,k(t),n)}function x1(e,t){return s.IsEqual(s.Keys(t).length,0)?U(e):B()}function R1(e,t,n,o,i){return ee(e,n,i)}function Eb(e,t,n,o){return de(o)?R1(e,Kc(t),n,Kc(it(o)),Se(o)):D(o)?x1(e,o.properties):Ve(o)?U(e):et(o)?U(e):B()}function _b(e,t,n){return We(n)?U(e):ae(e,t,n)}function Ib(e,t,n){return hr(n)?U(e):ae(e,t,n)}function bb(e,t,n){let o=ht(t);return ee(e,o,n)}function cm(e,t){return y.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function va(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 pm(e){return un(e)?Ke(e.items)?Z(e.items.extends)?cm(e.items.name,e.items.extends.items):et(e.items.extends)?cm(e.items.name,e.items.extends):void 0:fe():void 0}function Op(e){return Ke(e)?cm(e.name,e.extends):void 0}function um(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>Ae(ee({},o,t),()=>um(i,t,[...n,o]),()=>{}),()=>n)}function Sb(e,t,n,o){let i=um(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:ke(i)})):B()}function xp(e,t,n,o){let i=um(n,o);return s.IsArray(i)?U(y.Assign(e,{[t]:F(i)})):B()}function C1(e){return[...e].reverse()}function lm(e,t){return t?C1(e):e}function P1(e){let t=e.length>0?e[0]:void 0,n=Ue(t)?pm(t):void 0;return Ue(n)}function U1(e,t,n,o,i,a){return Ae(ee(e,n,i),c=>Ab(c,t,o,a),()=>B())}function w1(e,t,n,o,i){let a=pm(o);return va(a)?Sb(e,a.name,lm(n,t),a.type):s.ShiftLeft(n,(c,l)=>U1(e,t,c,l,o,i),()=>B())}function v1(e,t,n,o){return s.ShiftLeft(o,(i,a)=>w1(e,t,n,i,a),()=>s.IsEqual(n.length,0)?U(e):B())}function Ab(e,t,n,o){return v1(e,t,n,o)}function N1(e,t,n){let o=fn(e,be([],[]),n),i=P1(o);return Ab(e,i,lm(t,i),lm(o,i))}function Ob(e,t,n){let o=Op(n);return va(o)?xp(e,o.name,t,o.type):s.ShiftLeft(t,(i,a)=>Ae(ee(e,i,n),c=>Ob(c,a,n),()=>B()),()=>U(e))}function xb(e,t,n){let o=fn(e,be([],[]),t);return Y(n)?N1(e,o,n.items):Z(n)?Ob(e,o,n.items):ae(e,ke(o),n)}function Rb(e,t,n){return kt(n)?U(e):nr(n)?U(e):ae(e,t,n)}function Cb(e,t,n){return s.ShiftLeft(n,(o,i)=>Ae(ee(e,t,o),a=>U(a),()=>Cb(e,t,i)),()=>B())}function mm(e,t,n){return s.ShiftLeft(t,(o,i)=>Ae(Cb(e,o,n),a=>mm(a,i,n),()=>B()),()=>U(e))}function Pb(e,t,n){let o=Op(n);return va(o)?xp(e,o.name,t,o.type):R(n)?mm(e,t,n.anyOf):mm(e,t,[n])}function Ub(e,t,n){return Ke(n)?ae(e,t,n):Ve(n)?U(e):et(n)?U(e):B()}function wb(e,t,n){return kt(n)?U(e):ae(e,t,n)}function ee(e,t,n){return Ve(t)?nb(e,t,n):Z(t)?ob(e,t,t.items,n):vt(t)?ib(e,t,n):_t(t)?ab(e,t,n):Be(t)?sb(e,t.parameters,t.instanceType,n):Le(t)?cb(e,t.if,t.then,t.else,n):ze(t)?pb(e,t.enum,n):He(t)?ub(e,t.parameters,t.returnType,n):ot(t)?lb(e,t,n):M(t)?mb(e,t.allOf,n):Q(t)?db(e,t,n):tr(t)?fb(e,t,n):gr(t)?gb(e,t,n):Ce(t)?hb(e,t,n):D(t)?Tb(e,t.properties,n):de(t)?Eb(e,it(t),Se(t),n):We(t)?_b(e,t,n):hr(t)?Ib(e,t,n):Ee(t)?bb(e,t.pattern,n):Y(t)?xb(e,t.items,n):nr(t)?Rb(e,t,n):R(t)?Pb(e,t.anyOf,n):et(t)?Ub(e,t,n):kt(t)?wb(e,t,n):B()}function L1(e,t){return we([...e,k(t)])}function dm(e,t,n){return K(e)?y.Update(L1(e,t),{},n):Aa(e,t,n)}function vb(e,t,n,o,i){let a=jt(e,t,n),c=Na(e,t,o);return dm(a,c,i)}function Aa(e,t,n={}){return v("Interface",[e,t],n)}function Ko(e){return Ue(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function Nb(e,t,n={}){return dm(e,t,n)}function k1(e,t,n){return e.includes(n)?!0:La([...e,n],t,t[n])}function Lb(e,t,n){let o=Cc(n);return Xn(e,t,o)}function Xn(e,t,n){return s.ShiftLeft(n,(o,i)=>La(e,t,o)?!0:Xn(e,t,i),()=>!1)}function La(e,t,n){return ce(n)?k1(e,t,n.$ref):Z(n)?La(e,t,n.items):Be(n)?Xn(e,t,[...n.parameters,n.instanceType]):He(n)?Xn(e,t,[...n.parameters,n.returnType]):Ko(n)?Lb(e,t,n.parameters[1]):M(n)?Xn(e,t,n.allOf):D(n)?Lb(e,t,n.properties):R(n)?Xn(e,t,n.anyOf):Y(n)?Xn(e,t,n.items):de(n)?La(e,t,Se(n)):!1}function kb(e,t,n){return La(e,t,n)}function M1(e,t){return t.reduce((n,o)=>kb([o],e,e[o])?[...n,o]:n,[])}function Mb(e){let t=Rc(e);return M1(e,t)}function D1(e,t,n){return n.includes(t)?n:t in e?ka(e,e[t],[...n,t]):fe()}function Db(e,t,n){let o=Cc(t);return zo(e,o,n)}function zo(e,t,n){return t.reduce((o,i)=>ka(e,i,o),n)}function ka(e,t,n){return ce(t)?D1(e,t.$ref,n):Z(t)?ka(e,t.items,n):Be(t)?zo(e,[...t.parameters,t.instanceType],n):He(t)?zo(e,[...t.parameters,t.returnType],n):Ko(t)?Db(e,t.parameters[1],n):M(t)?zo(e,t.allOf,n):D(t)?Db(e,t.properties,n):R(t)?zo(e,t.anyOf,n):Y(t)?zo(e,t.items,n):de(t)?ka(e,Se(t),n):n}function Gb(e,t,n){return ka(e,n,[t])}function G1(e){return vo()}function $1(e){return s.Keys(e).reduce((t,n)=>({...t,[n]:Jn(e[n])}),{})}function Ma(e){return e.reduce((t,n)=>[...t,Jn(n)],[])}function Jn(e){return ce(e)?G1(e.$ref):Z(e)?Pt(Jn(e.items),Uo(e)):Be(e)?ur(Ma(e.parameters),Jn(e.instanceType)):He(e)?lr(Ma(e.parameters),Jn(e.returnType)):M(e)?ut(Ma(e.allOf)):D(e)?k($1(e.properties)):de(e)?$o(pn(e),Jn(Se(e))):R(e)?F(Ma(e.anyOf)):Y(e)?ke(Ma(e.items)):e}function j1(e,t){return t in e?Jn(e[t]):Qe()}function $b(e){return j1(e.$defs,e.$ref)}function q1(e,t,n){let o=jt(e,be([],[]),t),i=Na({},be([],[]),n);return we([...o,k(i)])}function F1(e,t){return s.Keys(e).filter(o=>t.includes(o)).reduce((o,i)=>{let a=e[i],c=Ko(a)?q1(e,a.parameters[0],a.parameters[1]):a;return{...o,[i]:c}},{})}function jb(e,t,n){let o=Gb(e,t,n),i=F1(e,o);return dr(i,t)}function qb(e,t){return t in e?ce(e[t])?qb(e,e[t].$ref):e[t]:me()}function yr(e,t){return qb(e,t)}function Fb(e){return Te(e)?$b(e):Pc(e)?Qe():e}function dt(e,t,n){let o=Fb(t),i=Fb(n);return ee(e,o,i)}var Ea="equal",B1="disjoint",_a="left-inside",Ia="right-inside";function Qn(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])?Ea:G.IsExtendsTrueLike(n[0])&&G.IsExtendsFalse(n[1])?_a:G.IsExtendsFalse(n[0])&&G.IsExtendsTrueLike(n[1])?Ia:B1}function H1(e,t){return t.filter(n=>Qn(e,n)!==Ia)}function K1(e,t){let n=t.some(o=>{let i=Qn(e,o);return s.IsEqual(i,_a)||s.IsEqual(i,Ea)});return s.IsEqual(n,!1)}function z1(e,t){let n=Vt(e);return Ve(n)?[n]:K1(n,t)?[...H1(n,t),n]:t}function Y1(e){return e.reduce((t,n)=>D(n)?[...t,n]:tr(n)?t:z1(n,t),[])}function Kl(e){let t=Y1(e);return Go(t)}function fm(e,t){return y.Update(Vt(e),{},t)}function Bb(e,t,n,o){let i=O(e,t,n);return fm(i,o)}function Da(e,t=[]){return nn(e)&&s.IsEqual(e.action,"Conditional")?ce(e.parameters[0])?Da(e.parameters[2],Da(e.parameters[3],[...t,e.parameters[0].$ref])):Da(e.parameters[2],Da(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 V1(e,t){return e.reduce((n,o)=>[...n,t.includes(o.name)],[])}function zb(e,t,n=[]){return s.ShiftLeft(e,(o,i)=>s.ShiftLeft(t,(a,c)=>zb(i,c,[...n,[a,o]]),()=>n),()=>n)}function Q1(e){return Ee(e)?ht(e.pattern):ze(e)?wt(e.enum):e}function W1(e){let t=Q1(e);return R(t)?[...t.anyOf]:[t]}function Z1(e,t){return e.reduce((n,o)=>[...n,[...o,t]],[])}function Hb(e,t){return t.reduce((n,o)=>[...n,...Z1(e,o)],[])}function Kb(e){return e.reduce((t,n)=>s.IsEqual(n[0],!0)?Hb(t,W1(n[1])):Hb(t,[n[1]]),[[]])}function Yb(e,t,n){let o=Da(n),i=V1(e,o),a=zb(t,i);return nn(n)&&s.IsEqual(n.action,"Conditional")||nn(n)&&s.IsEqual(n.action,"Mapped")?Kb(a):[t]}function X1(){return["(not-resolvable)",me()]}function J1(){return["(not-generic)",me()]}function ej(e,t,n){return[e,on(t,n)]}function tj(e,t,n){return t in e?Vb(e,t,e[t],n):X1()}function Vb(e,t,n,o){return wo(n)?ej(t,n.parameters,n.expression):ce(n)?tj(e,n.$ref,o):J1()}function Qb(e,t,n){return Vb(e,"(anonymous)",t,n)}function rj(e,t,n){if(Ke(t)||Yo(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 Wb(e,t,n,o,i){let a=O(e,t,i);return rj(n,a,o),y.Assign(e,{[n]:a})}function nj(e,t,n,o,i){let a=O(e,t,n.extends),c=O(e,t,n.equals);return s.ShiftLeft(i,(l,m)=>gm(Wb(e,t,n.name,a,l),t,o,m),()=>gm(Wb(e,t,n.name,a,c),t,o,[]))}function gm(e,t,n,o){return s.ShiftLeft(n,(i,a)=>nj(e,t,i,a,o),()=>e)}function Zb(e,t,n,o){return gm(e,t,n,o)}var hm=0,ym=0;function oj(){if(!s.IsLessThan(ym,rt.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function ij(){oj(),ym++,hm++}function aj(){hm--,s.IsEqual(hm,0)&&(ym=0)}function sj(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function cj(e,t){return s.IsEqual(sj(e),t)}function pj(e,t,n,o,i,a){ij();try{let c=Zb(e,t,o,a),l=O(c,be([...t.callstack,n.$ref],t.visited),i);return O(c,be([],[]),l)}finally{aj()}}function uj(e,t,n,o,i,a){return a.reduce((c,l)=>{let m=pj(e,t,n,o,i,l);return[...c,m]},[])}function lj(e,t,n,o,i,a){let c=Yb(o,a,i),l=uj(e,t,n,o,i,c);return s.IsEqual(l.length,1)?l[0]:Lt(l)}function Rp(e,t,n,o){let i=jt(e,t,o),a=Qb(e,n,o),c=a[0],l=a[1];return wo(l)?cj(t,c)?Oa(nt(c),i):lj(e,t,nt(c),l.parameters,l.expression,i):Oa(n,i)}function Oa(e,t){return y.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Xb(e,t){return Rp({},be([],[]),e,t)}function Yo(e){return w(e,"Call")}function mj(e){return y.Discard(e,["~immutable"])}function Jb(e,t){return y.Update(mj(e),{},t)}function eS(e,t,n,o){let i=O(e,t,n);return Jb(i,o)}function tS(e,t){return e(t)}function rS(e,t){return s.IsString(t)?z(tS(e,t)):z(t)}function nS(e,t){let n=ht(t);return Dr(e,n)}function oS(e,t){let n=t.map(o=>Dr(e,o));return F(n)}function Dr(e,t){return Q(t)?rS(e,t.const):Ee(t)?nS(e,t.pattern):R(t)?oS(e,t.anyOf):t}function Wc(e,t={}){return v("Capitalize",[e],t)}function iS(e,t={}){return Tm(e,t)}function Zc(e,t={}){return v("Lowercase",[e],t)}function aS(e,t={}){return Em(e,t)}function Xc(e,t={}){return v("Uncapitalize",[e],t)}function sS(e,t={}){return _m(e,t)}function Jc(e,t={}){return v("Uppercase",[e],t)}function cS(e,t={}){return Im(e,t)}var dj=e=>e[0].toUpperCase()+e.slice(1),fj=e=>e.toLowerCase(),gj=e=>e[0].toLowerCase()+e.slice(1),hj=e=>e.toUpperCase();function Tm(e,t){return K([e])?y.Update(Dr(dj,e),{},t):Wc(e,t)}function Em(e,t){return K([e])?y.Update(Dr(fj,e),{},t):Zc(e,t)}function _m(e,t){return K([e])?y.Update(Dr(gj,e),{},t):Xc(e,t)}function Im(e,t){return K([e])?y.Update(Dr(hj,e),{},t):Jc(e,t)}function pS(e,t,n,o){let i=O(e,t,n);return Tm(i,o)}function uS(e,t,n,o){let i=O(e,t,n);return Em(i,o)}function lS(e,t,n,o){let i=O(e,t,n);return _m(i,o)}function mS(e,t,n,o){let i=O(e,t,n);return Im(i,o)}function ep(e,t,n,o,i={}){return v("Conditional",[e,t,n,o],i)}function dS(e,t,n,o,i={}){return bm({},be([],[]),e,t,n,o,i)}function yj(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 bm(e,t,n,o,i,a,c){return K([n,o])?y.Update(yj(e,t,n,o,i,a),{},c):ep(n,o,i,a,c)}function fS(e,t,n,o,i,a,c){let l=O(e,t,n),m=O(e,t,o);return bm(e,t,l,m,i,a,c)}function tp(e,t={}){return v("ConstructorParameters",[e],t)}function gS(e,t={}){return Sm(e,t)}function Tj(e){let t=Be(e)?e.parameters:[],n=fn({},be([],[]),t);return ke(n)}function Sm(e,t){return K([e])?y.Update(Tj(e),{},t):tp(e,t)}function hS(e,t,n,o){let i=O(e,t,n);return Sm(i,o)}function rp(e,t,n={}){return v("Exclude",[e,t],n)}function yS(e,t,n={}){return Ga(e,t,n)}function Ga(e,t,n){return K([e,t])?y.Update(Fc(e,t),{},n):rp(e,t,n)}function TS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Ga(a,c,i)}function np(e,t,n={}){return v("Extract",[e,t],n)}function ES(e,t,n={}){return Am(e,t,n)}function Ej(e,t){let n=dt({},e,t);return G.IsExtendsTrueLike(n)?[e]:[]}function _j(e,t){return e.reduce((n,o)=>[...n,...Ej(o,t)],[])}function _S(e,t){let n=Vt(e),o=R(n)?n.anyOf:[n],i=_j(o,t);return Lt(i)}function Am(e,t,n){return K([e,t])?y.Update(_S(e,t),{},n):np(e,t,n)}function IS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Am(a,c,i)}function Ij(e){return e.reduce((t,n)=>Lc(n)?[...t,z(n)]:t,[])}function Vo(e){let t=Ij(e);return F(t)}function xa(e,t,n={}){return v("Index",[e,t],n)}function bS(e,t,n={}){let o=s.IsArray(t)?Vo(t):t;return Om(e,o,n)}function SS(e,t){let n=yr(e,t);return qt(n)}function AS(e,t,n){let o=rr(e,t,n);return qt(o)}function bj(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 OS(e){return e.reduce((t,n)=>bj(t,qt(n)),{})}function xS(e){let t=wT(ke(e));return qt(t)}function Sj(e,t){return s.Keys(e).filter(i=>i in t).reduce((i,a)=>({...i,[a]:Lt([e[a],t[a]])}),{})}function RS(e,t){return s.ShiftLeft(e,(n,o)=>RS(o,Sj(t,qt(n))),()=>t)}function CS(e){return s.ShiftLeft(e,(t,n)=>RS(n,qt(t)),()=>fe())}function qt(e){return Te(e)?SS(e.$defs,e.$ref):Le(e)?AS(e.if,e.then,e.else):M(e)?OS(e.allOf):R(e)?CS(e.anyOf):Y(e)?xS(e.items):D(e)?e.properties:{}}function Qo(e){let t=qt(e);return k(t)}var Aj=new RegExp("^(?:0|[1-9][0-9]*)$");function Wo(e){let t=`${e}`;return Aj.test(t)?parseInt(t):e}function Oj(e){return z(Wo(e))}function PS(e){return e.map(t=>US(t))}function US(e){return M(e)?ut(PS(e.allOf)):R(e)?F(PS(e.anyOf)):Q(e)?Oj(e.const):e}function wS(e,t){let n=US(t),o=dt({},n,Nt());return G.IsExtendsTrueLike(o)?e:Q(t)&&s.IsEqual(t.const,"length")?Nt():me()}function vS(e,t){let n=yr(e,t);return Mt(n)}function NS(e,t,n){let o=rr(e,t,n);return Mt(o)}function LS(e){let t=wt(e);return Mt(t)}function kS(e){let t=we(e);return Mt(t)}function MS(e){return[`${e}`]}function DS(e){let t=ht(e);return Mt(t)}function GS(e){return e.reduce((t,n)=>[...t,...Mt(n)],[])}function Mt(e){return Te(e)?vS(e.$defs,e.$ref):Le(e)?NS(e.if,e.then,e.else):ze(e)?LS(e.enum):M(e)?kS(e.allOf):Q(e)?MS(e.const):Ee(e)?DS(e.pattern):R(e)?GS(e.anyOf):[]}function Zo(e){return Mt(e)}function $a(e,t){return t.map(n=>ja(e,n))}function ja(e,t){return Z(t)?Pt(ja(e,t.items)):Be(t)?ur($a(e,t.parameters),ja(e,t.instanceType)):He(t)?lr($a(e,t.parameters),ja(e,t.returnType)):Y(t)?ke($a(e,t.items)):R(t)?F($a(e,t.anyOf)):M(t)?ut($a(e,t.allOf)):Yc(t)?k(e):t}function $S(e,t){return ja(e,t)}function xj(e,t){let n=t in e?e[t]:me();return $S(e,n)}function jS(e,t){return t.reduce((n,o)=>[...n,xj(e,o)],[])}function Rj(e,t){let n=Zo(t),o=jS(e,n);return Lt(o)}var Cj=new RegExp(cn);function Pj(e){return e.filter(n=>Cj.test(n))}function Uj(e){let t=Rc(e),n=Pj(t),o=jS(e,n);return Lt(o)}function qS(e,t){return Ce(t)?Uj(e):Rj(e,t)}function wj(e){return z(Wo(e))}function FS(e){return e.map(t=>xm(t))}function xm(e){return M(e)?ut(FS(e.allOf)):R(e)?F(FS(e.anyOf)):Q(e)?wj(e.const):e}function vj(e,t){return e.reduceRight((n,o,i)=>{let a=dt({},z(i),t);return G.IsExtendsTrueLike(a)?[o,...n]:n},[])}function Nj(e,t){let n=xm(t),o=vj(e,n);return kr(o)}function Lj(e){return kr(e)}function BS(e,t){return Q(t)&&s.IsEqual(t.const,"length")?z(e.length):Ce(t)||ot(t)?Lj(e):Nj(e,t)}function HS(e,t){return Z(e)?wS(e.items,t):D(e)?qS(e.properties,t):Y(e)?BS(e.items,t):me()}function kj(e){return Te(e)||Le(e)||M(e)||R(e)?Qo(e):e}function Om(e,t,n){return K([e,t])?y.Update(HS(kj(e),t),{},n):xa(e,t,n)}function KS(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Om(a,c,i)}function op(e,t={}){return v("InstanceType",[e],t)}function zS(e,t={}){return Rm(e,t)}function Mj(e){return Be(e)?e.instanceType:me()}function Rm(e,t){return K([e])?y.Update(Mj(e),{},t):op(e,t)}function YS(e,t,n,o={}){let i=O(e,t,n);return Rm(i,o)}function Ra(e,t={}){return v("KeyOf",[e],t)}function VS(e,t={}){return Cm(e,t)}function QS(){return F([Nt(),It(),Mo()])}function WS(e){return Nt()}function Dj(e){return e.reduce((n,o)=>Lc(o)?[...n,z(Wo(o))]:fe(),[])}function ZS(e){let t=s.Keys(e),n=Dj(t);return kr(n)}function XS(e){return pn(e)}function JS(e){let t=e.map((n,o)=>z(o));return kr(t)}function eA(e){return Ve(e)?QS():Z(e)?WS(e.items):D(e)?ZS(e.properties):de(e)?XS(e):Y(e)?JS(e.items):me()}function Gj(e){return Te(e)||Le(e)||M(e)||R(e)?Qo(e):e}function Cm(e,t){return K([e])?y.Update(eA(Gj(e)),{},t):Ra(e,t)}function tA(e,t,n,o){let i=O(e,t,n);return Cm(i,o)}function Sa(e,t,n,o,i={}){return v("Mapped",[e,t,n,o],i)}function rA(e,t,n,o,i={}){return Pm({},be([],[]),e,t,n,o,i)}function $j(e){let t=ht(e);return Cp(t)}function jj(e){return e.reduce((t,n)=>[...t,...Cp(n)],[])}function qj(e){let t=wt(e);return Cp(t)}function Fj(e){return s.IsNumber(e)?[z(`${e}`)]:[z(e)]}function Cp(e){return ze(e)?qj(e.enum):Q(e)?Fj(e.const):Ee(e)?$j(e.pattern):R(e)?jj(e.anyOf):[e]}function nA(e){return Cp(e)}function Bj(e){return Ee(e)?ht(e.pattern):e}function Hj(e,t,n,o,i,a){let c=y.Assign(e,{[n.name]:o}),l=O(c,t,i),m=Bj(l),f=O(c,t,a);return kc(m)||Mc(m)?{[m.const]:f}:{}}function Kj(e,t,n,o,i,a){return o.reduce((c,l)=>[...c,Hj(e,t,n,l,i,a)],[])}function zj(e){return e.reduce((t,n)=>[...t,k(n)],[])}function oA(e,t,n,o,i,a){let c=nA(o),l=Kj(e,t,n,c,i,a),m=zj(l);return we(m)}function Pm(e,t,n,o,i,a,c){return K([o])?y.Update(oA(e,t,n,o,i,a),{},c):Sa(n,o,i,a,c)}function iA(e,t,n,o,i,a,c){let l=O(e,t,o);return Pm(e,t,n,l,i,a,c)}function Yj(e,t,n){let o=y.Assign(e,t);return s.Keys(t).filter(a=>n.includes(a)).reduce((a,c)=>({...a,[c]:jb(o,c,t[c])}),{})}function Vj(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 Qj(e,t,n){let o=Mb(t),i=Yj(e,t,o),a=Vj(e,t,o),c={...i,...a};return y.Update(c,{},n)}function Pp(e,t,n,o){return Qj(e,n,o)}function ip(e,t={}){return v("NonNullable",[e],t)}function aA(e,t={}){return Um(e,t)}function Wj(e){let t=F([ko(),jo()]);return Ga(e,t,{})}function Um(e,t){return K([e])?y.Update(Wj(e),{},t):ip(e,t)}function sA(e,t,n,o){let i=O(e,t,n);return Um(i,o)}function ap(e,t,n={}){return v("Omit",[e,t],n)}function cA(e,t,n={}){let o=s.IsArray(t)?Vo(t):t;return wm(e,o,n)}function Up(e){let t=Qo(e);return D(t)?t.properties:fe()}function Zj(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?o:{...o,[i]:e[i]},{})}function pA(e,t){let n=Up(e),o=Zo(t),i=Zj(n,o);return k(i)}function wm(e,t,n){return K([e,t])?y.Update(pA(e,t),{},n):ap(e,t,n)}function uA(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return wm(a,c,i)}function sp(e,t={}){return v("Parameters",[e],t)}function lA(e,t={}){return vm(e,t)}function Xj(e){let t=He(e)?e.parameters:[],n=fn({},be([],[]),t);return ke(n)}function vm(e,t){return K([e])?y.Update(Xj(e),{},t):sp(e,t)}function mA(e,t,n,o){let i=O(e,t,n);return vm(i,o)}function cp(e,t={}){return v("Partial",[e],t)}function dA(e,t={}){return Nm(e,t)}function fA(e,t){let n=yr(e,t),o=Tr(n);return dr(y.Assign(e,{[t]:o}),t)}function gA(e,t,n){let o=rr(e,t,n);return Tr(o)}function hA(e){let t=we(e);return Tr(t)}function yA(e){let t=e.map(n=>Tr(n));return F(t)}function TA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:jn(e[i])}),{});return k(t)}function Tr(e){return Te(e)?fA(e.$defs,e.$ref):Le(e)?gA(e.if,e.then,e.else):M(e)?hA(e.allOf):R(e)?yA(e.anyOf):D(e)?TA(e.properties):k({})}function Nm(e,t){return K([e])?y.Update(Tr(e),{},t):cp(e,t)}function EA(e,t,n,o){let i=O(e,t,n);return Nm(i,o)}function pp(e,t,n={}){return v("Pick",[e,t],n)}function _A(e,t,n={}){let o=s.IsArray(t)?Vo(t):t;return Lm(e,o,n)}function Jj(e,t){return s.Keys(e).reduce((o,i)=>t.includes(i)?y.Assign(o,{[i]:e[i]}):o,{})}function IA(e,t){let n=Up(e),o=Zo(t),i=Jj(n,o);return k(i)}function Lm(e,t,n){return K([e,t])?y.Update(IA(e,t),{},n):pp(e,t,n)}function bA(e,t,n,o,i){let a=O(e,t,n),c=O(e,t,o);return Lm(a,c,i)}function up(e,t={}){return v("ReadonlyObject",[e],t)}function km(e,t={}){return Mm(e,t)}var SA=km;function AA(e){return Lo(Pt(e))}function OA(e,t){let n=yr(e,t),o=Er(n);return dr(y.Assign(e,{[t]:o}),t)}function xA(e,t,n){let o=rr(e,t,n);return Er(o)}function RA(e){let t=we(e);return Er(t)}function CA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:Kn(e[i])}),{});return k(t)}function PA(e){return Lo(ke(e))}function UA(e){let t=e.map(n=>Er(n));return F(t)}function Er(e){return Z(e)?AA(e.items):Te(e)?OA(e.$defs,e.$ref):Le(e)?xA(e.if,e.then,e.else):M(e)?RA(e.allOf):D(e)?CA(e.properties):Y(e)?PA(e.items):R(e)?UA(e.anyOf):e}function Mm(e,t){return K([e])?y.Update(Er(e),{},t):up(e)}function wA(e,t,n,o){let i=O(e,t,n);return Mm(i,o)}function vA(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 NA(e,t){let n=yr(e,t),o=_r(n);return dr(y.Assign(e,{[t]:o}),t)}function LA(e,t,n){let o=rr(e,t,n);return _r(o)}function kA(e){let t=we(e);return _r(t)}function MA(e){let t=e.map(n=>_r(n));return F(t)}function DA(e){let t=s.Keys(e).reduce((o,i)=>({...o,[i]:qc(e[i])}),{});return k(t)}function _r(e){return Te(e)?NA(e.$defs,e.$ref):Le(e)?LA(e.if,e.then,e.else):M(e)?kA(e.allOf):R(e)?MA(e.anyOf):D(e)?DA(e.properties):k({})}function lp(e,t={}){return v("Required",[e],t)}function GA(e,t={}){return Dm(e,t)}function Dm(e,t){return K([e])?y.Update(_r(e),{},t):lp(e,t)}function $A(e,t,n,o){let i=O(e,t,n);return Dm(i,o)}function mp(e,t={}){return v("ReturnType",[e],t)}function jA(e,t={}){return Gm(e,t)}function eq(e){return He(e)?e.returnType:me()}function Gm(e,t){return K([e])?y.Update(eq(e),{},t):mp(e,t)}function qA(e,t,n,o={}){let i=O(e,t,n);return Gm(i,o)}function dp(e,t){return v("With",[e,t],{})}function wp(e,t){return $m(e,t)}function $m(e,t){return K([e])?y.Update(e,{},t):dp(e,t)}function FA(e,t,n,o){let i=O(e,t,n);return $m(i,o)}function tq(e){return un(e)?Y(e.items)?jm(e.items.items):Ke(e.items)?[e]:ce(e.items)?[e]:[me()]:[e]}function jm(e){return e.reduce((n,o)=>[...n,...tq(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 Na(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 jm(o)}function jt(e,t,n){return n.map(o=>O(e,t,o))}function rq(e,t){let n=Je(e)?la(t,{}):t,o=zn(e)?ua(n,{}):n;return Hn(e)?qa(o,{}):o}function nq(e,t,n,o,i){return s.IsEqual(n,"AddImmutable")?BA(e,t,o[0],i):s.IsEqual(n,"RemoveImmutable")?eS(e,t,o[0],i):s.IsEqual(n,"AddReadonly")?Ly(e,t,o[0],i):s.IsEqual(n,"RemoveReadonly")?xT(e,t,o[0],i):s.IsEqual(n,"AddOptional")?ky(e,t,o[0],i):s.IsEqual(n,"RemoveOptional")?PT(e,t,o[0],i):s.IsEqual(n,"Capitalize")?pS(e,t,o[0],i):s.IsEqual(n,"Conditional")?fS(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"ConstructorParameters")?hS(e,t,o[0],i):s.IsEqual(n,"Evaluate")?Bb(e,t,o[0],i):s.IsEqual(n,"Exclude")?TS(e,t,o[0],o[1],i):s.IsEqual(n,"Extract")?IS(e,t,o[0],o[1],i):s.IsEqual(n,"Index")?KS(e,t,o[0],o[1],i):s.IsEqual(n,"InstanceType")?YS(e,t,o[0],i):s.IsEqual(n,"Interface")?vb(e,t,o[0],o[1],i):s.IsEqual(n,"KeyOf")?tA(e,t,o[0],i):s.IsEqual(n,"Lowercase")?uS(e,t,o[0],i):s.IsEqual(n,"Mapped")?iA(e,t,o[0],o[1],o[2],o[3],i):s.IsEqual(n,"Module")?Pp(e,t,o[0],i):s.IsEqual(n,"NonNullable")?sA(e,t,o[0],i):s.IsEqual(n,"Pick")?bA(e,t,o[0],o[1],i):s.IsEqual(n,"Parameters")?mA(e,t,o[0],i):s.IsEqual(n,"Partial")?EA(e,t,o[0],i):s.IsEqual(n,"Omit")?uA(e,t,o[0],o[1],i):s.IsEqual(n,"ReadonlyObject")?wA(e,t,o[0],i):s.IsEqual(n,"Record")?zT(e,t,o[0],o[1],i):s.IsEqual(n,"Required")?$A(e,t,o[0],i):s.IsEqual(n,"ReturnType")?qA(e,t,o[0],i):s.IsEqual(n,"TemplateLiteral")?WI(e,t,o[0],i):s.IsEqual(n,"Uncapitalize")?lS(e,t,o[0],i):s.IsEqual(n,"Uppercase")?mS(e,t,o[0],i):s.IsEqual(n,"With")?FA(e,t,o[0],o[1]):v(n,o,i)}function oq(e,t,n){let o=ce(n)?vA(e,t,n,n.$ref):Z(n)?Pt(O(e,t,n.items),Uo(n)):Yo(n)?Rp(e,t,n.target,n.arguments):Be(n)?ur(jt(e,t,n.parameters),O(e,t,n.instanceType),My(n)):He(n)?lr(jt(e,t,n.parameters),O(e,t,n.returnType),Dy(n)):Le(n)?qn(O(e,t,n.if),O(e,t,n.then),O(e,t,n.else),By(n)):M(n)?ut(jt(e,t,n.allOf),Vy(n)):D(n)?k(Na(e,t,n.properties),qy(n)):de(n)?Hc(it(n),O(e,t,Se(n))):un(n)?Wn(O(e,t,n.items)):Y(n)?ke(fn(e,t,n.items),OT(n)):R(n)?F(jt(e,t,n.anyOf),gT(n)):n;return rq(n,o)}function O(e,t,n){return nn(n)?nq(e,t,n.action,n.parameters,n.options):oq(e,t,n)}function Qt(e,t){return O(e,be([],[]),t)}function iq(e){return y.Update(e,{"~immutable":!0},{})}function qa(e,t){return y.Update(iq(e),{},t)}function BA(e,t,n,o){let i=O(e,t,n);return qa(i,o)}function z_(e,t={}){return v("AddImmutable",[e],t)}function Lo(e,t={}){return qa(e,t)}function Y_(e,t={}){return v("Evaluate",[e],t)}function ft(e,t={}){return fm(e,t)}function V_(e,t={}){return v("Module",[e],t)}function HA(e,t={}){return Pp({},be([],[]),e,t)}function aq(e,t){let n=Qn(e,t);return s.IsEqual(n,"right-inside")||s.IsEqual(n,"disjoint")?1:0}function KA(e,t,n=[]){return s.ShiftLeft(t,(o,i)=>s.IsEqual(aq(e,o),1)?KA(e,i,[...n,o]):[...n,e,...t],()=>[...n,e])}function zA(e,t=[]){return s.ShiftLeft(e,(n,o)=>zA(o,KA(n,t)),()=>t)}function YA(e){return zA(e)}function VA(...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=KI(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:()=>vo,Array:()=>Pt,BigInt:()=>ga,Boolean:()=>vc,Call:()=>Xb,Capitalize:()=>iS,Codec:()=>Uc,Conditional:()=>dS,Constructor:()=>ur,ConstructorParameters:()=>gS,Cyclic:()=>dr,Decode:()=>iT,DecodeBuilder:()=>fa,Dependent:()=>qn,Encode:()=>aT,EncodeBuilder:()=>da,Enum:()=>Yy,Evaluate:()=>ft,Exclude:()=>yS,Extends:()=>dt,ExtendsResult:()=>G,Extract:()=>ES,Function:()=>lr,Generic:()=>on,Identifier:()=>ha,Immutable:()=>sT,Index:()=>bS,Infer:()=>ma,InstanceType:()=>zS,Instantiate:()=>Qt,Integer:()=>Yn,Interface:()=>Nb,Intersect:()=>ut,IsAny:()=>Ve,IsArray:()=>Z,IsBigInt:()=>vt,IsBoolean:()=>_t,IsCall:()=>Yo,IsCodec:()=>Bn,IsConstructor:()=>Be,IsCyclic:()=>Te,IsDependent:()=>Le,IsEnum:()=>ze,IsEnumValue:()=>zy,IsFunction:()=>He,IsGeneric:()=>wo,IsIdentifier:()=>lT,IsImmutable:()=>Hn,IsInfer:()=>Ke,IsInteger:()=>ot,IsIntersect:()=>M,IsKind:()=>w,IsLiteral:()=>Q,IsNever:()=>tr,IsNull:()=>gr,IsNumber:()=>Ce,IsObject:()=>D,IsOptional:()=>Je,IsParameter:()=>fT,IsReadonly:()=>zn,IsRecord:()=>de,IsRef:()=>ce,IsRefine:()=>wc,IsRest:()=>un,IsSchema:()=>Ue,IsString:()=>We,IsSymbol:()=>hr,IsTemplateLiteral:()=>Ee,IsThis:()=>Yc,IsTuple:()=>Y,IsUndefined:()=>nr,IsUnion:()=>R,IsUnknown:()=>et,IsUnsafe:()=>Pc,IsVoid:()=>kt,KeyOf:()=>VS,Literal:()=>z,Lowercase:()=>aS,Mapped:()=>rA,Module:()=>HA,Never:()=>me,NonNullable:()=>aA,Null:()=>ko,Number:()=>Nt,Object:()=>k,Omit:()=>cA,Optional:()=>$y,Parameter:()=>Vn,Parameters:()=>lA,Partial:()=>dA,Pick:()=>_A,Readonly:()=>cT,ReadonlyObject:()=>km,ReadonlyType:()=>SA,Record:()=>$o,RecordKey:()=>pn,RecordPattern:()=>it,RecordValue:()=>Se,Ref:()=>nt,Refine:()=>pT,Required:()=>GA,Rest:()=>Wn,ReturnType:()=>jA,Script:()=>VA,String:()=>It,Symbol:()=>Mo,TemplateLiteral:()=>XI,This:()=>zc,Tuple:()=>ke,Uncapitalize:()=>sS,Undefined:()=>jo,Union:()=>F,Unknown:()=>Qe,Unsafe:()=>Fy,Uppercase:()=>cS,Void:()=>Vc,With:()=>wp});var QA="Must be a valid tags query: only tag:value searches (no wildcards), boolean operators, and parentheses are supported.";var sq=tn(ZA());var XA="lowercase-email",qm="iana-timezone",Fm="simple-time",Bm="simple-date-time";var cq=(e,t)=>RegExp(`^${e.source}(${t.source}${e.source})*$`),pq=/[a-zA-Z0-9-_]+/,uq=/\./,tCe=cq(pq,uq);var JA="lowercase-domain";var Xo="kebab-case";var eO="camel-case";var lq=new Set;function C(e,t,n={}){let o=t.map(i=>{let a=i;return a.$id?(lq.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 ei=1e3,Np=100,ge={limit:r.Optional(r.Integer({minimum:1,maximum:ei,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:ei,default:Np,description:`Maximum number of items to return in this page. Omit to use the public API default of ${Np}.`}))},mq=r.Object({totalCount:r.Integer({description:"Total number of items matching the query before `limit` and `offset` are applied."}),pageCount:r.Integer({description:"Total number of pages available for the requested `limit`."})},{description:"Counts describing the full result set that the returned page was taken from, for computing how many further pages remain."}),sCe=r.Object({pagination:mq},{$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 Jo=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:eO,minLength:i,maxLength:Jo,...a});case"kebab-case":return r.String({format:Xo,minLength:i,maxLength:Jo,...a});case"email":return r.String({format:XA,minLength:i,maxLength:254,errorMessage:{format:"Must be a valid lowercase email address."},...a});case"lowercase-domain":return r.String({format:JA,minLength:i,maxLength:Jo,...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:Jo,...a});case"long":return r.String({minLength:i,maxLength:5e4,...a});case"short":return r.String({minLength:i,maxLength:Jo,...a});case"tsuga-formula":return r.String({format:"tsuga-formula",minLength:i,maxLength:Jo,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 Fa=["ingestion-api-key","operation-api-key","rum-public-token","dashboard","log-route","metric-route","monitor","notification-rule","notification-silence","slo"],Lp=r.Array(r.Enum(Fa,{description:"Tsuga-managed asset type."}),{description:"Tsuga-managed asset types covered by the policy. An empty array means all supported asset types."});var Hm=["CLUSTER_DB_QUERY_INVALID_CONNECTION_PARAMS","CLUSTER_DB_QUERY_INVALID_CREDENTIALS","CLUSTER_DB_QUERY_PERMISSION_DENIED","CLUSTER_DB_QUERY_QUERY_SYNTAX_ERROR","CLUSTER_DB_QUERY_DATABASE_UNREACHABLE","CLUSTER_DB_QUERY_CONNECTION_FAILED","CLUSTER_DB_QUERY_QUERY_EXECUTION_FAILED","CLUSTER_DB_QUERY_QUERY_TIMEOUT"],ECe=r.Enum(Hm),dq=["CLUSTER_AGGREGATION_STRUCTURE"],_Ce=r.Object({code:r.Enum(Hm),message:r.String()}),tO=[...Hm,...dq,"ABORT_ERROR","BAD_REQUEST","DUPLICATE_KEY_VIOLATION","FOREIGN_KEY_VIOLATION","FST_ERR_VALIDATION","GROK_RULE_VALIDATION_ERROR","INVALID_INPUT","FORBIDDEN","MISSING_PERMISSION","PRIVILEGE_ESCALATION","RATE_LIMITED","RESERVED_TAG_POLICY_ERROR","RESOURCE_NOT_FOUND","INVALID_INVITATION","TAG_POLICY_ALREADY_EXISTS_ERROR","TAG_POLICY_VALIDATION_ERROR","UNAUTHORIZED","URL_NOT_FOUND"],rO=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var fq=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],gq=[...tO,...rO,...fq],hq=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(Fa,{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."}),yq=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`."}),Tq=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:yq},{description:"A single grok rule that failed to compile, with its position in the submitted rules and the structured compile error."}),nO=C("type",[r.Object({type:r.Literal("tag_policy_violation",{description:"Discriminator identifying tag-policy validation details. Set by Tsuga to `tag_policy_violation`. Returned when the error code is `TAG_POLICY_VALIDATION_ERROR`."}),violations:r.Array(hq,{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(Tq,{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(gq,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"}),details:r.Optional(nO)},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),bCe=r.Object({code:r.Optional(r.Enum(tO,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"}),details:r.Optional(nO)},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),SCe=r.Object({code:r.Optional(r.Enum(rO,{description:"Machine readable error code describing what went wrong"})),message:r.String({description:"Human readable explanation of the error"}),statusCode:r.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),ACe=r.Object({requestId:r.String({description:"Identifier used to trace the lifecycle of this API request"}),error:r.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),OCe=r.Object({requestId:r.String({description:"Identifier used to trace the lifecycle of this API request"}),error:r.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function d({body:e,description:t,method:n,operationId:o,params:i,tags:a,query:c,paginated:l,response:m,url:f}){return i?{buildUrl:E=>f.replace(/:[a-zA-Z_]+/g,I=>E[I.slice(1)]),method:n,params:i,response:m,templateUrl:f,...e===void 0?{}:{body:e},...t===void 0?{}:{description:t},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}:{method:n,response:m,url:f,templateUrl:f,...e===void 0?{}:{body:e},...t===void 0?{}:{description:t},...o===void 0?{}:{operationId:o},...c===void 0?{}:{query:c},...l===void 0?{}:{paginated:l},...a===void 0?{}:{tags:a}}}function oO(e,t){if(!t||typeof t!="object")return e;let n=new URLSearchParams;return Object.entries(t).forEach(([o,i])=>{Array.isArray(i)?i.length>0&&i.forEach(a=>{a!==void 0&&(typeof a=="string"||typeof a=="number"||typeof a=="boolean")&&n.append(o,String(a))}):(typeof i=="boolean"||typeof i=="string"||typeof i=="number")&&n.append(o,String(i))}),`${e}?${n.toString()}`}var N=r.Object({success:r.Literal(!0,{description:"Always `true` when the delete request completed and the resource was removed."})},{$id:"DeleteResponse",description:"Confirmation that the targeted resource was deleted.",example:{success:!0}});var Km="tsuga-cli";var eo="/v0/oauth",iO=d({description:"OAuth 2.1 authorization endpoint: validates the client and redirect URI, then redirects to the consent page",url:`${eo}/authorize`,method:"GET",query:r.Partial(r.Object({response_type:r.String({description:"Must be `code`"}),client_id:r.String({description:"First-party client id or CIMD document URL"}),redirect_uri:r.String({description:"Client redirect URI"}),code_challenge:r.String({description:"PKCE code challenge"}),code_challenge_method:r.String({description:"Must be `S256`"}),state:r.String({description:"Opaque client state, echoed back"}),resource:r.String({description:"RFC 8707 resource indicator"})})),response:r.Object({},{description:"Never returned: this endpoint redirects (302) or renders an HTML error (400)"})}),aO=d({description:"OAuth 2.1 token endpoint: exchanges an authorization code (PKCE) or refresh token for a token pair",url:`${eo}/token`,method:"POST",body:r.Partial(r.Object({grant_type:r.String({description:"`authorization_code` or `refresh_token`"}),code:r.String({description:"Authorization code being exchanged"}),code_verifier:r.String({description:"PKCE code verifier"}),redirect_uri:r.String({description:"Must match the redirect URI used on /authorize"}),client_id:r.String({description:"Client id, when sent by the client"}),refresh_token:r.String({description:"Refresh token, for `grant_type=refresh_token`"})})),response:r.Object({access_token:r.String(),token_type:r.Literal("Bearer"),expires_in:r.Number({description:"Access token lifetime in seconds"}),refresh_token:r.String()})}),qCe=d({description:"Resolve a signed authorization request handle for the consent page",url:`${eo}/authorization-request`,method:"GET",query:r.Object({handle:r.String()}),response:r.Object({clientId:r.String(),clientName:r.String(),redirectUri:r.String()})}),FCe=d({description:"Approve or deny an OAuth authorization request from the consent page",url:`${eo}/approve`,method:"POST",body:r.Object({handle:r.String({description:"The signed authorization request handle"}),approve:r.Boolean()}),response:r.Object({redirectTo:r.String({description:"The client's redirect URI carrying either the code or the denial"})})}),BCe=d({description:"Validate an OAuth access token (internal, for the MCP resource server)",url:`${eo}/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())})}),Eq=["pending","active","revoked"],_q=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(Eq),lastUsedAt:r.Optional(A())}),HCe=d({tags:["oauth"],description:"List OAuth grants: your own, or all users for admins",url:`${eo}/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(_q)}),KCe=d({tags:["oauth"],description:"Delete an OAuth grant (own grant, or any grant for admins)",url:`${eo}/grants/:id`,method:"DELETE",params:r.Object({id:r.String()}),response:N});function sO(e,t){let n=new URL(iO.url,e);return n.search=new URLSearchParams({response_type:"code",client_id:Km,redirect_uri:t.redirectUri,code_challenge:t.challenge,code_challenge_method:"S256",state:t.state}).toString(),n.href}function Iq(e){if(!e)return{};try{let t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}async function bq(e,t){let n=await fetch(new URL(aO.url,e).href,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams(t).toString()}),o=await n.text(),i=Iq(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*Rl)}}async function cO(e,t){return bq(e,{grant_type:"authorization_code",client_id:Km,code:t.code,code_verifier:t.verifier,redirect_uri:t.redirectUri})}var Wt=require("node:fs"),Jm=require("node:os"),ro=require("node:path");var uO=tn(require("os"),1),Ba=tn(require("path"),1),gn=uO.default.homedir(),{env:to}=process,pO=to.XDG_DATA_HOME||(gn?Ba.default.join(gn,".local","share"):void 0),kp=to.XDG_CONFIG_HOME||(gn?Ba.default.join(gn,".config"):void 0),WCe=to.XDG_STATE_HOME||(gn?Ba.default.join(gn,".local","state"):void 0),lO=to.XDG_CACHE_HOME||(gn?Ba.default.join(gn,".cache"):void 0),ZCe=to.XDG_RUNTIME_DIR||void 0,Sq=(to.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");pO&&Sq.unshift(pO);var Aq=(to.XDG_CONFIG_DIRS||"/etc/xdg").split(":");kp&&Aq.unshift(kp);var mO=new Set(["api.tsuga.com","api.tsuga-staging.com"]),Oq=new Set(["localhost","127.0.0.1","[::1]"]);function zm(e){let t=e.replace(/\/+$/,"");if(!URL.canParse(t))throw new Error(`TSUGA_API_URL is not a URL: ${t}`);let n=new URL(t);if(!Oq.has(n.hostname)&&(n.protocol!=="https:"||!mO.has(n.hostname)))throw new Error(`Refusing to send credentials to ${t}. Set TSUGA_API_URL to ${[...mO].map(o=>`https://${o}`).join(", ")}, or a localhost URL.`);return t}var dO=require("node:child_process"),fO=require("node:fs"),Ha="/usr/bin/security",Ym="tsuga-cli",gO=44,xq=/^https?:\/\/[^\s"'\\]+$/,Ka="the macOS Keychain";function Vm(e){if(process.platform!=="darwin"||!xq.test(e))return!1;try{return(0,fO.lstatSync)(Ha).isFile()}catch{return!1}}function Qm(e,t){try{return{status:0,stdout:(0,dO.execFileSync)(Ha,e,{env:{},input:t,encoding:"utf-8",stdio:["pipe","pipe","pipe"]}),stderr:""}}catch(n){let{status:o,stderr:i}=n;return{status:o??1,stdout:"",stderr:i??""}}}function Wm(e,{status:t,stderr:n}){let o=n.trim()||`\`security\` exited with ${t}`;console.error(`Warning: could not ${e} ${Ka}: ${o}`)}function hO(e){if(!Vm(e))return;let t=Qm(["find-generic-password","-s",Ym,"-a",e,"-w"]);if(t.status!==0){t.status!==gO&&Wm("read the session from",t);return}try{return JSON.parse(t.stdout.trim())}catch{return}}function yO(e,t){if(!Vm(e))return!1;let n=Buffer.from(JSON.stringify(t),"utf-8").toString("hex"),o=Qm(["-i"],`add-generic-password -U -s ${Ym} -a ${e} -X ${n}
|
|
43
|
+
`);return o.status!==0?(Wm("save the session to",o),!1):!0}function Zm(e){if(!Vm(e))return!0;let t=Qm(["delete-generic-password","-s",Ym,"-a",e]);return t.status!==0&&t.status!==gO?(Wm("remove the session from",t),!1):!0}var TO=(0,ro.join)(kp??(0,ro.join)((0,Jm.homedir)(),".config"),"tsuga"),ti=(0,ro.join)(TO,"config.json"),EO=(0,ro.join)(lO??(0,ro.join)((0,Jm.homedir)(),".cache"),"tsuga"),Xm=(0,ro.join)(EO,"update-check.json"),za=zm("https://api.tsuga.com");function _O(e){return Ph(e.credential)}function Dp(){if(!(0,Wt.existsSync)(ti))return{};try{let e=JSON.parse((0,Wt.readFileSync)(ti,"utf-8")),{operationApiKey:t,userAuth:n,...o}=e;return!t&&!n?e:{...o,credentials:{...e.credentials,[za]:{...t?{operationApiKey:t}:{},...n?{userAuth:n}:{},...e.credentials?.[za]}}}}catch{throw new Error(`Config file corrupted: ${ti}
|
|
44
|
+
Re-authenticate with \`tsuga auth login\` or \`tsuga auth operation-key <OPERATION_API_KEY>\`.`)}}function Ya(){try{return Dp()}catch{return{}}}function ri(e){(0,Wt.mkdirSync)(TO,{recursive:!0,mode:448}),(0,Wt.writeFileSync)(ti,`${JSON.stringify(e,null,2)}
|
|
45
|
+
`,{mode:384})}function ed(e,t=hn()){let n=e.credentials?.[t]??{},o=hO(t);return o?{...n,userAuth:o}:n}function Mp(e,t,n=hn()){return{...e,credentials:{...e.credentials,[n]:t}}}function hn(){return zm(process.env.TSUGA_API_URL?.trim()||za)}function ni(e){let t=Dp(),n=hn(),o=ed(t,n),i=Ch({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 IO(){return ed(Dp()).userAuth}function bO(e){let t=Ya(),n=hn();if(yO(n,e))return ri(Mp(t,{},n)),Ka;if(!Zm(n))throw new Error(`Could not save the session to ${Ka}, nor remove the session already stored there. Remove it with \`${Ha} delete-generic-password -s tsuga-cli -a ${n}\` and log in again.`);return ri(Mp(t,{userAuth:e},n)),ti}function SO(e){let t=Ya();ri(Mp(t,{operationApiKey:e}))}function AO(){let e=hn(),t=Zm(e),n=Ya(),o=ed(n,e);if(ri(Mp(n,o.operationApiKey?{operationApiKey:o.operationApiKey}:{},e)),!t)throw new Error(`The session is still in ${Ka}. Remove it with \`${Ha} delete-generic-password -s tsuga-cli -a ${e}\`.`)}function Gp(){return ti}var OO={from:"-30m",to:"now",query:"*","max-results":"100"};function Gr(e){return(Dp().defaults??{})[e]??OO[e]}function xO(e,t){let n=Ya();ri({...n,defaults:{...n.defaults,[e]:t}})}function RO(){let{defaults:e,...t}=Ya();ri(t)}function CO(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: ${ia(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={...OO,...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
46
|
`)}
|
|
46
|
-
`}function
|
|
47
|
-
`,{mode:384})}async function
|
|
48
|
-
`),process.exitCode=1;return}if(tc({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}V(r.accessToken)}function cj(){let{credential:e}=Yo({});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(`Logged in as a user (token ${Yi(e.userAuth.accessToken)}, expires ${e.userAuth.accessExpiresAt}).`);return;case"operation-api-key":V("Authenticated with an operation API key.");return;default:pt(e)}}function pj(){RO(),V("Local user session cleared.")}function kO(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(aj),r.command("logout").description("Clear the saved user session").action(pj),r.command("token").description("Print the saved user access token to stdout").action(sj),r.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(n=>{xO(n),V(`Operation API key saved to ${Ma()}`)}),r.command("status").description("Show the current authentication method").action(cj)}var uj=["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"],lj=["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"],mj=["log","metric","trace","rum"],Um=[...lj,...mj],ZAe=[...uj,...Um];var Ap=["admin","public_editor","public_viewer","teams_only"],Vo=["admin","editor","viewer"];var Jn="/v0/team-membership",wm="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.",vm=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(Vo,{description:wm})}),MO=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(Vo,{description:wm})}),dj=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."})}),fj=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."}))})),XAe=m({tags:["access-control"],url:Jn,method:"GET",query:fj,response:t.Array(vm)}),JAe=m({tags:["access-control"],url:Jn,method:"POST",body:MO,response:vm}),exe=m({tags:["access-control"],url:Jn,method:"PUT",body:MO,response:vm}),txe=m({tags:["access-control"],url:Jn,method:"DELETE",body:dj,response:N}),Op=500,DO=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(Vo,{description:wm})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:Op,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."}),gj={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(DO,{examples:[gj]});var GO=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."}),yj={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(GO,{examples:[yj]});var rxe=m({tags:["access-control"],url:`${Jn}/bulk-add`,method:"POST",body:DO,response:GO}),nxe=m({tags:["access-control"],url:`${Jn}/bulk-update-user-roles`,method:"PUT",body:t.Object({userIds:t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:Op}),teamId:p({allowEmpty:!1}),role:t.Enum(Vo)}),response:t.Object({})}),$O=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:Op,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:Op,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."}),hj={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign($O,{examples:[hj]});var jO=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."}),Ej={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign(jO,{examples:[Ej]});var oxe=m({tags:["access-control"],url:`${Jn}/bulk-remove`,method:"DELETE",body:$O,response:jO});var Tj=["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"],qO=t.Enum(Tj,{description:"Stable nav item key within a main sidebar category."}),BO=t.Array(qO,{description:"Nav item keys shown in the primary sidebar for this category, in display order."}),FO=t.Optional(t.Array(qO,{description:"Nav item keys for this category that are folded away (e.g. View more). Omitted or empty means none."})),HO="Stable category id. Unknown or renamed ids are ignored by the client catalog.",KO="Sidebar categories in display order. Unknown or renamed ids are ignored by the client catalog.",Nm=t.Object({categories:t.Array(t.Object({id:t.String({description:HO}),visible:BO,folded:FO}),{description:KO})}),zO=t.Object({categories:t.Array(t.Object({id:p({allowEmpty:!1,description:HO}),visible:BO,folded:FO}),{description:KO})});var xp="/v0/org",_j=`${xp}/current-user`,YO=`${xp}/settings`,VO=`${xp}/allowed-domains`,Rp=50,Ij=50,bj=4e3,QO=t.Array(t.String(),{description:"IPv4/IPv6 CIDR ranges allowed to use a user session in this account. An empty list allows every network."}),Sj=t.Array(p({allowEmpty:!1,description:'An IPv4 or IPv6 CIDR range (e.g. "203.0.113.0/24").'}),{maxItems:Ij,description:"Replaces the existing list. The caller's own IP address must match one of the ranges. An empty list removes the restriction."}),WO=t.Object({id:t.String(),name:t.String(),createdAt:b(),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()}),ZO=t.Object({allowedDomains:t.Array(p({allowEmpty:!1,type:"lowercase-domain",description:'A lowercase email domain (e.g. "acme.com").'}),{maxItems:Rp,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."})}),XO=t.Pick(WO,["allowedDomains"]),dxe=m({tags:["organization"],url:_j,method:"GET",response:WO}),fxe=m({tags:["organization"],url:YO,method:"GET",response:t.Object({enableLlmFeatures:t.Boolean(),enableAiAssistant:t.Optional(t.Boolean({description:"Per-feature toggle for the ask-AI assistant, under the master enableLlmFeatures switch; unset means enabled."})),enableSandboxAgent:t.Optional(t.Boolean({description:"Per-feature toggle for the sandbox agent, under the master enableLlmFeatures switch; unset means enabled."})),allowEmailPasswordLogin:t.Boolean(),sidebarNavLayout:t.Optional(Nm),sessionIpAllowlist:QO,assistantSystemPrompt:t.Optional(t.String({description:"Custom instructions appended to the ask-AI assistant system prompt for every conversation in the org."}))})}),gxe=m({tags:["organization"],url:YO,method:"PUT",body:t.Object({enableLlmFeatures:t.Optional(t.Boolean()),enableAiAssistant:t.Optional(t.Boolean({description:"Per-feature toggle for the ask-AI assistant, under the master enableLlmFeatures switch; unset means enabled."})),enableSandboxAgent:t.Optional(t.Boolean({description:"Per-feature toggle for the sandbox agent, under the master enableLlmFeatures switch; unset means enabled."})),allowEmailPasswordLogin:t.Optional(t.Boolean()),sidebarNavLayout:t.Optional(t.Union([zO,t.Null()])),sessionIpAllowlist:t.Optional(Sj),assistantSystemPrompt:t.Optional(t.String({maxLength:bj,description:"Custom instructions appended to the ask-AI assistant system prompt for every conversation in the org."}))}),response:t.Object({enableLlmFeatures:t.Boolean(),enableAiAssistant:t.Optional(t.Boolean({description:"Per-feature toggle for the ask-AI assistant, under the master enableLlmFeatures switch; unset means enabled."})),enableSandboxAgent:t.Optional(t.Boolean({description:"Per-feature toggle for the sandbox agent, under the master enableLlmFeatures switch; unset means enabled."})),allowEmailPasswordLogin:t.Boolean(),sidebarNavLayout:t.Optional(Nm),sessionIpAllowlist:QO,assistantSystemPrompt:t.Optional(t.String({description:"Custom instructions appended to the ask-AI assistant system prompt for every conversation in the org."}))})}),yxe=m({tags:["organization"],url:xp,method:"PUT",body:ZO,response:t.Object({allowedDomains:t.Array(t.String())})}),hxe=m({tags:["organization"],url:VO,method:"GET",response:XO}),Exe=m({tags:["organization"],url:VO,method:"PUT",body:ZO,response:XO});var Cp="/v0/admin",Ze=`${Cp}/clusters`,eA=t.Object({helmParameters:t.Record(t.String(),t.Union([t.Number(),t.Boolean(),t.Null(),t.String()])),helmVersion:t.String()}),JO=t.Record(t.String(),eA),Mm=["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"],Dm=["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"],Gm=["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"],tA=["aws","gcp","azure"],Da=["xs","s","m","l"],$m=["1.0"],Oj=["tsuga-cluster","tsuga-telemetry","tsuga-deployer","tsuga-events"],Pp=t.Enum(Oj,{description:"Helm installation name identifying a chart component on the cluster."}),Aj={id:t.String(),name:t.String(),createdAt:b(),clusterCertificateExpiresAt:b(),bridgeEndpoint:t.String(),deployerEndpoint:t.String(),targetConfiguration:JO,appliedConfiguration:t.Optional(JO),automaticallyDeployLatestVersion:t.Boolean(),automatedDeploymentDisabledBy:t.Optional(t.String()),automatedDeploymentDisabledReason:t.Optional(t.String()),automatedDeploymentDisabledAt:t.Optional(b()),soakTimeMin:t.Optional(t.Number()),clusterSize:t.Optional(t.Enum(Da)),gitSyncByInstallation:t.Record(Pp,t.Boolean(),{description:"Per-installation git-sync state, keyed by installationName."})},Lm={...Aj,orgId:t.String(),orgName:t.String()},xxe=m({tags:["admin"],method:"GET",url:Ze,query:t.Object({orgId:t.Optional(p())}),response:t.Array(C("clusterType",[t.Object({...Lm,clusterType:t.Literal("aws"),clusterAccountId:t.String(),clusterBuilderRoleVersion:t.Optional(t.Enum($m)),clusterRegion:t.Enum(Mm)}),t.Object({...Lm,clusterType:t.Literal("gcp"),clusterAccountId:t.String(),clusterRegion:t.Enum(Dm)}),t.Object({...Lm,clusterType:t.Literal("azure"),clusterTenantId:t.String(),clusterSubscriptionId:t.String(),clusterRegion:t.Enum(Gm)})]))}),Rxe=m({tags:["admin"],method:"PUT",url:`${Ze}/create`,body:C("clusterType",[t.Object({clusterType:t.Literal("aws"),orgId:p(),name:p(),clusterSize:t.Enum(Da),clusterAccountId:t.String({minLength:12,maxLength:12}),clusterBuilderRoleVersion:t.Enum($m),clusterRegion:t.Enum(Mm)}),t.Object({clusterType:t.Literal("gcp"),orgId:p(),name:p(),clusterSize:t.Enum(Da),clusterAccountId:p(),clusterRegion:t.Enum(Dm)}),t.Object({clusterType:t.Literal("azure"),orgId:p(),name:p(),clusterSize:t.Enum(Da),clusterTenantId:p(),clusterSubscriptionId:p(),clusterRegion:t.Enum(Gm)})]),response:t.Object({id:t.String(),bridgeEndpoint:t.String(),deployerEndpoint:t.String()})}),Cxe=m({tags:["admin"],method:"DELETE",url:`${Ze}/:id`,params:t.Object({id:p()}),body:t.Object({orgId:p()}),response:N}),Pxe=m({tags:["admin"],method:"PUT",url:`${Ze}/add-inbounder-key`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),Uxe=m({tags:["admin"],method:"PUT",url:`${Ze}/replace-all-inbounder-keys`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),wxe=m({tags:["admin"],method:"PUT",url:`${Ze}/replace-inbounder-key`,body:t.Object({orgId:p(),clusterId:p(),inbounderAuthenticationKeyToReplace:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),inbounderAuthenticationKey:t.String()})}),vxe=m({tags:["admin"],method:"PUT",url:`${Ze}/delete-inbounder-key`,body:t.Object({orgId:p(),clusterId:p(),inbounderAuthenticationKeyToDelete:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyDeleted:t.Boolean()})}),Nxe=m({tags:["admin"],method:"PUT",url:`${Ze}/rotate-deployer-key`,body:t.Object({orgId:p(),clusterId:p(),newKey:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyUpdated:t.Boolean()})}),Lxe=m({tags:["admin"],method:"PUT",url:`${Ze}/rotate-bridge-key`,body:t.Object({orgId:p(),clusterId:p(),newKey:p()}),response:t.Object({orgId:t.String(),clusterId:t.String(),isKeyUpdated:t.Boolean()})}),km={central:t.String(),ngrokBridgeDomain:t.String(),ngrokDeployerDomain:t.String(),clusterCertificateExpiresAt:b(),clusterName:t.String(),clusterSize:t.Optional(t.Enum(Da)),secretBridgeAuthenticationKey:t.String(),secretDeployerAuthenticationKey:t.String(),secretOutbounderAuthenticationKey:t.String(),slackChannelEmail:t.String(),customerTier:t.String()},kxe=m({tags:["admin"],method:"POST",url:`${Ze}/:id`,body:t.Object({orgId:p()}),params:t.Object({id:p()}),response:C("clusterType",[t.Object({...km,clusterType:t.Literal("aws"),clusterAccountId:t.String(),clusterBuilderRoleVersion:t.Optional(t.Enum($m)),clusterRegion:t.Enum(Mm)}),t.Object({...km,clusterType:t.Literal("gcp"),clusterAccountId:t.String(),clusterRegion:t.Enum(Dm)}),t.Object({...km,clusterType:t.Literal("azure"),clusterTenantId:t.String(),clusterSubscriptionId:t.String(),clusterRegion:t.Enum(Gm)})])}),Mxe=m({tags:["admin"],method:"POST",url:`${Ze}/configuration`,body:t.Object({id:p({allowEmpty:!1}),orgId:p({allowEmpty:!1}),installationName:Pp,targetConfiguration:eA,gitSyncEnabled:t.Boolean({description:"Persisted on upgrade: whether this chart's values are synced from git."})}),response:t.Object({status:t.String()})}),Dxe=m({tags:["admin"],method:"GET",url:`${Ze}/git-values`,query:t.Object({orgId:p({allowEmpty:!1}),clusterId:p({allowEmpty:!1}),installationName:Pp}),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)."}))})}),Gxe=m({tags:["admin"],method:"POST",url:`${Ze}/git-sync`,body:t.Object({clusterId:p({allowEmpty:!1}),orgId:p({allowEmpty:!1}),installationName:Pp,gitSyncEnabled:t.Boolean({description:"Whether this chart syncs its Helm values from git."})}),response:t.Object({status:t.String()})}),$xe=m({tags:["admin"],method:"POST",url:`${Ze}/automation`,body:t.Object({id:p(),orgId:p(),enableAutomatedDeployment:t.Boolean(),disabledReason:t.Optional(p())}),response:t.Object({status:t.String()})}),jxe=m({tags:["admin"],method:"POST",url:`${Ze}/soak-time`,body:t.Object({id:p(),orgId:p(),soakTimeMin:t.Optional(t.Number())}),response:t.Object({status:t.String()})}),qxe=m({tags:["admin"],method:"POST",url:`${Ze}/deploy`,body:t.Object({orgId:p(),clusterId:p(),chartName:p(),toVersion:p()}),response:t.Object({id:t.String()})}),xj=C("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()})})]),Bxe=m({tags:["admin"],method:"GET",url:`${Ze}/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:xj,updatedAt:b(),createdAt:b(),installationName:t.String(),chartName:t.String(),isAutomated:t.Boolean(),createdBy:t.Optional(t.String()),createdByName:t.Optional(t.String()),createdByEmail:t.Optional(t.String())}))}),Rj=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())}))}),Fxe=m({tags:["admin"],method:"POST",url:`${Ze}/status`,body:t.Object({orgId:t.Optional(p()),clusterId:t.Optional(p())}),response:t.Array(t.Object({orgId:t.String(),clusterId:t.String(),status:Rj}))}),Hxe=m({tags:["admin"],method:"POST",url:`${Ze}/argocd-cert-info`,body:t.Object({orgId:p(),clusterId:p()}),response:t.Object({certificateExpiresAt:t.String()})}),Cj=t.Object({kind:t.String(),name:t.String()}),Pj=t.Object({id:Cj,liveManifest:t.Optional(t.String()),targetManifest:t.Optional(t.String())}),Kxe=m({tags:["admin"],method:"POST",url:`${Ze}/resource-details`,body:t.Object({orgId:p(),clusterId:p(),installationName:p()}),response:t.Object({resources:t.Array(Pj)})}),zxe=m({tags:["admin"],method:"GET",url:`${Ze}/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(b()),pushedAt:t.Optional(b())}))});var Uj=t.Object({id:t.Object({name:t.String(),kind:t.String()}),previewManifest:t.Optional(t.String())}),Yxe=m({tags:["admin"],method:"POST",url:`${Ze}/versions/render`,body:t.Object({chartName:p(),version:p(),values:p({type:"long"}),installationName:p(),namespace:p()}),response:t.Array(Uj)}),Mr=`${Cp}/orgs`,Vxe=m({tags:["admin"],url:Mr,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:b(),updatedAt:b()}))}),Qxe=m({tags:["admin"],url:Mr,method:"POST",body:t.Object({allowedDomains:t.Array(p({type:"lowercase-domain"}),{maxItems:Rp}),name:p()}),response:t.Object({id:t.String(),name:t.String()})}),Wxe=m({tags:["admin"],url:`${Mr}/:id`,method:"PUT",params:t.Object({id:p()}),body:t.Object({allowedDomains:t.Optional(t.Array(p({type:"lowercase-domain"}),{maxItems:Rp}))}),response:t.Object({id:t.String(),name:t.String(),allowedDomains:t.Array(t.String())})}),Zxe=m({tags:["admin"],url:`${Mr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),Xxe=m({tags:["admin"],url:`${Mr}/:id/restore`,method:"POST",params:t.Object({id:p()}),response:t.Object({success:t.Boolean()})}),Jxe=m({tags:["admin"],url:`${Mr}/: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()})}),eRe=m({tags:["admin"],url:`${Mr}/synchronize-sds-rules`,method:"POST",response:t.Object({errorOrgs:t.Optional(t.Array(t.Object({id:t.String(),name:t.String()}))),synchronizedOrgsCount:t.Number()})}),wj=["custom_usage_tag","ingestion_api_key","inventory_resource","monitor","retention_policy","route","sensitive_data_scanner_rule","tag_policy","team"],vj=t.Enum(wj),tRe=m({tags:["admin"],url:`${Mr}/refresh-assets`,method:"POST",body:t.Object({assetTypes:t.Array(vj,{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()}))}))}),rRe=m({tags:["admin"],url:`${Mr}/sudo`,method:"POST",body:t.Object({orgId:p()}),response:t.Object({sudoToken:t.String()})}),Nj=`${Cp}/users`,nRe=m({tags:["admin"],url:`${Nj}/invite`,method:"POST",body:t.Object({email:p({type:"email"}),orgId:p(),userRole:t.Enum(Ap)}),response:t.Array(t.Object({inviteId:t.String(),email:t.String(),result:t.Union([t.Literal("success"),t.Literal("email-failed")])}))});var oRe=m({tags:["admin"],url:`${Cp}/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 rA=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(tA,{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`."}),Lj={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(rA,{examples:[Lj]});var nA=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(rA)});function oA(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()(nA);J(o)})}function aA(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("__")||aA(c,[...r,c.name()],n,o)}function kj(e){let r=new Map,n=new Set;return aA(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 iA(e){return e.map(({key:r,cmds:n,flags:o})=>` ${JSON.stringify(r)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
|
|
49
|
-
|
|
47
|
+
`}function PO(){if((0,Wt.existsSync)(Xm))try{return JSON.parse((0,Wt.readFileSync)(Xm,"utf-8")).lastUpdateCheck}catch{return}}function UO(e){(0,Wt.mkdirSync)(EO,{recursive:!0,mode:448}),(0,Wt.writeFileSync)(Xm,`${JSON.stringify({lastUpdateCheck:e})}
|
|
48
|
+
`,{mode:384})}async function Rq(){let e=hn(),{verifier:t,challenge:n}=ay(),o=(0,vO.randomBytes)(16).toString("base64url"),{code:i,redirectUri:a}=await Ty({state:o,buildAuthorizeUrl:m=>sO(e,{redirectUri:m,challenge:n,state:o})}),c=await cO(e,{code:i,verifier:t,redirectUri:a}),l=bO(Rh(c));V(`Logged in. Session token ${ia(c.accessToken)} saved to ${l}`)}function Cq(){let e=hn(),t=IO();if(!t){let n=e===za?"":` for ${e}`;process.stderr.write(`No user session${n}. Run \`tsuga auth login\`.
|
|
49
|
+
`),process.exitCode=1;return}if(mc({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 wO(e,t){let n=oy(iy({start:e,end:t}),{format:["years","months","days","hours","minutes"]});return n===""?"less than a minute":n}function Pq(e){let t=ia(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 ${wO(o,n)} ago, on ${e.accessExpiresAt}. Run \`tsuga auth login\` to sign in again.`:`Logged in as a user (token ${t}). Session expires in ${wO(n,o)}, on ${e.accessExpiresAt}.`}function Uq(){let{credential:e}=ni({});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(Pq(e.userAuth));return;case"operation-api-key":V("Authenticated with an operation API key.");return;default:tt(e)}}function wq(){AO(),V("Local user session cleared.")}function NO(e){let t=e.command("auth").description("Manage authentication: user login (OAuth) or operation API key");t.action(()=>t.help()),t.command("login").description("Log in as a user with a browser authorization flow and save the session (replaces any saved operation API key)").action(Rq),t.command("logout").description("Clear the saved user session").action(wq),t.command("token").description("Print the saved user access token to stdout").action(Cq),t.command("operation-key <OPERATION_API_KEY>").description("Save an operation API key to the config file (replaces any saved user session)").action(n=>{SO(n),V(`Operation API key saved to ${Gp()}`)}),t.command("status").description("Show the current authentication method").action(Uq)}var vq=["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"],Nq=["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"],Lq=["log","metric","trace","rum"],td=[...Nq,...Lq],_Pe=[...vq,...td];var LO=["admin","public_editor","public_viewer","teams_only"],oi=["admin","editor","viewer"];var no="/v0/team-membership",rd="Role granted to the user inside this team. `admin` gives full team control, including managing assets, members, and settings. `editor` can view and update most team assets (dashboards, monitors, etc.) but cannot manage members or settings. `viewer` can view team data but cannot make changes.",nd=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(oi,{description:rd})}),kO=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(oi,{description:rd})}),kq=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."})}),Mq=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."}))})),IPe=d({tags:["access-control"],url:no,method:"GET",query:Mq,response:r.Array(nd)}),bPe=d({tags:["access-control"],url:no,method:"POST",body:kO,response:nd}),SPe=d({tags:["access-control"],url:no,method:"PUT",body:kO,response:nd}),APe=d({tags:["access-control"],url:no,method:"DELETE",body:kq,response:N}),$p=500,MO=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(oi,{description:rd})},{oneOf:[{required:["userId"]},{required:["userEmail"]}]}),{minItems:1,maxItems:$p,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."}),Dq={teamId:"team-123-abc",members:[{userId:"user-123-abc",roleKey:"viewer"},{userEmail:"sam@example.com",roleKey:"editor"}]};Object.assign(MO,{examples:[Dq]});var DO=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."}),Gq={results:[{userId:"user-123-abc",status:"added"},{userId:"sam@example.com",status:"user_not_found"}]};Object.assign(DO,{examples:[Gq]});var OPe=d({tags:["access-control"],url:`${no}/bulk-add`,method:"POST",body:MO,response:DO}),xPe=d({tags:["access-control"],url:`${no}/bulk-update-user-roles`,method:"PUT",body:r.Object({userIds:r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:$p}),teamId:u({allowEmpty:!1}),role:r.Enum(oi)}),response:r.Object({})}),GO=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:$p,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:$p,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."}),$q={teamId:"team-123-abc",userIds:["user-123-abc"]};Object.assign(GO,{examples:[$q]});var $O=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."}),jq={results:[{userId:"user-123-abc",status:"removed"},{userId:"missing@example.com",status:"user_not_found"}]};Object.assign($O,{examples:[jq]});var RPe=d({tags:["access-control"],url:`${no}/bulk-remove`,method:"DELETE",body:GO,response:$O});var qq={"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:[]}},Fq={"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:[]}},Bq={user:qq,team:Fq};function od(e){return jO(e,"team")}function id(e){return jO(e,"user")}function jO(e,t){let n=[],o=Bq[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 NPe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:id("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:id("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:id("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},LPe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:od("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:od("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:od("viewer"),roleKey:"viewer"}};var kPe=new Set(td);var Hq={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"},Kq=Object.entries(Hq),MPe=new Map(Kq.flatMap(([e,t])=>t?[[t,e]]:[]));var qO="__tsuga_cluster_id__",zq=r.Object({}),Yq=r.Object({status:r.Literal("error"),message:r.String({description:"Why this cluster failed to answer the query."})});function ii(e=zq){let t=C("status",[r.Object({...e.properties,status:r.Literal("ok")}),Yq]);return Object.assign(Hc($t,t),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var Vq=5,Va=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 FO=r.Object({type:r.Literal("number"),number:r.String()}),Qq=r.Object({type:r.Literal("string"),string:r.String()}),Wq=r.Object({type:r.Literal("timestamp"),timestamp:r.String()}),Qa=C("type",[FO,Qq,Wq]),Zq=r.Object({by:r.Record(r.String(),Qa),computed:r.Record(r.String(),FO)}),Xq=r.Object({type:r.Literal("buckets"),buckets:r.Array(Zq),clusterResponses:r.Optional(ii())}),Jq=r.Object({type:r.Literal("distribution"),bounds:r.Array(r.Number()),buckets:r.Array(r.Object({timestamp:r.Number(),counts:r.Array(r.Number())})),percentiles:r.Optional(r.Array(r.Number()))}),jp=C("type",[Xq,Jq]);var eF=["all","owning-team-and-public","owning-team-only"],yn=r.Enum(eF,{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 HO=1456444800,KO=4927737600,tF=HO*1e3,rF=KO*1e3,qp=1704067200,ad=qp*1e3,zO={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:qp,to:qp}]},nF={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:ad,to:ad}]},Fp=e=>r.Integer({description:e,examples:[qp],minimum:HO,maximum:KO,format:"int64"}),BO=e=>r.Integer({description:e,examples:[ad],minimum:tF,maximum:rF,format:"int64"}),at=r.Object({from:r.Optional(Fp("Start of the query window as a Unix timestamp in seconds")),to:r.Optional(Fp("End of the query window as a Unix timestamp in seconds"))},zO),bt=r.Object({from:Fp("Start of the query window as a Unix timestamp in seconds"),to:Fp("End of the query window as a Unix timestamp in seconds")},zO),ai=r.Object({from:BO("Start of the query window as a Unix timestamp in milliseconds"),to:BO("End of the query window as a Unix timestamp in milliseconds")},nF);var aF="/v0/aggregation",sF=r.Union([r.Literal("a"),r.Literal("d"),r.Literal("q"),r.Literal("w"),r.Literal("t")]),sd=r.Object({parallelism:r.Number(),engine:sF,recordBatchCache:r.Optional(r.Boolean()),includeNullGroups:r.Optional(r.Boolean()),restartAwareGaugeSum:r.Optional(r.Boolean())}),cd=["logs","metrics","traces"];var QO={logs:"Logs",metrics:"Metrics",traces:"Spans"},cF=[...cd,"connections","log-patterns","spans","rum"];var iUe={...QO,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},Ir=[...cd,"rum"];var aUe={...QO,rum:"RUM events"};var sUe=r.Enum(cF,{description:"Data source being queried"}),WO=r.Enum(cd,{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`."}),oo=r.String({description:"Attribute containing the values to aggregate"}),io=u({description:"Attribute containing the values to aggregate"}),pF=C("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(oo)},{$id:"AggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:oo},{$id:"AggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:oo},{$id:"AggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:oo},{$id:"AggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:oo},{$id:"AggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:oo},{$id:"AggregateSum",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:"AggregatePercentile",title:"Percentile"})],{title:"Aggregate",description:"Aggregation operation for this query. Required for every query; `field` is required by all aggregate types except `count`."}),uF=C("type",[r.Object({type:r.Literal("count",{description:"Counts the total number of records"}),field:r.Optional(io)},{$id:"InputAggregateCount",title:"Count"}),r.Object({type:r.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:io},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),r.Object({type:r.Literal("average",{description:"Calculates the average value of the selected field"}),field:io},{$id:"InputAggregateAverage",title:"Average"}),r.Object({type:r.Literal("max",{description:"Finds the largest value of the field"}),field:io},{$id:"InputAggregateMax",title:"Max"}),r.Object({type:r.Literal("min",{description:"Finds the smallest value of the field"}),field:io},{$id:"InputAggregateMin",title:"Min"}),r.Object({type:r.Literal("sum",{description:"Sums the values of the selected field"}),field:io},{$id:"InputAggregateSum",title:"Sum"}),r.Object({type:r.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:io,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`."}),ZO=r.Object({type:r.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),XO=r.Object({type:r.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),JO=r.Object({type:r.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),ex=r.Object({type:r.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),tx=r.Object({type:r.Literal("increase",{description:"`Increase` is designed for cumulative metrics. It computes the increase of cumulative metrics by automatically handling counter resets. When used with an aggregation such as `sum` it combines all series without requiring an explicit group-by."})},{$id:"FunctionIncrease",title:"Increase"}),rx=r.Object({type:r.Literal("power",{description:"Raises values to a specified power"}),exponent:r.Integer({description:"The exponent to raise values to"})},{$id:"FunctionPower",title:"Power"}),nx=r.Object({type:r.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),ox=r.Object({type:r.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),lF=r.Object({type:r.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:r.String({description:"Duration of the rolling window"})},{$id:"FunctionRolling",title:"Rolling"}),mF=r.Object({type:r.Literal("rolling",{description:"Computes a rolling window aggregate"}),window:u({allowEmpty:!1,description:"Duration of the rolling window"})},{$id:"InputFunctionRolling",title:"Rolling"}),dF=r.Object({type:r.Literal("log",{description:"Applies a logarithm transformation to the values"}),base:r.Integer({description:"The base of the logarithm"})},{$id:"FunctionLog",title:"Log"}),fF=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"}),gF=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"}),hF=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"}),yF=C("type",[ZO,XO,JO,ex,tx,lF,dF,rx,nx,ox,gF],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),TF=C("type",[ZO,XO,JO,ex,tx,mF,fF,rx,nx,ox,hF],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var YO=r.Object({min:r.Number({description:"Lower bound of the distribution range."}),max:r.Number({description:"Upper bound of the distribution range."})}),EF=["linear","log"],Bp=r.Enum(EF,{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."}),VO=r.Integer({minimum:1}),_F=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(VO),bounds:r.Optional(YO),boundsScale:r.Optional(Bp),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(VO),bounds:r.Optional(YO)},{title:"Heatmap",description:"Returns a distribution per time window"})]),Wa=15,IF=["zero","null"],bF=r.Enum(IF,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),ix=r.Object({mode:r.Object({type:bF},{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"],ax=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 sx={aggregate:pF,functions:r.Optional(r.Array(yF,{description:"Post-processing functions applied to aggregation results"})),fill:r.Optional(ix),timeAggregate:r.Optional(ax)},cx={aggregate:uF,functions:r.Optional(r.Array(TF,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:r.Optional(ix),timeAggregate:r.Optional(ax)},AF={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."},px={maxItems:Wa,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").'},ux=r.Array(r.Object({...sx,filter:r.Optional(r.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),AF),Za=r.Array(r.Object({...cx,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"}),px),$r=r.Array(r.Object({...sx,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."}),Tn=r.Array(r.Object({...cx,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."}),{...px,description:"Aggregation queries used by alerting. Each query is referenced from formulas as q1, q2, and so on."}),lx=r.Array(r.Omit(Tn.items,["fill"],{title:"SloAggregationQuery",description:"Single aggregation query evaluated by an SLO."}),{minItems:1,maxItems:Wa,description:"Aggregation queries used by SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var Hp=r.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),ao=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."}),OF=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"}),xF=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"}),mx=7;var si=r.Array(OF,{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(xF,{maxItems:mx,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 cUe=d({tags:["aggregation"],url:`${aF}/multi-query`,method:"POST",body:r.Object({timeRange:ai,queries:Za,groupBy:r.Optional(jr),returnType:_F,dataSource:or,formula:ao,executionOptions:sd,triggeredBy:r.Optional(r.Literal("refresh")),shouldStreamResults:r.Optional(r.Boolean()),clusterId:r.Optional(u({allowEmpty:!1})),clusterIds:r.Optional(Va),viewAs:r.Optional(r.Object({owner:u({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:yn}))}),response:jp});var pd=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],ud=["light","dark"];var RF={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)"}},dx=["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 fUe=RF.light.red.background;var ld=2,md=2;var fx=[{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-----
|
|
50
|
+
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAC4AWkdwKYSd8
|
|
51
|
+
Ks14IReLcYgADhoXk56ZzXI=
|
|
52
|
+
-----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}"}],CF=fx.map(e=>e.key);var SUe=new Set(CF),AUe=fx.map(e=>e.key);var $="context";var gx="trace_id",Kp=`${$}.team`,LUe=`${$}.env`,kUe=`${$}.api_key_id`,zp=`${$}.service.name`,MUe=`${$}.service.version`,Yp=`${$}.span.kind`,Vp=`${$}.span.name`,so=`${$}.status.code`,dd="resource.attributes.team",hx=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var Xa=`${$}.host.name`,PF=`${$}.instance`,UF=`${$}.instanceid`,wF=`${$}.instance_name`,DUe=`${$}.telemetry.sdk.language`,GUe=`${$}.process.runtime.name`,$Ue=`${$}.scope.name`,jUe=`${$}.cloud.provider`,qUe=`${$}.cloud.platform`,FUe=`${$}.aws.ecs.task.arn`,BUe=`${$}.k8s.cluster.name`,HUe=`${$}.k8s.cluster.uid`,KUe=`${$}.k8s.namespace.name`,vF=`${$}.k8s.pod.name`,zUe=`${$}.k8s.pod.uid`,YUe=`${$}.k8s.container.name`,VUe=`${$}.k8s.node.name`,QUe=`${$}.k8s.node.uid`,NF=`${$}.k8s.deployment.name`,WUe=`${$}.k8s.deployment.uid`,LF=`${$}.k8s.replicaset.name`,ZUe=`${$}.k8s.replicaset.uid`,kF=`${$}.k8s.statefulset.name`,XUe=`${$}.k8s.statefulset.uid`,MF=`${$}.k8s.daemonset.name`,JUe=`${$}.k8s.daemonset.uid`,ewe=`${$}.k8s.job.name`,twe=`${$}.k8s.job.uid`,rwe=`${$}.k8s.cronjob.name`,nwe=`${$}.k8s.cronjob.uid`,ci="status_code",Qp="span.name";var Wp="span.kind";var DF="db.system.name",GF="db.system",$F="db.namespace",jF="db.name";var owe=`span_attributes.${$F}`,iwe=`span_attributes.${jF}`,awe=`span_attributes.${DF}`,swe=`span_attributes.${GF}`;var cwe={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${$}.tag_policy_id`,dataSource:`${$}.data_source`}};var pwe={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 fd="__tsuga_metadata__",uwe=`${fd}.signature`,lwe=`${fd}.routes`,mwe=`${fd}.trace_id_bucket`;var ywe={[Yp]:Wp,[Yp.replace(`${$}.`,"")]:Wp,[Vp]:Qp,[Vp.replace(`${$}.`,"")]:Qp,[so]:ci,[so.replace(`${$}.`,"")]:ci},Twe={[Wp]:Yp,[Qp]:Vp,[ci]:so};function yx(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var Tx=["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"],Ex=["alert_queries","alert_thresholds","alert_values"],qF=[...Tx,...Ex],_x=["alert_event_name","alert_message"],Hwe=[...qF,..._x],Kwe=new Set([...Tx,..._x]),zwe=new Set(Ex);var gd={aws:"aws",gcp:"gcp",azure:"azure"},En=[gd.aws,gd.gcp,gd.azure];var Ix=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(En,{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`."}),FF={id:"abc-123-def",name:"production",friendlyName:"Production (US)",clusterType:"aws",clusterRegion:"us-east-1"};Object.assign(Ix,{examples:[FF]});var bx=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(Ix)});function Sx(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()(bx);J(o)})}function Ox(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("__")||Ox(c,[...t,c.name()],n,o)}function BF(e){let t=new Map,n=new Set;return Ox(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 Ax(e){return e.map(({key:t,cmds:n,flags:o})=>` ${JSON.stringify(t)}) cmds=${JSON.stringify(n)} flags=${JSON.stringify(o)} ;;`).join(`
|
|
53
|
+
`)}function HF(e,t){return`_tsuga_complete() {
|
|
50
54
|
local cur key cmds flags words i word prev
|
|
51
|
-
local valueflags="${
|
|
55
|
+
local valueflags="${t}"
|
|
52
56
|
local -a path
|
|
53
57
|
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
54
58
|
prev=""
|
|
@@ -67,10 +71,10 @@ ${e}
|
|
|
67
71
|
COMPREPLY=( $(compgen -W "$words" -- "$cur") )
|
|
68
72
|
}
|
|
69
73
|
complete -F _tsuga_complete tsuga
|
|
70
|
-
`}function
|
|
74
|
+
`}function KF(e,t){return`#compdef tsuga
|
|
71
75
|
_tsuga_complete() {
|
|
72
76
|
local cur key cmds flags out i word prev
|
|
73
|
-
local valueflags="${
|
|
77
|
+
local valueflags="${t}"
|
|
74
78
|
local -a path
|
|
75
79
|
cur="\${words[CURRENT]}"
|
|
76
80
|
prev=""
|
|
@@ -89,12 +93,12 @@ ${e}
|
|
|
89
93
|
compadd -- \${=out}
|
|
90
94
|
}
|
|
91
95
|
compdef _tsuga_complete tsuga
|
|
92
|
-
`}function
|
|
93
|
-
set cmds ${
|
|
94
|
-
set flags ${
|
|
95
|
-
`)}function
|
|
96
|
+
`}function hd(e){return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}function zF(e){return e.map(({key:t,cmds:n,flags:o})=>` case ${hd(t)}
|
|
97
|
+
set cmds ${hd(n)}
|
|
98
|
+
set flags ${hd(o)}`).join(`
|
|
99
|
+
`)}function YF(e,t){return`# Update with: tsuga completion fish > ~/.config/fish/completions/tsuga.fish
|
|
96
100
|
function __tsuga_complete
|
|
97
|
-
set -l valueflags -- ${
|
|
101
|
+
set -l valueflags -- ${t}
|
|
98
102
|
set -l tokens (commandline -xpc)
|
|
99
103
|
set -l cur (commandline -ct)
|
|
100
104
|
set -l path
|
|
@@ -127,50 +131,47 @@ ${e}
|
|
|
127
131
|
end
|
|
128
132
|
end
|
|
129
133
|
complete -c tsuga -f -a '(__tsuga_complete)'
|
|
130
|
-
`}function
|
|
134
|
+
`}function xx(e){e.command("completion <SHELL>").description("Print a shell completion script (bash, zsh, or fish)").addHelpText("after",`
|
|
131
135
|
Usage:
|
|
132
136
|
bash: eval "$(tsuga completion bash)" # add to ~/.bashrc
|
|
133
137
|
zsh: eval "$(tsuga completion zsh)" # add to ~/.zshrc
|
|
134
|
-
fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(
|
|
135
|
-
...`};Object.assign(uA,{examples:[jj]});var lA=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"}),qj={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(lA,{examples:[qj]});var mA=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:pA,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:uA}),dA=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:`${pA}/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(lA)});function fA(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()(mA,{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 r()(dA,{query:{query:o}});J(i)})}var Bj=`/${"v1"}/feedback`,gA=t.Object({id:t.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),Fj={id:"request-123-abc"};Object.assign(gA,{examples:[Fj]});var yA=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."})}),Hj={content:"The traces command times out for large services."};Object.assign(yA,{examples:[Hj]});var hA=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:Bj,method:"POST",body:yA,response:gA});function EA(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()(hA,{body:{content:n.join(" ")}});J(o)})}var Kj={"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:[]}},zj={"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:[]}},Yj={user:Kj,team:zj};function qm(e){return TA(e,"team")}function Bm(e){return TA(e,"user")}function TA(e,r){let n=[],o=Yj[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 jRe={admin:{name:"Global admin",description:"Full control across the organization. Can view and modify everything, including private teams.",permissions:Bm("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:Bm("public_editor"),roleKey:"public_editor"},public_viewer:{name:"Public viewer",description:"Read-only access to public team data. Cannot make changes.",permissions:Bm("public_viewer"),roleKey:"public_viewer"},teams_only:{name:"Teams only",description:"Only access data and assets in their own teams.",permissions:[],roleKey:"teams_only"}},qRe={admin:{name:"Team admin",description:"Full team control, manage assets, members, and settings.",permissions:qm("admin"),roleKey:"admin"},editor:{name:"Team editor",description:"Can view and update most assets (like dashboards, monitors).",permissions:qm("editor"),roleKey:"editor"},viewer:{name:"Team viewer",description:"Can view all team data but cannot make changes.",permissions:qm("viewer"),roleKey:"viewer"}};var BRe=new Set(Um);var Vj={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"},Qj=Object.entries(Vj),FRe=new Map(Qj.flatMap(([e,r])=>r?[[r,e]]:[]));var _A="__tsuga_cluster_id__",Wj=t.Object({}),Zj=t.Object({status:t.Literal("error"),message:t.String({description:"Why this cluster failed to answer the query."})});function Qo(e=Wj){let r=C("status",[t.Object({...e.properties,status:t.Literal("ok")}),Zj]);return Object.assign(wc(Dt,r),{description:'Outcome per cluster, keyed by cluster ID. A cluster that failed reports `status: "error"`.'})}var Xj=5,Ga=t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:Xj,uniqueItems:!0,description:"IDs of the clusters to query, without duplicates. Mutually exclusive with `clusterId`. Omit both to use the default cluster."});var IA=t.Object({type:t.Literal("number"),number:t.String()}),Jj=t.Object({type:t.Literal("string"),string:t.String()}),eq=t.Object({type:t.Literal("timestamp"),timestamp:t.String()}),$a=C("type",[IA,Jj,eq]),tq=t.Object({by:t.Record(t.String(),$a),computed:t.Record(t.String(),IA)}),rq=t.Object({type:t.Literal("buckets"),buckets:t.Array(tq),clusterResponses:t.Optional(Qo())}),nq=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()))}),Up=C("type",[rq,nq]);var oq=["all","owning-team-and-public","owning-team-only"],yn=t.Enum(oq,{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 SA=1456444800,OA=4927737600,iq=SA*1e3,aq=OA*1e3,wp=1704067200,Fm=wp*1e3,AA={title:"TimeRange",description:"Inclusive time range for telemetry queries. Use Unix timestamps in seconds unless the field description says milliseconds.",examples:[{from:wp,to:wp}]},sq={title:"TimeRange",description:"Inclusive time range for telemetry queries using Unix timestamps in milliseconds.",examples:[{from:Fm,to:Fm}]},vp=e=>t.Integer({description:e,examples:[wp],minimum:SA,maximum:OA,format:"int64"}),bA=e=>t.Integer({description:e,examples:[Fm],minimum:iq,maximum:aq,format:"int64"}),it=t.Object({from:t.Optional(vp("Start of the query window as a Unix timestamp in seconds")),to:t.Optional(vp("End of the query window as a Unix timestamp in seconds"))},AA),It=t.Object({from:vp("Start of the query window as a Unix timestamp in seconds"),to:vp("End of the query window as a Unix timestamp in seconds")},AA),Wo=t.Object({from:bA("Start of the query window as a Unix timestamp in milliseconds"),to:bA("End of the query window as a Unix timestamp in milliseconds")},sq);var uq="/v0/aggregation",lq=t.Union([t.Literal("a"),t.Literal("d"),t.Literal("q"),t.Literal("w"),t.Literal("t")]),Hm=t.Object({parallelism:t.Number(),engine:lq,recordBatchCache:t.Optional(t.Boolean()),includeNullGroups:t.Optional(t.Boolean()),restartAwareGaugeSum:t.Optional(t.Boolean())}),Km=["logs","metrics","traces"];var CA={logs:"Logs",metrics:"Metrics",traces:"Spans"},mq=[...Km,"connections","log-patterns","spans","rum"];var mCe={...CA,connections:"Connections","log-patterns":"Log Patterns",spans:"Spans",rum:"RUM events"},Tr=[...Km,"rum"];var dCe={...CA,rum:"RUM events"};var fCe=t.Enum(mq,{description:"Data source being queried"}),PA=t.Enum(Km,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, or `traces`."}),rr=t.Enum(Tr,{description:"Telemetry source queried by this aggregation: `logs`, `metrics`, `traces`, or `rum`."}),eo=t.String({description:"Attribute containing the values to aggregate"}),to=p({description:"Attribute containing the values to aggregate"}),dq=C("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(eo)},{$id:"AggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:eo},{$id:"AggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:eo},{$id:"AggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:eo},{$id:"AggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:eo},{$id:"AggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:eo},{$id:"AggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:eo,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`."}),fq=C("type",[t.Object({type:t.Literal("count",{description:"Counts the total number of records"}),field:t.Optional(to)},{$id:"InputAggregateCount",title:"Count"}),t.Object({type:t.Literal("unique-count",{description:"Counts the distinct values of the field"}),field:to},{$id:"InputAggregateUniqueCount",title:"UniqueCount"}),t.Object({type:t.Literal("average",{description:"Calculates the average value of the selected field"}),field:to},{$id:"InputAggregateAverage",title:"Average"}),t.Object({type:t.Literal("max",{description:"Finds the largest value of the field"}),field:to},{$id:"InputAggregateMax",title:"Max"}),t.Object({type:t.Literal("min",{description:"Finds the smallest value of the field"}),field:to},{$id:"InputAggregateMin",title:"Min"}),t.Object({type:t.Literal("sum",{description:"Sums the values of the selected field"}),field:to},{$id:"InputAggregateSum",title:"Sum"}),t.Object({type:t.Literal("percentile",{description:"Calculates a percentile of the selected field"}),field:to,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`."}),UA=t.Object({type:t.Literal("per-second",{description:"Normalizes the metric to events per second"})},{$id:"FunctionPerSecond",title:"PerSecond"}),wA=t.Object({type:t.Literal("per-minute",{description:"Normalizes the metric to events per minute"})},{$id:"FunctionPerMinute",title:"PerMinute"}),vA=t.Object({type:t.Literal("per-hour",{description:"Normalizes the metric to events per hour"})},{$id:"FunctionPerHour",title:"PerHour"}),NA=t.Object({type:t.Literal("rate",{description:"Calculates the rate of change"})},{$id:"FunctionRate",title:"Rate"}),LA=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"}),kA=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"}),MA=t.Object({type:t.Literal("sqrt",{description:"Applies a square root transformation to the values"})},{$id:"FunctionSqrt",title:"Sqrt"}),DA=t.Object({type:t.Literal("last",{description:"Takes the last value of the metric for the selected time frame"})},{$id:"FunctionLast",title:"Last"}),gq=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"}),yq=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"}),hq=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"}),Eq=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"}),Tq=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"}),_q=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"}),Iq=C("type",[UA,wA,vA,NA,LA,gq,hq,kA,MA,DA,Tq],{title:"Function",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."}),bq=C("type",[UA,wA,vA,NA,LA,yq,Eq,kA,MA,DA,_q],{title:"InputFunction",description:"Post-processing function applied to an aggregation query result after the aggregate is computed, selected by `type`."});var xA=t.Object({min:t.Number({description:"Lower bound of the distribution range."}),max:t.Number({description:"Upper bound of the distribution range."})}),Sq=["linear","log"],Np=t.Enum(Sq,{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."}),RA=t.Integer({minimum:1}),Oq=C("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(RA),bounds:t.Optional(xA),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(RA),bounds:t.Optional(xA)},{title:"Heatmap",description:"Returns a distribution per time window"})]),Lp=15,Aq=["zero","null"],xq=t.Enum(Aq,{description:"`zero` fills missing points with zero. `null` keeps missing points null."}),GA=t.Object({mode:t.Object({type:xq},{description:"How missing aggregation points should be filled."})},{description:"Missing-point fill behavior for aggregation results. Optional; omit to keep missing points null."}),$A=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. 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 jA={aggregate:dq,functions:t.Optional(t.Array(Iq,{description:"Post-processing functions applied to aggregation results"})),fill:t.Optional(GA),timeAggregate:t.Optional($A)},qA={aggregate:fq,functions:t.Optional(t.Array(bq,{maxItems:10,description:"Post-processing functions applied to aggregation results. Defaults to an empty array when omitted."})),fill:t.Optional(GA),timeAggregate:t.Optional($A)},Rq={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."},BA={maxItems:Lp,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").'},FA=t.Array(t.Object({...jA,filter:t.Optional(t.String({description:"Filter to apply to the aggregation"}))},{title:"AggregationQuery"}),Rq),ja=t.Array(t.Object({...qA,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"}),BA),Dr=t.Array(t.Object({...jA,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."}),Gr=t.Array(t.Object({...qA,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."}),{...BA,description:"Aggregation queries used by alerting and SLO evaluation. Each query is referenced from formulas as q1, q2, and so on."});var kp=t.String({description:"Formula referencing submitted query outputs, such as `q1 + q2`. References must be within `q1` through `qN` for the submitted queries."}),ro=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."}),Cq=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"}),Pq=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"}),HA=7;var Zo=t.Array(Cq,{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."}),$r=t.Array(Pq,{maxItems:HA,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 gCe=m({tags:["aggregation"],url:`${uq}/multi-query`,method:"POST",body:t.Object({timeRange:Wo,queries:ja,groupBy:t.Optional($r),returnType:Oq,dataSource:rr,formula:ro,executionOptions:Hm,triggeredBy:t.Optional(t.Literal("refresh")),shouldStreamResults:t.Optional(t.Boolean()),clusterId:t.Optional(p({allowEmpty:!1})),clusterIds:t.Optional(Ga),viewAs:t.Optional(t.Object({owner:p({allowEmpty:!1,description:"Team ID to fetch data as"}),permissions:yn}))}),response:Up});var zm=["red","orange","amber","yellow","green","emerald","teal","cyan","sky","blue","indigo","purple","pink"],Ym=["light","dark"];var Uq={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)"}},KA=["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 ICe=Uq.light.red.background;var Vm=2,Qm=2;var zA=[{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}"}],wq=zA.map(e=>e.key);var UCe=new Set(wq),wCe=zA.map(e=>e.key);var j="context";var YA="trace_id",Mp=`${j}.team`,qCe=`${j}.env`,BCe=`${j}.api_key_id`,Dp=`${j}.service.name`,FCe=`${j}.service.version`,Wm=`${j}.span.kind`,Zm=`${j}.span.name`,Xm=`${j}.status.code`,Jm="resource.attributes.team",VA=["SPAN_KIND_UNSPECIFIED","SPAN_KIND_INTERNAL","SPAN_KIND_SERVER","SPAN_KIND_CLIENT","SPAN_KIND_PRODUCER","SPAN_KIND_CONSUMER"];var qa=`${j}.host.name`,vq=`${j}.instance`,Nq=`${j}.instanceid`,Lq=`${j}.instance_name`,HCe=`${j}.telemetry.sdk.language`,KCe=`${j}.process.runtime.name`,zCe=`${j}.scope.name`,YCe=`${j}.cloud.provider`,VCe=`${j}.cloud.platform`,QCe=`${j}.aws.ecs.task.arn`,WCe=`${j}.k8s.cluster.name`,ZCe=`${j}.k8s.cluster.uid`,XCe=`${j}.k8s.namespace.name`,kq=`${j}.k8s.pod.name`,JCe=`${j}.k8s.pod.uid`,ePe=`${j}.k8s.container.name`,tPe=`${j}.k8s.node.name`,rPe=`${j}.k8s.node.uid`,Mq=`${j}.k8s.deployment.name`,nPe=`${j}.k8s.deployment.uid`,Dq=`${j}.k8s.replicaset.name`,oPe=`${j}.k8s.replicaset.uid`,Gq=`${j}.k8s.statefulset.name`,iPe=`${j}.k8s.statefulset.uid`,$q=`${j}.k8s.daemonset.name`,aPe=`${j}.k8s.daemonset.uid`,sPe=`${j}.k8s.job.name`,cPe=`${j}.k8s.job.uid`,pPe=`${j}.k8s.cronjob.name`,uPe=`${j}.k8s.cronjob.uid`,ed="status_code",td="span.name";var rd="span.kind";var jq="db.system.name",qq="db.system",Bq="db.namespace",Fq="db.name";var lPe=`span_attributes.${Bq}`,mPe=`span_attributes.${Fq}`,dPe=`span_attributes.${jq}`,fPe=`span_attributes.${qq}`;var gPe={name:"tsuga.internal.processing_tag_policy_violations_total",attributes:{tagPolicyId:`${j}.tag_policy_id`,dataSource:`${j}.data_source`}};var yPe={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${j}.batch_kind`,batchKindMetricsFilter:`${j}.batch_kind:metrics`,sourceApiKeyId:`${j}.source_api_key_id`,sourceEnv:`${j}.source_env`,sourceTeam:`${j}.source_team`}};var nd="__tsuga_metadata__",hPe=`${nd}.signature`,EPe=`${nd}.routes`,TPe=`${nd}.trace_id_bucket`;var OPe={[Wm]:rd,[Wm.replace(`${j}.`,"")]:rd,[Zm]:td,[Zm.replace(`${j}.`,"")]:td,[Xm]:ed,[Xm.replace(`${j}.`,"")]:ed};function QA(e){return e.replace(/ies$/,"y").replace(/s$/,"")}var WA=["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"],ZA=["alert_queries","alert_thresholds","alert_values"],Hq=[...WA,...ZA],XA=["alert_event_name","alert_message"],WPe=[...Hq,...XA],ZPe=new Set([...WA,...XA]),XPe=new Set(ZA);var Kq="^\\S(.*\\S)?$",zq=128,Yq=256,Vq=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"}),Qq=t.Object({key:t.String({maxLength:zq,description:"Tag key to attach to the resource."}),value:t.String({maxLength:Yq,pattern:Kq,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),jt=t.Array(Vq,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),qt=t.Array(Qq,{title:"Tags",maxItems:50,description:"Key/value tags to apply to the resource. Tag policies may require specific keys or values."}),De=t.Optional(jt),Xe=t.Optional(qt);var hn="/v0/teams",$p=["public","private"],Gp={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},Wq=t.Enum([Gp.NAME,Gp.CREATED_AT,Gp.MEMBER_COUNT,Gp.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),tx=t.Object({color:t.Enum(zm,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:t.Enum(Ym,{description:"Avatar rendering mode selected for the team."}),iconName:t.Enum(KA,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),od=t.Object({color:t.Enum(zm),mode:t.Enum(Ym)}),JA=100,ex=250,Xo=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($p,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:De,createdAt:b({description:"Timestamp when Tsuga created the team."}),updatedAt:b({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(tx)}),jp=t.Object({name:t.String({minLength:1,maxLength:JA,format:Fo,description:`Name to assign to the team. Must be kebab-case (lowercase letters, numbers, and dashes only) and unique in the organization. Maximum length is ${JA} characters.`}),description:t.Optional(t.String({maxLength:ex,description:`Optional team description. Maximum length is ${ex} characters.`})),visibility:t.Enum($p,{description:"`public` makes team-owned resources discoverable according to access controls. `private` restricts discovery to team members and authorized users."}),tags:Xe,avatar:t.Optional(tx)}),Zq=t.Object({id:t.String(),name:t.String(),email:t.String(),role:t.Enum(Vo),joinedTeamAt:b(),orgRole:t.Enum(Ap),avatar:t.Optional(od)}),QUe=m({tags:["teams"],url:hn,method:"GET",paginated:!0,response:t.Array(Xo),query:t.Object({...Te,includeMemberCount:t.Optional(t.Boolean()),searchQuery:t.Optional(p({description:"Substring matched against team names and descriptions."})),visibility:t.Optional(t.Enum($p,{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(Wq),sortDirection:t.Optional(t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending."}))})}),WUe=m({tags:["teams"],url:`${hn}/:id`,method:"GET",params:t.Object({id:p()}),response:Xo}),ZUe=m({tags:["teams"],url:`${hn}/:id/members`,method:"GET",params:t.Object({id:p()}),response:t.Array(Zq)}),XUe=m({tags:["teams"],url:`${hn}/: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()})}),JUe=m({tags:["teams"],url:hn,method:"POST",body:jp,response:Xo}),ewe=m({tags:["teams"],url:`${hn}/:id`,method:"PUT",params:t.Object({id:p()}),body:jp,response:Xo}),twe=m({tags:["teams"],url:`${hn}/bulk-update`,method:"POST",body:t.Object({teamIds:t.Array(p(),{maxItems:100}),config:t.Object({visibility:t.Enum($p)})}),response:t.Object({})}),rwe=m({tags:["teams"],url:`${hn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N});var Xq=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."}),pe=C("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(od)}),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(Xq)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var St="/v0/monitors",Jo=["alert","resolve","keep_last_status","consider_zero"],ei=["alert","resolve","keep_last_status"];var nx=["no_aggregation","all","any","each","proportion"],ox=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var Jq=t.Object({formula:t.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(ox,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),eB=t.Object({formula:p({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:t.Enum(ox,{description:"Comparison operator used to evaluate the threshold condition."}),threshold:t.Number({description:"Numeric threshold value used by the comparison. May be negative when the formula result can be below zero."})}),tB=5,id=t.Array(Jq,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),ad=t.Array(eB,{minItems:1,maxItems:tB,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),sd=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`."}),cd=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`."}),bt=[1,2,3,4,5];var qp={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(nx,{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`."}))},Bp={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(nx,{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`."}))},pd={...qp,timeframe:t.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},ud={...Bp,timeframe:t.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},ix=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:id,noDataBehavior:t.Enum(Jo,{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."}),...qp,queries:Dr},{$id:"MonitorConfigurationMetric"}),ax=t.Object({type:t.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:ad,noDataBehavior:t.Enum(Jo,{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."}),...Bp,queries:Gr},{$id:"InputMonitorConfigurationMetric"}),sx=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:id,noDataBehavior:t.Enum(Jo,{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."}),...qp,queries:Dr},{$id:"MonitorConfigurationLog"}),cx=t.Object({type:t.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:ad,noDataBehavior:t.Enum(Jo,{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."}),...Bp,queries:Gr},{$id:"InputMonitorConfigurationLog"}),px=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:id,noDataBehavior:t.Enum(Jo,{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."}),...qp,queries:Dr},{$id:"MonitorConfigurationTrace"}),rB=t.Object({type:t.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:ad,noDataBehavior:t.Enum(Jo,{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."}),...Bp,queries:Gr},{$id:"InputMonitorConfigurationTrace"}),ux=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:sd,noDataBehavior:t.Enum(ei,{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."}),...pd,queries:Dr},{$id:"MonitorConfigurationAnomalyLog"}),lx=t.Object({type:t.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:cd,noDataBehavior:t.Enum(ei,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...ud,queries:Gr},{$id:"InputMonitorConfigurationAnomalyLog"}),mx=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:sd,noDataBehavior:t.Enum(ei,{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."}),...pd,queries:Dr},{$id:"MonitorConfigurationAnomalyMetric"}),dx=t.Object({type:t.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:cd,noDataBehavior:t.Enum(ei,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...ud,queries:Gr},{$id:"InputMonitorConfigurationAnomalyMetric"}),fx=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:sd,noDataBehavior:t.Enum(ei,{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."}),...pd,queries:Dr},{$id:"MonitorConfigurationAnomalyTrace"}),nB=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:cd,noDataBehavior:t.Enum(ei,{description:"How the anomaly monitor updates state when no data is returned. `alert` enters no-data alert state, `resolve` resolves, and `keep_last_status` preserves the previous state."}),...ud,queries:Gr},{$id:"InputMonitorConfigurationAnomalyTrace"}),gx=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"}),oB=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"}),iB=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"}),aB=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"}),sB=C("type",[ix,sx,px,ux,mx,iB,fx,gx],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),cB=C("type",[ax,cx,rB,lx,dx,nB,aB,oB],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var jr=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:De,configuration:sB,priority:t.Enum(bt,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:yn,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(b({description:"Timestamp until which the monitor is snoozed."})),creator:t.Optional(pe),updater:t.Optional(pe),createdAt:b({description:"Timestamp when Tsuga created the monitor."}),updatedAt:b({description:"Timestamp when Tsuga last updated the monitor."}),assetUpdatedAt:b({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"}),pB=C("type",[ix,sx,px,ux,mx,fx,gx]),Swe=t.Object({...jr.properties,configuration:pB},{title:"Monitor"}),Owe=t.Object({...jr.properties,configuration:C("type",[ax,cx,lx,dx])},{title:"Monitor"}),Ba=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:Xe,configuration:cB,priority:t.Enum(bt,{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:yn,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."}))}),rx=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],En={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var ld=t.Object({owners:Me(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:Me(qt.items,{description:"Restrict results to monitors that have at least one of the listed key/value tags",maxItems:50}),priorities:Me(t.Enum(bt),{description:"Restrict results to monitors with one of these priorities",maxItems:bt.length}),types:Me(t.Enum(rx),{description:"Restrict results to monitors with these types",maxItems:rx.length}),activity:t.Enum(["active","snoozed"],{description:"Restrict results by activity status: active monitors or currently snoozed monitors"}),clusterIds:Me(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"}),md=t.Partial(t.Object({...Te,filters:t.Partial(ld),sort:t.Object({by:t.Enum([En.PRIORITY,En.TYPE,En.NAME,En.OWNER,En.TAGS,En.CLUSTER_IDS,En.PAUSE_UNTIL,En.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."})})),Awe=m({tags:["monitors"],url:`${St}/query`,method:"POST",paginated:!0,response:t.Array(jr),body:md}),xwe=m({tags:["monitors"],url:`${St}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(ld,["tags"])))}),response:jt}),Rwe=m({tags:["monitors"],url:`${St}/counts/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(ld,["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."})})}),Cwe=m({tags:["monitors"],url:`${St}/:id`,method:"GET",params:t.Object({id:p()}),response:jr}),Pwe=m({tags:["monitors"],url:St,method:"POST",body:Ba,response:jr}),Uwe=m({tags:["monitors"],url:`${St}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ba,response:jr}),wwe=m({tags:["monitors"],url:`${St}/bulk-update`,method:"PUT",body:t.Object({monitorIds:t.Array(p({allowEmpty:!1}),{minItems:1}),owner:p({allowEmpty:!1})}),response:t.Object({})}),vwe=m({tags:["monitors"],url:`${St}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),Nwe=m({tags:["monitors"],url:`${St}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})}),Lwe=m({tags:["monitors"],url:`${St}/:id/snooze`,method:"POST",params:t.Object({id:p()}),body:t.Object({pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:jr}),kwe=m({tags:["monitors"],url:`${St}/bulk-snooze`,method:"POST",body:t.Object({monitorIds:t.Array(p()),pauseUntil:p({allowEmpty:!1,type:"date-time"})}),response:t.Object({})}),uB=["alert","alert_consider_zero","alert_no_data","keep_last_status_alert"],lB=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],mB=[...uB,...lB],no=t.Enum(mB),dB=C("type",[t.Object({type:t.Literal("each"),subStates:t.Record(t.String(),t.Object({stateValue:t.Union([no,t.Null()]),lastChangedAt:b()}))}),t.Object({type:t.Literal("no_aggregation"),stateValue:t.Optional(no)}),t.Object({type:t.Literal("any"),stateValue:t.Optional(no)}),t.Object({type:t.Literal("all"),stateValue:t.Optional(no)}),t.Object({type:t.Literal("proportion"),stateValue:t.Optional(no)})]),fB=t.Object({monitorId:t.String(),currentState:dB,lastChangedAt:t.Optional(b())}),Mwe=m({tags:["monitors"],url:`${St}/states/:id`,method:"GET",params:t.Object({id:p()}),response:fB}),Dwe=m({tags:["monitors"],url:`${St}/: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:b(),fromState:t.Optional(no),toState:t.Optional(no),dimension:t.Optional(t.String())}))}),gB=["unprocessed","processed","failed-to-process"],Gwe=m({tags:["monitors"],url:`${St}/: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:b(),formulaResult:t.Object({groups:t.Array(t.Object({groupKey:t.Record(t.String(),$a),results:t.Array(t.Union([t.Number(),t.Null()])),conditionMet:t.Enum(["true","false","nan-no-data"])}))}),createdAt:b(),status:t.Enum(gB)}))})});var qr="/v0/slos",yB=[7,30,90],hB=["good","bad"],Tx=t.Enum(hB,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),EB=["good","bad","ignore"],_x=t.Enum(EB,{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)"}),yx=30,hx=1440,Ix=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],TB=["healthy","breached","no_data"],Fp=t.Enum(TB,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),Ex={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:Fp},_B=t.Object({overall:t.Object(Ex,{description:"Latest overall evaluation for the cluster"}),perGroup:t.Array(t.Object({groupKey:t.Record(t.String(),$a,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...Ex}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),bx=t.Record(t.String(),_B,{description:"Latest evaluation results keyed by cluster ID."}),dd=t.Object({queries:Dr,formula:kp},{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."}),fd=t.Object({queries:Gr,formula:ro},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Formulas reference queries as q1, q2, and so on."}),IB=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"}),bB=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 SB=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"}),OB=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"}),AB=C("type",[IB,SB],{description:"Alert trigger configuration: burn-rate or threshold"}),Sx=C("type",[bB,OB],{description:"Alert trigger configuration: burn-rate or threshold"}),gd=t.Enum(bt,{description:"Alert priority (1 is highest, 5 is lowest)"}),yd=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:gd,configuration:AB,createdAt:b({description:"Timestamp when Tsuga created the alert."}),updatedAt:b({description:"Timestamp when Tsuga last updated the alert."}),assetUpdatedAt:b({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"SloAlert"}),xB=t.Object({priority:gd,configuration:Sx}),RB=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:gd,configuration:Sx}),CB=C("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:rr,goodQuery:dd,totalQuery:dd,groupByFields:t.Optional(Zo),noDataBehavior:Tx},{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:rr,query:dd,sliceSizeMinutes:t.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:t.Object({operator:t.Enum(Ix,{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(Zo),noDataBehavior:_x},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),PB=C("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:rr,goodQuery:fd,totalQuery:fd,groupByFields:t.Optional($r),noDataBehavior:Tx},{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:rr,query:fd,sliceSizeMinutes:t.Integer({minimum:yx,maximum:hx,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${yx} through ${hx}.`}),threshold:t.Object({operator:t.Enum(Ix,{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($r),noDataBehavior:_x},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),UB=t.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),Ox=t.Enum(yB,{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."}),wB=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."}),vB=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."}),ti=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:De,configuration:CB,target:t.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:Ox,owner:t.String({description:"Team ID that owns the SLO"}),permissions:yn,clusterIds:wB,creator:t.Optional(pe),updater:t.Optional(pe),alerts:t.Array(yd,{description:"Alerts attached to this SLO"}),createdAt:b({description:"Timestamp when Tsuga created the SLO."}),updatedAt:b({description:"Timestamp when Tsuga last updated the SLO."}),assetUpdatedAt:b({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})},{title:"Slo"}),NB=t.Object({...ti.properties,results:bx},{title:"SloWithResults"}),Hp=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:Xe,configuration:PB,target:UB,timeframeDays:Ox,owner:p({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:yn,clusterIds:t.Optional(vB),alerts:t.Array(xB,{description:"Alerts to create on this SLO. Send an empty array for none."})}),hd=t.Object({...t.Omit(Hp,["alerts"]).properties,alerts:t.Array(RB,{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."})}),Ax=t.Object({owners:Me(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:Me(qt.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:Me(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:Me(Fp,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),Ed=t.Partial(t.Object({...Te,filters:t.Partial(Ax),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"})})),Wwe=m({tags:["slos"],url:`${qr}/query`,method:"POST",paginated:!0,response:t.Array(NB),body:Ed}),Zwe=m({tags:["slos"],url:`${qr}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Partial(t.Omit(Ax,["tags","statuses"])))}),response:jt}),Xwe=m({tags:["slos"],url:`${qr}/:id`,method:"GET",params:t.Object({id:p()}),response:ti}),Jwe=m({tags:["slos"],url:`${qr}/:id/results`,method:"GET",params:t.Object({id:p()}),response:bx}),eve=m({tags:["slos"],url:qr,method:"POST",body:Hp,response:ti}),tve=m({tags:["slos"],url:`${qr}/:id`,method:"PUT",params:t.Object({id:p()}),body:hd,response:ti}),rve=m({tags:["slos"],url:`${qr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),nve=m({tags:["slos"],url:`${qr}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})}),ove=m({tags:["slos"],url:`${qr}/bulk-update`,method:"PUT",body:t.Object({sloIds:t.Array(p()),owner:p({allowEmpty:!1})}),response:t.Object({})});var ri="/v0/notifications",Tn=`${ri}/rules`,xx=`${ri}/slack/setup`,Fa=`${ri}/integrations`,oo=["triggered","resolved","no-data"],LB=["sent","stale","pending","rate-limited","failed","silenced"],kB=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."})),Td=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."}),MB=t.Optional(Td),_r=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."})),Ir=t.Optional(t.Object({mode:t.Literal("each",{description:"Renotification mode. `each` sends repeat notifications for each matching monitor alert that remains in a configured state."}),renotificationStates:t.Array(t.Enum(["alert","alert_no_data"]),{description:"Monitor alert states that trigger repeat notifications while the target remains configured for renotification."}),renotifyIntervalMinutes:t.Integer({minimum:1,description:"Minimum number of minutes to wait after the previous notification."})},{description:"Configuration for repeat monitor notifications on this target. If omitted, Tsuga sends only the original notification for each alert transition."})),Ha=t.Object({id:t.String({description:"Identifier of the notification target within this rule, used with the rule ID for per-target delivery state such as rate limiting."}),rateLimit:kB,config:C("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:_r},{$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:_r},{$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:_r},{$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:_r},{$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:_r},{$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:_r},{$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:_r},{$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:_r},{$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:_r},{$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:_r},{$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`."})}),ni=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:MB,config:C("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:Ir},{$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:Ir},{$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:Ir},{$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:Ir},{$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:Ir},{$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:Ir},{$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:Ir},{$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:Ir},{$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:Ir},{$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:Ir},{$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)."})}),_d=C("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."}),Id=C("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."}),oi=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:_d,prioritiesFilter:t.Array(t.Enum(bt),{description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(oo),{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:b({description:"Timestamp when Tsuga created the rule."}),updatedAt:b({description:"Timestamp when Tsuga last updated the rule."}),isActive:t.Boolean({description:"Whether the rule currently sends notifications when its filters match."}),tags:De,targets:t.Array(Ha,{description:"Destinations that receive a notification whenever this rule matches an alert transition. Every target in the list is notified independently, subject to its own rate limit and renotification settings."}),creator:t.Optional(pe),updater:t.Optional(pe)}),Ka=t.Object({name:p({description:"Display name of the notification rule."}),queryString: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:Id,prioritiesFilter:t.Array(t.Enum(bt),{maxItems:bt.length,description:"Monitor priorities that must match for this rule to fire. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(oo),{maxItems:oo.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:Xe,isActive:t.Boolean({description:"Set to true for the rule to send notifications when its filters match."}),targets:t.Array(ni,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),Kp=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:b({description:"Timestamp when Tsuga created the rule."}),updatedAt:b({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:De,monitorIds:t.Array(t.String(),{description:"Monitors this rule reacts to."}),fallbackTarget:Ha,creator:t.Optional(pe),updater:t.Optional(pe)}),Rx=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:Xe,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:ni}),dve=m({tags:["notification-rules"],url:Tn,method:"GET",paginated:!0,query:t.Object(Te),response:t.Array(oi)}),fve=m({tags:["notification-rules"],url:`${Tn}/:id`,params:t.Object({id:p()}),method:"GET",response:oi}),gve=m({tags:["notification-rules"],url:Tn,method:"POST",body:Ka,response:oi}),yve=m({tags:["notification-rules"],url:`${Tn}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ka,response:oi}),hve=m({tags:["notification-rules"],url:`${Tn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),Eve=m({tags:["notification-rules"],url:`${Tn}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})}),ii=`${ri}/adaptive-rules`,Tve=m({tags:["notification-rules"],url:ii,method:"GET",paginated:!0,query:t.Object(Te),response:t.Array(Kp)}),_ve=m({tags:["notification-rules"],url:`${ii}/:id`,params:t.Object({id:p()}),method:"GET",response:Kp}),Ive=m({tags:["notification-rules"],url:ii,method:"POST",body:Rx,response:Kp}),bve=m({tags:["notification-rules"],url:`${ii}/:id`,method:"PUT",params:t.Object({id:p()}),body:Rx,response:Kp}),Sve=m({tags:["notification-rules"],url:`${ii}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),Ove=m({tags:["notification-rules"],url:`${ii}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})}),Ave=m({tags:["notification-integrations"],url:`${xx}/start`,method:"POST",response:t.Object({redirectUrl:t.String()})}),DB=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],GB=t.Object({id:t.String(),name:t.String(),type:t.Enum(DB),createdAt:b(),ruleCount:t.Number(),creator:t.Optional(pe)}),xve=m({tags:["notification-integrations"],url:`${Tn}/integrations`,method:"GET",paginated:!0,query:t.Object(Te),response:t.Array(GB)}),Rve=m({tags:["notification-integrations"],url:`${xx}/callback`,method:"GET",query:t.Object({code:p()}),response:t.Object({success:t.Boolean()})}),bd=["POST","PUT"],$B=t.Record(t.String(),t.String()),jB=t.Record(t.String(),t.Unknown()),qB=t.Record(t.String(),t.Union([t.String(),t.Number(),t.Boolean(),t.Null(),t.Array(t.Union([t.String(),t.Number(),t.Boolean()]))])),BB=C("type",[t.Object({type:t.Literal("json"),value:jB}),t.Object({type:t.Literal("form"),value:qB})]),FB=t.Object({ok:t.String(),alert:t.String()}),Sd=t.Object({id:t.String(),name:t.String(),setting:C("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(bd),authentication:C("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($B),payloadTemplate:BB,eventNameMapping:t.Optional(FB)}),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:De}),HB=t.Object({type:t.Literal("webhook"),url:p({type:"uri"}),method:t.Enum(bd),authentication:C("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:C("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})}))}),Cx=t.Object({type:t.Literal("incident-io"),alertSourceConfigId:p(),token:p()}),Px=t.Object({type:t.Literal("grafana-irm"),url:p({type:"uri"})}),Ux=t.Object({type:t.Literal("pagerduty"),integrationKey:p()}),wx=t.Object({type:t.Literal("microsoft-teams"),webhookUrl:p({type:"uri"})}),KB=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})}),zB=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),YB=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),VB=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."})}),QB=t.Object({name:p(),setting:C("type",[Cx,Px,Ux,wx,HB,KB,zB,YB,VB]),tags:Xe}),WB=t.Object({type:t.Literal("webhook"),url:t.Optional(p({type:"uri"})),method:t.Optional(t.Enum(bd)),authentication:t.Optional(C("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(C("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}))}))}),ZB=t.Object({type:t.Literal("servicenow"),instanceName:t.Optional(p({allowEmpty:!1})),username:t.Optional(p({allowEmpty:!1})),password:t.Optional(p({allowEmpty:!1}))}),XB=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}))}),JB=t.Object({type:t.Literal("google-chat"),webhookUrl:p({type:"uri"})}),eF=t.Object({type:t.Literal("squadcast"),webhookUrl:p({type:"uri"})}),tF=t.Object({name:t.Optional(p()),setting:t.Optional(C("type",[Cx,Px,Ux,wx,WB,ZB,JB,eF,XB]))}),Cve=m({tags:["notification-integrations"],url:Fa,method:"POST",body:QB,response:Sd}),Pve=m({tags:["notification-integrations"],url:`${Fa}/:id`,method:"GET",params:t.Object({id:p()}),response:Sd}),Uve=m({tags:["notification-integrations"],url:`${Fa}/:id`,method:"PUT",params:t.Object({id:p()}),body:tF,response:Sd}),wve=m({tags:["notification-integrations"],url:`${Fa}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),rF=C("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."}),vve=m({tags:["notification-integrations"],url:`${Fa}/:id/jira-metadata`,method:"GET",params:t.Object({id:p()}),response:rF}),Nve=m({tags:["notification-rules"],url:`${St}/: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(LB),tryCount:t.Number(),nextTryAt:b(),createdAt:b(),updatedAt:b(),sentAt:t.Optional(b())})),isTruncated:t.Boolean()})}),nF=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],Lve=m({tags:["notification-rules"],url:`${Tn}/test`,method:"POST",body:t.Object({notificationRule:Ka,targetIds:t.Optional(t.Array(p({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:t.Union([t.Object({success:t.Literal(!1),overallMessage:t.String({description:"Message when there is an overall error"})}),t.Object({success:t.Boolean(),results:t.Array(t.Object({targetId:t.String({description:"The ID of the target that was tested"}),targetType:t.Enum(nF,{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 Bt="/v0/service-catalog";var oF=t.Object({team:t.String({description:"Team name observed on telemetry for this service."}),lastSeenAt:b({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."}),iF=t.Object({ingestionApiKey:t.String({description:"Ingestion API key name or identifier observed on telemetry for this service."}),lastSeenAt:b({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."}),aF=t.Object({version:t.String({description:"Service version value observed in telemetry."}),firstSeenAt:b({description:"First time this version was observed for the service."}),lastSeenAt:b({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."}),sF=t.Object({language:t.String({description:"Programming language observed for this service."}),lastSeenAt:b({description:"Most recent time this language was observed."})},{description:"A programming language observed for this service, with the last time it was seen."}),cF=t.Object({runtime:t.String({description:"Runtime observed for this service."}),lastSeenAt:b({description:"Most recent time this runtime was observed."})},{description:"A runtime observed for this service, with the last time it was seen."}),vx=t.Object({protocol:t.String({description:"Observed API protocol (e.g. 'http', 'grpc', 'graphql')"}),lastSeenAt:b({description:"Most recent observation timestamp"})},{description:"An API protocol observed for this service, with the last time it was seen."}),pF=t.Object({framework:t.String({description:"Observed application framework (e.g. 'express', 'fastify', 'django', 'rails')"}),lastSeenAt:b({description:"Most recent observation timestamp"})},{description:"An application framework detected from OpenTelemetry instrumentation scope, with the last time it was seen."}),uF=t.Object({platform:t.String({description:"Observed cloud or orchestration platform (e.g. 'aws_eks', 'kubernetes')"}),lastSeenAt:b({description:"Most recent observation timestamp"})},{description:"A cloud or orchestration platform this service runs on, with the last time it was seen."}),lF=t.Object({provider:t.String({description:"Observed cloud provider (e.g. 'aws', 'gcp', 'azure')"}),lastSeenAt:b({description:"Most recent observation timestamp"})},{description:"A cloud provider this service runs on, with the last time it was seen."}),zp=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:Ha.properties.config,rateLimit:Ha.properties.rateLimit,createdAt:b({description:"Timestamp when user created this service target."}),updatedAt:b({description:"Timestamp when user last updated this service target."})}),mF=t.Object({config:ni.properties.config,rateLimit:ni.properties.rateLimit}),dF=t.Object({config:ni.properties.config,rateLimit:t.Union([Td,t.Null()])}),za=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(oF,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:t.Array(iF,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:t.Array(aF,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:t.Array(sF,{description:"Programming languages observed for this service."}),runtimes:t.Array(cF,{description:"Runtime values observed for this service."}),serverProtocols:t.Array(vx,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:t.Array(vx,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:t.Array(pF,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:t.Array(uF,{description:"Cloud platforms this service is running on"}),cloudProviders:t.Array(lF,{description:"Cloud providers this service is running on"}),lastSeenAt:b({description:"Most recent time Tsuga observed telemetry for this service."}),firstSeenAt:b({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(zp,{description:"Notification targets attached to this service, used by adaptive notification rules to page its owners."}),createdAt:b({description:"Timestamp when Tsuga created this service catalog entry."}),updatedAt:b({description:"Timestamp when Tsuga last updated this service catalog entry."})}),Kve=m({tags:["service-catalog"],query:t.Object({...Te,clusterId:t.Optional(p())}),method:"GET",paginated:!0,url:`${Bt}/services`,response:t.Array(za)}),fF=t.Object({spanKind:t.Enum(VA),count:t.Number()}),Nx=t.Object({...za.properties,spanKindCounts:t.Array(fF),envs:t.Object({primaryEnv:t.String(),allEnvs:t.Array(t.String())})}),zve=m({tags:["service-catalog"],query:t.Object({...Te,clusterId:t.Optional(p()),env:t.Optional(p())}),method:"GET",paginated:!0,url:`${Bt}/v2/services`,response:t.Array(Nx)}),Yve=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:`${Bt}/v2/service`,response:Nx}),Vve=m({tags:["service-catalog"],method:"GET",url:`${Bt}/services/:serviceId`,params:t.Object({serviceId:p()}),response:za}),Qve=m({tags:["service-catalog"],method:"GET",url:`${Bt}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),response:t.Array(zp)}),Wve=m({tags:["service-catalog"],method:"POST",url:`${Bt}/services/:serviceId/targets`,params:t.Object({serviceId:p()}),body:mF,response:zp}),Zve=m({tags:["service-catalog"],method:"PUT",url:`${Bt}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),body:dF,response:zp}),Xve=m({tags:["service-catalog"],method:"DELETE",url:`${Bt}/services/:serviceId/targets/:targetId`,params:t.Object({serviceId:p(),targetId:p()}),response:N}),gF=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var Lx=t.Object({id:t.String(),hostName:t.String(),env:t.Optional(t.String()),cpuUtilizationAverage:t.Number(),hostType:t.Enum(gF),teams:t.Array(t.String()),tags:t.Array(t.String()),firstSeenAt:b(),lastSeenAt:b(),clusterId:t.String()}),Jve=m({tags:["service-catalog"],method:"GET",url:`${Bt}/hosts`,response:t.Array(Lx)}),eNe=m({tags:["service-catalog"],method:"GET",url:`${Bt}/hosts/:hostId`,params:t.Object({hostId:p()}),response:Lx}),yF=["http","rpc","messaging","genai","object_store"],kx={name:t.String({description:"Service or inferred dependency name shown in the graph."}),env:t.Optional(t.String({description:"Environment observed from spans."}))},Od=t.Object({...kx,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."})}),Mx={...kx,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"}))},Ad=t.Object({...Mx,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`."})}),xd=t.Object({...Mx,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(yF,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),hF=C("nodeType",[Od,Ad,xd]),Rd=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."}),tNe=m({tags:["service-catalog"],url:`${Bt}/services/:serviceId/graph`,method:"GET",params:t.Object({serviceId:p()}),query:t.Object({...it.properties,query:t.Optional(p({type:"tsuga-query"}))}),response:t.Object({clusterId:t.String(),nodes:t.Array(hF),edges:t.Array(Rd)})}),EF=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(bt,{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(Fp,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"})}))}),rNe=m({tags:["service-catalog"],method:"GET",url:`${Bt}/services/:serviceId/related-resources`,params:t.Object({serviceId:p()}),response:EF}),nNe=m({tags:["service-catalog"],method:"GET",url:`${Bt}/services/by-api-keys`,response:t.Record(t.String(),t.Array(t.Object({serviceName:t.String(),serviceNamespace:t.Optional(t.String())})))});var Cd=`/${"v1"}/services`,Pd=t.Pick(za,["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)."}),TF={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(Pd,{examples:[TF]});var Dx=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:Cd,method:"GET",paginated:!0,query:t.Object({...We,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(Pd)}),Gx=m({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${Cd}/: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:Pd}),_F=t.Pick(Od,["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."}),IF=t.Pick(xd,["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."}),bF=t.Pick(Ad,["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."}),SF=C("nodeType",[_F,bF,IF]),OF=t.Pick(Rd,["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."}),AF=t.Optional(t.Integer({...it.properties.from,description:"Start of the service graph query window as a Unix timestamp in seconds. Provide both `from` and `to` for a deterministic graph window; otherwise Tsuga uses backend graph defaults."})),xF=t.Optional(t.Integer({...it.properties.to,description:"End of the service graph query window as a Unix timestamp in seconds. Provide both `from` and `to` for a deterministic graph window; otherwise Tsuga uses backend graph defaults."})),RF=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."}),$x=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:`${Cd}/: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:AF,to:xF,query:t.Optional(RF)},{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(SF,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:t.Array(OF,{description:"Directed dependency edges between graph nodes."})})});var Ge=" (unix seconds, ISO 8601, or relative like -1h/-30m/now)";function jx(e,r){let n=r??kr(e);return n===void 0?void 0:oc(n)}function Ud(e){let r=kr(e);return r===void 0?"":` (default: ${r})`}function qx(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${Ge}${Ud("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${Ud("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${Ud("query")}`).action(async(o,i)=>{let a={},c=jx("from",i.from),l=jx("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()($x,{params:{serviceId:o},query:a});J(d)})}var CF=`/${"v1"}/grok`,PF=25,UF=100,Bx=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:PF,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:UF,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."}),wF={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(Bx,{examples:[wF]});var Fx=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."}),vF={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(Fx,{examples:[vF]});var Hx=m({url:`${CF}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:Bx,response:Fx,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 Kx=tn(require("node:fs"));function ai(e){if(e.file){let r=Kx.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 wd(e){return s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,r=>s.IsObject(r)&&s.HasPropertyKey(r,"check")&&s.HasPropertyKey(r,"error")&&s.IsFunction(r.check)&&s.IsFunction(r.error))}function nr(e){return s.IsObject(e)&&!s.IsArray(e)}function Yp(e){return s.IsBoolean(e)}function q(e){return nr(e)||Yp(e)}function vd(e){return s.HasPropertyKey(e,"additionalItems")&&q(e.additionalItems)}function Br(e){return s.HasPropertyKey(e,"additionalProperties")&&q(e.additionalProperties)}function Nd(e){return s.HasPropertyKey(e,"allOf")&&s.IsArray(e.allOf)&&e.allOf.every(r=>q(r))}function Ya(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function Ld(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(r=>q(r))}function kd(e){return s.HasPropertyKey(e,"const")}function io(e){return s.HasPropertyKey(e,"contains")&&q(e.contains)}function Ft(e){return s.HasPropertyKey(e,"default")}function Md(e){return s.HasPropertyKey(e,"dependencies")&&s.IsObject(e.dependencies)&&Object.values(e.dependencies).every(r=>q(r)||s.IsArray(r)&&r.every(n=>s.IsString(n)))}function Dd(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 Gd(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(r=>q(r))}function _n(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function $d(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function jd(e){return s.HasPropertyKey(e,"else")&&q(e.else)}function qd(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function Bd(e){return s.HasPropertyKey(e,"exclusiveMaximum")&&(s.IsNumber(e.exclusiveMaximum)||s.IsBigInt(e.exclusiveMaximum))}function Fr(e){return s.HasPropertyKey(e,"exclusiveMinimum")&&(s.IsNumber(e.exclusiveMinimum)||s.IsBigInt(e.exclusiveMinimum))}function Va(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Hr(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function Fd(e){return s.HasPropertyKey(e,"if")&&q(e.if)}function si(e){return s.HasPropertyKey(e,"items")&&(q(e.items)||s.IsArray(e.items)&&e.items.every(r=>q(r)))}function Hd(e){return si(e)&&s.IsArray(e.items)}function Kd(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function zd(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function Vp(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function Yd(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function Vd(e){return s.HasPropertyKey(e,"maxProperties")&&s.IsNumber(e.maxProperties)}function Kr(e){return s.HasPropertyKey(e,"minimum")&&(s.IsNumber(e.minimum)||s.IsBigInt(e.minimum))}function ao(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function ci(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function Qa(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function Wa(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function Qd(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function Wd(e){return s.HasPropertyKey(e,"not")&&q(e.not)}function Zd(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(r=>q(r))}function Za(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function Xa(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(r=>q(r))}function pi(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(r=>q(r))}function Ja(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(r=>q(r))}function Xd(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||q(e.propertyNames))}function NF(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function Qp(e){return NF(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function Jd(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function ef(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function so(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(r=>s.IsString(r))}function tf(e){return s.HasPropertyKey(e,"then")&&q(e.then)}function rf(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(r=>s.IsString(r)))}function ui(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function Wp(e){return s.HasPropertyKey(e,"unevaluatedItems")&&q(e.unevaluatedItems)}function Zp(e){return s.HasPropertyKey(e,"unevaluatedProperties")&&q(e.unevaluatedProperties)}var At=class{constructor(){let r=new Set,n=new Set;this.stack=[{indices:r,keys:n}]}Push(){let r=new Set,n=new Set;return this.stack.push({indices:r,keys:n}),!0}Pop(){return this.stack.pop(),!0}AddIndex(r){return this.GetIndices().add(r),!0}AddKey(r){return this.GetKeys().add(r),!0}GetIndices(){return this.stack[this.stack.length-1].indices}GetKeys(){return this.stack[this.stack.length-1].keys}Merge(r){for(let n of r)n.GetIndices().forEach(o=>this.GetIndices().add(o)),n.GetKeys().forEach(o=>this.GetKeys().add(o));return!0}},es=class extends At{constructor(r){super(),this.callback=r}AddError(r){return this.callback(r),!1}},at=class extends es{constructor(){super(r=>this.errors.push(r)),this.errors=[]}AddError(r){return this.errors.push(r),!1}GetErrors(){return this.errors}};function zx(e,r,n,o){return s.Every(n["~refine"],0,(i,a)=>i.check(o))}function Yx(e,r,n,o,i,a){return s.EveryAll(i["~refine"],0,(c,l)=>c.check(a)||r.AddError({keyword:"~refine",schemaPath:n,instancePath:o,params:{index:l,message:c.error(a)}}))}function Vx(e){return si(e)&&s.IsArray(e.items)}function Qx(e,r,n,o){return Vx(n)?s.Every(o,0,(a,c)=>s.IsLessThan(c,n.items.length)||Ht(e,r,n.additionalItems,a)&&r.AddIndex(c)):!0}function Wx(e,r,n,o,i,a){return Vx(i)?s.Every(a,0,(l,d)=>{let f=`${n}/additionalItems`,y=`${o}/${d}`;return s.IsLessThan(d,i.items.length)||Kt(e,r,f,y,i.additionalItems,l)&&r.AddIndex(d)}):!0}function LF(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function Zx(e){let r=[];return Xa(e)&&r.push(...s.Keys(e.patternProperties)),Ja(e)&&r.push(...s.Keys(e.properties).map(LF)),s.IsEqual(r.length,0)?"(?!)":`(${r.join("|")})`}function Xx(e,r,n,o){let i=new RegExp(Zx(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||Ht(e,r,n.additionalProperties,o[c])&&r.AddKey(c))}function Jx(e,r,n,o,i,a){let c=new RegExp(Zx(i)),l=[];return s.EveryAll(s.Keys(a),0,(f,y)=>{let _=`${n}/additionalProperties`,I=`${o}/${f}`,g=new at,E=c.test(f)||Kt(e,g,_,I,i.additionalProperties,a[f])&&r.AddKey(f);return E||l.push(f),E})||r.AddError({keyword:"additionalProperties",schemaPath:n,instancePath:o,params:{additionalProperties:l}})}function eR(e,r,n,o){let i=n.allOf.reduce((a,c)=>{let l=new At;return ne(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,n.allOf.length)&&r.Merge(i)}function tR(e,r,n,o,i,a){let c=[],l=i.allOf.reduce((f,y,_)=>{let I=`${n}/allOf/${_}`,g=new at,E=_e(e,g,I,o,y,a);return E||c.push(g),E?[...f,g]:f},[]),d=s.IsEqual(l.length,i.allOf.length)&&r.Merge(l);return d||c.forEach(f=>f.GetErrors().forEach(y=>r.AddError(y))),d}function rR(e,r,n,o){let i=n.anyOf.reduce((a,c)=>{let l=new At;return ne(e,l,c,o)?[...a,l]:a},[]);return s.IsGreaterThan(i.length,0)&&r.Merge(i)}function nR(e,r,n,o,i,a){let c=[],l=i.anyOf.reduce((f,y,_)=>{let I=new at,g=`${n}/anyOf/${_}`,E=_e(e,I,g,o,y,a);return E||c.push(I),E?[...f,I]:f},[]),d=s.IsGreaterThan(l.length,0)&&r.Merge(l);return d||c.forEach(f=>f.GetErrors().forEach(y=>r.AddError(y))),d||r.AddError({keyword:"anyOf",schemaPath:n,instancePath:o,params:{}})}function of(e,r,n,o){return n}function oR(e,r,n,o,i,a){return of(e,r,i,a)||r.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function af(e,r,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function iR(e,r,n,o,i,a){return af(e,r,i,a)||r.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function kF(e){return!(ao(e)&&s.IsEqual(e.minContains,0))}function sf(e,r,n,o){return kF(n)?!s.IsEqual(o.length,0)&&s.SomeAll(o,(i,a)=>ne(e,r,n.contains,i)&&r.AddIndex(a)):!0}function aR(e,r,n,o,i,a){return sf(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function sR(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)):ne(e,r,l,o)));return i||a}function cR(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 y=`${n}/dependencies/${d}`;return!s.HasPropertyKey(a,d)||(s.IsArray(f)?f.every(_=>s.HasPropertyKey(a,_)||r.AddError({keyword:"dependencies",schemaPath:n,instancePath:o,params:{property:d,dependencies:f}})):_e(e,r,y,o,f,a))});return c||l}function pR(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 uR(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,y=>s.HasPropertyKey(a,y)||r.AddError({keyword:"dependentRequired",schemaPath:n,instancePath:o,params:{property:d,dependencies:f}})));return c||l}function lR(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)||ne(e,r,l,o));return i||a}function mR(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 y=`${n}/dependentSchemas/${d}`;return!s.HasPropertyKey(a,d)||_e(e,r,y,o,f,a)});return c||l}function dR(e,r,n,o){let i=e.DynamicRef(n)??!1;return q(i)&&ne(e,r,i,o)}function fR(e,r,n,o,i,a){let c=e.DynamicRef(i)??!1;return q(c)&&_e(e,r,"#",o,c,a)}function uf(e,r,n,o){return s.Some(n.enum,i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function gR(e,r,n,o,i,a){return uf(e,r,i,a)||r.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function lf(e,r,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function yR(e,r,n,o,i,a){return lf(e,r,i,a)||r.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function mf(e,r,n,o){return s.IsGreaterThan(o,n.exclusiveMinimum)}function hR(e,r,n,o,i,a){return mf(e,r,i,a)||r.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var fi={};zt(fi,{Clear:()=>CR,Entries:()=>_H,Get:()=>SH,Has:()=>bH,IsDate:()=>mi,IsDateTime:()=>Xp,IsDuration:()=>Jp,IsEmail:()=>eu,IsHostname:()=>ru,IsIPv4:()=>iu,IsIPv6:()=>au,IsIdnEmail:()=>nu,IsIdnHostname:()=>ou,IsIri:()=>cu,IsIriReference:()=>su,IsJsonPointer:()=>uu,IsJsonPointerUriFragment:()=>pu,IsRegex:()=>lu,IsRelativeJsonPointer:()=>mu,IsTime:()=>di,IsUri:()=>yu,IsUriReference:()=>du,IsUriTemplate:()=>fu,IsUrl:()=>hu,IsUuid:()=>Eu,Reset:()=>PR,Set:()=>IH,Test:()=>OH});var MF=[0,31,28,31,30,31,30,31,31,30,31,30,31],DF=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function GF(e){return e%4===0&&(e%100!==0||e%400===0)}function mi(e){let r=DF.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&&GF(n)?29:MF[o])}var $F=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function di(e,r=!0){let n=$F.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,y=o-l*c-(f<0?1:0);return(y===23||y===-1)&&(f===59||f===-1)&&a<61}function Xp(e,r=!0){let n=e.split(/T/i);return n.length===2&&mi(n[0])&&di(n[1],r)}var jF=/^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 Jp(e){return jF.test(e)}var qF=/^(?!.*\.\.)[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 eu(e){return qF.test(e)}var co=36,tu=1,df=26,BF=38,FF=700,HF=72,KF=128;function zF(e,r,n){e=n?Math.floor(e/FF):e>>1,e+=Math.floor(e/r);let o=0;for(;e>(co-tu)*df>>1;)e=Math.floor(e/(co-tu)),o+=co;return o+Math.floor((co-tu+1)*e/(e+BF))}function ER(e){let r=[],n=KF,o=0,i=HF,a=e.lastIndexOf("-");if(a>0)for(let l=0;l<a;l++){let d=e.charCodeAt(l);if(d>=128)throw new Error("Invalid punycode: non-basic before delimiter");r.push(d)}let c=a<0?0:a+1;for(;c<e.length;){let l=o,d=1,f=co;for(;;){if(c>=e.length)throw new Error("Invalid punycode: unexpected end of input");let _=e.charCodeAt(c++),I;if(_>=97&&_<=122)I=_-97;else if(_>=48&&_<=57)I=_-48+26;else if(_>=65&&_<=90)fe();else throw new Error("Invalid punycode: bad digit character");o+=I*d;let g=f<=i?tu:f>=i+df?df:f-i;if(I<g)break;d*=co-g,f+=co}let y=r.length+1;i=zF(o-l,y,l===0),n+=Math.floor(o/y),o%=y,r.splice(o,0,n),o++}return globalThis.String.fromCodePoint(...r)}function VF(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function QF(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function WF(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function ZF(e){return VF(e)||QF(e)||WF(e)}var XF=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),JF=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 eH(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function tH(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function rH(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function nH(e){return new RegExp("\\p{Script=Katakana}","u").test(String.fromCodePoint(e))}function oH(e){return new RegExp("\\p{Script=Han}","u").test(String.fromCodePoint(e))}function iH(e){return e>=1632&&e<=1641}function aH(e){return e>=1776&&e<=1785}function TR(e){return JF.has(e)}function _R(e){if(e.length===0)return fe();let r=[...e].map(c=>c.codePointAt(0)),n=r.length;if(r[0]===45||r[n-1]===45||n>=4&&r[2]===45&&r[3]===45||ZF(r[0]))return!1;let o=!1,i=!1,a=!1;for(let c=0;c<n;c++){let l=r[c];if(XF.has(l))return!1;(rH(l)||nH(l)||oH(l))&&(o=!0),iH(l)&&(i=!0),aH(l)&&(a=!0);let d=r[c-1],f=r[c+1];switch(l){case 183:if(d!==108||f!==108)return!1;break;case 885:if(f===void 0||!eH(f))return!1;break;case 1523:case 1524:if(d===void 0||!tH(d))return!1;break;case 8204:if(d===void 0||d<128&&!TR(d))return!1;break;case 8205:if(d===void 0||!TR(d))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o||i&&a)}function sH(e){if(e.charCodeAt(0)===45||e.charCodeAt(e.length-1)===45||e.length>=4&&e.charCodeAt(2)===45&&e.charCodeAt(3)===45)return!1;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(!(n>=97&&n<=122||n>=65&&n<=90||n>=48&&n<=57||n===45))return!1}return!0}function IR(e){return e.toLowerCase().startsWith("xn--")}function bR(e){try{let r=e.slice(4).toLowerCase();if(r.lastIndexOf("-")===0)return!1;let o=ER(r);return o?_R(o):!1}catch{return!1}}function SR(e){return e.length===0||e.length>63?!1:IR(e)?bR(e):_R(e)}function OR(e){return e.length===0||e.length>63?!1:IR(e)?bR(e):sH(e)}function ru(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(let r of e.split("."))if(!OR(r))return!1;return!0}var pH=/^(?!.*\.\.)[\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 nu(e){return pH.test(e)}function ou(e){if(e.length===0||e.includes(" "))return!1;let r=e.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g,".");if(r.length>253)return!1;for(let n of r.split("."))if(!SR(n))return!1;return!0}function ff(e,r,n){let o=0,i=0,a=0,c=0;for(let l=r;l<n;l++){let d=e.charCodeAt(l);if(d===46){if(a===0||i>255||c===48&&a>1)return!1;o++,i=0,a=0,c=0}else if(d>=48&&d<=57)a===0&&(c=d),i=i*10+(d-48),a++;else return!1}return o===3&&a>0&&i<=255&&!(c===48&&a>1)}function iu(e){return ff(e,0,e.length)}function uH(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function au(e){let r=e.length;if(r===0)return!1;let n=0,o=!1,i=0;if(e.charCodeAt(0)===58&&e.charCodeAt(1)===58){if(r===2)return!0;o=!0,i=2}for(;i<r;){let a=0,c=i;for(;i<r&&uH(e.charCodeAt(i));)i++,a++;if(a===0)return!1;let l=e.charCodeAt(i);if(l===46){if(!ff(e,c,r))return!1;n+=2,i=r;break}if(a>4)return!1;if(n++,i===r)break;if(l!==58)return!1;if(i++,e.charCodeAt(i)===58){if(o||e.charCodeAt(i+1)===58)return!1;if(o=!0,i++,i===r)break}}return o?n<=7:n===8}function AR(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function su(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))?AR(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&r===-1?!1:AR(e)}function cu(e){try{return new URL(e),!0}catch{return!1}}var lH=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function pu(e){return lH.test(e)}var mH=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function uu(e){return mH.test(e)}function lu(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var dH=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function mu(e){return dH.test(e)}var fH=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function du(e){return fH.test(e)}var gH=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;function fu(e){return gH.test(e)}function xR(e){return e>=97&&e<=122||e>=65&&e<=90}function RR(e){return xR(e)||e>=48&&e<=57}function gu(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function yH(e){return RR(e)||e===43||e===45||e===46}function gf(e){return RR(e)||e===45||e===46||e===95||e===126}function yf(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 hH(e){return gf(e)||yf(e)||e===58||e===64}function yu(e){let r=e.length;if(r===0||!xR(e.charCodeAt(0)))return!1;let n=1;for(;n<r;){let o=e.charCodeAt(n);if(o===58)break;if(!yH(o))return!1;n++}if(e.charCodeAt(n)!==58)return!1;if(n++,e.charCodeAt(n)===47&&e.charCodeAt(n+1)===47){n+=2;let o=n,i=-1;for(let a=n;a<r;a++){let c=e.charCodeAt(a);if(c===64){i=a;break}if(c===47||c===63||c===35)break}if(i!==-1){for(let a=o;a<i;a++){let c=e.charCodeAt(a);if(c===91||c===93)return!1;if(c===37){if(a+2>=i||!gu(e.charCodeAt(a+1))||!gu(e.charCodeAt(a+2)))return!1;a+=2}else if(!gf(c)&&!yf(c)&&c!==58)return!1}n=i+1}if(e.charCodeAt(n)===91){for(n++;n<r&&e.charCodeAt(n)!==93;)n++;if(e.charCodeAt(n)!==93)return!1;n++}else for(;n<r;){let a=e.charCodeAt(n);if(a===47||a===63||a===35||a===58)break;if(a<128&&!gf(a)&&!yf(a))return!1;n++}if(e.charCodeAt(n)===58)for(n++;n<r;){let a=e.charCodeAt(n);if(a===47||a===63||a===35)break;if(a<48||a>57)return!1;n++}}for(;n<r;){let o=e.charCodeAt(n);if(o===37){if(n+2>=r||!gu(e.charCodeAt(n+1))||!gu(e.charCodeAt(n+2)))return!1;n+=2}else{if(o>127)return!1;if(!(hH(o)||o===47||o===63||o===35))return!1}n++}return!0}var EH=/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;function hu(e){return EH.test(e)}var TH=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Eu(e){return TH.test(e)}var Oe=new Map;function CR(){Oe.clear()}function _H(){return[...Oe.entries()]}function IH(e,r){Oe.set(e,r)}function bH(e){return Oe.has(e)}function SH(e){return Oe.get(e)}function OH(e,r){return Oe.get(e)?.(r)??!0}function PR(){CR(),Oe.set("date-time",Xp),Oe.set("date",mi),Oe.set("duration",Jp),Oe.set("email",eu),Oe.set("hostname",ru),Oe.set("idn-email",nu),Oe.set("idn-hostname",ou),Oe.set("ipv4",iu),Oe.set("ipv6",au),Oe.set("iri-reference",su),Oe.set("iri",cu),Oe.set("json-pointer-uri-fragment",pu),Oe.set("json-pointer",uu),Oe.set("regex",lu),Oe.set("relative-json-pointer",mu),Oe.set("time",di),Oe.set("uri-reference",du),Oe.set("uri-template",fu),Oe.set("uri",yu),Oe.set("url",hu),Oe.set("uuid",Eu)}PR();function hf(e,r,n,o){return fi.Test(n.format,o)}function UR(e,r,n,o,i,a){return hf(e,r,i,a)||r.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function wR(e,r,n,o){let i=tf(n)?n.then:!0,a=jd(n)?n.else:!0;return ne(e,r,n.if,o)?ne(e,r,i,o):ne(e,r,a,o)}function vR(e,r,n,o,i,a){let c=tf(i)?i.then:!0,l=jd(i)?i.else:!0,d=new at,f=_e(e,d,`${n}/if`,o,i.if,a)?_e(e,d,`${n}/then`,o,c,a)||r.AddError({keyword:"if",schemaPath:n,instancePath:o,params:{failingKeyword:"then"}}):_e(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 AH(e,r,n,o){return s.Every(n.items,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Ht(e,r,i,o[a])&&r.AddIndex(a))}function xH(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)||Kt(e,r,d,f,c,a[l])&&r.AddIndex(l)})}function RH(e,r,n,o){let i=pi(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>Ht(e,r,n.items,a)&&r.AddIndex(c))}function CH(e,r,n,o,i,a){let c=pi(i)?i.prefixItems.length:0;return s.EveryAll(a,c,(l,d)=>{let f=`${n}/items`,y=`${o}/${d}`;return Kt(e,r,f,y,i.items,l)&&r.AddIndex(d)})}function NR(e,r,n,o){return Hd(n)?AH(e,r,n,o):RH(e,r,n,o)}function LR(e,r,n,o,i,a){return Hd(i)?xH(e,r,n,o,i,a):CH(e,r,n,o,i,a)}function PH(e){return io(e)}function Ef(e,r,n,o){if(!PH(n))return!0;let i=s.Counted(o,a=>ne(e,r,n.contains,a));return s.IsLessEqualThan(i,n.maxContains)}function kR(e,r,n,o,i,a){let c=ao(i)?i.minContains:1;return Ef(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function Tf(e,r,n,o){return s.IsLessEqualThan(o,n.maximum)}function MR(e,r,n,o,i,a){return Tf(e,r,i,a)||r.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function _f(e,r,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function DR(e,r,n,o,i,a){return _f(e,r,i,a)||r.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function If(e,r,n,o){return s.IsMaxLength(o,n.maxLength)}function GR(e,r,n,o,i,a){return If(e,r,i,a)||r.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function bf(e,r,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function $R(e,r,n,o,i,a){return bf(e,r,i,a)||r.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function UH(e){return io(e)}function Sf(e,r,n,o){if(!UH(n))return!0;let i=s.Counted(o,(a,c)=>ne(e,r,n.contains,a)&&r.AddIndex(c));return s.IsGreaterEqualThan(i,n.minContains)}function jR(e,r,n,o,i,a){return Sf(e,r,i,a)||r.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function Of(e,r,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function qR(e,r,n,o,i,a){return Of(e,r,i,a)||r.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function Af(e,r,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function BR(e,r,n,o,i,a){return Af(e,r,i,a)||r.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function xf(e,r,n,o){return s.IsMinLength(o,n.minLength)}function FR(e,r,n,o,i,a){return xf(e,r,i,a)||r.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function Rf(e,r,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function HR(e,r,n,o,i,a){return Rf(e,r,i,a)||r.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function Cf(e,r,n,o){return s.IsMultipleOf(o,n.multipleOf)}function KR(e,r,n,o,i,a){return Cf(e,r,i,a)||r.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function Pf(e,r,n,o){let i=new At;return!ne(e,i,n.not,o)&&r.Merge([i])}function zR(e,r,n,o,i,a){return Pf(e,r,i,a)||r.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function YR(e,r,n,o){let i=n.oneOf.reduce((a,c)=>{let l=new At;return ne(e,l,c,o)?[...a,l]:a},[]);return s.IsEqual(i.length,1)&&r.Merge(i)}function VR(e,r,n,o,i,a){let c=[],l=[],d=i.oneOf.reduce((y,_,I)=>{let g=new at,E=`${n}/oneOf/${I}`,O=_e(e,g,E,o,_,a);return O&&l.push(I),O||c.push(g),O?[...y,g]:y},[]),f=s.IsEqual(d.length,1)&&r.Merge(d);return!f&&s.IsEqual(l.length,0)&&c.forEach(y=>y.GetErrors().forEach(_=>r.AddError(_))),f||r.AddError({keyword:"oneOf",schemaPath:n,instancePath:o,params:{passingSchemas:l}})}function Uf(e,r,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(o)}function QR(e,r,n,o,i,a){return Uf(e,r,i,a)||r.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function WR(e,r,n,o){return s.Every(s.Entries(n.patternProperties),0,([i,a])=>{let c=new RegExp(i,"u");return s.Every(s.Entries(o),0,([l,d])=>!c.test(l)||Ht(e,r,a,d)&&r.AddKey(l))})}function ZR(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,"u");return s.EveryAll(s.Entries(a),0,([y,_])=>{let I=`${o}/${y}`;return!f.test(y)||Kt(e,r,d,I,l,_)&&r.AddKey(y)})})}function XR(e,r,n,o){return s.IsEqual(o.length,0)||s.Every(n.prefixItems,0,(i,a)=>s.IsLessEqualThan(o.length,a)||Ht(e,r,i,o[a])&&r.AddIndex(a))}function JR(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)||Kt(e,r,d,f,c,a[l])&&r.AddIndex(l)})}function wf(e,r){return e.includes(r)||tt.Get().exactOptionalPropertyTypes}function vf(e,r){return s.IsUndefined(e[r])}function eC(e,r,n,o){let i=so(n)?n.required:[];return s.Every(s.Entries(n.properties),0,([c,l])=>{let d=!s.HasPropertyKey(o,c)||Ht(e,r,l,o[c])&&r.AddKey(c);return wf(i,c)?d:vf(o,c)||d})}function tC(e,r,n,o,i,a){let c=so(i)?i.required:[];return s.EveryAll(s.Entries(i.properties),0,([d,f])=>{let y=`${n}/properties/${d}`,_=`${o}/${d}`,I=()=>!s.HasPropertyKey(a,d)||Kt(e,r,y,_,f,a[d])&&r.AddKey(d);return wf(c,d)?I():vf(a,d)||I()})}function rC(e,r,n,o){return s.Every(s.Keys(o),0,(i,a)=>ne(e,r,n.propertyNames,i))}function nC(e,r,n,o,i,a){let c=[];return s.EveryAll(s.Keys(a),0,(d,f)=>{let y=`${o}/${d}`,_=`${n}/propertyNames`,I=new at,g=_e(e,I,_,y,i.propertyNames,d);return g||c.push(d),g})||r.AddError({keyword:"propertyNames",schemaPath:n,instancePath:o,params:{propertyNames:c}})}function oC(e,r,n,o){let i=e.RecursiveRef(n)??!1;return q(i)&&ne(e,r,i,o)}function iC(e,r,n,o,i,a){let c=e.RecursiveRef(i)??!1;return q(c)&&_e(e,r,"#",o,c,a)}function aC(e,r,n,o){let i=e.Ref(n)??!1,a=new At,c=q(i)&&ne(e,a,i,o);return c&&r.Merge([a]),c}function sC(e,r,n,o,i,a){let c=e.Ref(i)??!1,l=new at,d=q(c)&&_e(e,l,"#",o,c,a);return d&&r.Merge([l]),d||l.GetErrors().forEach(f=>r.AddError(f)),d}function cC(e,r,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function pC(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 Nf(e,r,n,o,i){return s.IsEqual(n,"object")?s.IsObjectNotArray(i):s.IsEqual(n,"array")?s.IsArray(i):s.IsEqual(n,"boolean")?s.IsBoolean(i):s.IsEqual(n,"integer")?s.IsInteger(i):s.IsEqual(n,"number")?s.IsNumber(i):s.IsEqual(n,"null")?s.IsNull(i):s.IsEqual(n,"string")?s.IsString(i):s.IsEqual(n,"bigint")?s.IsBigInt(i):s.IsEqual(n,"constructor")?s.IsConstructor(i):s.IsEqual(n,"function")?s.IsFunction(i):s.IsEqual(n,"symbol")?s.IsSymbol(i):s.IsEqual(n,"undefined")?s.IsUndefined(i):s.IsEqual(n,"void")?s.IsUndefined(i):!0}function uC(e,r,n,o,i){return s.Some(n,a=>Nf(e,r,a,o,i))}function lC(e,r,n,o){return s.IsArray(n.type)?uC(e,r,n.type,n,o):Nf(e,r,n.type,n,o)}function mC(e,r,n,o,i,a){return(s.IsArray(i.type)?uC(e,r,i.type,i,a):Nf(e,r,i.type,i,a))||r.AddError({keyword:"type",schemaPath:n,instancePath:o,params:{type:i.type}})}function dC(e,r,n,o){let i=r.GetIndices();return s.Every(o,0,(a,c)=>(i.has(c)||ne(e,r,n.unevaluatedItems,a))&&r.AddIndex(c))}function fC(e,r,n,o,i,a){let c=r.GetIndices(),l=[];return s.EveryAll(a,0,(f,y)=>{let _=new at,I=(c.has(y)||_e(e,_,n,o,i.unevaluatedItems,f))&&r.AddIndex(y);return I||l.push(y),I})||r.AddError({keyword:"unevaluatedItems",schemaPath:n,instancePath:o,params:{unevaluatedItems:l}})}function gC(e,r,n,o){let i=r.GetKeys();return s.Every(s.Entries(o),0,([a,c])=>i.has(a)||ne(e,r,n.unevaluatedProperties,c)&&r.AddKey(a))}function yC(e,r,n,o,i,a){let c=r.GetKeys(),l=[];return s.EveryAll(s.Entries(a),0,([f,y])=>{let _=new at,I=c.has(f)||_e(e,_,n,o,i.unevaluatedProperties,y)&&r.AddKey(f);return I||l.push(f),I})||r.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function hC(e){return!s.IsEqual(e.uniqueItems,!1)}function EC(e,r,n,o){if(!hC(n))return!0;let i=new Set(o.map(Gn.Hash)).size,a=o.length;return s.IsEqual(i,a)}function TC(e,r,n,o,i,a){if(!hC(i))return!0;let c=new Set,l=a.reduce((f,y,_)=>{let I=Gn.Hash(y);return c.has(I)?[...f,_]:(c.add(I),f)},[]);return s.IsEqual(l.length,0)||r.AddError({keyword:"uniqueItems",schemaPath:n,instancePath:o,params:{duplicateItems:l}})}function Ht(e,r,n,o){return r.Push()&&ne(e,r,n,o)&&r.Pop()}function ne(e,r,n,o){e.Push(n);let i=Yp(n)?of(e,r,n,o):(!rf(n)||lC(e,r,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!so(n)||cC(e,r,n,o))&&(!Br(n)||Xx(e,r,n,o))&&(!Md(n)||sR(e,r,n,o))&&(!Dd(n)||pR(e,r,n,o))&&(!Gd(n)||lR(e,r,n,o))&&(!Xa(n)||WR(e,r,n,o))&&(!Ja(n)||eC(e,r,n,o))&&(!Xd(n)||rC(e,r,n,o))&&(!Wa(n)||Rf(e,r,n,o))&&(!Vd(n)||bf(e,r,n,o)))&&(!s.IsArray(o)||(!vd(n)||Qx(e,r,n,o))&&(!io(n)||sf(e,r,n,o))&&(!si(n)||NR(e,r,n,o))&&(!zd(n)||Ef(e,r,n,o))&&(!Vp(n)||_f(e,r,n,o))&&(!ao(n)||Sf(e,r,n,o))&&(!ci(n)||Af(e,r,n,o))&&(!pi(n)||XR(e,r,n,o))&&(!ui(n)||EC(e,r,n,o)))&&(!s.IsString(o)||(!Yd(n)||If(e,r,n,o))&&(!Qa(n)||xf(e,r,n,o))&&(!Va(n)||hf(e,r,n,o))&&(!Za(n)||Uf(e,r,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!Bd(n)||lf(e,r,n,o))&&(!Fr(n)||mf(e,r,n,o))&&(!Kd(n)||Tf(e,r,n,o))&&(!Kr(n)||Of(e,r,n,o))&&(!Qd(n)||Cf(e,r,n,o)))&&(!ef(n)||aC(e,r,n,o))&&(!Jd(n)||oC(e,r,n,o))&&(!$d(n)||dR(e,r,n,o))&&(!kd(n)||af(e,r,n,o))&&(!qd(n)||uf(e,r,n,o))&&(!Fd(n)||wR(e,r,n,o))&&(!Wd(n)||Pf(e,r,n,o))&&(!Nd(n)||eR(e,r,n,o))&&(!Ld(n)||rR(e,r,n,o))&&(!Zd(n)||YR(e,r,n,o))&&(!Wp(n)||!s.IsArray(o)||dC(e,r,n,o))&&(!Zp(n)||!s.IsObject(o)||gC(e,r,n,o))&&(!wd(n)||zx(e,r,n,o));return e.Pop(n),i}function Kt(e,r,n,o,i,a){return r.Push()&&_e(e,r,n,o,i,a)&&r.Pop()}function _e(e,r,n,o,i,a){e.Push(i);let c=Yp(i)?oR(e,r,n,o,i,a):!!(+(!rf(i)||mC(e,r,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!so(i)||pC(e,r,n,o,i,a))&+(!Br(i)||Jx(e,r,n,o,i,a))&+(!Md(i)||cR(e,r,n,o,i,a))&+(!Dd(i)||uR(e,r,n,o,i,a))&+(!Gd(i)||mR(e,r,n,o,i,a))&+(!Xa(i)||ZR(e,r,n,o,i,a))&+(!Ja(i)||tC(e,r,n,o,i,a))&+(!Xd(i)||nC(e,r,n,o,i,a))&+(!Wa(i)||HR(e,r,n,o,i,a))&+(!Vd(i)||$R(e,r,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!vd(i)||Wx(e,r,n,o,i,a))&+(!io(i)||aR(e,r,n,o,i,a))&+(!si(i)||LR(e,r,n,o,i,a))&+(!zd(i)||kR(e,r,n,o,i,a))&+(!Vp(i)||DR(e,r,n,o,i,a))&+(!ao(i)||jR(e,r,n,o,i,a))&+(!ci(i)||BR(e,r,n,o,i,a))&+(!pi(i)||JR(e,r,n,o,i,a))&+(!ui(i)||TC(e,r,n,o,i,a))))&+(!s.IsString(a)||!!(+(!Yd(i)||GR(e,r,n,o,i,a))&+(!Qa(i)||FR(e,r,n,o,i,a))&+(!Va(i)||UR(e,r,n,o,i,a))&+(!Za(i)||QR(e,r,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!Bd(i)||yR(e,r,n,o,i,a))&+(!Fr(i)||hR(e,r,n,o,i,a))&+(!Kd(i)||MR(e,r,n,o,i,a))&+(!Kr(i)||qR(e,r,n,o,i,a))&+(!Qd(i)||KR(e,r,n,o,i,a))))&+(!ef(i)||sC(e,r,n,o,i,a))&+(!Jd(i)||iC(e,r,n,o,i,a))&+(!$d(i)||fR(e,r,n,o,i,a))&+(!kd(i)||iR(e,r,n,o,i,a))&+(!qd(i)||gR(e,r,n,o,i,a))&+(!Fd(i)||vR(e,r,n,o,i,a))&+(!Wd(i)||zR(e,r,n,o,i,a))&+(!Nd(i)||tR(e,r,n,o,i,a))&+(!Ld(i)||nR(e,r,n,o,i,a))&+(!Zd(i)||VR(e,r,n,o,i,a))&+(!Wp(i)||!s.IsArray(a)||fC(e,r,n,o,i,a))&+(!Zp(i)||!s.IsObject(a)||yC(e,r,n,o,i,a)))&&(!wd(i)||Yx(e,r,n,o,i,a));return e.Pop(i),c}var In={};zt(In,{DynamicRef:()=>KH,Ref:()=>kf});var gi={};zt(gi,{Delete:()=>GH,Get:()=>MH,Has:()=>kH,Indices:()=>ns,Set:()=>DH});function _C(e){if(e.length===0)throw Error("Cannot set root")}function IC(e){if(!s.IsObject(e))throw Error("Cannot set value")}function wH(e){if(s.IsUnsafePropertyKey(e))throw Error("Pointer contains unsafe property key")}function bC(e){for(let r of e)wH(r)}function vH(e){return/^(0|[1-9]\d*)$/.test(e)}function SC(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function NH(e,r){return s.IsObject(r)&&s.HasPropertyKey(r,e)}function LH(e,r){return s.IsObject(r)&&!s.IsUnsafePropertyKey(e)?r[e]:void 0}function Lf(e,r){return e.reduce((n,o)=>LH(o,n),r)}function ns(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 kH(e,r){let n=e;return ns(r).every(o=>NH(o,n)?(n=n[o],!0):!1)}function MH(e,r){let n=ns(r);return Lf(n,e)}function DH(e,r,n){let o=ns(r);_C(o),bC(o);let[i,a]=SC(o),c=Lf(i,e);return IC(c),c[a]=n,e}function GH(e,r){let n=ns(r);_C(n),bC(n);let[o,i]=SC(n),a=Lf(o,e);return IC(a),s.IsArray(a)&&vH(i)?a.splice(+i,1):delete a[i],e}function $H(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("#")?OC(e,r,n):e}function jH(e,r,n){let o=new URL(`#${e.$anchor}`,r.href),i=new URL(n.href,r.href);return s.IsEqual(o.href,i.href)?e:void 0}function qH(e,r,n){let o=new URL(`#${e.$dynamicAnchor}`,r.href),i=new URL(n.href,r.href);return s.IsEqual(o.href,i.href)?e:void 0}function OC(e,r,n){if(n.href.endsWith("#"))return e;if(!n.hash.startsWith("#"))return;let o=decodeURIComponent(n.hash.slice(1));if(o.startsWith("/"))return gi.Get(e,o)}function BH(e,r,n){if(Hr(e)){let o=$H(e,r,n);if(!s.IsUndefined(o))return o}if(Ya(e)){let o=jH(e,r,n);if(!s.IsUndefined(o))return o}if(_n(e)){let o=qH(e,r,n);if(!s.IsUndefined(o))return o}return OC(e,r,n)}function FH(e,r,n){return e.reduce((o,i)=>{let a=Mf(i,r,n);return s.IsUndefined(a)?o:a},void 0)}function HH(e,r,n){return s.Keys(e).reduce((o,i)=>{let a=Mf(e[i],r,n);return s.IsUndefined(a)?o:a},void 0)}function Mf(e,r,n){let o=nr(e)&&Hr(e)?new URL(e.$id,r.href):r;if(nr(e)){let i=BH(e,o,n);if(!s.IsUndefined(i))return i}if(s.IsArray(e))return FH(e,o,n);if(s.IsObject(e))return HH(e,o,n)}function kf(e,r){let n=new URL("http://unknown/"),o=Hr(e)?new URL(e.$id,n.href):n,i=new URL(r,o.href);return Mf(e,o,i)}function KH(e,r,n,o){let i=n.$dynamicRef.startsWith("#")?kf(r,n.$dynamicRef):kf(e,n.$dynamicRef);return s.IsUndefined(i)?void 0:!nr(i)||!_n(i)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?i:o.find(l=>l.$dynamicAnchor===i.$dynamicAnchor)??i}var yi=function(e,r,n,o){if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?e!==r||!o:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?o:n==="a"?o.call(e):o?o.value:r.get(e)},bn,AC,xC,RC,CC,po=class{constructor(r,n){bn.add(this),this.context=r,this.schema=n,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((r,n)=>new URL(n.$id,r),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(r){nr(r)&&(Hr(r)&&(this.ids.push(r),yi(this,bn,"m",AC).call(this,r)),Ya(r)&&this.anchors.push(r),Qp(r)&&this.recursiveAnchors.push(r),_n(r)&&this.dynamicAnchors.push(r))}Pop(r){nr(r)&&(Hr(r)&&(this.ids.pop(),yi(this,bn,"m",xC).call(this,r)),Ya(r)&&this.anchors.pop(),Qp(r)&&this.recursiveAnchors.pop(),_n(r)&&this.dynamicAnchors.pop())}Ref(r){return yi(this,bn,"m",RC).call(this,r)??yi(this,bn,"m",CC).call(this,r)}RecursiveRef(r){return Qp(this.Base())?In.Ref(this.recursiveAnchors[0],r.$recursiveRef):In.Ref(this.Base(),r.$recursiveRef)}DynamicRef(r){let n=this.schema;return In.DynamicRef(n,this.Base(),r,this.dynamicAnchors)}};bn=new WeakSet,AC=function e(r,n=!0){if(!nr(r))return;let o=r;if(!(!n&&Hr(o))){!n&&_n(o)&&this.dynamicAnchors.push(o);for(let i of s.Keys(o))yi(this,bn,"m",e).call(this,o[i],!1)}},xC=function e(r,n=!0){if(!nr(r))return;let o=r;if(!(!n&&Hr(o))){!n&&_n(o)&&this.dynamicAnchors.pop();for(let i of s.Keys(o))yi(this,bn,"m",e).call(this,o[i],!1)}},RC=function(r){return s.HasPropertyKey(this.context,r.$ref)?this.context[r.$ref]:void 0},CC=function(r){let n=this.schema;return r.$ref.startsWith("#")?In.Ref(this.Base(),r.$ref):In.Ref(n,r.$ref)};function Tu(...e){let[r,n,o]=oe.Match(e,{3:(y,_,I)=>[y,_,I],2:(y,_)=>[{},y,_]}),i=tt.Get(),a=dh(),c=[],l=new po(r,n),d=new es(y=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...y,message:a(y)})});return[_e(l,d,"#","",n,o),c]}function Gf(...e){let[r,n,o]=oe.Match(e,{3:(c,l,d)=>[c,l,d],2:(c,l)=>[{},c,l]}),i=new po(r,n),a=new At;return ne(i,a,n,o)}function ge(...e){let[r,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return Gf(r,n,o)}function Sn(...e){let[r,n,o]=oe.Match(e,{3:(c,l,d)=>[c,l,d],2:(c,l)=>[{},c,l]}),[i,a]=Tu(r,n,o);return a}var On=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 PC(e,r,n){return s.IsArray(n)?n.map(o=>st(e,r.items,o)):n}function UC(e,r,n){return st({...e,...r.$defs},rt(r.$ref),n)}function VH(e,r){let n=s.HasPropertyKey(r,"unevaluatedProperties")?{additionalProperties:r.unevaluatedProperties}:{},o=Vt(e,r),i=ft(o);return D(i)?Ep(i,n):i}function wC(e,r,n){let o=VH(e,r);return st(e,o,n)}function _u(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function vC(e,r,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=_u(r);for(let i of s.Keys(n)){if(s.HasPropertyKey(r.properties,i)){n[i]=st(e,r.properties[i],n[i]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Pe(o)&&ge(e,o,n[i])){n[i]=st(e,o,n[i]);continue}delete n[i]}return n}function NC(e,r,n){if(!s.IsObject(n))return n;let o=_u(r),[i,a]=[new RegExp(ot(r)),be(r)];for(let c of s.Keys(n)){if(i.test(c)){n[c]=st(e,a,n[c]);continue}if(s.IsBoolean(o)&&s.IsEqual(o,!0)||Pe(o)&&ge(e,o,n[c])){n[c]=st(e,o,n[c]);continue}delete n[c]}return n}function LC(e,r,n){return s.HasPropertyKey(e,r.$ref)?st(e,e[r.$ref],n):n}function kC(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]=st(e,r.items[i],n[i]);return s.IsGreaterThan(n.length,o)?n.slice(0,o):n}function $e(e){return kn(e)}function MC(e,r,n){for(let o of r.anyOf){let i=st(e,o,$e(n));if(ge(e,o,i))return i}return n}function st(e,r,n){return Z(r)?PC(e,r,n):he(r)?UC(e,r,n):M(r)?wC(e,r,n):D(r)?vC(e,r,n):de(r)?NC(e,r,n):ce(r)?LC(e,r,n):Y(r)?kC(e,r,n):R(r)?MC(e,r,n):n}function QH(e,r){for(let n of dc.Keys(e))dc.HasPropertyKey(r,n)||(r[n]=e[n]);return r}function WH(e){let r={};for(let n of dc.Keys(e))r[n]=os(e[n]);return r}function ZH(e){return $f(nO(e))}function $f(e){return e.map(r=>os(r))}function os(e){let r=Z(e)?Ct(os(e.items),Io(e)):M(e)?ut($f(e.allOf)):R(e)?B(ZH(e.anyOf)):D(e)?k(WH(e.properties)):de(e)?Uo(pn(e),os(be(e))):Y(e)?Le($f(e.items)):e;return QH(e,r)}function hi(e){return os(e)}function br(...e){let[r,n,o]=oe.Match(e,{3:(a,c,l)=>[a,c,l],2:(a,c)=>[{},a,c]}),i=tt.Get().unionPrioritySort?hi(n):n;return st(r,i,o)}var ie={};zt(ie,{Fail:()=>lo,IsOk:()=>jf,Ok:()=>L,TryArray:()=>XH,TryBigInt:()=>qf,TryBoolean:()=>u2,TryNull:()=>g2,TryNumber:()=>T2,TryString:()=>_2,TryUndefined:()=>A2});function jf(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function L(e){return{value:e}}function lo(){}function XH(e){return s.IsArray(e)?L(e):L([e])}function JH(e){return s.IsEqual(e,!0)?L(BigInt(1)):L(BigInt(0))}var e2=/^-?(0|[1-9]\d*)n$/,t2=/^-?(0|[1-9]\d*)\.\d+$/,r2=/^-?(0|[1-9]\d*)$/;function n2(e){return e2.test(e)}function o2(e){return t2.test(e)}function i2(e){return r2.test(e)}function a2(e){let r=e.toLowerCase();return n2(e)?L(BigInt(e.slice(0,e.length-1))):o2(e)?L(BigInt(e.split(".")[0])):i2(e)?L(BigInt(e)):s.IsEqual(r,"false")?L(BigInt(0)):s.IsEqual(r,"true")?L(BigInt(1)):void 0}function qf(e){return s.IsBigInt(e)?L(e):s.IsBoolean(e)?JH(e):s.IsNumber(e)?L(BigInt(Math.trunc(e))):s.IsNull(e)?L(BigInt(0)):s.IsString(e)?a2(e):s.IsUndefined(e)?L(BigInt(0)):void 0}function s2(e){return s.IsEqual(e,BigInt(0))?L(!1):s.IsEqual(e,BigInt(1))?L(!0):void 0}function c2(e){return s.IsEqual(e,0)?L(!1):s.IsEqual(e,1)?L(!0):void 0}function p2(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 u2(e){return s.IsBigInt(e)?s2(e):s.IsBoolean(e)?L(e):s.IsNumber(e)?c2(e):s.IsNull(e)?L(!1):s.IsString(e)?p2(e):s.IsUndefined(e)?L(!1):void 0}function l2(e){return s.IsEqual(e,BigInt(0))?L(null):void 0}function m2(e){return s.IsEqual(e,!1)?L(null):void 0}function d2(e){return s.IsEqual(e,0)?L(null):void 0}function f2(e){let r=e.toLowerCase();return s.IsEqual(r,"undefined")||s.IsEqual(r,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?L(null):void 0}function g2(e){return s.IsBigInt(e)?l2(e):s.IsBoolean(e)?m2(e):s.IsNumber(e)?d2(e):s.IsNull(e)?L(null):s.IsString(e)?f2(e):s.IsUndefined(e)?L(null):void 0}var DC=BigInt(Number.MAX_SAFE_INTEGER),GC=BigInt(Number.MIN_SAFE_INTEGER);function y2(e){return e<=DC&&e>=GC?L(Number(e)):void 0}function h2(e){return L(e?1:0)}function E2(e){let r=+e;if(s.IsNumber(r))return L(r);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 jf(o)?o.value<=DC&&o.value>=GC?L(Number(o.value)):void 0:void 0}function T2(e){return s.IsBigInt(e)?y2(e):s.IsBoolean(e)?h2(e):s.IsNumber(e)?L(e):s.IsNull(e)?L(0):s.IsString(e)?E2(e):s.IsUndefined(e)?L(0):void 0}function _2(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 I2(e){return s.IsEqual(e,BigInt(0))?L(void 0):void 0}function b2(e){return s.IsEqual(e,!1)?L(void 0):void 0}function S2(e){return s.IsEqual(e,0)?L(void 0):void 0}function O2(e){let r=e.toLowerCase();return s.IsEqual(r,"undefined")||s.IsEqual(r,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?L(void 0):void 0}function A2(e){return s.IsBigInt(e)?I2(e):s.IsBoolean(e)?b2(e):s.IsNumber(e)?S2(e):s.IsNull(e)?L(void 0):s.IsString(e)?O2(e):s.IsUndefined(e)?L(e):void 0}function $C(e,r,n){return ie.TryArray(n).value.map(i=>je(e,r.items,i))}function jC(e,r,n){let o=ie.TryBigInt(n);return ie.IsOk(o)?o.value:n}function qC(e,r,n){let o=ie.TryBoolean(n);return ie.IsOk(o)?o.value:n}function BC(e,r,n){return je({...e,...r.$defs},rt(r.$ref),n)}function FC(e,r,n){return je(e,ft(r),n)}function HC(e,r,n){let o=ie.TryNumber(n);return ie.IsOk(o)?Math.trunc(o.value):n}function KC(e,r,n){let o=Vt(e,r),i=ft(o);return je(e,i,n)}function x2(e,r,n){let o=ie.TryBigInt(n);return ie.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function R2(e,r,n){let o=ie.TryBoolean(n);return ie.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function C2(e,r,n){let o=ie.TryNumber(n);return ie.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function P2(e,r,n){let o=ie.TryString(n);return ie.IsOk(o)&&s.IsEqual(r.const,o.value)?o.value:n}function zC(e,r,n){return s.IsEqual(r.const,n)?n:bh(r)?x2(e,r,n):Sh(r)?R2(e,r,n):bc(r)?C2(e,r,n):Sc(r)?P2(e,r,n):fe()}function YC(e,r,n){let o=ie.TryNull(n);return ie.IsOk(o)?o.value:n}function VC(e,r,n){let o=ie.TryNumber(n);return ie.IsOk(o)?o.value:n}function Iu(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 is(e,r,n){return Je(e)&&s.IsUndefined(n[r])}function U2(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)||is(c,l,n)||(n[l]=je(e,c,n[l]));return s.HasPropertyKey(r,"additionalProperties")&&s.IsObject(r.additionalProperties)?Iu(e,o,r.additionalProperties,n):n}function QC(e,r,n){return s.IsObjectNotArray(n)?U2(e,r,n):n}function w2(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)?Iu(e,o,r.additionalProperties,n):n}function WC(e,r,n){return s.IsObjectNotArray(n)?w2(e,r,n):n}function ZC(e,r,n){return s.HasPropertyKey(e,r.$ref)?je(e,e[r.$ref],n):n}function XC(e,r,n){let o=ie.TryString(n);return ie.IsOk(o)?o.value:n}function JC(e,r,n){return je(e,ft(r),n)}function eP(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 tP(e,r,n){let o=ie.TryUndefined(n);return ie.IsOk(o)?o.value:n}function rP(e,r,n){if(r.anyOf.some(c=>ge(e,c,n)))return n;let a=r.anyOf.map(c=>je(e,c,$e(n))).find(c=>ge(e,r,c));return s.IsUndefined(a)?n:a}function nP(e,r,n){let o=ie.TryUndefined(n);return ie.IsOk(o)?void 0:n}function je(e,r,n){return Z(r)?$C(e,r,n):wt(r)?jC(e,r,n):Tt(r)?qC(e,r,n):he(r)?BC(e,r,n):ze(r)?FC(e,r,n):nt(r)?HC(e,r,n):M(r)?KC(e,r,n):Q(r)?zC(e,r,n):dr(r)?YC(e,r,n):Re(r)?VC(e,r,n):D(r)?QC(e,r,n):de(r)?WC(e,r,n):ce(r)?ZC(e,r,n):Qe(r)?XC(e,r,n):Ee(r)?JC(e,r,n):Y(r)?eP(e,r,n):tr(r)?tP(e,r,n):R(r)?rP(e,r,n):Lt(r)?nP(e,r,n):n}function An(...e){let[r,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return je(r,n,o)}function oP(e,r,n){if(!s.IsArray(n))return n;for(let o=0;o<n.length;o++)n[o]=ct(e,r.items,n[o]);return n}function iP(e,r,n){return ct({...e,...r.$defs},rt(r.$ref),n)}function aP(e,r){return s.IsUndefined(r)?s.IsFunction(e.default)?e.default():$e(e.default):r}function sP(e,r,n){let o=Vt(e,r),i=ft(o);return ct(e,i,n)}function cP(e,r,n){if(!s.IsObject(n))return n;let o=s.Keys(r.properties);for(let i of o){let a=ct(e,r.properties[i],n[i]);s.IsUndefined(a)&&(Je(r.properties[i])||!s.HasPropertyKey(r.properties[i],"default"))||(n[i]=a)}if(!Br(r)||s.IsBoolean(r.additionalProperties))return n;for(let i of s.Keys(n))o.includes(i)||(n[i]=ct(e,r.additionalProperties,n[i]));return n}function pP(e,r,n){if(!s.IsObject(n))return n;let[o,i]=[new RegExp(ot(r)),be(r)];for(let a of s.Keys(n))o.test(a)&&Ft(i)&&(n[a]=ct(e,i,n[a]));if(!Br(r))return n;for(let a of s.Keys(n))o.test(a)||(n[a]=ct(e,r.additionalProperties,n[a]));return n}function uP(e,r,n){return s.HasPropertyKey(e,r.$ref)?ct(e,e[r.$ref],n):n}function lP(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]=ct(e,o[a],n[a]));return n}function mP(e,r,n){for(let o of r.anyOf){let i=ct(e,o,$e(n));if(ge(e,o,i))return i}return n}function ct(e,r,n){let o=Ft(r)?aP(r,n):n;return Z(r)?oP(e,r,o):he(r)?iP(e,r,o):M(r)?sP(e,r,o):D(r)?cP(e,r,o):de(r)?pP(e,r,o):ce(r)?uP(e,r,o):Y(r)?lP(e,r,o):R(r)?mP(e,r,o):o}function mo(...e){let[r,n,o]=oe.Match(e,{3:(i,a,c)=>[i,a,c],2:(i,a)=>[{},i,a]});return ct(r,n,o)}function Ei(e){return(...r)=>{let[n,o,i]=oe.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 v2(e,r,n){return r["~codec"].decode(n)}function N2(e,r,n){return r["~codec"].encode(n)}function Ae(e,r,n,o){return $n(n)?s.IsEqual(e,"Decode")?v2(r,n,o):N2(r,n,o):o}function L2(e,r,n,o){if(!s.IsArray(o))return o;for(let i=0;i<o.length;i++)o[i]=Ce(e,r,n.items,o[i]);return Ae(e,r,n,o)}function k2(e,r,n,o){let i=Ae(e,r,n,o);if(!s.IsArray(i))return i;for(let a=0;a<i.length;a++)i[a]=Ce(e,r,n.items,i[a]);return i}function dP(e,r,n,o){return s.IsEqual(e,"Decode")?L2(e,r,n,o):k2(e,r,n,o)}function fP(e,r,n,o){return o=Ce(e,{...r,...n.$defs},rt(n.$ref),o),Ae(e,r,n,o)}function gP(e){return e.reduce((r,n)=>({...r,...n}),{})}function yP(e,r){for(let n of r)if(!s.IsDeepEqual(e,n))return n;return e}function M2(e,r,n,o){if(s.IsEqual(n.allOf.length,0))return Ae(e,r,n,o);let i=n.allOf.map(l=>Ce(e,r,l,br(l,$e(o)))),c=i.every(l=>s.IsObject(l))?gP(i):yP(o,i);return Ae(e,r,n,c)}function D2(e,r,n,o){if(s.IsEqual(n.allOf.length,0))return Ae(e,r,n,o);let i=Ae(e,r,n,o),a=n.allOf.map(l=>Ce(e,r,l,br(l,$e(i))));return a.every(l=>s.IsObject(l))?gP(a):yP(i,a)}function hP(e,r,n,o){return s.IsEqual(e,"Decode")?M2(e,r,n,o):D2(e,r,n,o)}function G2(e,r,n,o){if(!s.IsObjectNotArray(o))return o;for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||is(n.properties[i],i,o)||(o[i]=Ce(e,r,n.properties[i],o[i]));return Ae(e,r,n,o)}function $2(e,r,n,o){let i=Ae(e,r,n,o);if(!s.IsObjectNotArray(i))return i;for(let a of s.Keys(n.properties))!s.HasPropertyKey(i,a)||is(n.properties[a],a,i)||(i[a]=Ce(e,r,n.properties[a],i[a]));return i}function EP(e,r,n,o){return s.IsEqual(e,"Decode")?G2(e,r,n,o):$2(e,r,n,o)}function j2(e,r,n,o){if(!s.IsObjectNotArray(o))return o;let i=new RegExp(ot(n));for(let a of s.Keys(o))i.test(a)&&(o[a]=Ce(e,r,be(n),o[a]));return Ae(e,r,n,o)}function q2(e,r,n,o){let i=Ae(e,r,n,o);if(!s.IsObjectNotArray(i))return i;let a=new RegExp(ot(n));for(let c of s.Keys(i))a.test(c)&&(i[c]=Ce(e,r,be(n),i[c]));return i}function TP(e,r,n,o){return s.IsEqual(e,"Decode")?j2(e,r,n,o):q2(e,r,n,o)}function _P(e,r,n,o){return s.HasPropertyKey(r,n.$ref)?Ce(e,r,r[n.$ref],o):o}function IP(e,r,n,o){return s.IsEqual(e,"Decode")?Ae(e,r,n,_P(e,r,n,o)):_P(e,r,n,Ae(e,r,n,o))}function B2(e,r,n,o){if(!s.IsArray(o))return o;for(let i=0;i<Math.min(n.items.length,o.length);i++)o[i]=Ce(e,r,n.items[i],o[i]);return Ae(e,r,n,o)}function F2(e,r,n,o){let i=Ae(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]=Ce(e,r,n.items[a],i[a]);return i}function bP(e,r,n,o){return s.IsEqual(e,"Decode")?B2(e,r,n,o):F2(e,r,n,o)}function H2(e,r,n,o){for(let i of n.anyOf){if(!ge(r,i,o))continue;let a=Ce(e,r,i,o);return Ae(e,r,n,a)}return o}function K2(e,r,n,o){let i=Ae(e,r,n,o);for(let a of n.anyOf){let c=Ce(e,r,a,$e(i));if(ge(r,a,c))return c}return i}function SP(e,r,n,o){return s.IsEqual(e,"Decode")?H2(e,r,n,o):K2(e,r,n,o)}function Ce(e,r,n,o){return Z(n)?dP(e,r,n,o):he(n)?fP(e,r,n,o):M(n)?hP(e,r,n,o):D(n)?EP(e,r,n,o):de(n)?TP(e,r,n,o):ce(n)?IP(e,r,n,o):Y(n)?bP(e,r,n,o):R(n)?SP(e,r,n,o):Ae(e,r,n,o)}var Bf=class extends On{constructor(r,n){super("Decode",r,n)}};function z2(e,r,n){if(!ge(e,r,n))throw new Bf(n,Sn(e,r,n));return n}function Y2(e,r,n){let o=tt.Get().unionPrioritySort?hi(r):r;return Ce("Decode",e,o,n)}var c4e=Ei([(e,r,n)=>$e(n),(e,r,n)=>mo(e,r,n),(e,r,n)=>An(e,r,n),(e,r,n)=>br(e,r,n),(e,r,n)=>z2(e,r,n),(e,r,n)=>Y2(e,r,n)]);var Ff=class extends On{constructor(r,n){super("Encode",r,n)}};function V2(e,r,n){if(!ge(e,r,n))throw new Ff(n,Sn(e,r,n));return n}function Q2(e,r,n){let o=tt.Get().unionPrioritySort?hi(r):r;return Ce("Encode",e,o,n)}var I4e=Ei([(e,r,n)=>$e(n),(e,r,n)=>Q2(e,r,n),(e,r,n)=>mo(e,r,n),(e,r,n)=>An(e,r,n),(e,r,n)=>br(e,r,n),(e,r,n)=>V2(e,r,n)]);var Wt=class extends Error{constructor(r,n){super(n),this.type=r}};function OP(e,r){return s.IsFunction(r.default)?r.default(r):s.IsObject(r.default)?$e(r.default):r.default}function AP(e,r){if(ui(r)&&!Ft(r))throw new Wt(r,"Arrays with uniqueItems constraints must specify a default annotation");let n=ci(r)?r.minItems:0;return Array.from({length:n},()=>qe(e,r.items))}function xP(e,r){return Fr(r)?BigInt(r.exclusiveMinimum)+BigInt(1):Kr(r)?BigInt(r.minimum):BigInt(0)}function RP(e,r){return!1}function CP(e,r){let n=qe(e,r.instanceType);return class{constructor(){Object.assign(this,n)}}}function PP(e,r){return qe({...e,...r.$defs},rt(r.$ref))}function UP(e,r){return qe(e,ft(r))}function wP(e,r){let n=qe(e,r.returnType);return()=>n}function vP(e,r){return Fr(r)&&s.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:Kr(r)?r.minimum:0}function NP(e,r){let n=Vt(e,r),o=ft(n);return qe(e,o)}function LP(e,r){return r.const}function kP(e,r){throw new Wt(r,"Cannot create TNever types")}function MP(e,r){return null}function DP(e,r){return Fr(r)&&s.IsNumber(r.exclusiveMinimum)?r.exclusiveMinimum+1:Kr(r)?r.minimum:0}function GP(e,r){return(s.IsUndefined(r.required)?[]:r.required).reduce((o,i)=>({...o,[i]:qe(e,r.properties[i])}),{})}function $P(e,r){if(Wa(r)&&!Ft(r))throw new Wt(r,"Record with the minProperties constraint must have a default annotation");return{}}function jP(e,r){return s.HasPropertyKey(e,r.$ref)?qe(e,e[r.$ref]):(()=>{throw new Wt(r,"Unable to deref Ref")})()}function qP(e,r){if((Za(r)||Va(r))&&!Ft(r))throw Error("Strings with format or pattern constraints must specify default");let o=Qa(r)?r.minLength:0;return"".padEnd(o)}function BP(e,r){return Symbol()}function FP(e,r){let n=aa(r.pattern);if(Qe(n))throw new Wt(r,"Unable to create TemplateLiteral due to infinite type expansion");return qe(e,n)}function HP(e,r){return Array.from({length:r.minItems},(n,o)=>qe(e,r.items[o]))}function KP(e,r){if(s.IsEqual(r.anyOf.length,0))throw Error("Unable to create Union with no variants");return qe(e,r.anyOf[0])}function qe(e,r){return Ft(r)?OP(e,r):Z(r)?AP(e,r):wt(r)?xP(e,r):Tt(r)?RP(e,r):Fe(r)?CP(e,r):he(r)?PP(e,r):ze(r)?UP(e,r):He(r)?wP(e,r):nt(r)?vP(e,r):M(r)?NP(e,r):Q(r)?LP(e,r):Jt(r)?kP(e,r):dr(r)?MP(e,r):Re(r)?DP(e,r):D(r)?GP(e,r):de(r)?$P(e,r):ce(r)?jP(e,r):Qe(r)?qP(e,r):fr(r)?BP(e,r):Ee(r)?FP(e,r):Y(r)?HP(e,r):tr(r)?void 0:R(r)?KP(e,r):Lt(r)?void 0:void 0}function Sr(...e){let[r,n]=oe.Match(e,{2:(o,i)=>[o,i],1:o=>[{},o]});return qe(r,n)}var Hf=class extends On{constructor(r,n){super("Parse",r,n)}};function W2(e,r,n){if(!ge(e,r,n))throw new Hf(n,Sn(e,r,n));return n}var BYe=Ei([(e,r,n)=>$e(n),(e,r,n)=>mo(e,r,n),(e,r,n)=>An(e,r,n),(e,r,n)=>br(e,r,n),(e,r,n)=>W2(e,r,n)]);var X2=k({type:z("insert"),path:_t(),value:Ve()}),J2=Object({type:z("update"),path:_t(),value:Ve()}),eK=k({type:z("delete"),path:_t()}),QYe=B([X2,J2,eK]);function Ti(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]:Sr(r)}function Vr(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){J(Ti(o));return}let c=ai(a),l=await i()(o,{body:c});J(l)})}function VP(e,r){let n=e.command("grok").description("Test and preview grok parsing rules");Vr(n,"parse","Parse sample log lines with grok rules and return the extracted fields",Hx,r)}var QP=require("node:child_process"),WP=require("node:fs"),ZP=require("node:os"),Ou=require("node:path");var fo=require("node:fs");function as(e,r){let n=`${e}.tmp.${process.pid}`;(0,fo.writeFileSync)(n,r),(0,fo.renameSync)(n,e)}function ss(e){try{return(0,fo.readFileSync)(e,"utf8")}catch(r){if(r.code==="ENOENT")return;throw r}}function cs(e,r){if(r===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,fo.writeFileSync)(n,r),n}function go(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Kf="tsuga-dev/agent-plugins",bu="tsuga";function Su(e,r){V(` $ ${e} ${r.join(" ")}`);try{(0,QP.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 nK(e,r){V("Claude Code \u2192 installing Tsuga plugin"),Su("claude",["plugin","marketplace","add",Kf]),Su("claude",["plugin","install",`tsuga@${bu}`]),r.autoUpdate&&oK(e)}function oK(e){let r=(0,Ou.join)(e,".claude","settings.json");V(`Claude Code \u2192 ${r} (autoUpdate)`),(0,WP.mkdirSync)((0,Ou.dirname)(r),{recursive:!0});let n=ss(r),o=JSON.parse(n??"{}");if(!go(o))throw new Error(`${r} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!go(i))throw new Error(`${r} "extraKnownMarketplaces" must be a JSON object`);let a=i[bu],c=go(a)?a:{};o.extraKnownMarketplaces={...i,[bu]:{source:{source:"github",repo:Kf},...c,autoUpdate:!0}};let l=cs(r,n);as(r,`${JSON.stringify(o,null,2)}
|
|
139
|
-
`),V(l===void 0?" created":` patched (backup: ${l})`)}function iK(){V("Codex \u2192 installing Tsuga plugin"),Su("codex",["plugin","marketplace","add",Kf]),Su("codex",["plugin","add",`tsuga@${bu}`])}function XP(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=>{nK((0,ZP.homedir)(),n),V("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(()=>{iK(),V("Restart your codex session to load the new plugins.")})}var aK=10,sK=t.Object({key:p({allowEmpty:!1,description:"Attribute key this entry scopes by, e.g. context.service.name"}),value:t.Optional(p({allowEmpty:!1,description:"Value the key should equal, e.g. the service name. When omitted, any artifact scoped by this key matches the entry at full weight."})),valueMustMatch:t.Optional(t.Boolean({description:"When true, this entry is a hard filter rather than a weight: any widget or monitor that does not match it exactly (key = value) contributes no fields at all, instead of contributing at a reduced weight. Other widgets of the same dashboard still contribute if they match. Requires `value`."}))}),zf=t.Object({field:t.String({description:"Attribute dot-path, or a metric name (or metricName.context.attribute path) when `kind` is `metric`."}),kind:t.Enum(["attribute","metric"],{description:"Whether the field is a telemetry attribute or a metric name. `metric` appears only in the metrics bucket, for fields referenced as the aggregated field of a metrics-source query."}),inferredType:t.Enum(["numeric","categorical","unknown"],{description:"Value type inferred from how the field is used: `numeric` when aggregated with sum/average/percentile, referenced by numeric or range filters, or a metric name; `categorical` when only grouped by or matched with equality/text filters; `unknown` otherwise. Evidence-based \u2014 a numeric field used only in equality filters reads as categorical."}),score:t.Number({description:"TF-IDF-style usage score: usage-kind weights over log-damped, scope-overlap-weighted reference counts, discounted by how ubiquitous the field is across all artifacts org-wide. Higher = more evidence of scope-specific interest."}),artifacts:t.Number({description:"Distinct dashboards + monitors referencing this field"}),globalArtifacts:t.Number({description:"Org-wide artifacts referencing this field regardless of scope or caller permissions"}),usage:t.Object({groupBy:t.Number({description:"Distinct artifacts using this field as a group-by / split dimension"}),filter:t.Number({description:"Distinct artifacts filtering on this field in widget/monitor queries or dashboard-wide filters"}),measure:t.Number({description:"Distinct artifacts aggregating this field (aggregate.field)"}),column:t.Number({description:"Distinct artifacts pinning this field as a list-widget column"})},{description:"Distinct-artifact counts per usage kind \u2014 a dashboard referencing the field the same way in many widgets counts once"})}),Yf=t.Object({logs:t.Array(zf,{description:"Ranked fields from logs-sourced widgets and monitors (top 50 by score)"}),traces:t.Array(zf,{description:"Ranked fields from traces-sourced widgets and monitors (top 50 by score)"}),metrics:t.Array(zf,{description:"Ranked fields from metrics-sourced widgets and monitors (top 50 by score)"}),dashboardsMatched:t.Number({description:"Dashboards that matched the scope and survived per-artifact read authorization (dashboards the caller cannot read are removed and contribute nothing)"}),monitorsMatched:t.Number({description:"Monitors that matched the scope and survived per-artifact read authorization (monitors the caller cannot read are removed and contribute nothing)"})}),Vf=t.Object({scope:t.Array(sK,{minItems:1,maxItems:aK,description:"Scope entries, matched softly: an artifact's contribution is weighted by the fraction of entries it matches. Derive entries from a population-defining TQL query by taking its positive equality pairs."})}),Y6e=m({tags:["interesting-fields"],url:"/v0/interesting-fields",method:"POST",body:Vf,response:Yf});var cK=`/${"v1"}/interesting-fields`,pK={scope:[{key:"context.service.name",value:"payments"},{key:"context.env",value:"prod",valueMustMatch:!0}]},uK=t.Object(Vf.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: an artifact contributes in proportion to how many of them it matches, so a broader scope returns a broader ranking.",examples:[pK]}),JP=m({url:cK,method:"POST",operationId:"getInterestingFields",tags:["public","interesting-fields"],body:uK,response:Yf,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 eU(e,r){let n=e.command("interesting-fields").description("Discover the telemetry fields an org already uses for a scope");Vr(n,"list","Rank the log, trace and metric fields most relevant to a scope, mined from dashboards and monitors",JP,r)}var or="/v0/kubernetes-explorer",lK="^[a-z0-9.-]+$",mK="^[A-Za-z0-9._-]+$",tU=256,rU=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 Or=e=>t.Optional(t.Array(p({allowEmpty:!1}),{description:e})),nU={clusterId:rU,search:t.Optional(t.String({pattern:lK,minLength:1,maxLength:tU,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."}))},oU={clusterId:rU,search:t.Optional(t.String({pattern:mK,minLength:1,maxLength:tU,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."}))},iU=t.Object(nU),aU=t.Object(oU),ps={...nU,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:Or("Restrict results to these Kubernetes cluster names."),namespaces:Or("Restrict results to these namespaces."),teams:Or("Restrict results to these team names."),envs:Or("Restrict results to these environments."),...Te},sU=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],dK={...ps,nodes:Or("Restrict results to pods scheduled on these nodes."),deployments:Or("Restrict results to pods owned by these Deployments."),statefulsets:Or("Restrict results to pods owned by these StatefulSets."),daemonsets:Or("Restrict results to pods owned by these DaemonSets."),podStatus:t.Optional(t.Array(t.Enum(sU),{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."}))},_i=t.Enum(["asc","desc"],{description:"Sort direction. Defaults to ascending."}),fK=["deployment","statefulset","daemonset"],cU=t.Object({kind:t.Enum(fK,{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."}),pU=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(sU,{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(b({description:"Timestamp from pod start time telemetry for the selected pod instance. Present when pod start time telemetry is observed."}))}),Qf=t.Object({...pU.properties,workload:t.Optional(cU),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."}))}),gK=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],a5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/pods`,query:t.Object({...dK,sortBy:t.Optional(t.Enum(gK,{description:"Field to sort pods by."})),sortDirection:t.Optional(_i)}),paginated:!0,response:t.Array(Qf)}),Wf=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."}))}),yK=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],s5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/clusters`,query:t.Object({...oU,teams:Or("Restrict to clusters that host workloads from these team names."),envs:Or("Restrict to clusters that host workloads in these environments."),sortBy:t.Optional(t.Enum(yK,{description:"Field to sort clusters by."})),sortDirection:t.Optional(_i),...Te}),paginated:!0,response:t.Array(Wf)}),Zf=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."}))}),hK=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],c5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/namespaces`,query:t.Object({...ps,sortBy:t.Optional(t.Enum(hK,{description:"Field to sort namespaces by."})),sortDirection:t.Optional(_i)}),paginated:!0,response:t.Array(Zf)}),Xf=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."}))}),EK=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],p5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/deployments`,query:t.Object({...ps,sortBy:t.Optional(t.Enum(EK,{description:"Field to sort deployments by."})),sortDirection:t.Optional(_i)}),paginated:!0,response:t.Array(Xf)}),Jf=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."}))}),TK=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],u5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/statefulsets`,query:t.Object({...ps,sortBy:t.Optional(t.Enum(TK,{description:"Field to sort StatefulSets by."})),sortDirection:t.Optional(_i)}),paginated:!0,response:t.Array(Jf)}),eg=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."}))}),_K=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],l5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/daemonsets`,query:t.Object({...ps,sortBy:t.Optional(t.Enum(_K,{description:"Field to sort DaemonSets by."})),sortDirection:t.Optional(_i)}),paginated:!0,response:t.Array(eg)}),tg=t.Object({overview:t.Object({...pU.properties,workload:t.Optional(cU)},{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."})}),uU=t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),podName:p({allowEmpty:!1})}),m5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/pod-details`,query:uU,response:tg}),rg=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:b({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(b({description:"Timestamp when Tsuga last observed the pod deletion event. Present when the latest observed pod event is deleted."}))}),d5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/pod-manifest`,query:uU,response:rg}),ng=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."}),og=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(b({description:"Latest ReplicaSet metadata.creationTimestamp observed for the Deployment. Present when ReplicaSet object telemetry is observed."}))}),podReplicas:t.Array(ng,{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(b({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."})}),f5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/deployment-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),deploymentName:p({allowEmpty:!1})}),response:og}),IK=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(b())}),podReplicas:t.Array(ng,{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(b())}))}),g5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/statefulset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),statefulSetName:p({allowEmpty:!1})}),response:IK}),bK=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(b())}),podReplicas:t.Array(ng,{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(b())}))}),y5e=m({tags:["kubernetes-explorer"],method:"GET",url:`${or}/daemonset-details`,query:t.Object({clusterId:t.Optional(p({allowEmpty:!1})),k8sCluster:p({allowEmpty:!1}),k8sNamespace:p({allowEmpty:!1}),daemonSetName:p({allowEmpty:!1})}),response:bK});var Qr=`/${"v1"}/kubernetes-explorer`,lU=t.Pick(Qf,["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."}),SK={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(lU,{examples:[SK]});var mU=t.Pick(Wf,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),OK={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(mU,{examples:[OK]});var dU=t.Pick(Zf,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),AK={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(dU,{examples:[AK]});var fU=t.Pick(Xf,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),xK={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(fU,{examples:[xK]});var gU=t.Pick(Jf,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),RK={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(gU,{examples:[RK]});var yU=t.Pick(eg,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),CK={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(yU,{examples:[CK]});var hU=t.Pick(tg,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),PK={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:[PK]});var EU=t.Pick(rg,["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."}),UK={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(EU,{examples:[UK]});var TU=t.Pick(og,["overview","podReplicas","revisions"],{description:"Detailed information for a single Kubernetes deployment: replica status, backing pods, and rollout revisions."}),wK={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(TU,{examples:[wK]});var _U=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."}))}),us=t.Pick(iU,["clusterId","search"]),vK=t.Pick(aU,["clusterId","search"]),IU=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:`${Qr}/pods`,query:us,response:t.Array(lU)}),bU=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:`${Qr}/clusters`,query:vK,response:t.Array(mU)}),SU=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:`${Qr}/namespaces`,query:us,response:t.Array(dU)}),OU=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:`${Qr}/deployments`,query:us,response:t.Array(fU)}),AU=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:`${Qr}/statefulsets`,query:us,response:t.Array(gU)}),xU=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:`${Qr}/daemonsets`,query:us,response:t.Array(yU)}),RU=t.Object({..._U.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."})}),CU=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:`${Qr}/pod-details`,query:RU,response:hU}),PU=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:`${Qr}/pod-manifest`,query:RU,response:EU}),UU=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:`${Qr}/deployment-details`,query:t.Object({..._U.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:TU});var NK="clusterId";function wU(e,r,n){let o=r.query.properties??{},i=Object.keys(o).filter(a=>a!==NK);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 Ii(e,r,n,o){let i=e.command(r).description(n.description??`List Kubernetes ${r}`),a=wU(i,n,!1);i.action(async c=>{let l={};for(let d of a)c[d]!==void 0&&(l[d]=c[d]);J(Object.keys(l).length>0?await o()(n,{query:l}):await o()(n))})}function ig(e,r,n,o){let i=e.command(r).description(n.description??`Get Kubernetes ${r}`),a=wU(i,n,!0);i.action(async c=>{let l={};for(let d of a)l[d]=c[d];J(await o()(n,{query:l}))})}function vU(e,r){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");Ii(n,"pods",IU,r),Ii(n,"clusters",bU,r),Ii(n,"namespaces",SU,r),Ii(n,"deployments",OU,r),Ii(n,"statefulsets",AU,r),Ii(n,"daemonsets",xU,r),ig(n,"pod-details",CU,r),ig(n,"pod-manifest",PU,r),ig(n,"deployment-details",UU,r)}var LK=t.Union([t.Literal("scalar"),t.Literal("timeseries")]),kK="/v0/promql",Au=t.Object({query:p({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:Wo,step:p({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:t.Optional(LK),executionOptions:Hm,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."}))}),MK={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(Au,{examples:[MK]});var N5e=m({tags:["promql"],url:kK,method:"POST",body:Au,response:Up});var NU=`/${"v1"}/aggregation`,LU=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."})}),kU=t.Object({results:t.Array(t.Object({...LU.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."}),DK={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(kU,{examples:[DK]});var xu=t.Object({series:t.Array(t.Object({...LU.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."}),GK={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign(xu,{examples:[GK]});var $K=t.Omit(ja.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),jK=t.Optional($r),MU={timeRange:It,queries:t.Array($K,{maxItems:Lp,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 ${Lp} 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:jK,dataSource:PA,formula:t.Optional(ro)},DU=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."}))}),GU=t.Object(MU,{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."}),qK={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(GU,{examples:[qK]});var $U=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:`${NU}/multi-query/scalar`,method:"POST",body:GU,query:DU,response:kU}),jU=t.Object({...MU,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."}),BK={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(jU,{examples:[BK]});var qU=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:`${NU}/multi-query/timeseries`,method:"POST",body:jU,query:DU,response:xu});var FK=`/${"v1"}/promql`,HK=t.Object({...t.Pick(Au,["query","step"]).properties,timeRange:It},{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"}]}),KK=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."}))}),BU=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:FK,method:"POST",body:HK,query:KK,response:xu});function FU(e,r){let n=e.command("promql").description("Run PromQL queries over metric data");Vr(n,"query","Run a PromQL range query over metric data",BU,r)}var Si="/v0/dashboard-folders",Oi=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:De,creator:t.Optional(pe),updater:t.Optional(pe),createdAt:b(),updatedAt:b()},{title:"DashboardFolder"}),ag=t.Object({...Oi.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."})}),Ru=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:Xe}),Cu=t.Partial(t.Object({owners:Me(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:Me(qt.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"})),bi={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},sg=[bi.OWNER,bi.TAGS,bi.DASHBOARD_COUNT,bi.UPDATED_AT,bi.NAME],zK=t.Partial(t.Object({...Te,filters:Cu,sort:t.Object({by:t.Enum([...sg,bi.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"})})),i8e=m({tags:["dashboard-folders"],url:`${Si}/query`,method:"POST",paginated:!0,body:zK,response:t.Array(ag)}),a8e=m({tags:["dashboard-folders"],url:`${Si}/:id`,method:"GET",params:t.Object({id:p()}),response:Oi}),s8e=m({tags:["dashboard-folders"],url:Si,method:"POST",body:Ru,response:Oi}),c8e=m({tags:["dashboard-folders"],url:`${Si}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ru,response:Oi}),p8e=m({tags:["dashboard-folders"],url:`${Si}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),u8e=m({tags:["dashboard-folders"],url:`${Si}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit(Cu,["tags"]))}),response:jt});var ls=`/${"v1"}/dashboard-folders`,Pu=t.Pick(Oi,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),HU={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(Pu,{examples:[HU]});var KU=t.Pick(ag,["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."}),YK={...HU,dashboardCount:10};Object.assign(KU,{examples:[YK]});var cg=t.Pick(Ru,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),VK={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(cg,{examples:[VK]});var QK=t.Object({by:t.Enum(sg,{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"}),zU=t.Object({...We,filters:t.Optional(t.Pick(Cu,["owners","searchQuery","tags","parentFolderId"])),sort:t.Optional(QK)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),WK={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(zU,{examples:[WK]});var YU=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:`${ls}/query`,method:"POST",paginated:!0,body:zU,response:t.Array(KU)}),VU=m({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${ls}/: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:Pu}),QU=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:ls,method:"POST",body:cg,response:Pu}),WU=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:`${ls}/: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:cg,response:Pu}),ZU=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:`${ls}/: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:N});var Wr="/v0/dashboards",JU=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],ZK=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],U8e=[...ZK,"note"];var XK=["ns","us","ms","s","m","h","days"];var JK=["B","KB","MB","GB","TB","PB"];var ez=20;var ew=t.Object({type:t.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),tw=t.Object({type:t.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:t.Enum(XK,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),rw=t.Object({type:t.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:t.Enum(JK,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),nw=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"}),ow=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"}),iw=t.Object({type:t.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),aw=t.Object({type:t.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),sw=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"}),tz=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"}),rz=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:ez})},{$id:"InputDataNormalizerCustom",title:"Custom"}),xt=C("type",[tw,rw,nw,ow,iw,aw,ew,sw,tz],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Rt=C("type",[tw,rw,nw,ow,iw,aw,ew,sw,rz],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),pg=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(xt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),ug=t.Object({attribute:t.String({description:"Attribute (log field or database row column) displayed as a column in the list"}),normalizer:t.Optional(Rt)},{title:"WidgetListColumn",description:"List column pairing a displayed attribute with the formatting applied to its values."}),Ai=["background","no-background"],nz=["table","legend-only","no-legend"];var oz=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],cw=["alert","warning","success"],Ar=t.Object({operator:t.Enum(oz,{description:"Comparator used to evaluate the metric value"}),value:t.Number({description:"Threshold value used when evaluating the operator"}),color:t.Enum(cw,{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."}),iz=t.Object({value:t.Number({description:"Y-axis value where the threshold marker is placed"}),level:t.Enum(cw,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker",description:"Marker line drawn across the chart at a fixed value, colored by its level."}),az=["sec","min","hour","day"],Rn=t.Object({time:t.Number({description:"Numeric count of `metric` units in each bucket. Required when `timeBucket` is present."}),metric:t.Enum(az,{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 xn=t.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),xi=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."}),Ri=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."}),wu={source:rr,queries:FA,formula:t.Optional(kp),aliases:t.Optional(xi),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},vu={source:rr,queries:ja,formula:t.Optional(ro),aliases:t.Optional(Ri),visibleSeries:t.Optional(t.Array(t.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},Ci={...wu,groupBy:t.Optional(Zo)},Pi={...vu,groupBy:t.Optional($r)},Be=t.Enum(nz,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),ye=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."})),Zt=t.Optional(t.Array(iz,{description:"Threshold markers displayed on the chart"})),sz=t.Object({name:t.String({description:"Display name of the table column"}),...wu,source:rr,normalizer:t.Optional(xt),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`."}),cz=t.Object({name:p({description:"Display name of the table column"}),...vu,source:rr,normalizer:t.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`."}),pz=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."}),uz=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."}),lg=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."}),mg=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."}),pw=["horizontal","vertical"],lz=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(pg,{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(lg)},{$id:"GraphVisualizationList",title:"List"}),mz=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(ug,{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(mg)},{$id:"InputGraphVisualizationList",title:"List"}),Uu=C("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"}),Ui=t.Object({min:Uu,max:Uu,scale:C("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."}),wi=t.Object({min:Uu,max:Uu,scale:C("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."}),dz=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"}),fz=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 gz=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(Be),thresholds:Zt,yAxisSettings:t.Optional(Ui)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),yz=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(Be),thresholds:Zt,yAxisSettings:t.Optional(wi)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),hz=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(pg,{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(lg)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),Ez=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(ug,{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(mg)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),Tz=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"}),_z=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"}),Iz=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(Be)},{$id:"GraphVisualizationPieConnection",title:"PieConnection"}),bz=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(Be)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),Sz=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(Be),thresholds:Zt,yAxisSettings:t.Optional(Ui)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),Oz=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(Be),thresholds:Zt,yAxisSettings:t.Optional(wi)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),Az=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(Ai,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Ar,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:t.Optional(xt),legendMode:t.Optional(Be)},{$id:"GraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),xz=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(Ai,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Ar,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:t.Optional(Rt),legendMode:t.Optional(Be)},{$id:"InputGraphVisualizationQueryValueConnection",title:"QueryValueConnection"}),Rz=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(pw,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),Cz=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(pw,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),Pz=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(pg,{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(lg)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),Uz=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(ug,{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(mg)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),ms=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."}),ds=t.Array(p({allowEmpty:!1,type:"long",description:"Raw PromQL expression for this widget."}),{minItems:1,description:"PromQL expressions configured for this widget."}),wz=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:ms,aliases:t.Optional(xi),timeBucket:t.Optional(Rn),normalizer:t.Optional(xt),precision:ye,legendMode:t.Optional(Be),thresholds:Zt,yAxisSettings:t.Optional(Ui),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),vz=t.Object({type:t.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:ds,aliases:t.Optional(Ri),timeBucket:t.Optional(Rn),normalizer:t.Optional(Rt),precision:ye,legendMode:t.Optional(Be),thresholds:Zt,yAxisSettings:t.Optional(wi),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),Nz=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:ms,aliases:t.Optional(xi),backgroundMode:t.Optional(t.Enum(Ai,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Ar,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:t.Optional(xt),legendMode:t.Optional(Be)},{$id:"GraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),Lz=t.Object({type:t.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:ds,aliases:t.Optional(Ri),backgroundMode:t.Optional(t.Enum(Ai,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Ar,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:t.Optional(Rt),legendMode:t.Optional(Be)},{$id:"InputGraphVisualizationQueryValuePromql",title:"QueryValuePromql"}),kz=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:ms,aliases:t.Optional(xi),normalizer:t.Optional(xt),precision:ye,conditions:t.Optional(t.Array(Ar,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"GraphVisualizationTopListPromql",title:"TopListPromql"}),Mz=t.Object({type:t.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:ds,aliases:t.Optional(Ri),normalizer:t.Optional(Rt),precision:ye,conditions:t.Optional(t.Array(Ar,{description:"Conditional formatting rules applied to the displayed value"}))},{$id:"InputGraphVisualizationTopListPromql",title:"TopListPromql"}),Dz=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:ms,aliases:t.Optional(xi),normalizer:t.Optional(xt),precision:ye,legendMode:t.Optional(Be)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),Gz=t.Object({type:t.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:ds,aliases:t.Optional(Ri),normalizer:t.Optional(Rt),precision:ye,legendMode:t.Optional(Be)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),$z=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:ms,aliases:t.Optional(xi),timeBucket:t.Optional(Rn),precision:ye,normalizer:t.Optional(xt),thresholds:Zt,legendMode:t.Optional(Be),yAxisSettings:t.Optional(Ui)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),jz=t.Object({type:t.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:ds,aliases:t.Optional(Ri),timeBucket:t.Optional(Rn),precision:ye,normalizer:t.Optional(Rt),thresholds:Zt,legendMode:t.Optional(Be),yAxisSettings:t.Optional(wi)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),qz=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...Ci,timeBucket:t.Optional(Rn),normalizer:t.Optional(xt),precision:ye,legendMode:t.Optional(Be),thresholds:Zt,yAxisSettings:t.Optional(Ui),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),Bz=t.Object({type:t.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...Pi,timeBucket:t.Optional(Rn),normalizer:t.Optional(Rt),precision:ye,legendMode:t.Optional(Be),thresholds:Zt,yAxisSettings:t.Optional(wi),smoothing:t.Optional(t.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),uw="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.",Fz=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...Ci,normalizer:t.Optional(xt),precision:ye,conditions:t.Optional(t.Array(Ar,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:t.Optional(t.Boolean({description:uw}))},{$id:"GraphVisualizationTopList",title:"TopList"}),Hz=t.Object({type:t.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...Pi,normalizer:t.Optional(Rt),precision:ye,conditions:t.Optional(t.Array(Ar,{description:"Conditional formatting rules applied to the displayed value"})),isStacked:t.Optional(t.Boolean({description:uw}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),Kz=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...Ci,normalizer:t.Optional(xt),precision:ye,legendMode:t.Optional(Be)},{$id:"GraphVisualizationPie",title:"Pie"}),zz=t.Object({type:t.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...Pi,normalizer:t.Optional(Rt),precision:ye,legendMode:t.Optional(Be)},{$id:"InputGraphVisualizationPie",title:"Pie"}),Yz=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...wu,backgroundMode:t.Optional(t.Enum(Ai,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Ar,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:t.Optional(xt),legendMode:t.Optional(Be)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),Vz=t.Object({type:t.Literal("query-value",{description:"Displays the aggregation as a single value"}),...vu,backgroundMode:t.Optional(t.Enum(Ai,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:t.Optional(t.Array(Ar,{description:"Conditional formatting rules applied to the displayed value"})),precision:ye,normalizer:t.Optional(Rt),legendMode:t.Optional(Be)},{$id:"InputGraphVisualizationQueryValue",title:"QueryValue"}),Qz=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...Ci,timeBucket:t.Optional(Rn),precision:ye,normalizer:t.Optional(xt),thresholds:Zt,legendMode:t.Optional(Be),yAxisSettings:t.Optional(Ui)},{$id:"GraphVisualizationBar",title:"Bar"}),Wz=t.Object({type:t.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...Pi,timeBucket:t.Optional(Rn),precision:ye,normalizer:t.Optional(Rt),thresholds:Zt,legendMode:t.Optional(Be),yAxisSettings:t.Optional(wi)},{$id:"InputGraphVisualizationBar",title:"Bar"}),lw='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.',mw=t.String({description:lw}),dw=p({description:lw}),Zz=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...Ci,group:t.Optional(mw),precision:ye,normalizer:t.Optional(xt),percentileMarkers:t.Optional(dz),boundsScale:t.Optional(Np)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),Xz=t.Object({type:t.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...Pi,group:t.Optional(dw),precision:ye,normalizer:t.Optional(Rt),percentileMarkers:t.Optional(fz),boundsScale:t.Optional(Np)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),fw=["red","pink","violet","blue","cyan","green","yellow","orange"],gw=t.Enum(fw,{description:"Color palette used to render the heatmap intensity gradient"}),Jz=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...Ci,group:t.Optional(mw),precision:ye,normalizer:t.Optional(xt),palette:t.Optional(gw)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),e4=t.Object({type:t.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...Pi,group:t.Optional(dw),precision:ye,normalizer:t.Optional(Rt),palette:t.Optional(gw)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),yw=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(fw,{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."}),t4=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...wu,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(yw,{description:"Color thresholds inside the gauge range"})),precision:ye,normalizer:t.Optional(xt)},{$id:"GraphVisualizationGauge",title:"Gauge"}),r4=t.Object({type:t.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...vu,max:t.Optional(t.Number({description:"Gauge maximum value"})),colorThresholds:t.Optional(t.Array(yw,{description:"Color thresholds inside the gauge range"})),precision:ye,normalizer:t.Optional(Rt)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),n4=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(sz,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional(Zo),defaultSorting:t.Optional(pz),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"}),o4=t.Object({type:t.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:t.Array(cz,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:t.Optional($r),defaultSorting:t.Optional(uz),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"}),i4=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(JU,{description:"Background color used to render the note"})),noteAlign:t.Optional(xn),noteJustifyContent:t.Optional(xn)},{$id:"GraphVisualizationNote",title:"Note"}),a4=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(JU,{description:"Background color used to render the note"})),noteAlign:t.Optional(xn),noteJustifyContent:t.Optional(xn)},{$id:"InputGraphVisualizationNote",title:"Note"}),s4=C("type",[gz,hz,Tz,Iz,Sz,Az,wz,Nz,kz,Dz,$z,qz,Fz,Kz,Yz,t4,Qz,Zz,Jz,n4,lz,i4,Rz,Pz],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),c4=C("type",[yz,Ez,_z,bz,Oz,xz,vz,Lz,Mz,Gz,jz,Bz,Hz,zz,Vz,r4,Wz,Xz,e4,o4,mz,a4,Cz,Uz],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),Nu=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(xn),descriptionJustifyContent:t.Optional(xn),visualization:s4,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid. Dashboard validation uses this with `h` and the widget type to reject layouts below the widget minimum."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall. Dashboard validation uses this with `w` and the widget type to reject layouts below the widget minimum."})},{description:`Grid position and size of the widget. Optional; when provided, the size must be at least ${Vm}\xD7${Qm} (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."}),Lu=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(xn),descriptionJustifyContent:t.Optional(xn),visualization:c4,layout:t.Optional(t.Object({x:t.Number({description:"Column position of the widget on the 12-column dashboard grid. 0 is the leftmost column; increasing values move right."}),y:t.Number({description:"Row position of the widget on the dashboard grid, in row units of 50 pixels each. 0 is the topmost row; increasing values move down."}),w:t.Number({description:"Width of the widget in grid columns, out of the 12-column grid. Dashboard validation uses this with `h` and the widget type to reject layouts below the widget minimum."}),h:t.Number({description:"Height of the widget in grid rows, where each row is 50 pixels tall. Dashboard validation uses this with `w` and the widget type to reject layouts below the widget minimum."})},{description:`Grid position and size of the widget. Optional; when provided, the size must be at least ${Vm}\xD7${Qm} (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."}),XU=10,p4=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."}),u4=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:XU,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${XU} filters are allowed.`}),vi=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(Nu,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(p4),createdAt:b({description:"Timestamp when Tsuga created the dashboard."}),updatedAt:b({description:"Timestamp when Tsuga last updated the dashboard."}),creator:t.Optional(pe),updater:t.Optional(pe),tags:De,timePreset:t.Optional(t.Enum(pl,{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."}))}),ku=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(Lu,{description:"Ordered widgets that compose the dashboard"}),filters:t.Optional(u4),tags:Xe,timePreset:t.Optional(t.Enum(pl,{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."}))}),ir={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",WIDGET_COUNT:"widgetCount",UPDATED_AT:"updatedAt",NAME:"name"},hw=[ir.OWNER,ir.TAGS,ir.WIDGET_COUNT,ir.UPDATED_AT,ir.NAME],Mu=t.Partial(t.Object({owners:Me(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:Me(qt.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"})),l4=t.Partial(t.Object({...Te,filters:Mu,sort:t.Object({by:t.Enum([ir.IS_FAVORITE,ir.OWNER,ir.TAGS,ir.WIDGET_COUNT,ir.UPDATED_AT,ir.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"})})),w8e=m({tags:["dashboards"],url:`${Wr}/query`,method:"POST",paginated:!0,response:t.Array(vi),body:l4}),v8e=m({tags:["dashboards"],url:`${Wr}/tags/query`,method:"POST",body:t.Object({filters:t.Optional(t.Omit(Mu,["tags"]))}),response:jt}),N8e=m({tags:["dashboards"],url:`${Wr}/:id`,method:"GET",params:t.Object({id:p()}),response:vi}),L8e=m({tags:["dashboards"],url:Wr,method:"POST",body:ku,response:vi}),k8e=m({tags:["dashboards"],url:`${Wr}/:id`,method:"PUT",params:t.Object({id:p()}),body:t.Partial(ku),response:vi}),M8e=m({tags:["dashboards"],url:`${Wr}/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({})}),D8e=m({tags:["dashboards"],url:`${Wr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),G8e=m({tags:["dashboards"],url:`${Wr}/:id/graphs/:graphId`,method:"PUT",params:t.Object({id:p({allowEmpty:!1}),graphId:p({allowEmpty:!1})}),body:t.Omit(Lu,["id"]),response:Nu}),$8e=m({tags:["dashboards"],url:`${Wr}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})});var Ni=`/${"v1"}/dashboards`,fs=t.Pick(vi,["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)."}),m4={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(fs,{examples:[m4]});var d4=t.Object({by:t.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:t.Enum(["asc","desc"],{description:"Sort direction: ascending or descending"})},{description:"Optional sorting applied to the returned dashboards"}),Ew=t.Object({...We,filters:t.Optional(t.Pick(Mu,["owners","searchQuery","tags","folderId"])),sort:t.Optional(d4)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),f4={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(Ew,{examples:[f4]});var Tw=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:`${Ni}/query`,method:"POST",paginated:!0,body:Ew,response:t.Array(fs)}),_w=m({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${Ni}/: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:fs}),dg=t.Pick(ku,["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."}),g4={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(dg,{examples:[g4]});var y4=t.Omit(Lu,["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."}),Iw=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:Ni,method:"POST",body:dg,response:fs}),bw=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:`${Ni}/: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(dg),response:fs}),h4=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."})}),Sw=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:`${Ni}/:id`,method:"DELETE",params:h4,response:N}),Y8e=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:`${Ni}/: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:y4,response:Nu});var Ow=100,Aw=3,Li=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:jt,teamOverrideFields:t.Optional(t.Array(t.String(),{description:"Telemetry attribute names used to override ownership for data sent with this key."})),updatedAt:b({description:"Timestamp when Tsuga last updated the key metadata."}),createdAt:b({description:"Timestamp when Tsuga created the key."}),creator:t.Optional(pe),updater:t.Optional(pe),assetUpdatedAt:b({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})}),gs=t.Object({name:t.String({format:Fo,minLength:1,maxLength:Ow,description:`Kebab-case name for the ingestion API key. Maximum length is ${Ow} characters.`}),owner:p({allowEmpty:!1,description:"Team ID that will own and manage the ingestion API key."}),tags:qt,teamOverrideFields:t.Union([t.Array(p({allowEmpty:!1}),{minItems:1,maxItems:Aw,description:`Array form. Up to ${Aw} 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."})}),ki="/v0/ingestion-api-keys",rQe=m({tags:["ingestion-api-keys"],url:ki,method:"POST",body:gs,response:t.Intersect([Li,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."})})])}),nQe=m({tags:["ingestion-api-keys"],url:ki,method:"GET",paginated:!0,query:t.Object(Te),response:t.Array(Li)}),oQe=m({tags:["ingestion-api-keys"],url:`${ki}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:Li}),iQe=m({tags:["ingestion-api-keys"],url:`${ki}/:id`,method:"PUT",params:t.Object({id:p({allowEmpty:!1})}),body:gs,response:Li}),aQe=m({tags:["ingestion-api-keys"],url:`${ki}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:N}),sQe=m({tags:["ingestion-api-keys"],url:`${ki}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p({allowEmpty:!1}))}),response:t.Object({})});var ys=`/${"v1"}/ingestion-api-keys`,hs=t.Pick(Li,["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)."}),xw={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(hs,{examples:[xw]});var Rw=t.Pick(gs,["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."}),Cw=t.Pick(gs,["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."}),Pw={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(Rw,{examples:[Pw]});Object.assign(Cw,{examples:[Pw]});var E4={...xw,key:"tsuga_in:v1:abc123xyx7Qm"},Uw=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:ys,method:"GET",paginated:!0,query:t.Object(We),response:t.Array(hs)}),gQe=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:`${ys}/: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:hs}),T4=t.Intersect([t.Pick(hs,["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:E4}),ww=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:ys,method:"POST",body:Rw,response:T4}),vw=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:`${ys}/: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:Cw,response:hs}),Nw=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:`${ys}/: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:N});var _4={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"]}},[TQe,yg,Es]=I4(_4);function I4(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[fg(r),fg(n),fg(o)]}function fg(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var gg=t.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),b4=t.Object({versioningStatus:t.Optional(t.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),S4=t.Object({domainName:t.Optional(t.String()),origins:t.Optional(t.Array(t.String()))}),O4=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())}),A4=t.Object({version:t.Optional(t.String()),virtualNetworkId:t.Optional(t.String()),subnets:t.Optional(t.Array(t.String()))}),x4=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())}),R4=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()))}),C4=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(b())}),P4=t.Object({isEncrypted:t.Optional(t.Boolean()),ownerId:t.Optional(t.String()),state:t.Optional(t.Enum(["creating","available","deleting","deleted","error","updating"]))}),U4=t.Object({type:t.Optional(t.String()),osType:t.Optional(t.String()),subnetIds:t.Optional(t.Array(t.String())),nbContainers:t.Optional(t.Number())}),w4=t.Object({digest:t.String(),imageTags:t.Array(t.String()),imageSizeBytes:t.Optional(t.Number()),imagePushedAt:t.Optional(b()),mediaType:t.Optional(t.String()),repositoryName:t.String(),repositoryId:t.Optional(t.String()),scanStatus:t.Optional(t.String())}),v4=t.Object({url:t.Optional(t.String()),maxMessageSizeBytes:t.Optional(t.Number()),messageRetentionHours:t.Optional(t.Number())}),N4=t.Object({runtime:t.Optional(t.String()),memoryAllocationMib:t.Optional(t.Number()),timeoutMs:t.Optional(t.Number()),codeSha256:t.Optional(t.String())}),L4=t.Object({kind:t.Optional(t.String())}),k4=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())}),M4=t.Object({id:t.Optional(t.String()),ipCidrBlocks:t.Array(t.String())}),D4=t.Object({protocol:t.Optional(gg),port:t.Optional(t.Number()),instanceProtocol:t.Optional(gg),instancePort:t.Optional(t.Number())}),G4=t.Object({protocol:t.Optional(t.String()),ports:t.Optional(t.Array(t.String())),portRange:t.Optional(t.String()),allPorts:t.Optional(t.Boolean())}),$4=t.Object({name:t.String(),ip:t.Optional(t.String()),type:t.Enum(["public","private"])}),j4=t.Object({type:t.String(),name:t.String()}),q4=t.Object({frontendIp:t.Optional($4),backendIpPools:t.Array(j4)}),B4=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())}),F4=t.Object({protocol:t.Optional(gg),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(B4)),targetCount:t.Optional(t.Number()),healthyTargetCount:t.Optional(t.Number()),loadBalancerArns:t.Optional(t.Array(t.String()))}),H4=t.Object({first:t.Optional(t.String()),last:t.Optional(t.String()),scope:t.Optional(t.Number())}),K4=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(),H4]))),target:t.Optional(t.String()),weight:t.Optional(t.Number()),priority:t.Optional(t.Number()),status:t.Optional(t.String())}),z4=t.Object({instanceId:t.Optional(t.String()),state:t.Optional(t.String()),reasonCode:t.Optional(t.String()),description:t.Optional(t.String())}),Y4=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(D4),t.Array(G4)])),targets:t.Optional(t.Union([t.Array(t.String()),t.Array(z4),t.Array(K4)])),azureLoadBalancingRules:t.Optional(t.Array(q4))}),V4=t.Object({domainName:t.Optional(t.String()),expiresAt:t.Optional(b()),inUseBy:t.Optional(t.Array(t.String())),renewalEligibility:t.Optional(t.String()),revokedAt:t.Optional(b()),status:t.Optional(t.String()),type:t.Optional(t.String())}),Q4=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"]))}),W4=t.Object({osType:t.Optional(t.Enum(["Windows","Linux"]))}),Z4=t.Object({state:t.Optional(t.String()),volumeType:t.Optional(t.String())}),X4=t.Intersect([t.Object({isEncrypted:t.Optional(t.Boolean()),sizeGib:t.Optional(t.Number())}),t.Union([Q4,Z4,W4])]),J4=t.Object({instanceCount:t.Optional(t.Number()),hostnames:t.Optional(t.Array(t.String())),runtime:t.Optional(t.String())}),Du=t.Union([t.Object({category:t.Literal("application"),resourceType:t.Literal("webService"),attributes:t.Optional(J4)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("bucket"),attributes:t.Optional(b4)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("messagingService"),attributes:t.Optional(v4)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("fileSystem"),attributes:t.Optional(P4)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("contentDeliveryNetwork"),attributes:t.Optional(S4)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("database"),attributes:t.Optional(O4)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("storageAccount"),attributes:t.Optional(L4)}),t.Object({category:t.Literal("data"),resourceType:t.Literal("volume"),attributes:t.Optional(X4)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("virtualMachine"),attributes:t.Optional(k4)}),t.Object({category:t.Literal("compute"),resourceType:t.Literal("serverless"),attributes:t.Optional(N4)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("kubernetesCluster"),attributes:t.Optional(A4)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerRepository"),attributes:t.Optional(x4)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerCluster"),attributes:t.Optional(R4)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerServiceTask"),attributes:t.Optional(C4)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerService"),attributes:t.Optional(U4)}),t.Object({category:t.Literal("container"),resourceType:t.Literal("containerImage"),attributes:t.Optional(w4)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("virtualNetwork"),attributes:t.Optional(M4)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("loadBalancer"),attributes:Y4}),t.Object({category:t.Literal("network"),resourceType:t.Literal("targetGroup"),attributes:t.Optional(F4)}),t.Object({category:t.Literal("network"),resourceType:t.Literal("certificate"),attributes:t.Optional(V4)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var yo="/v0/inventory",Ts=["aws","gcp","azure"],Lw=["scan_in_progress","success","failure","partial"],Eg=t.Object({id:t.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:t.Enum(Ts,{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(b({description:"Timestamp when the resource was created in the cloud, when known."})),resourceUpdatedAt:t.Optional(b({description:"Timestamp when the resource was last updated in the cloud, when known."})),resourceLastSeenAt:b({description:"Timestamp when Tsuga last observed this resource during an inventory scan."}),tags:De,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"}))}),Mi={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},kw=t.Object({cloudPlatforms:Me(t.Enum(Ts),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:Ts.length}),cloudAccounts:Me(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud accounts",maxItems:500}),cloudRegions:Me(p({allowEmpty:!1}),{description:"Restrict results to resources in any of these cloud regions",maxItems:500}),nativeResourceTypes:Me(t.Enum(Es),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:Es.length}),resourceTypes:Me(t.Enum(yg),{description:"Restrict results to resources of any of these normalized resource types",maxItems:yg.length}),tags:Me(qt.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"}),Tg=t.Partial(t.Object({...Te,filters:t.Partial(kw,{description:"Filters applied to narrow the returned resources."}),sort:t.Object({by:t.Enum([Mi.DISPLAY_NAME,Mi.CLOUD_ACCOUNT,Mi.NATIVE_RESOURCE_TYPE,Mi.CLOUD_REGION,Mi.RESOURCE_TYPE,Mi.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."})})),RQe=m({tags:["inventory"],method:"POST",url:`${yo}/resources/query`,paginated:!0,body:Tg,response:t.Array(t.Intersect([Eg,Du]))}),e3=["resourceType","cloudAccount","isIacManaged"],CQe=m({tags:["inventory"],method:"POST",url:`${yo}/resources/counts`,body:t.Object({filters:t.Optional(t.Partial(kw)),groupBy:t.Enum(e3,{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."})}))}),PQe=m({tags:["inventory"],method:"GET",url:`${yo}/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:jt})}),UQe=C("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."})})]),t3="^[0-9]{12}$",r3="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",n3="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",o3="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",i3="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",hg="^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$",a3=t.Object({type:t.Literal("aws",{description:"Discriminator identifying AWS connection settings."}),accountId:t.String({pattern:t3,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:r3,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"}),s3=t.Object({type:t.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:t.String({pattern:n3,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:o3,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:i3,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"}),c3=t.Object({type:t.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:t.String({pattern:hg,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:t.String({pattern:hg,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:t.String({pattern:hg,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),Mw=C("type",[a3,s3,c3],{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`."}),Di=t.Object({id:t.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:t.Enum(Ts,{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:b({description:"Timestamp when the account was registered in Tsuga."}),lastScanStartedAt:t.Optional(b({description:"Timestamp when the most recent inventory scan started."})),lastScanFinishedAt:t.Optional(b({description:"Timestamp when the most recent inventory scan finished."})),lastScanStatus:t.Optional(t.Enum(Lw,{description:"Status of the most recent inventory scan."}))}),_g=t.Object({cloudType:t.Enum(Ts,{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:Mw,lastScanStatus:t.Optional(t.Enum(Lw,{description:"Status of the most recent inventory scan."}))}),ho=`${yo}/cloud-accounts`,wQe=m({tags:["inventory"],url:ho,method:"GET",response:t.Array(Di)}),vQe=m({tags:["inventory"],url:`${ho}/:id`,method:"GET",params:t.Object({id:p()}),response:Di}),NQe=m({tags:["inventory"],url:ho,method:"POST",body:_g,response:Di}),Ig=t.Object({accountFriendlyName:p({description:"Human-readable name for the account shown in Tsuga."})}),LQe=m({tags:["inventory"],url:`${ho}/:id`,method:"PUT",params:t.Object({id:p()}),body:Ig,response:Di}),kQe=m({tags:["inventory"],url:`${ho}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),MQe=m({tags:["inventory"],url:`${yo}/trigger-scan`,method:"POST",body:t.Object({}),response:t.Object({success:t.Literal(!0)})}),DQe=m({tags:["inventory"],url:`${ho}/azure/onboarding`,method:"POST",body:t.Object({tenantId:p()}),response:t.Object({subjectId:t.String(),audience:t.String()})}),GQe=m({tags:["inventory"],method:"POST",url:`${ho}/validate/:type`,params:t.Object({type:p()}),body:t.Object({data:Mw,id:t.Optional(p())}),response:t.Object({areAccountSettingsValid:t.Boolean(),message:t.Optional(t.String())})}),Dw=`${yo}/settings`,$Qe=m({tags:["inventory"],url:Dw,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())}))}))})}),p3=50,jQe=m({tags:["inventory"],url:Dw,method:"POST",body:t.Object({infrastructureIdentifiers:t.Array(t.Object({name:p({allowEmpty:!1}),value:t.Optional(p({allowEmpty:!1}))}),{maxItems:p3})}),response:t.Object({})}),qQe=m({tags:["inventory"],url:`${yo}/iac-tags-proposal`,method:"GET",response:t.Array(t.Object({name:t.String(),value:t.Optional(t.String())}))});var Gw=`/${"v1"}/inventory`,u3=t.Omit(Eg,["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)."}),$w=t.Intersect([u3,Du],{$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)."}),l3={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($w,{examples:[l3]});var jw=t.Object({...Tg.properties,...We},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),m3={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(jw,{examples:[m3]});var qw=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:`${Gw}/resources/query`,method:"POST",paginated:!0,body:jw,response:t.Array($w)}),_s=`${Gw}/cloud-accounts`,Is=t.Pick(Di,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),d3={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(Is,{examples:[d3]});var Bw=t.Pick(_g,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),f3={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(Bw,{examples:[f3]});var g3=t.Pick(Ig,["accountFriendlyName"]),WQe=m({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:_s,method:"GET",response:t.Array(Is)}),ZQe=m({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${_s}/: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:Is}),XQe=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:_s,method:"POST",body:Bw,response:Is}),JQe=m({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${_s}/: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:g3,response:Is}),eWe=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:`${_s}/: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:N});var bs="/v0/investigations",y3=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],h3=t.Object({type:t.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:t.String({description:"Identifier of the linked asset"})}),E3=t.Object({type:t.Enum(y3,{description:"Kind of linked asset"}),id:p({allowEmpty:!1,description:"Identifier of the linked asset"})}),Zr=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:De,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(h3,{description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}),creator:t.Optional(pe),updater:t.Optional(pe),createdAt:b({description:"Timestamp the investigation was created at."}),updatedAt:b({description:"Timestamp the investigation was last updated at."})},{title:"Investigation"}),Gu=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:Xe,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(E3,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),bg=t.Object(t.Omit(Gu,["slug"]).properties),cWe=m({tags:["investigations"],url:bs,method:"GET",paginated:!0,query:t.Object(Te),response:t.Array(Zr)}),pWe=m({tags:["investigations"],url:`${bs}/:id`,params:t.Object({id:p()}),method:"GET",response:Zr}),uWe=m({tags:["investigations"],url:bs,method:"POST",body:Gu,response:Zr}),lWe=m({tags:["investigations"],url:`${bs}/:id`,method:"PUT",body:bg,params:t.Object({id:p()}),response:Zr}),mWe=m({tags:["investigations"],url:`${bs}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N});var Ss=`/${"v1"}/investigations`,Fw=m({description:"Retrieve all investigations",tags:["private"],url:Ss,method:"GET",paginated:!0,query:t.Object(We),response:t.Array(Zr)}),Hw=m({description:"Retrieve an investigation by its id",tags:["private"],url:`${Ss}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:Zr}),Kw=m({description:"Create a new investigation",tags:["private"],url:Ss,method:"POST",body:Gu,response:Zr}),zw=m({description:"Update an investigation by its id",tags:["private"],url:`${Ss}/:id`,method:"PUT",body:bg,params:t.Object({id:p({allowEmpty:!1})}),response:Zr}),Yw=m({description:"Delete an investigation by its id",tags:["private"],url:`${Ss}/:id`,method:"DELETE",params:t.Object({id:p({allowEmpty:!1})}),response:N});var Vw=15,$u={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:De,updatedAt:t.Optional(b({description:"Timestamp when Tsuga last updated the processor."}))},ju={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:Xe,updatedAt:t.Optional(b({description:"Backend-maintained timestamp for this processor. Omit this field on create and update requests; Tsuga sets or preserves it based on processor changes."}))},Qw={...$u,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},Ww={...ju,type:t.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},T3=C("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."}),_3=C("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:Vw,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."}),I3=t.Object({...Qw,params:T3}),b3=t.Object({...Ww,params:_3}),Zw={...$u,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},Xw={...ju,type:t.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},S3=C("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."}),O3=C("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."}),A3=t.Object({...Xw,params:O3}),x3=t.Object({...Zw,params:S3}),Jw={...$u,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},ev={...ju,type:t.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},tv=5,R3=C("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."}),C3=C("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:tv,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."}),P3=t.Object({...Jw,params:R3}),U3=t.Object({...ev,params:C3}),w3=t.Object({...Ww,params:C("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:Vw,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")})])}),v3=t.Object({...Xw,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")})}),N3=t.Object({...ev,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:tv,description:"Example log lines for validating the Grok rules."})),subtype:t.Literal("grok")})}),AWe=C("type",[v3,N3,w3]),L3=t.Object({...Qw,params:C("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")})])}),k3=t.Object({...Zw,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")})}),M3=t.Object({...Jw,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")})}),xWe=C("type",[k3,M3,L3]),D3=11,rv=t.Cyclic({OutputProcessor:t.Union([x3,P3,I3,t.Object({...$u,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"}),nv=t.Cyclic({InputProcessor:t.Union([A3,U3,b3,t.Object({...ju,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:D3,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 G3="/v0/logs",Cn=`${G3}/routes`,Pn=t.Object({id:t.String({description:"Tsuga-generated log route ID assigned when the route is created."}),name:t.String({description:"Human-readable route name shown in Tsuga."}),description:t.Optional(t.String({description:"Optional free-text note about the route's purpose, set by the caller. This metadata is not evaluated when matching or processing logs."})),isEnabled:t.Boolean({description:"Whether this route is active for newly ingested logs. Disabled routes remain saved but do not process logs."}),query:t.String({description:"Tsuga query that selects which newly ingested logs enter the route processor chain."}),rank:t.Number({description:"Tsuga-assigned evaluation order, unique across all routes and dense (no gaps). Enabled routes are checked from lower rank to higher rank during ingestion, and every route whose query matches a log applies its processors to it \u2014 matching is not stopped after the first hit. New routes are appended with the highest rank; deleting a route shifts all higher ranks down by one to close the gap. Use `PUT /:id/modify-ranking` to move a route to a different rank, which shifts the routes between its old and new position accordingly."}),tags:De,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(rv,{description:"Processors applied in array order to logs that match the route, each transforming the output of the previous one. A `split` processor forks the chain into branches and cannot be followed by another processor at the same level."}),creator:t.Optional(pe),updater:t.Optional(pe),updatedAt:b({description:"Timestamp when Tsuga last updated the route."}),createdAt:b({description:"Timestamp when Tsuga created the route."}),assetUpdatedAt:b({description:"Timestamp when Tsuga last changed route behavior. This can differ from `updatedAt` when only metadata such as `description` or `tags` changed."})},{title:"LogRoute"}),Os=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:Xe,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(nv,{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 kWe=m({tags:["routes"],url:Cn,method:"GET",paginated:!0,query:t.Object(Te),response:t.Array(Pn)}),MWe=m({tags:["routes"],url:`${Cn}/:id`,params:t.Object({id:p()}),method:"GET",response:Pn}),DWe=m({tags:["routes"],url:Cn,method:"POST",body:Os,response:Pn}),GWe=m({tags:["routes"],url:`${Cn}/:id`,method:"PUT",body:Os,params:t.Object({id:p()}),response:Pn}),$We=m({tags:["routes"],url:`${Cn}/:id/clone`,method:"POST",params:t.Object({id:p()}),body:Os,response:Pn}),jWe=m({tags:["routes"],url:`${Cn}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),qWe=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:`${Cn}/: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({})}),BWe=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:`${Cn}/:id/enable`,method:"PUT",params:t.Object({id:p()}),body:t.Object({enable:t.Boolean({description:"Set to true to enable the route, or false to disable it."})}),response:Pn});var As=`/${"v1"}/routes`,ov={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}"]}}]},iv={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}}]},xs=t.Pick(Pn,["id","name","description","isEnabled","query","tags","owner","processors"],{$id:"Route",description:"Team-owned log processing definition that selects newly ingested logs and applies ordered processors. See [Routes](/documentation/process/routes/index)."}),$3={id:"123-456-abc",...ov},j3={id:"456-789-def",...iv};Object.assign(xs,{examples:[$3,j3]});var av=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:As,method:"GET",paginated:!0,query:t.Object(We),response:t.Array(xs)}),sv=m({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${As}/: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:xs}),Sg=t.Pick(Os,["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(Sg,{examples:[ov,iv]});var cv=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:As,method:"POST",body:Sg,response:xs}),pv=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:`${As}/:id`,method:"PUT",body:Sg,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:xs}),uv=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:`${As}/: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:N});var Rs=`/${"v1"}/monitors`,Cs=t.Pick(jr,["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)."}),mv={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:[]},dv={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:[]},fv={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:[]},gv={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:[]},q3={id:"123-456-abc",...mv},B3={id:"234-567-bcd",...dv},F3={id:"345-678-cde",...fv},H3={id:"456-789-def",...gv};Object.assign(Cs,{examples:[q3,B3,F3,H3]});var lv=t.Pick(md,["filters","sort","limit","offset"]),yv=t.Object({...lv.properties,...We,filters:lv.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),K3={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(yv,{examples:[K3]});var hv=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:`${Rs}/query`,method:"POST",paginated:!0,body:yv,response:t.Array(Cs)}),Ev=m({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${Rs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:Cs}),Tv=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],_v=t.Pick(Ba,Tv,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),Iv=t.Pick(Ba,Tv,{$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."}),bv=mv,Sv=dv,Ov=fv,Av=gv;Object.assign(_v,{examples:[bv,Sv,Ov,Av]});Object.assign(Iv,{examples:[bv,Sv,Ov,Av]});var xv=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:Rs,method:"POST",body:_v,response:Cs}),Rv=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:`${Rs}/: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:Iv,response:Cs}),z3=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."})}),Cv=m({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${Rs}/:id`,method:"DELETE",params:z3,response:N});var Ps=`/${"v1"}/notification-rules`,Us=t.Pick(oi,["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)."}),Pv={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}}}]},Y3={id:"123-456-abc",...Pv};Object.assign(Us,{examples:[Y3]});var Uv=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:Ps,method:"GET",paginated:!0,query:t.Object(We),response:t.Array(Us)}),wv=m({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${Ps}/: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:Us}),Og=t.Pick(Ka,["name","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","tags","isActive","targets"],{description:"Notification rule create or update request. Provide matching filters, owner, tags, active state, and delivery targets."}),V3=Pv;Object.assign(Og,{examples:[V3]});var vv=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:Ps,method:"POST",body:Og,response:Us}),Nv=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:`${Ps}/: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:Og,response:Us}),Q3=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."})}),Lv=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:`${Ps}/:id`,method:"DELETE",params:Q3,response:N});var Gi=`${ri}/silences`,kv=t.Union([t.Literal("monday"),t.Literal("tuesday"),t.Literal("wednesday"),t.Literal("thursday"),t.Literal("friday"),t.Literal("saturday"),t.Literal("sunday")]),W3=t.Partial(t.Record(kv,t.Array(t.Object({startTime:t.String({format:bm,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:t.String({format:bm,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`."}),Z3=t.Partial(t.Record(kv,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`."}),qu='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',Mv="One-time silence schedule with specific start and end times",Dv="Recurring weekly silence schedule",X3=C("type",[t.Object({type:t.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:t.String({format:Sm,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:t.String({format:Sm,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:Im,description:qu}))},{$id:"InputSilenceScheduleOneTime",description:Mv}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:W3,timeZone:t.Optional(t.String({format:Im,description:qu}))},{$id:"InputSilenceScheduleRecurring",description:Dv})],{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."}),J3=C("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:qu}))},{$id:"OutputSilenceScheduleOneTime",description:Mv}),t.Object({type:t.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:Z3,timeZone:t.Optional(t.String({description:qu}))},{$id:"OutputSilenceScheduleRecurring",description:Dv})],{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."}),eY="monitor_id",Gv=`Query on the alerting monitor tags and group-by dimensions, e.g. \`env:prod AND service:bridge\`. The monitor itself can be targeted with \`${eY}:<monitor id>\`.`,Bu=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:Xe,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:X3,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:Gv})),teamsFilter:Id,prioritiesFilter:t.Array(t.Enum(bt),{maxItems:bt.length,description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(oo),{maxItems:oo.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),$i=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:De,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:J3,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:Gv})),teamsFilter:_d,prioritiesFilter:t.Array(t.Enum(bt),{description:"Monitor priorities that must match for this silence to apply. An empty array matches every priority."}),transitionTypesFilter:t.Array(t.Enum(oo),{description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."}),createdAt:b(),updatedAt:b(),creator:t.Optional(pe),updater:t.Optional(pe)}),_7e=m({tags:["notification-silences"],url:Gi,method:"GET",response:t.Array($i)}),I7e=m({tags:["notification-silences"],url:`${Gi}/:id`,params:t.Object({id:p()}),method:"GET",response:$i}),b7e=m({tags:["notification-silences"],url:Gi,method:"POST",body:Bu,response:$i}),S7e=m({tags:["notification-silences"],url:`${Gi}/:id`,method:"PUT",params:t.Object({id:p()}),body:Bu,response:$i}),O7e=m({tags:["notification-silences"],url:`${Gi}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),A7e=m({tags:["notification-silences"],url:`${Gi}/bulk-delete`,method:"DELETE",body:t.Object({ids:t.Array(p())}),response:t.Object({})});var ws=`/${"v1"}/notification-silences`,vs=t.Pick($i,["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)."}),tY={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"]},rY={id:"sil-critical-routing",name:"Critical routing maintenance",reason:"Temporarily suppress notifications from the critical routing rule.",owner:"team-123-abc",tags:[{key:"change",value:"chg-1234"}],isActive:!0,schedule:{type:"one-time",startTime:"2026-07-04T02:00:00",endTime:"2026-07-04T04:00:00",timeZone:"UTC"},notificationRuleIds:["rule-critical-routing"],teamsFilter:{type:"specific-teams",teams:["team-123-abc"]},prioritiesFilter:[],transitionTypesFilter:[]};Object.assign(vs,{examples:[tY,rY]});var $v=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:ws,method:"GET",response:t.Array(vs)}),jv=m({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${ws}/: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:vs}),Ag=t.Pick(Bu,["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."}),nY={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"]},oY={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(Ag,{examples:[nY,oY]});var qv=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:ws,method:"POST",body:Ag,response:vs}),Bv=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:`${ws}/: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:Ag,response:vs}),iY=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."})}),Fv=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:`${ws}/:id`,method:"DELETE",params:iY,response:N});var aY={critical:3,important:2,normal:1},se=e=>({label:e,weight:aY[e]}),sY={"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:`${Jm} matches ${Mp}`,summary:`Detects logs and spans whose ${Jm} resource attribute names a different team than the ${Mp} resolved at ingestion.`,rationale:`${Mp} 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:`${Dp} present`,summary:`Logs and spans must populate ${Dp} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:se("critical"),recommendation:`Populate ${Dp} 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:`${qa} presence`,summary:`Logs and spans must populate ${qa} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:se("important"),recommendation:`Populate ${qa} 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 ${YA} 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"}},Hv={"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_"]}},cY=Object.fromEntries(Object.keys(Hv).map(e=>{let{label:r,receiver:n}=Hv[e];return[e,{key:e,title:`${r} server metrics collected`,summary:`${r} seen in client spans should have its server metrics collected.`,rationale:"Server metrics (connections, throughput, replication, contention) are needed to investigate database slowness beyond what client spans show. A detected database with no server metrics has a gap in its monitoring setup.",objectType:"metric",category:"collection-coverage",impact:se("important"),recommendation:n?`Configure the ${n} OpenTelemetry receiver so ${r} server metrics are collected.`:`Collect ${r} server metrics, for example via its Prometheus exporter.`,scope:"global"}]})),pY=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),uY=Es.filter(e=>e.startsWith("azure_")&&!pY.has(e)),Kv={"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:uY,metricPrefixes:["azure_"]}},lY=Object.fromEntries(Object.keys(Kv).map(e=>{let{label:r,source:n}=Kv[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:se("important"),recommendation:`Enable the ${n} metrics integration so ${r} metrics are ingested.`,scope:"global"}]})),mY={...sY,...cY,...lY},zv=Object.values(mY);var Yv=["passed","failed","ignored"],dY=10,fY=t.Enum(Yv,{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."}),gY=["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"],yY=["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"],Rg=["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",...yY,...gY],hY=t.Enum(Rg),EY=["log","metric","resource","span","api-key","dashboard","monitor","route"],TY=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],_Y=["critical","important","normal"],IY=["team","global"],Cg=t.Object({key:t.Enum(Rg),title:t.String(),summary:t.String(),rationale:t.String(),objectType:t.Enum(EY),category:t.Enum(TY),impact:t.Object({label:t.Enum(_Y),weight:t.Number()}),recommendation:t.String(),scope:t.Optional(t.Enum(IY))}),Ns=t.Object({type:t.String({description:"Tsuga asset or telemetry kind referenced by this example. Set by the rule evaluator from the failing object, record, or lookup result; examples include `monitor`, `dashboard`, `metric`, `log`, and `api-key`."}),label:t.String({description:"Human-readable summary of the example. Set by the rule evaluator from the asset name, telemetry identifier, or lookup result so clients can display the example without following the link."}),link:t.Object({to:t.String({description:"In-app route that opens the example in Tsuga. Set by the rule evaluator when the example has a product surface for inspection."}),search:t.Optional(t.Unknown({description:"Route search payload for the in-app link. Set when the destination needs query-string state such as a search query, time range, or table filter."})),params:t.Optional(t.Unknown({description:"Route params for the in-app link. Set when the destination route needs path parameters such as an asset identifier."}))},{description:"In-app deep link for inspecting the example. Returned when Tsuga can route from the quality-report row to a relevant product page."})}),xg=t.Intersect([Cg,t.Object({id:t.Optional(t.String()),status:fY,normalizedScore:t.Number(),details:t.Optional(t.Record(t.String(),t.Unknown())),recommendation:t.Optional(t.String()),examples:t.Optional(t.Array(Ns)),exampleCount:t.Optional(t.Integer())})]),bY=t.Object({generatedAt:t.String(),overallScore:t.Optional(t.Number()),rules:t.Array(Cg),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(xg)})),globalResults:t.Optional(t.Object({score:t.Optional(t.Number()),ruleResults:t.Array(xg)}))}),Pg=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(Rg,{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(Yv,{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(Ns,{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 ${dY}; compare against exampleCount to detect truncation.`})),exampleCount:t.Optional(t.Integer({description:"Total number of examples persisted for this row, before the preview truncation applied to examples. Returned whenever examples are visible to the caller."})),createdAt:t.String({description:"ISO timestamp the row was generated at"})}),q7e=m({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:bY}),Ug=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."})),B7e=m({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:t.Object({clusterId:Ug,team:t.Optional(p({allowEmpty:!1}))}),response:t.Array(Pg,{description:"Latest persisted rule evaluation rows for the cluster"})}),F7e=m({tags:["quality-reports"],url:"/v0/quality-reports/:id/examples",method:"GET",params:t.Object({id:p({allowEmpty:!1})}),response:t.Object({examples:t.Array(Ns)})}),H7e=m({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:t.Object({ruleKey:hY,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:Cg,result:xg,teamId:t.Optional(t.String()),teamName:t.Optional(t.String())})}),K7e=new Map(zv.map(e=>[e.key,e]));var Vv=`/${"v1"}/quality-reports`,Qv=t.Pick(Pg,["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)."}),SY={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(Qv,{examples:[SY]});var OY=t.Object({clusterId:Ug,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."}),Wv=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:`${Vv}/latest`,method:"GET",query:OY,response:t.Array(Qv)}),X7e=m({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:`${Vv}/:id/examples`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"Identifier of the quality-report row whose examples are returned. Use the id from the latest-report endpoint. Unknown ids, rows the caller cannot access, and cluster-wide rows requested by a non-admin all return RESOURCE_NOT_FOUND."})}),response:t.Object({examples:t.Array(Ns,{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 Ls="/v0/admin-center";var xr=`${Ls}/retention-policies`,Zv=3650,AY=t.Integer({description:"Number of days Tsuga retains matching telemetry."}),Xv=t.Integer({minimum:1,maximum:Zv,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${Zv}.`}),Xr=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(Tr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:AY,isEnabled:t.Boolean({description:"Whether this policy participates in retention resolution."}),createdAt:b({description:"Timestamp when Tsuga created the retention policy."}),updatedAt:b({description:"Timestamp when Tsuga last updated the retention policy."})}),Fu=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(Tr,{description:"Telemetry signal retained by this policy: logs, metrics, traces or rum."}),durationDays:Xv,isEnabled:t.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),Jv=t.Array(t.Object({env:p(),dataSource:t.Enum(Tr),durationDays:t.Union([Xv,t.Null()]),isEnabled:t.Boolean()})),eN=t.Object({inserted:t.Array(Xr),updated:t.Array(Xr),deleted:t.Array(Xr)}),sZe=m({tags:["retention-policies"],url:xr,method:"POST",body:Fu,response:Xr}),cZe=m({tags:["retention-policies"],url:xr,method:"GET",response:t.Array(Xr)}),pZe=m({tags:["retention-policies"],url:`${xr}/:id`,method:"GET",params:t.Object({id:p()}),response:Xr}),uZe=m({tags:["retention-policies"],url:`${xr}/:id`,method:"PUT",params:t.Object({id:p()}),body:Fu,response:Xr}),lZe=m({tags:["retention-policies"],url:`${xr}/bulk-update`,method:"POST",body:Jv,response:eN}),mZe=m({tags:["retention-policies"],url:`${xr}/bulk-update-for-team`,method:"POST",body:t.Object({teamId:p(),policies:Jv}),response:eN}),dZe=m({tags:["retention-policies"],url:`${xr}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),ks=["past-24-hours","past-7-days","past-30-days"],fZe=m({tags:["retention-policies"],url:`${xr}/requested-history-percentile/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({percentile:t.Number({minimum:0,maximum:1}),observationWindow:t.Enum(ks),dataSource:t.Enum(Tr)}),response:t.Object({percentile:t.Number(),observationWindow:t.Enum(ks),dataSource:t.Enum(Tr),teamId:t.String(),requestedHistoryDays:t.Number()})}),xY=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var RY=t.Array(t.Object({bucket:t.Enum(xY),count:t.Number()})),gZe=m({tags:["retention-policies"],url:`${xr}/requested-history-histogram/:teamId`,method:"POST",params:t.Object({teamId:p()}),body:t.Object({observationWindow:t.Enum(ks),dataSource:t.Enum(Tr)}),response:t.Object({observationWindow:t.Enum(ks),dataSource:t.Enum(Tr),teamId:t.String(),histogram:RY})}),yZe=m({tags:["retention-policies"],url:`${xr}/top-teams-with-retention-surplus`,method:"POST",body:t.Object({dataSource:t.Enum(Tr),observationWindow:t.Enum(ks),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 Ms=`/${"v1"}/retention-policies`,Ds=t.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)."}),CY={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Ds,{examples:[CY]});var tN=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:Ms,method:"GET",response:t.Array(Ds)}),rN=m({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${Ms}/: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:Ds}),wg=t.Pick(Fu,["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."}),PY={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(wg,{examples:[PY]});var nN=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:Ms,method:"POST",body:wg,response:Ds}),oN=m({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${Ms}/: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:wg,response:Ds}),iN=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:`${Ms}/: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:N});var Gs=`/${"v1"}/slos`,UY=t.Pick(yd,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),$s=t.Object({...t.Pick(ti,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:t.Array(UY,{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"}),wY={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($s,{examples:[wY]});var aN=t.Pick(Ed,["filters","sort","limit","offset"]),sN=t.Object({...aN.properties,...We,filters:aN.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),vY={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(sN,{examples:[vY]});var cN=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:`${Gs}/query`,method:"POST",paginated:!0,body:sN,response:t.Array($s)}),pN=m({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${Gs}/:id`,method:"GET",params:t.Object({id:p({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:$s}),uN=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],lN=t.Pick(Hp,uN,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),mN=t.Pick(hd,uN,{$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."}),dN={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(lN,{examples:[dN]});Object.assign(mN,{examples:[dN]});var fN=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:Gs,method:"POST",body:lN,response:$s}),gN=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:`${Gs}/: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:mN,response:$s}),yN=m({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${Gs}/: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:N});var Eo=`${Ls}/tag-policies`;var NY=["logs","metrics","traces"],vg=t.Array(t.Enum(NY,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),LY=t.Union([Ip,vg]),kY=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."}),MY=C("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:vg,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:Ip},{title:"TsugaAssetTagPolicy"})]),DY=C("type",[t.Object({type:t.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:vg,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:Ip},{title:"TsugaAssetTagPolicy"})]),hN="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",GY=t.Unsafe({...MY,description:hN}),$Y=t.Unsafe({...DY,description:hN}),ji=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(kY),configuration:GY,creator:t.Optional(pe),updater:t.Optional(pe),owner:t.Optional(t.String({description:"Team ID that owns and manages the policy."})),createdAt:b({description:"Timestamp when Tsuga created the tag policy."}),updatedAt:b({description:"Timestamp when Tsuga last updated the tag policy."}),assetUpdatedAt:b({description:"Timestamp used for asset-change tracking across Tsuga-managed resources."})});var js=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:$Y,owner:p({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),$Ze=m({tags:["tag-policies"],url:Eo,method:"GET",query:t.Object({teamIds:t.Optional(t.Array(p(),{maxItems:100})),assetTypes:t.Optional(LY),searchQuery:t.Optional(p())}),response:t.Array(ji)}),jZe=m({tags:["tag-policies"],url:`${Eo}/:id`,method:"GET",params:t.Object({id:p()}),response:ji}),qZe=m({tags:["tag-policies"],url:Eo,method:"POST",body:js,response:ji}),BZe=m({tags:["tag-policies"],url:`${Eo}/:id`,method:"PUT",params:t.Object({id:p()}),body:js,response:ji}),FZe=m({tags:["tag-policies"],url:`${Eo}/:id`,method:"DELETE",params:t.Object({id:p()}),response:N}),HZe=m({tags:["tag-policies"],url:`${Ls}/applicable-tag-rules`,method:"GET",query:t.Object({assetType:t.Enum(Ua),teamId:p()}),response:t.Array(t.Object({tagKey:t.String(),allowedTagValues:t.Array(t.String()),isRequired:t.Boolean(),tagPolicyId:t.String()}))}),EN=t.Object({total:t.Number(),totalNonCompliant:t.Number(),idsNonCompliant:t.Array(t.String())}),TN=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")]),jY=t.Object({total:t.Number(),totalNonCompliant:t.Number(),byAssetType:t.Record(TN,EN)}),qY=t.Omit(EN,["total"]),BY=t.Object({totalNonCompliant:t.Number(),byAssetType:t.Record(TN,qY)}),_N=t.Object({totals:jY,byTeam:t.Record(t.String(),BY)}),KZe=m({tags:["tag-policies"],url:`${Eo}/:id/stats`,method:"GET",params:t.Object({id:p()}),response:_N}),zZe=m({tags:["tag-policies"],url:`${Eo}/new-policy-stats`,method:"POST",body:js,response:_N});var qs=`/${"v1"}/tag-policies`,IN={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"},bN={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"},FY={id:"123-456-abc",...IN},HY={id:"456-789-def",...bN},Bs=t.Pick(ji,["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)."}),KY=FY,zY=HY;Object.assign(Bs,{examples:[KY,zY]});var Ng=t.Pick(js,["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."}),YY=IN,VY=bN;Object.assign(Ng,{examples:[YY,VY]});var SN=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:qs,method:"GET",response:t.Array(Bs)}),ON=m({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${qs}/: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:Bs}),AN=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:qs,method:"POST",body:Ng,response:Bs}),xN=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:`${qs}/: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:Ng,response:Bs}),RN=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:`${qs}/: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:N});var Fs=`/${"v1"}/teams`,Hs=t.Pick(Xo,["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)."}),QY={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Hs,{examples:[QY]});var CN=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:Fs,method:"GET",paginated:!0,query:t.Object(We),response:t.Array(Hs)}),PN=m({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${Fs}/: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:Hs}),Lg=t.Pick(jp,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),WY={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Lg,{examples:[WY]});var UN=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:Fs,method:"POST",body:Lg,response:Hs}),wN=m({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${Fs}/: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:Lg,response:Hs}),vN=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:`${Fs}/: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:N});function ZY(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function NN(e,r){let n=Number(r);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${r})`);return n}function LN(e){let r={};return e.limit!==void 0&&(r.limit=NN("limit",e.limit)),e.offset!==void 0&&(r.offset=NN("offset",e.offset)),r}function kg(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 kN(e,r,n){let o=e.command(r.commandName).description(r.description),i=r.singularOverride??QA(r.commandName).replace(/-/g," "),a=r.pluralOverride??r.commandName.replace(/-/g," "),c=ZY(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 ${Ko} (default: ${_p})`).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){J(Ti(r.endpoints.list));return}let f=d.data?ai({data:d.data}):{},y=await n()(r.endpoints.list,{body:{...f,...LN(d)}});J(y)}):l.action(async d=>{let f=LN(d);if(r.listOptions)for(let _ of r.listOptions){let I=d[_.queryParam];I!==void 0&&(f[_.queryParam]=I)}let y=await n()(r.endpoints.list,Object.keys(f).length>0?{query:f}:void 0);J(y)}),r.endpoints.get){let d=r.endpoints.get,f=kg(d);o.command("get <ID>").description(`Get ${c} ${i} by ID`).action(async y=>{let _=await n()(d,{params:{[f]:y}});J(_)})}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){J(Ti(d));return}let y=ai(f),_=await n()(d,{body:y});J(_)})}if(r.endpoints.update){let d=r.endpoints.update,f=kg(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(y,_)=>{if(_.generateSkeleton){J(Ti(d));return}let I=ai(_),g=await n()(d,{params:{[f]:y},body:I});J(g)})}if(r.endpoints.delete){let d=r.endpoints.delete,f=kg(d);o.command("delete <ID>").description(`Delete ${c} ${i} by ID`).action(async y=>{let _=await n()(d,{params:{[f]:y}});J(_)})}}var XY=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:qw},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:YU,get:VU,create:QU,update:WU,delete:ZU},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:Tw,get:_w,create:Iw,update:bw,delete:Sw},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:Uw,create:ww,update:vw,delete:Nw}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:Fw,get:Hw,create:Kw,update:zw,delete:Yw}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:hv,get:Ev,create:xv,update:Rv,delete:Cv},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:Uv,get:wv,create:vv,update:Nv,delete:Lv}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:$v,get:jv,create:qv,update:Bv,delete:Fv}},{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:Wv},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:tN,get:rN,create:nN,update:oN,delete:iN}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:av,get:sv,create:cv,update:pv,delete:uv}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:Dx,get:Gx}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:cN,get:pN,create:fN,update:gN,delete:yN},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:SN,get:ON,create:AN,update:xN,delete:RN}},{commandName:"teams",description:"Manage teams",endpoints:{list:CN,get:PN,create:UN,update:wN,delete:vN}}];function MN(e,r){for(let n of XY)kN(e,n,r)}var DN=require("node:child_process");var Hu="@tsuga/cli@latest";function JY(){V(`Updating ${Hu}`),V(` $ npm install -g ${Hu}`);try{(0,DN.execFileSync)("npm",["install","-g",Hu],{stdio:["ignore","inherit","inherit"]})}catch(e){let r=e.status??1;throw new Error(`npm install -g ${Hu} exited ${r}`,{cause:e})}V("Updated. Run `tsuga --version` to confirm the new version.")}function GN(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{JY()})}var Bg=require("node:fs"),qg=require("node:os"),Bi=require("node:path");var e9=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,Ks=class e extends Date{#t=!1;#r=!1;#e=null;constructor(r){let n=!0,o=!0,i="Z";if(typeof r=="string"){let a=r.match(e9);a?(a[1]||(n=!1,r=`0000-01-01T${r}`),o=!!a[2],o&&r[10]===" "&&(r=r.replace(" ","T")),a[2]&&+a[2]>23?r="":(i=a[3]||null,r=r.toUpperCase(),!i&&o&&(r+="Z"))):r=""}super(r),isNaN(this.getTime())||(this.#t=n,this.#r=o,this.#e=i)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let r=super.toISOString();if(this.isDate())return r.slice(0,10);if(this.isTime())return r.slice(11,23);if(this.#e===null)return r.slice(0,-1);if(this.#e==="Z")return r;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(r,n="Z"){let o=new e(r);return o.#e=n,o}static wrapAsLocalDateTime(r){let n=new e(r);return n.#e=null,n}static wrapAsLocalDate(r){let n=new e(r);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(r){let n=new e(r);return n.#t=!1,n.#e=null,n}};function 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 X=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}
|
|
138
|
+
fish: tsuga completion fish > ~/.config/fish/completions/tsuga.fish`).action(t=>{let{rows:n,valueFlags:o}=BF(e);if(t==="bash")V(HF(Ax(n),o));else if(t==="zsh")V(KF(Ax(n),o));else if(t==="fish")V(YF(zF(n),o));else throw new Error(`Unsupported shell "${t}". Supported: bash, zsh, fish.`)})}function Rx(e){let t=e.command("config").description("Show or manage configuration");t.action(()=>{let n=e.opts(),o=ni({operationApiKey:n.operationApiKey,clusterId:n.cluster});V(CO(o,Gp()).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)=>{xO(n,o),V(`Default set: ${n} = ${o}`)}),t.command("reset").description("Reset configuration values").command("defaults").description("Clear all custom defaults").action(()=>{RO(),V("Custom defaults cleared")})}var Cx=`/${"v1"}/docs`,Px=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
|
|
139
|
+
...`};Object.assign(Px,{examples:[VF]});var Ux=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"}),QF={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(Ux,{examples:[QF]});var wx=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:Cx,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:Px}),vx=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:`${Cx}/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(Ux)});function Nx(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()(wx,{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()(vx,{query:{query:o}});J(i)})}var WF=`/${"v1"}/feedback`,Lx=r.Object({id:r.String({description:"API request ID recorded with the feedback."})},{$id:"Feedback",description:"A recorded piece of feedback"}),ZF={id:"request-123-abc"};Object.assign(Lx,{examples:[ZF]});var kx=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."})}),XF={content:"The traces command times out for large services."};Object.assign(kx,{examples:[XF]});var Mx=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:WF,method:"POST",body:kx,response:Lx});function Dx(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()(Mx,{body:{content:n.join(" ")}});J(o)})}var JF="^\\S(.*\\S)?$",eB=128,tB=256,rB=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"}),nB=r.Object({key:r.String({maxLength:eB,description:"Tag key to attach to the resource."}),value:r.String({maxLength:tB,pattern:JF,description:"Tag value to attach to the resource. Leading or trailing whitespace is rejected."})},{title:"Tag"}),Ft=r.Array(rB,{title:"Tags",description:"Key/value tags applied to the resource. Use them to organize resources and to satisfy tag policies."}),Bt=r.Array(nB,{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 _n="/v0/teams",Xp=["public","private"],Zp={NAME:"name",CREATED_AT:"createdAt",MEMBER_COUNT:"memberCount",VISIBILITY:"visibility"},oB=r.Enum([Zp.NAME,Zp.CREATED_AT,Zp.MEMBER_COUNT,Zp.VISIBILITY],{description:"Team field used for sorting list responses. Use `name`, `createdAt`, `memberCount`, or `visibility`."}),jx=r.Object({color:r.Enum(pd,{description:"Color token used by Tsuga when rendering the team avatar."}),mode:r.Enum(ud,{description:"Avatar rendering mode selected for the team."}),iconName:r.Enum(dx,{description:"Icon name rendered inside the team avatar when icon mode is used."})}),yd=r.Object({color:r.Enum(pd),mode:r.Enum(ud)}),Gx=100,$x=250,pi=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(Xp,{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(jx)}),Jp=r.Object({name:r.String({minLength:1,maxLength:Gx,format:Xo,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 ${Gx} characters.`}),description:r.Optional(r.String({maxLength:$x,description:`Optional team description. Maximum length is ${$x} characters.`})),visibility:r.Enum(Xp,{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(jx)}),iB=r.Object({id:r.String(),name:r.String(),email:r.String(),role:r.Enum(oi),joinedTeamAt:A(),orgRole:r.Enum(LO),avatar:r.Optional(yd)}),qx=r.Object({searchQuery:r.Optional(u({description:"Substring matched against team names and descriptions."})),visibility:r.Optional(r.Enum(Xp,{description:"Restrict results to teams with this visibility."})),myTeamsOnly:r.Optional(r.Boolean({description:"If true, return only teams that include the authenticated user."}))}),INe=d({tags:["teams"],url:_n,method:"GET",paginated:!0,response:r.Array(pi),query:r.Object({...ge,includeMemberCount:r.Optional(r.Boolean()),...qx.properties,sortBy:r.Optional(oB),sortDirection:r.Optional(r.Enum(["asc","desc"],{description:"Sort direction: ascending or descending."}))})}),bNe=d({tags:["teams"],url:`${_n}/:id`,method:"GET",params:r.Object({id:u()}),response:pi}),SNe=d({tags:["teams"],url:`${_n}/:id/members`,method:"GET",params:r.Object({id:u()}),response:r.Array(iB)}),ANe=d({tags:["teams"],url:`${_n}/: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()})}),ONe=d({tags:["teams"],url:_n,method:"POST",body:Jp,response:pi}),xNe=d({tags:["teams"],url:`${_n}/:id`,method:"PUT",params:r.Object({id:u()}),body:Jp,response:pi}),aB=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(qx)})]),RNe=d({tags:["teams"],url:`${_n}/bulk-update`,method:"POST",body:r.Object({selection:aB,config:r.Object({visibility:r.Enum(Xp)})}),response:r.Object({})}),CNe=d({tags:["teams"],url:`${_n}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N});var sB=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(yd)}),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(sB)})],{description:"User or operation API key responsible for creating or updating a resource. Returned by Tsuga for audit context."});var At="/v0/monitors",ui=["alert","resolve","keep_last_status","consider_zero"],li=["alert","resolve","keep_last_status"];var Bx=["no_aggregation","all","any","each","proportion"],Hx=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var uB=r.Object({formula:r.String({description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(Hx,{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."})}),lB=r.Object({formula:u({type:"tsuga-formula",description:"Formula result to compare against the threshold, usually `q1` or a formula alias."}),operator:r.Enum(Hx,{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."})}),mB=5,Td=r.Array(uB,{description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),Ed=r.Array(lB,{minItems:1,maxItems:mB,description:"Threshold conditions evaluated against query and formula results. All listed conditions must match for a non-grouped threshold monitor to alert."}),_d=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`."}),Id=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 eu={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(Bx,{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`."}))},tu={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(Bx,{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`."}))},bd={...eu,timeframe:r.Number({description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over. Always a whole number from 5 through 1440."})},Sd={...tu,timeframe:r.Integer({minimum:5,maximum:1440,description:"Lookback window, in minutes, that each anomaly monitor evaluation aggregates over."})},Kx=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Td,noDataBehavior:r.Enum(ui,{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."}),...eu,queries:$r},{$id:"MonitorConfigurationMetric"}),zx=r.Object({type:r.Literal("metric",{description:"Threshold monitor over metric aggregations."}),conditions:Ed,noDataBehavior:r.Enum(ui,{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."}),...tu,queries:Tn},{$id:"InputMonitorConfigurationMetric"}),Yx=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Td,noDataBehavior:r.Enum(ui,{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."}),...eu,queries:$r},{$id:"MonitorConfigurationLog"}),Vx=r.Object({type:r.Literal("log",{description:"Threshold monitor over log aggregations."}),conditions:Ed,noDataBehavior:r.Enum(ui,{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."}),...tu,queries:Tn},{$id:"InputMonitorConfigurationLog"}),Qx=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Td,noDataBehavior:r.Enum(ui,{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."}),...eu,queries:$r},{$id:"MonitorConfigurationTrace"}),dB=r.Object({type:r.Literal("trace",{description:"Threshold monitor over trace aggregations."}),conditions:Ed,noDataBehavior:r.Enum(ui,{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."}),...tu,queries:Tn},{$id:"InputMonitorConfigurationTrace"}),Wx=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:_d,noDataBehavior:r.Enum(li,{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."}),...bd,queries:$r},{$id:"MonitorConfigurationAnomalyLog"}),Zx=r.Object({type:r.Literal("anomaly-log",{description:"Anomaly monitor over log aggregations."}),condition:Id,noDataBehavior:r.Enum(li,{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."}),...Sd,queries:Tn},{$id:"InputMonitorConfigurationAnomalyLog"}),Xx=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:_d,noDataBehavior:r.Enum(li,{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."}),...bd,queries:$r},{$id:"MonitorConfigurationAnomalyMetric"}),Jx=r.Object({type:r.Literal("anomaly-metric",{description:"Anomaly monitor over metric aggregations."}),condition:Id,noDataBehavior:r.Enum(li,{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."}),...Sd,queries:Tn},{$id:"InputMonitorConfigurationAnomalyMetric"}),eR=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:_d,noDataBehavior:r.Enum(li,{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."}),...bd,queries:$r},{$id:"MonitorConfigurationAnomalyTrace"}),fB=r.Object({type:r.Literal("anomaly-trace",{description:"Anomaly monitor over trace aggregations. Set this value to create or update an anomaly monitor that learns historical trace query behavior and alerts on unusual movement in trace-derived values."}),condition:Id,noDataBehavior:r.Enum(li,{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."}),...Sd,queries:Tn},{$id:"InputMonitorConfigurationAnomalyTrace"}),tR=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"}),gB=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"}),hB=r.Object({type:r.Literal("log-error-pattern",{description:"Monitor that alerts on newly detected log error patterns for the configured team, environment, and optional service. Recovery notifications are not sent for this monitor type."}),aggregationAlertLogic:r.Literal("each",{description:"Fixed aggregation logic for log error pattern monitors. Each new pattern is evaluated as its own alert group."}),noDataBehavior:r.Literal("keep_last_status",{description:"Fixed no-data behavior for log error pattern monitors. Pattern state is kept until inactive pattern groups expire."}),filter:r.Object({teamIds:r.Array(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"}),yB=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"}),TB=C("type",[Kx,Yx,Qx,Wx,Xx,hB,eR,tR],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."}),EB=C("type",[zx,Vx,dB,Zx,Jx,fB,yB,gB],{description:"Monitor evaluation configuration. The `type` discriminator determines which telemetry source, condition shape, and evaluation rules Tsuga uses."});var YNe=[ci,so,so.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:TB,priority:r.Enum(St,{description:"Monitor priority from 1 through 5, where 1 is highest priority."}),permissions:yn,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"}),_B=C("type",[Kx,Yx,Qx,Wx,Xx,eR,tR]),VNe=r.Object({...qr.properties,configuration:_B},{title:"Monitor"}),QNe=r.Object({...qr.properties,configuration:C("type",[zx,Vx,Zx,Jx])},{title:"Monitor"}),Ja=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:EB,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:yn,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."}))}),Fx=["threshold","certificate-expiry","anomaly-detection","log-error-pattern"],In={PRIORITY:"priority",TYPE:"type",NAME:"name",OWNER:"owner",TAGS:"tags",CLUSTER_IDS:"clusterIds",PAUSE_UNTIL:"pauseUntil",ASSET_UPDATED_AT:"assetUpdatedAt"};var Ad=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(Fx),{description:"Restrict results to monitors with these types",maxItems:Fx.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"}),Od=r.Partial(r.Object({...ge,filters:r.Partial(Ad),sort:r.Object({by:r.Enum([In.PRIORITY,In.TYPE,In.NAME,In.OWNER,In.TAGS,In.CLUSTER_IDS,In.PAUSE_UNTIL,In.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."})})),WNe=d({tags:["monitors"],url:`${At}/query`,method:"POST",paginated:!0,response:r.Array(qr),body:Od}),ZNe=d({tags:["monitors"],url:`${At}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(Ad,["tags"])))}),response:Ft}),XNe=d({tags:["monitors"],url:`${At}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(Ad,["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."})})}),JNe=d({tags:["monitors"],url:`${At}/:id`,method:"GET",params:r.Object({id:u()}),response:qr}),eLe=d({tags:["monitors"],url:At,method:"POST",body:Ja,response:qr}),tLe=d({tags:["monitors"],url:`${At}/:id`,method:"PUT",params:r.Object({id:u()}),body:Ja,response:qr}),rLe=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({})}),nLe=d({tags:["monitors"],url:`${At}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),oLe=d({tags:["monitors"],url:`${At}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),iLe=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}),aLe=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"],bB=["ok","ok_consider_zero","ok_no_data","keep_last_status_ok"],SB=[...IB,...bB],co=r.Enum(SB),AB=C("type",[r.Object({type:r.Literal("each"),subStates:r.Record(r.String(),r.Object({stateValue:r.Union([co,r.Null()]),lastChangedAt:A()}))}),r.Object({type:r.Literal("no_aggregation"),stateValue:r.Optional(co)}),r.Object({type:r.Literal("any"),stateValue:r.Optional(co)}),r.Object({type:r.Literal("all"),stateValue:r.Optional(co)}),r.Object({type:r.Literal("proportion"),stateValue:r.Optional(co)})]),OB=r.Object({monitorId:r.String(),currentState:AB,lastChangedAt:r.Optional(A())}),sLe=d({tags:["monitors"],url:`${At}/states/:id`,method:"GET",params:r.Object({id:u()}),response:OB}),cLe=d({tags:["monitors"],url:`${At}/:id/transitions`,method:"GET",params:r.Object({id:u()}),query:r.Object({from:r.Number(),to:r.Number()}),response:r.Array(r.Object({id:r.String(),createdAt:A(),fromState:r.Optional(co),toState:r.Optional(co),dimension:r.Optional(r.String())}))}),xB=["unprocessed","processed","failed-to-process"],pLe=d({tags:["monitors"],url:`${At}/:id/results`,method:"GET",params:r.Object({id:u()}),query:r.Object({from:r.Number(),to:r.Number()}),response:r.Object({isTruncated:r.Boolean(),results:r.Array(r.Object({id:r.String(),evaluationAt:A(),formulaResult:r.Object({groups:r.Array(r.Object({groupKey:r.Record(r.String(),Qa),results:r.Array(r.Union([r.Number(),r.Null()])),conditionMet:r.Enum(["true","false","nan-no-data"])}))}),createdAt:A(),status:r.Enum(xB)}))})});var Fr="/v0/slos",RB=[7,30,90],CB=["good","bad"],iR=r.Enum(CB,{description:"How to treat SLO with no data: good (count as meeting the SLO), bad (count as breaching it)"}),PB=["good","bad","ignore"],aR=r.Enum(PB,{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)"}),rR=30,nR=1440,sR=["greater_than","less_than","greater_than_or_equal","less_than_or_equal"],UB=["healthy","breached","no_data"],ru=r.Enum(UB,{description:"SLO status: healthy (meeting the target), breached (breaching it), or no_data (not evaluated yet)"}),oR={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:ru},wB=r.Object({overall:r.Object(oR,{description:"Latest overall evaluation for the cluster"}),perGroup:r.Array(r.Object({groupKey:r.Record(r.String(),Qa,{description:"Group-by field values identifying this group, keyed by field name. Present only when the SLO configuration sets `groupByFields`."}),...oR}),{description:"Latest evaluation for each group produced by the SLO configuration's `groupByFields`. Empty when the SLO is not grouped."})},{title:"SloClusterResults"}),cR=r.Record(r.String(),wB,{description:"Latest evaluation results keyed by cluster ID."}),xd=r.Object({queries:$r,formula:Hp},{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."}),Rd=r.Object({queries:lx,formula:ao},{title:"SloQueryFormula",description:"Aggregation queries combined by a formula to produce the SLO signal. Formulas reference queries as q1, q2, and so on. Do not send per-query fill; Tsuga derives the fill behavior from the SLO type."}),vB=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"}),NB=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 LB=r.Object({type:r.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:r.Number({description:"SLI percentage threshold for this alert. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),kB=r.Object({type:r.Literal("threshold",{description:"Alert configuration kind. Set to `threshold` for alerts that fire when the SLO indicator falls below a percentage threshold."}),threshold:r.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"SLI percentage threshold for this alert. Required for threshold alerts; valid input is greater than 0 and less than 100. The alert passes when SLI is at or above this value and fires when SLI is strictly below it."})},{title:"ThresholdAlert"}),MB=C("type",[vB,LB],{description:"Alert trigger configuration: burn-rate or threshold"}),pR=C("type",[NB,kB],{description:"Alert trigger configuration: burn-rate or threshold"}),Cd=r.Enum(St,{description:"Alert priority (1 is highest, 5 is lowest)"}),Pd=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:Cd,configuration:MB,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"}),DB=r.Object({priority:Cd,configuration:pR}),GB=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:Cd,configuration:pR}),$B=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:xd,totalQuery:xd,groupByFields:r.Optional(si),noDataBehavior:iR},{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:xd,sliceSizeMinutes:r.Integer({description:"Length of each time-SLO evaluation slice in minutes. Required for `type: time`."}),threshold:r.Object({operator:r.Enum(sR,{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(si),noDataBehavior:aR},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."});var jB=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:Rd,totalQuery:Rd,groupByFields:r.Optional(jr),noDataBehavior:iR},{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:Rd,sliceSizeMinutes:r.Integer({minimum:rR,maximum:nR,description:`Length of each time-SLO evaluation slice in minutes. Required for \`type: time\`. Valid input is ${rR} through ${nR}.`}),threshold:r.Object({operator:r.Enum(sR,{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:aR},{title:"TimeSliceSloConfiguration"})],{description:"SLI configuration for this SLO. Use `event` for good/total event-ratio SLOs or `time` for thresholded time-slice SLOs."}),qB=r.Number({exclusiveMinimum:0,exclusiveMaximum:100,description:"Target percentage (0 < target < 100, e.g. 99.9)"}),uR=r.Enum(RB,{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."}),FB=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."}),BB=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."}),mi=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:$B,target:r.Number({description:"Target percentage (0 < target < 100, e.g. 99.9)"}),timeframeDays:uR,owner:r.String({description:"Team ID that owns the SLO"}),permissions:yn,clusterIds:FB,creator:r.Optional(pe),updater:r.Optional(pe),alerts:r.Array(Pd,{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"}),HB=r.Object({...mi.properties,results:cR},{title:"SloWithResults"}),nu=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:jB,target:qB,timeframeDays:uR,owner:u({allowEmpty:!1,description:"Team ID that owns the SLO"}),permissions:yn,clusterIds:r.Optional(BB),alerts:r.Array(DB,{description:"Alerts to create on this SLO. Send an empty array for none."})}),Ud=r.Object({...r.Omit(nu,["alerts"]).properties,alerts:r.Array(GB,{description:"Alerts attached to this SLO. The SLO owns its alerts: the set is reconciled to exactly this list \u2014 existing alerts are matched by id, alerts without an id are created, and existing alerts absent from the list are deleted. Send an empty array to clear all alerts."})}),lR=r.Object({owners:_e(u({allowEmpty:!1}),{description:"Restrict results to SLOs owned by any of these team IDs",maxItems:50}),searchQuery:r.Object({value:u({allowEmpty:!1,description:"Substring matched case-insensitively against the SLO name or SLO ID."}),exclude:r.Optional(r.Boolean({description:"If true, exclude SLOs matching this value instead of including them"}))},{description:"Text filter for SLO names or IDs. Optional; `exclude: true` removes matching SLOs."}),tags:_e(Bt.items,{description:"Restrict results to SLOs that have at least one of the listed key/value tags",maxItems:50}),clusterIds:_e(u({allowEmpty:!1}),{description:"Restrict results to SLOs that run against any of these cluster IDs (SLOs with no cluster restriction are always included)",maxItems:50}),statuses:_e(ru,{description:"Restrict results to SLOs whose status is one of these values",maxItems:3})},{description:"Optional filters applied to narrow the returned SLOs"}),mR=r.Partial(lR),wd=r.Partial(r.Object({...ge,filters:mR,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(HB),body:wd}),ULe=d({tags:["slos"],url:`${Fr}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(r.Omit(lR,["tags","statuses"])))}),response:Ft}),wLe=d({tags:["slos"],url:`${Fr}/:id`,method:"GET",params:r.Object({id:u()}),response:mi}),vLe=d({tags:["slos"],url:`${Fr}/:id/results`,method:"GET",params:r.Object({id:u()}),response:cR}),NLe=d({tags:["slos"],url:Fr,method:"POST",body:nu,response:mi}),LLe=d({tags:["slos"],url:`${Fr}/:id`,method:"PUT",params:r.Object({id:u()}),body:Ud,response:mi}),kLe=d({tags:["slos"],url:`${Fr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),dR=r.Object({type:r.Literal("all"),filters:r.Optional(mR)}),KB=C("type",[r.Object({type:r.Literal("ids"),ids:r.Array(u({allowEmpty:!1}),{minItems:1})}),dR]),MLe=d({tags:["slos"],url:`${Fr}/bulk-delete`,method:"DELETE",body:r.Object({selection:KB}),response:r.Object({})}),zB=C("type",[r.Object({type:r.Literal("ids"),ids:r.Array(u({allowEmpty:!1}),{minItems:1,maxItems:100})}),dR]),DLe=d({tags:["slos"],url:`${Fr}/bulk-update`,method:"PUT",body:r.Object({selection:zB,owner:u({allowEmpty:!1})}),response:r.Object({})});var di="/v0/notifications",bn=`${di}/rules`,fR=`${di}/slack/setup`,es=`${di}/integrations`,po=["triggered","resolved","no-data"],YB=["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."})),vd=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."}),QB=r.Optional(vd),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."})),ts=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`."})}),fi=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:QB,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)."})}),Nd=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."}),Ld=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."}),gi=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:Nd,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(po),{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(ts,{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)}),rs=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:Ld,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(po),{maxItems:po.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(fi,{minItems:1,description:"Destinations that receive a notification whenever this rule matches an alert transition. This list replaces the existing targets on update."})}),ou=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:ts,creator:r.Optional(pe),updater:r.Optional(pe)}),gR=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:fi}),zLe=d({tags:["notification-rules"],url:bn,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(gi)}),YLe=d({tags:["notification-rules"],url:`${bn}/:id`,params:r.Object({id:u()}),method:"GET",response:gi}),VLe=d({tags:["notification-rules"],url:bn,method:"POST",body:rs,response:gi}),QLe=d({tags:["notification-rules"],url:`${bn}/:id`,method:"PUT",params:r.Object({id:u()}),body:rs,response:gi}),WLe=d({tags:["notification-rules"],url:`${bn}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),ZLe=d({tags:["notification-rules"],url:`${bn}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),hi=`${di}/adaptive-rules`,XLe=d({tags:["notification-rules"],url:hi,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(ou)}),JLe=d({tags:["notification-rules"],url:`${hi}/:id`,params:r.Object({id:u()}),method:"GET",response:ou}),eke=d({tags:["notification-rules"],url:hi,method:"POST",body:gR,response:ou}),tke=d({tags:["notification-rules"],url:`${hi}/:id`,method:"PUT",params:r.Object({id:u()}),body:gR,response:ou}),rke=d({tags:["notification-rules"],url:`${hi}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),nke=d({tags:["notification-rules"],url:`${hi}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})}),oke=d({tags:["notification-integrations"],url:`${fR}/start`,method:"POST",response:r.Object({redirectUrl:r.String()})}),WB=["google-chat","grafana-irm","incident-io","jira","microsoft-teams","pagerduty","servicenow","slack","squadcast","webhook"],ZB=r.Object({id:r.String(),name:r.String(),type:r.Enum(WB),createdAt:A(),ruleCount:r.Number(),creator:r.Optional(pe)}),ike=d({tags:["notification-integrations"],url:`${bn}/integrations`,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(ZB)}),ake=d({tags:["notification-integrations"],url:`${fR}/callback`,method:"GET",query:r.Object({code:u()}),response:r.Object({success:r.Boolean()})}),kd=["POST","PUT"],XB=r.Record(r.String(),r.String()),JB=r.Record(r.String(),r.Unknown()),eH=r.Record(r.String(),r.Union([r.String(),r.Number(),r.Boolean(),r.Null(),r.Array(r.Union([r.String(),r.Number(),r.Boolean()]))])),tH=C("type",[r.Object({type:r.Literal("json"),value:JB}),r.Object({type:r.Literal("form"),value:eH})]),rH=r.Object({ok:r.String(),alert:r.String()}),Md=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(kd),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(XB),payloadTemplate:tH,eventNameMapping:r.Optional(rH)}),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}),nH=r.Object({type:r.Literal("webhook"),url:u({type:"uri"}),method:r.Enum(kd),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})}))}),hR=r.Object({type:r.Literal("incident-io"),alertSourceConfigId:u(),token:u()}),yR=r.Object({type:r.Literal("grafana-irm"),url:u({type:"uri"})}),TR=r.Object({type:r.Literal("pagerduty"),integrationKey:u()}),ER=r.Object({type:r.Literal("microsoft-teams"),webhookUrl:u({type:"uri"})}),oH=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})}),iH=r.Object({type:r.Literal("google-chat"),webhookUrl:u({type:"uri"})}),aH=r.Object({type:r.Literal("squadcast"),webhookUrl:u({type:"uri"})}),sH=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."})}),cH=r.Object({name:u(),setting:C("type",[hR,yR,TR,ER,nH,oH,iH,aH,sH]),tags:Xe}),pH=r.Object({type:r.Literal("webhook"),url:r.Optional(u({type:"uri"})),method:r.Optional(r.Enum(kd)),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}))}))}),uH=r.Object({type:r.Literal("servicenow"),instanceName:r.Optional(u({allowEmpty:!1})),username:r.Optional(u({allowEmpty:!1})),password:r.Optional(u({allowEmpty:!1}))}),lH=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}))}),mH=r.Object({type:r.Literal("google-chat"),webhookUrl:u({type:"uri"})}),dH=r.Object({type:r.Literal("squadcast"),webhookUrl:u({type:"uri"})}),fH=r.Object({name:r.Optional(u()),setting:r.Optional(C("type",[hR,yR,TR,ER,pH,uH,mH,dH,lH]))}),ske=d({tags:["notification-integrations"],url:es,method:"POST",body:cH,response:Md}),cke=d({tags:["notification-integrations"],url:`${es}/:id`,method:"GET",params:r.Object({id:u()}),response:Md}),pke=d({tags:["notification-integrations"],url:`${es}/:id`,method:"PUT",params:r.Object({id:u()}),body:fH,response:Md}),uke=d({tags:["notification-integrations"],url:`${es}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),gH=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."}),lke=d({tags:["notification-integrations"],url:`${es}/:id/jira-metadata`,method:"GET",params:r.Object({id:u()}),response:gH}),mke=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(YB),tryCount:r.Number(),nextTryAt:A(),createdAt:A(),updatedAt:A(),sentAt:r.Optional(A())})),isTruncated:r.Boolean()})}),hH=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast","jira"],dke=d({tags:["notification-rules"],url:`${bn}/test`,method:"POST",body:r.Object({notificationRule:rs,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(hH,{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 yH=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."}),TH=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."}),EH=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."}),_H=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."}),_R=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."}),bH=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."}),AH=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."}),yi=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:ts.properties.config,rateLimit:ts.properties.rateLimit,createdAt:A({description:"Timestamp when user created this service target."}),updatedAt:A({description:"Timestamp when user last updated this service target."})}),Dd=r.Object({config:fi.properties.config,rateLimit:fi.properties.rateLimit}),Gd=r.Object({config:fi.properties.config,rateLimit:r.Union([vd,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."})}),ns=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(yH,{description:"Team names observed on telemetry for this service and when each was last seen."}),ingestionApiKeys:r.Array(TH,{description:"Ingestion API keys observed on telemetry for this service and when each was last seen."}),versions:r.Array(EH,{description:"Service version values observed in telemetry, including first and last seen timestamps."}),languages:r.Array(_H,{description:"Programming languages observed for this service."}),runtimes:r.Array(IH,{description:"Runtime values observed for this service."}),serverProtocols:r.Array(_R,{description:"API protocols this service exposes (from server-kind spans)"}),clientProtocols:r.Array(_R,{description:"API protocols this service calls out over (from client-kind spans)"}),frameworks:r.Array(bH,{description:"Application frameworks detected from OTel instrumentation scope"}),cloudPlatforms:r.Array(SH,{description:"Cloud platforms this service is running on"}),cloudProviders:r.Array(AH,{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(yi,{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."})}),Ake=d({tags:["service-catalog"],query:r.Object({...ge,clusterId:r.Optional(u())}),method:"GET",paginated:!0,url:`${Dt}/services`,response:r.Array(ns)}),OH=r.Object({spanKind:r.Enum(hx),count:r.Number()}),$d=r.Object({...ns.properties,spanKindCounts:r.Array(OH),envs:r.Object({primaryEnv:r.String(),allEnvs:r.Array(r.String())})}),Oke=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($d)}),xH=["serviceName","envs","lastDeploy","traceErrorRate","traceRequestRate","logErrorRate","logRequestRate","teams","api","frameworks","languages","pagingDestination"],RH=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"})}),CH=r.Partial(r.Object({...ge,clusterId:u(),filters:r.Partial(RH,{description:"Optional filters applied to narrow the returned services"}),sort:r.Object({by:r.Enum(xH,{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"})})),xke=d({tags:["service-catalog"],url:`${Dt}/v2/services/query`,method:"POST",paginated:!0,body:CH,response:r.Array($d)}),Rke=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:$d}),Cke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId`,params:r.Object({serviceId:u()}),response:ns}),Pke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId/targets`,params:r.Object({serviceId:u()}),response:r.Array(yi)}),Uke=d({tags:["service-catalog"],method:"POST",url:`${Dt}/services/:serviceId/targets`,params:r.Object({serviceId:u()}),body:Dd,response:yi}),wke=d({tags:["service-catalog"],method:"PUT",url:`${Dt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:u(),targetId:u()}),body:Gd,response:yi}),vke=d({tags:["service-catalog"],method:"DELETE",url:`${Dt}/services/:serviceId/targets/:targetId`,params:r.Object({serviceId:u(),targetId:u()}),response:N}),PH=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var IR=r.Object({id:r.String(),hostName:r.String(),env:r.Optional(r.String()),cpuUtilizationAverage:r.Number(),hostType:r.Enum(PH),teams:r.Array(r.String()),tags:r.Array(r.String()),firstSeenAt:A(),lastSeenAt:A(),clusterId:r.String()}),Nke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/hosts`,response:r.Array(IR)}),Lke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/hosts/:hostId`,params:r.Object({hostId:u()}),response:IR}),UH=["http","rpc","messaging","genai","object_store"],bR={name:r.String({description:"Service or inferred dependency name shown in the graph."}),env:r.Optional(r.String({description:"Environment observed from spans."}))},jd=r.Object({...bR,nodeType:r.Literal("observed",{description:"Discriminator for this node variant. Always `observed` for a graph node matched to a service catalog entry by name and env."}),id:r.Union([r.String(),r.Null()],{description:"Service ID, or null when multiple namespaces match the observed service name."}),namespace:r.Union([r.String(),r.Null()],{description:"Service namespace, or null when multiple namespaces match the observed service name."}),errorRate:r.Optional(r.Number({description:"Ratio of entry requests with at least one error to total entry requests observed on this service. Omitted when no entry requests were observed."})),entryErrorRequestCount:r.Number({description:"Number of entry requests on this service where at least one entry span had error status."}),entryRequestCount:r.Number({description:"Number of entry requests observed on this service, counted as unique trace IDs that have at least one entry span on this service. An entry span is a consumer-kind span, a root span (no parent), or any span whose parent belongs to a different service."})}),SR={...bR,endpoint:r.Optional(r.String({description:"Inferred service endpoint address"})),resourceName:r.Optional(r.String({description:"Inferred resource name, e.g. table or queue name"}))},qd=r.Object({...SR,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`."})}),Fd=r.Object({...SR,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(UH,{description:"Inferred dependency type from span metadata: http, rpc, messaging, genai, or object_store."})}),wH=C("nodeType",[jd,qd,Fd]),Bd=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."}),kke=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(wH),edges:r.Array(Bd)})}),vH=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(ru,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"})}))}),Mke=d({tags:["service-catalog"],method:"GET",url:`${Dt}/services/:serviceId/related-resources`,params:r.Object({serviceId:u()}),response:vH}),Dke=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 iu=`/${"v1"}/services`,Hd=r.Pick(ns,["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)."}),NH={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(Hd,{examples:[NH]});var AR=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:iu,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(Hd)}),OR=d({description:"Retrieves one telemetry-inferred service by service ID.",operationId:"getService",tags:["services"],url:`${iu}/: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:Hd}),LH=r.Pick(jd,["name","env","nodeType","id","namespace","errorRate","entryErrorRequestCount","entryRequestCount"],{$id:"ObservedServiceGraphNode",description:"Service graph node matched to a service catalog entry by name and env. `id`/`namespace` are null when multiple namespaces share the observed service name."}),kH=r.Pick(Fd,["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."}),MH=r.Pick(qd,["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."}),DH=C("nodeType",[LH,MH,kH]),GH=r.Pick(Bd,["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."}),$H=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."})),jH=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."})),qH=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."}),xR=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:`${iu}/: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:$H,to:jH,query:r.Optional(qH)},{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(DH,{description:"Observed and inferred nodes included in the service dependency graph."}),edges:r.Array(GH,{description:"Directed dependency edges between graph nodes."})})}),au=`${iu}/:serviceId/notification-targets`,su=r.Pick(yi,["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)."}),Kd={rateLimit:{maxMessages:10,minutes:5},config:{type:"email",addresses:["oncall@example.com"],renotifyConfig:{mode:"each",renotificationStates:["alert"],renotifyIntervalMinutes:30}}},FH={id:"789-abc-def",serviceId:"123-456-abc",...Kd};Object.assign(su,{examples:[FH]});var cu=u({allowEmpty:!1,description:"Identifier of the service the notification target belongs to. Use the `id` returned by service list or get responses."}),zke=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:au,method:"GET",params:r.Object({serviceId:cu}),response:r.Array(su)}),BH=r.Pick(Dd,["config","rateLimit"],{description:"Service notification target create request. Provide the delivery destination and an optional per-target rate limit.",examples:[Kd]}),HH=r.Pick(Gd,["config","rateLimit"],{description:"Service notification target update request. The submitted destination and rate limit overwrite the stored ones.",examples:[Kd]}),Yke=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:au,method:"POST",params:r.Object({serviceId:cu}),body:BH,response:su}),Vke=d({description:"Updates one notification target attached to a service.",operationId:"updateServiceNotificationTarget",tags:["services"],url:`${au}/:targetId`,method:"PUT",params:r.Object({serviceId:cu,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:HH,response:su}),Qke=d({description:"Detaches a notification target from a service. Notification rules stop paging this destination for the service.",operationId:"deleteServiceNotificationTarget",tags:["services"],url:`${au}/:targetId`,method:"DELETE",params:r.Object({serviceId:cu,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 RR(e,t){let n=t??Gr(e);return n===void 0?void 0:yc(n)}function zd(e){let t=Gr(e);return t===void 0?"":` (default: ${t})`}function CR(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}${zd("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${zd("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter graph spans${zd("query")}`).action(async(o,i)=>{let a={},c=RR("from",i.from),l=RR("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()(xR,{params:{serviceId:o},query:a});J(m)})}var KH=`/${"v1"}/grok`,zH=25,YH=100,PR=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:zH,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:YH,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(PR,{examples:[VH]});var UR=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."}),QH={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(UR,{examples:[QH]});var wR=d({url:`${KH}/parse`,method:"POST",operationId:"parseGrok",tags:["public","grok"],body:PR,response:UR,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 vR=tn(require("node:fs"));function Ti(e){if(e.file){let t=vR.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 Yd(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 pu(e){return s.IsBoolean(e)}function q(e){return ir(e)||pu(e)}function Vd(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 os(e){return s.HasPropertyKey(e,"$anchor")&&s.IsString(e.$anchor)}function Wd(e){return s.HasPropertyKey(e,"anyOf")&&s.IsArray(e.anyOf)&&e.anyOf.every(t=>q(t))}function Zd(e){return s.HasPropertyKey(e,"const")}function uo(e){return s.HasPropertyKey(e,"contains")&&q(e.contains)}function Ht(e){return s.HasPropertyKey(e,"default")}function Xd(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 Jd(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 ef(e){return s.HasPropertyKey(e,"dependentSchemas")&&s.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>q(t))}function Sn(e){return s.HasPropertyKey(e,"$dynamicAnchor")&&s.IsString(e.$dynamicAnchor)}function tf(e){return s.HasPropertyKey(e,"$dynamicRef")&&s.IsString(e.$dynamicRef)}function rf(e){return s.HasPropertyKey(e,"else")&&q(e.else)}function nf(e){return s.HasPropertyKey(e,"enum")&&s.IsArray(e.enum)}function of(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 is(e){return s.HasPropertyKey(e,"format")&&s.IsString(e.format)}function Kr(e){return s.HasPropertyKey(e,"$id")&&s.IsString(e.$id)}function af(e){return s.HasPropertyKey(e,"if")&&q(e.if)}function Ei(e){return s.HasPropertyKey(e,"items")&&(q(e.items)||s.IsArray(e.items)&&e.items.every(t=>q(t)))}function sf(e){return Ei(e)&&s.IsArray(e.items)}function cf(e){return s.HasPropertyKey(e,"maximum")&&(s.IsNumber(e.maximum)||s.IsBigInt(e.maximum))}function pf(e){return s.HasPropertyKey(e,"maxContains")&&s.IsNumber(e.maxContains)}function uu(e){return s.HasPropertyKey(e,"maxItems")&&s.IsNumber(e.maxItems)}function uf(e){return s.HasPropertyKey(e,"maxLength")&&s.IsNumber(e.maxLength)}function lf(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 lo(e){return s.HasPropertyKey(e,"minContains")&&s.IsNumber(e.minContains)}function _i(e){return s.HasPropertyKey(e,"minItems")&&s.IsNumber(e.minItems)}function as(e){return s.HasPropertyKey(e,"minLength")&&s.IsNumber(e.minLength)}function ss(e){return s.HasPropertyKey(e,"minProperties")&&s.IsNumber(e.minProperties)}function mf(e){return s.HasPropertyKey(e,"multipleOf")&&(s.IsNumber(e.multipleOf)||s.IsBigInt(e.multipleOf))}function df(e){return s.HasPropertyKey(e,"not")&&q(e.not)}function ff(e){return s.HasPropertyKey(e,"oneOf")&&s.IsArray(e.oneOf)&&e.oneOf.every(t=>q(t))}function cs(e){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)}function ps(e){return s.HasPropertyKey(e,"patternProperties")&&s.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>q(t))}function Ii(e){return s.HasPropertyKey(e,"prefixItems")&&s.IsArray(e.prefixItems)&&e.prefixItems.every(t=>q(t))}function us(e){return s.HasPropertyKey(e,"properties")&&s.IsObject(e.properties)&&Object.values(e.properties).every(t=>q(t))}function gf(e){return s.HasPropertyKey(e,"propertyNames")&&(s.IsObject(e.propertyNames)||q(e.propertyNames))}function WH(e){return s.HasPropertyKey(e,"$recursiveAnchor")&&s.IsBoolean(e.$recursiveAnchor)}function lu(e){return WH(e)&&s.IsEqual(e.$recursiveAnchor,!0)}function hf(e){return s.HasPropertyKey(e,"$recursiveRef")&&s.IsString(e.$recursiveRef)}function yf(e){return s.HasPropertyKey(e,"$ref")&&s.IsString(e.$ref)}function mo(e){return s.HasPropertyKey(e,"required")&&s.IsArray(e.required)&&e.required.every(t=>s.IsString(t))}function Tf(e){return s.HasPropertyKey(e,"then")&&q(e.then)}function Ef(e){return s.HasPropertyKey(e,"type")&&(s.IsString(e.type)||s.IsArray(e.type)&&e.type.every(t=>s.IsString(t)))}function bi(e){return s.HasPropertyKey(e,"uniqueItems")&&s.IsBoolean(e.uniqueItems)}function mu(e){return s.HasPropertyKey(e,"unevaluatedItems")&&q(e.unevaluatedItems)}function du(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}},ls=class extends xt{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}},st=class extends ls{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}};function NR(e,t,n,o){return s.Every(n["~refine"],0,(i,a)=>i.check(o))}function LR(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 kR(e){return Ei(e)&&s.IsArray(e.items)}function MR(e,t,n,o){return kR(n)?s.Every(o,0,(a,c)=>s.IsLessThan(c,n.items.length)||Kt(e,t,n.additionalItems,a)&&t.AddIndex(c)):!0}function DR(e,t,n,o,i,a){return kR(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 ZH(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function GR(e){let t=[];return ps(e)&&t.push(...s.Keys(e.patternProperties)),us(e)&&t.push(...s.Keys(e.properties).map(ZH)),s.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function $R(e,t,n,o){let i=new RegExp(GR(n));return s.Every(s.Keys(o),0,(c,l)=>i.test(c)||Kt(e,t,n.additionalProperties,o[c])&&t.AddKey(c))}function jR(e,t,n,o,i,a){let c=new RegExp(GR(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 qR(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 FR(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 BR(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 HR(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 If(e,t,n,o){return n}function KR(e,t,n,o,i,a){return If(e,t,i,a)||t.AddError({keyword:"boolean",schemaPath:n,instancePath:o,params:{}})}function bf(e,t,n,o){return s.IsValueLike(n.const)?s.IsEqual(o,n.const):s.IsDeepEqual(o,n.const)}function zR(e,t,n,o,i,a){return bf(e,t,i,a)||t.AddError({keyword:"const",schemaPath:n,instancePath:o,params:{allowedValue:i.const}})}function XH(e){return!(lo(e)&&s.IsEqual(e.minContains,0))}function Sf(e,t,n,o){return XH(n)?!s.IsEqual(o.length,0)&&s.SomeAll(o,(i,a)=>ne(e,t,n.contains,i)&&t.AddIndex(a)):!0}function YR(e,t,n,o,i,a){return Sf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:1}})}function VR(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 QR(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 WR(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 ZR(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 XR(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 JR(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 eC(e,t,n,o){let i=e.DynamicRef(n)??!1;return q(i)&&ne(e,t,i,o)}function tC(e,t,n,o,i,a){let c=e.DynamicRef(i)??!1;return q(c)&&Ie(e,t,"#",o,c,a)}function xf(e,t,n,o){return s.Some(n.enum,i=>s.IsValueLike(i)?s.IsEqual(o,i):s.IsDeepEqual(o,i))}function rC(e,t,n,o,i,a){return xf(e,t,i,a)||t.AddError({keyword:"enum",schemaPath:n,instancePath:o,params:{allowedValues:i.enum}})}function Rf(e,t,n,o){return s.IsLessThan(o,n.exclusiveMaximum)}function nC(e,t,n,o,i,a){return Rf(e,t,i,a)||t.AddError({keyword:"exclusiveMaximum",schemaPath:n,instancePath:o,params:{comparison:"<",limit:i.exclusiveMaximum}})}function Cf(e,t,n,o){return s.IsGreaterThan(o,n.exclusiveMinimum)}function oC(e,t,n,o,i,a){return Cf(e,t,i,a)||t.AddError({keyword:"exclusiveMinimum",schemaPath:n,instancePath:o,params:{comparison:">",limit:i.exclusiveMinimum}})}var xi={};Yt(xi,{Clear:()=>gC,Entries:()=>D2,Get:()=>j2,Has:()=>$2,IsDate:()=>Ai,IsDateTime:()=>fu,IsDuration:()=>gu,IsEmail:()=>hu,IsHostname:()=>Tu,IsIPv4:()=>Iu,IsIPv6:()=>bu,IsIdnEmail:()=>Eu,IsIdnHostname:()=>_u,IsIri:()=>Au,IsIriReference:()=>Su,IsJsonPointer:()=>xu,IsJsonPointerUriFragment:()=>Ou,IsRegex:()=>Ru,IsRelativeJsonPointer:()=>Cu,IsTime:()=>Oi,IsUri:()=>vu,IsUriReference:()=>Pu,IsUriTemplate:()=>Uu,IsUrl:()=>Nu,IsUuid:()=>Lu,Reset:()=>hC,Set:()=>G2,Test:()=>q2});var JH=[0,31,28,31,30,31,30,31,31,30,31,30,31],e2=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function t2(e){return e%4===0&&(e%100!==0||e%400===0)}function Ai(e){let t=e2.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&&t2(n)?29:JH[o])}var r2=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Oi(e,t=!0){let n=r2.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 fu(e,t=!0){let n=e.split(/T/i);return n.length===2&&Ai(n[0])&&Oi(n[1],t)}var n2=/^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 gu(e){return n2.test(e)}var o2=/^(?!.*\.\.)[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 hu(e){return o2.test(e)}var fo=36,yu=1,Pf=26,i2=38,a2=700,s2=72,c2=128;function p2(e,t,n){e=n?Math.floor(e/a2):e>>1,e+=Math.floor(e/t);let o=0;for(;e>(fo-yu)*Pf>>1;)e=Math.floor(e/(fo-yu)),o+=fo;return o+Math.floor((fo-yu+1)*e/(e+i2))}function iC(e){let t=[],n=c2,o=0,i=s2,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=fo;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?yu:f>=i+Pf?Pf:f-i;if(I<g)break;m*=fo-g,f+=fo}let h=t.length+1;i=p2(o-l,h,l===0),n+=Math.floor(o/h),o%=h,t.splice(o,0,n),o++}return globalThis.String.fromCodePoint(...t)}function l2(e){return new RegExp("\\p{Mn}","u").test(String.fromCodePoint(e))}function m2(e){return new RegExp("\\p{Mc}","u").test(String.fromCodePoint(e))}function d2(e){return new RegExp("\\p{Me}","u").test(String.fromCodePoint(e))}function f2(e){return l2(e)||m2(e)||d2(e)}var g2=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347]),h2=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 y2(e){return new RegExp("\\p{Script=Greek}","u").test(String.fromCodePoint(e))}function T2(e){return new RegExp("\\p{Script=Hebrew}","u").test(String.fromCodePoint(e))}function E2(e){return new RegExp("\\p{Script=Hiragana}","u").test(String.fromCodePoint(e))}function _2(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 b2(e){return e>=1632&&e<=1641}function S2(e){return e>=1776&&e<=1785}function aC(e){return h2.has(e)}function sC(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||f2(t[0]))return!1;let o=!1,i=!1,a=!1;for(let c=0;c<n;c++){let l=t[c];if(g2.has(l))return!1;(E2(l)||_2(l)||I2(l))&&(o=!0),b2(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||!y2(f))return!1;break;case 1523:case 1524:if(m===void 0||!T2(m))return!1;break;case 8204:if(m===void 0||m<128&&!aC(m))return!1;break;case 8205:if(m===void 0||!aC(m))return!1;break;case 12539:break}}return!(e.includes("\u30FB")&&!o||i&&a)}function A2(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 cC(e){return e.toLowerCase().startsWith("xn--")}function pC(e){try{let t=e.slice(4).toLowerCase();if(t.lastIndexOf("-")===0)return!1;let o=iC(t);return o?sC(o):!1}catch{return!1}}function uC(e){return e.length===0||e.length>63?!1:cC(e)?pC(e):sC(e)}function lC(e){return e.length===0||e.length>63?!1:cC(e)?pC(e):A2(e)}function Tu(e){if(e.length===0||e.length>253||e.charCodeAt(e.length-1)===46)return!1;for(let t of e.split("."))if(!lC(t))return!1;return!0}var x2=/^(?!.*\.\.)[\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 Eu(e){return x2.test(e)}function _u(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(!uC(n))return!1;return!0}function Uf(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 Iu(e){return Uf(e,0,e.length)}function R2(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function bu(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&&R2(e.charCodeAt(i));)i++,a++;if(a===0)return!1;let l=e.charCodeAt(i);if(l===46){if(!Uf(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 mC(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function Su(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))?mC(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:mC(e)}function Au(e){try{return new URL(e),!0}catch{return!1}}var C2=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Ou(e){return C2.test(e)}var P2=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function xu(e){return P2.test(e)}function Ru(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var U2=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function Cu(e){return U2.test(e)}var w2=/^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;function Pu(e){return w2.test(e)}var v2=/^(?:(?:[^\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 Uu(e){return v2.test(e)}function dC(e){return e>=97&&e<=122||e>=65&&e<=90}function fC(e){return dC(e)||e>=48&&e<=57}function wu(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function N2(e){return fC(e)||e===43||e===45||e===46}function wf(e){return fC(e)||e===45||e===46||e===95||e===126}function vf(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 L2(e){return wf(e)||vf(e)||e===58||e===64}function vu(e){let t=e.length;if(t===0||!dC(e.charCodeAt(0)))return!1;let n=1;for(;n<t;){let o=e.charCodeAt(n);if(o===58)break;if(!N2(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||!wu(e.charCodeAt(a+1))||!wu(e.charCodeAt(a+2)))return!1;a+=2}else if(!wf(c)&&!vf(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&&!wf(a)&&!vf(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||!wu(e.charCodeAt(n+1))||!wu(e.charCodeAt(n+2)))return!1;n+=2}else{if(o>127)return!1;if(!(L2(o)||o===47||o===63||o===35))return!1}n++}return!0}var k2=/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;function Nu(e){return k2.test(e)}var M2=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function Lu(e){return M2.test(e)}var Oe=new Map;function gC(){Oe.clear()}function D2(){return[...Oe.entries()]}function G2(e,t){Oe.set(e,t)}function $2(e){return Oe.has(e)}function j2(e){return Oe.get(e)}function q2(e,t){return Oe.get(e)?.(t)??!0}function hC(){gC(),Oe.set("date-time",fu),Oe.set("date",Ai),Oe.set("duration",gu),Oe.set("email",hu),Oe.set("hostname",Tu),Oe.set("idn-email",Eu),Oe.set("idn-hostname",_u),Oe.set("ipv4",Iu),Oe.set("ipv6",bu),Oe.set("iri-reference",Su),Oe.set("iri",Au),Oe.set("json-pointer-uri-fragment",Ou),Oe.set("json-pointer",xu),Oe.set("regex",Ru),Oe.set("relative-json-pointer",Cu),Oe.set("time",Oi),Oe.set("uri-reference",Pu),Oe.set("uri-template",Uu),Oe.set("uri",vu),Oe.set("url",Nu),Oe.set("uuid",Lu)}hC();function Nf(e,t,n,o){return xi.Test(n.format,o)}function yC(e,t,n,o,i,a){return Nf(e,t,i,a)||t.AddError({keyword:"format",schemaPath:n,instancePath:o,params:{format:i.format}})}function TC(e,t,n,o){let i=Tf(n)?n.then:!0,a=rf(n)?n.else:!0;return ne(e,t,n.if,o)?ne(e,t,i,o):ne(e,t,a,o)}function EC(e,t,n,o,i,a){let c=Tf(i)?i.then:!0,l=rf(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 F2(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 B2(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 H2(e,t,n,o){let i=Ii(n)?n.prefixItems.length:0;return s.Every(o,i,(a,c)=>Kt(e,t,n.items,a)&&t.AddIndex(c))}function K2(e,t,n,o,i,a){let c=Ii(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 _C(e,t,n,o){return sf(n)?F2(e,t,n,o):H2(e,t,n,o)}function IC(e,t,n,o,i,a){return sf(i)?B2(e,t,n,o,i,a):K2(e,t,n,o,i,a)}function z2(e){return uo(e)}function Lf(e,t,n,o){if(!z2(n))return!0;let i=s.Counted(o,a=>ne(e,t,n.contains,a));return s.IsLessEqualThan(i,n.maxContains)}function bC(e,t,n,o,i,a){let c=lo(i)?i.minContains:1;return Lf(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:c,maxContains:i.maxContains}})}function kf(e,t,n,o){return s.IsLessEqualThan(o,n.maximum)}function SC(e,t,n,o,i,a){return kf(e,t,i,a)||t.AddError({keyword:"maximum",schemaPath:n,instancePath:o,params:{comparison:"<=",limit:i.maximum}})}function Mf(e,t,n,o){return s.IsLessEqualThan(o.length,n.maxItems)}function AC(e,t,n,o,i,a){return Mf(e,t,i,a)||t.AddError({keyword:"maxItems",schemaPath:n,instancePath:o,params:{limit:i.maxItems}})}function Df(e,t,n,o){return s.IsMaxLength(o,n.maxLength)}function OC(e,t,n,o,i,a){return Df(e,t,i,a)||t.AddError({keyword:"maxLength",schemaPath:n,instancePath:o,params:{limit:i.maxLength}})}function Gf(e,t,n,o){return s.IsLessEqualThan(s.Keys(o).length,n.maxProperties)}function xC(e,t,n,o,i,a){return Gf(e,t,i,a)||t.AddError({keyword:"maxProperties",schemaPath:n,instancePath:o,params:{limit:i.maxProperties}})}function Y2(e){return uo(e)}function $f(e,t,n,o){if(!Y2(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 RC(e,t,n,o,i,a){return $f(e,t,i,a)||t.AddError({keyword:"contains",schemaPath:n,instancePath:o,params:{minContains:i.minContains}})}function jf(e,t,n,o){return s.IsGreaterEqualThan(o,n.minimum)}function CC(e,t,n,o,i,a){return jf(e,t,i,a)||t.AddError({keyword:"minimum",schemaPath:n,instancePath:o,params:{comparison:">=",limit:i.minimum}})}function qf(e,t,n,o){return s.IsGreaterEqualThan(o.length,n.minItems)}function PC(e,t,n,o,i,a){return qf(e,t,i,a)||t.AddError({keyword:"minItems",schemaPath:n,instancePath:o,params:{limit:i.minItems}})}function Ff(e,t,n,o){return s.IsMinLength(o,n.minLength)}function UC(e,t,n,o,i,a){return Ff(e,t,i,a)||t.AddError({keyword:"minLength",schemaPath:n,instancePath:o,params:{limit:i.minLength}})}function Bf(e,t,n,o){return s.IsGreaterEqualThan(s.Keys(o).length,n.minProperties)}function wC(e,t,n,o,i,a){return Bf(e,t,i,a)||t.AddError({keyword:"minProperties",schemaPath:n,instancePath:o,params:{limit:i.minProperties}})}function Hf(e,t,n,o){return s.IsMultipleOf(o,n.multipleOf)}function vC(e,t,n,o,i,a){return Hf(e,t,i,a)||t.AddError({keyword:"multipleOf",schemaPath:n,instancePath:o,params:{multipleOf:i.multipleOf}})}function Kf(e,t,n,o){let i=new xt;return!ne(e,i,n.not,o)&&t.Merge([i])}function NC(e,t,n,o,i,a){return Kf(e,t,i,a)||t.AddError({keyword:"not",schemaPath:n,instancePath:o,params:{}})}function LC(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 kC(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 zf(e,t,n,o){return(s.IsString(n.pattern)?new RegExp(n.pattern,"u"):n.pattern).test(o)}function MC(e,t,n,o,i,a){return zf(e,t,i,a)||t.AddError({keyword:"pattern",schemaPath:n,instancePath:o,params:{pattern:i.pattern}})}function DC(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 GC(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 $C(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 jC(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 Yf(e,t){return e.includes(t)||rt.Get().exactOptionalPropertyTypes}function Vf(e,t){return s.IsUndefined(e[t])}function qC(e,t,n,o){let i=mo(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 Yf(i,c)?m:Vf(o,c)||m})}function FC(e,t,n,o,i,a){let c=mo(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 Yf(c,m)?I():Vf(a,m)||I()})}function BC(e,t,n,o){return s.Every(s.Keys(o),0,(i,a)=>ne(e,t,n.propertyNames,i))}function HC(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 KC(e,t,n,o){let i=e.RecursiveRef(n)??!1;return q(i)&&ne(e,t,i,o)}function zC(e,t,n,o,i,a){let c=e.RecursiveRef(i)??!1;return q(c)&&Ie(e,t,"#",o,c,a)}function YC(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 VC(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 QC(e,t,n,o){return s.Every(n.required,0,i=>s.HasPropertyKey(o,i))}function WC(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 ZC(e,t,n,o,i){return s.Some(n,a=>Qf(e,t,a,o,i))}function XC(e,t,n,o){return s.IsArray(n.type)?ZC(e,t,n.type,n,o):Qf(e,t,n.type,n,o)}function JC(e,t,n,o,i,a){return(s.IsArray(i.type)?ZC(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 eP(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 tP(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 rP(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 nP(e,t,n,o,i,a){let c=t.GetKeys(),l=[];return s.EveryAll(s.Entries(a),0,([f,h])=>{let E=new st,I=c.has(f)||Ie(e,E,n,o,i.unevaluatedProperties,h)&&t.AddKey(f);return I||l.push(f),I})||t.AddError({keyword:"unevaluatedProperties",schemaPath:n,instancePath:o,params:{unevaluatedProperties:l}})}function oP(e){return!s.IsEqual(e.uniqueItems,!1)}function iP(e,t,n,o){if(!oP(n))return!0;let i=new Set(o.map(Fn.Hash)).size,a=o.length;return s.IsEqual(i,a)}function aP(e,t,n,o,i,a){if(!oP(i))return!0;let c=new Set,l=a.reduce((f,h,E)=>{let I=Fn.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=pu(n)?If(e,t,n,o):(!Ef(n)||XC(e,t,n,o))&&(!(s.IsObject(o)&&!s.IsArray(o))||(!mo(n)||QC(e,t,n,o))&&(!Br(n)||$R(e,t,n,o))&&(!Xd(n)||VR(e,t,n,o))&&(!Jd(n)||WR(e,t,n,o))&&(!ef(n)||XR(e,t,n,o))&&(!ps(n)||DC(e,t,n,o))&&(!us(n)||qC(e,t,n,o))&&(!gf(n)||BC(e,t,n,o))&&(!ss(n)||Bf(e,t,n,o))&&(!lf(n)||Gf(e,t,n,o)))&&(!s.IsArray(o)||(!Vd(n)||MR(e,t,n,o))&&(!uo(n)||Sf(e,t,n,o))&&(!Ei(n)||_C(e,t,n,o))&&(!pf(n)||Lf(e,t,n,o))&&(!uu(n)||Mf(e,t,n,o))&&(!lo(n)||$f(e,t,n,o))&&(!_i(n)||qf(e,t,n,o))&&(!Ii(n)||$C(e,t,n,o))&&(!bi(n)||iP(e,t,n,o)))&&(!s.IsString(o)||(!uf(n)||Df(e,t,n,o))&&(!as(n)||Ff(e,t,n,o))&&(!is(n)||Nf(e,t,n,o))&&(!cs(n)||zf(e,t,n,o)))&&(!(s.IsNumber(o)||s.IsBigInt(o))||(!of(n)||Rf(e,t,n,o))&&(!Hr(n)||Cf(e,t,n,o))&&(!cf(n)||kf(e,t,n,o))&&(!zr(n)||jf(e,t,n,o))&&(!mf(n)||Hf(e,t,n,o)))&&(!yf(n)||YC(e,t,n,o))&&(!hf(n)||KC(e,t,n,o))&&(!tf(n)||eC(e,t,n,o))&&(!Zd(n)||bf(e,t,n,o))&&(!nf(n)||xf(e,t,n,o))&&(!af(n)||TC(e,t,n,o))&&(!df(n)||Kf(e,t,n,o))&&(!Qd(n)||qR(e,t,n,o))&&(!Wd(n)||BR(e,t,n,o))&&(!ff(n)||LC(e,t,n,o))&&(!mu(n)||!s.IsArray(o)||eP(e,t,n,o))&&(!du(n)||!s.IsObject(o)||rP(e,t,n,o))&&(!Yd(n)||NR(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=pu(i)?KR(e,t,n,o,i,a):!!(+(!Ef(i)||JC(e,t,n,o,i,a))&+(!(s.IsObject(a)&&!s.IsArray(a))||!!(+(!mo(i)||WC(e,t,n,o,i,a))&+(!Br(i)||jR(e,t,n,o,i,a))&+(!Xd(i)||QR(e,t,n,o,i,a))&+(!Jd(i)||ZR(e,t,n,o,i,a))&+(!ef(i)||JR(e,t,n,o,i,a))&+(!ps(i)||GC(e,t,n,o,i,a))&+(!us(i)||FC(e,t,n,o,i,a))&+(!gf(i)||HC(e,t,n,o,i,a))&+(!ss(i)||wC(e,t,n,o,i,a))&+(!lf(i)||xC(e,t,n,o,i,a))))&+(!s.IsArray(a)||!!(+(!Vd(i)||DR(e,t,n,o,i,a))&+(!uo(i)||YR(e,t,n,o,i,a))&+(!Ei(i)||IC(e,t,n,o,i,a))&+(!pf(i)||bC(e,t,n,o,i,a))&+(!uu(i)||AC(e,t,n,o,i,a))&+(!lo(i)||RC(e,t,n,o,i,a))&+(!_i(i)||PC(e,t,n,o,i,a))&+(!Ii(i)||jC(e,t,n,o,i,a))&+(!bi(i)||aP(e,t,n,o,i,a))))&+(!s.IsString(a)||!!(+(!uf(i)||OC(e,t,n,o,i,a))&+(!as(i)||UC(e,t,n,o,i,a))&+(!is(i)||yC(e,t,n,o,i,a))&+(!cs(i)||MC(e,t,n,o,i,a))))&+(!(s.IsNumber(a)||s.IsBigInt(a))||!!(+(!of(i)||nC(e,t,n,o,i,a))&+(!Hr(i)||oC(e,t,n,o,i,a))&+(!cf(i)||SC(e,t,n,o,i,a))&+(!zr(i)||CC(e,t,n,o,i,a))&+(!mf(i)||vC(e,t,n,o,i,a))))&+(!yf(i)||VC(e,t,n,o,i,a))&+(!hf(i)||zC(e,t,n,o,i,a))&+(!tf(i)||tC(e,t,n,o,i,a))&+(!Zd(i)||zR(e,t,n,o,i,a))&+(!nf(i)||rC(e,t,n,o,i,a))&+(!af(i)||EC(e,t,n,o,i,a))&+(!df(i)||NC(e,t,n,o,i,a))&+(!Qd(i)||FR(e,t,n,o,i,a))&+(!Wd(i)||HR(e,t,n,o,i,a))&+(!ff(i)||kC(e,t,n,o,i,a))&+(!mu(i)||!s.IsArray(a)||tP(e,t,n,o,i,a))&+(!du(i)||!s.IsObject(a)||nP(e,t,n,o,i,a)))&&(!Yd(i)||LR(e,t,n,o,i,a));return e.Pop(i),c}var An={};Yt(An,{DynamicRef:()=>cK,Ref:()=>Zf});var Ri={};Yt(Ri,{Delete:()=>tK,Get:()=>J2,Has:()=>X2,Indices:()=>fs,Set:()=>eK});function sP(e){if(e.length===0)throw Error("Cannot set root")}function cP(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 pP(e){for(let t of e)V2(t)}function Q2(e){return/^(0|[1-9]\d*)$/.test(e)}function uP(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function W2(e,t){return s.IsObject(t)&&s.HasPropertyKey(t,e)}function Z2(e,t){return s.IsObject(t)&&!s.IsUnsafePropertyKey(e)?t[e]:void 0}function Wf(e,t){return e.reduce((n,o)=>Z2(o,n),t)}function fs(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 X2(e,t){let n=e;return fs(t).every(o=>W2(o,n)?(n=n[o],!0):!1)}function J2(e,t){let n=fs(t);return Wf(n,e)}function eK(e,t,n){let o=fs(t);sP(o),pP(o);let[i,a]=uP(o),c=Wf(i,e);return cP(c),c[a]=n,e}function tK(e,t){let n=fs(t);sP(n),pP(n);let[o,i]=uP(n),a=Wf(o,e);return cP(a),s.IsArray(a)&&Q2(i)?a.splice(+i,1):delete a[i],e}function rK(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("#")?lP(e,t,n):e}function nK(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 oK(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 lP(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 Ri.Get(e,o)}function iK(e,t,n){if(Kr(e)){let o=rK(e,t,n);if(!s.IsUndefined(o))return o}if(os(e)){let o=nK(e,t,n);if(!s.IsUndefined(o))return o}if(Sn(e)){let o=oK(e,t,n);if(!s.IsUndefined(o))return o}return lP(e,t,n)}function aK(e,t,n){return e.reduce((o,i)=>{let a=Xf(i,t,n);return s.IsUndefined(a)?o:a},void 0)}function sK(e,t,n){return s.Keys(e).reduce((o,i)=>{let a=Xf(e[i],t,n);return s.IsUndefined(a)?o:a},void 0)}function Xf(e,t,n){let o=ir(e)&&Kr(e)?new URL(e.$id,t.href):t;if(ir(e)){let i=iK(e,o,n);if(!s.IsUndefined(i))return i}if(s.IsArray(e))return aK(e,o,n);if(s.IsObject(e))return sK(e,o,n)}function Zf(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 Xf(e,o,i)}function cK(e,t,n,o){let i=n.$dynamicRef.startsWith("#")?Zf(t,n.$dynamicRef):Zf(e,n.$dynamicRef);return s.IsUndefined(i)?void 0:!ir(i)||!Sn(i)||new URL(n.$dynamicRef,"http://unknown/").hash.startsWith("#/")?i:o.find(l=>l.$dynamicAnchor===i.$dynamicAnchor)??i}var Ci=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)},On,mP,dP,fP,gP,go=class{constructor(t,n){On.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),Ci(this,On,"m",mP).call(this,t)),os(t)&&this.anchors.push(t),lu(t)&&this.recursiveAnchors.push(t),Sn(t)&&this.dynamicAnchors.push(t))}Pop(t){ir(t)&&(Kr(t)&&(this.ids.pop(),Ci(this,On,"m",dP).call(this,t)),os(t)&&this.anchors.pop(),lu(t)&&this.recursiveAnchors.pop(),Sn(t)&&this.dynamicAnchors.pop())}Ref(t){return Ci(this,On,"m",fP).call(this,t)??Ci(this,On,"m",gP).call(this,t)}RecursiveRef(t){return lu(this.Base())?An.Ref(this.recursiveAnchors[0],t.$recursiveRef):An.Ref(this.Base(),t.$recursiveRef)}DynamicRef(t){let n=this.schema;return An.DynamicRef(n,this.Base(),t,this.dynamicAnchors)}};On=new WeakSet,mP=function e(t,n=!0){if(!ir(t))return;let o=t;if(!(!n&&Kr(o))){!n&&Sn(o)&&this.dynamicAnchors.push(o);for(let i of s.Keys(o))Ci(this,On,"m",e).call(this,o[i],!1)}},dP=function e(t,n=!0){if(!ir(t))return;let o=t;if(!(!n&&Kr(o))){!n&&Sn(o)&&this.dynamicAnchors.pop();for(let i of s.Keys(o))Ci(this,On,"m",e).call(this,o[i],!1)}},fP=function(t){return s.HasPropertyKey(this.context,t.$ref)?this.context[t.$ref]:void 0},gP=function(t){let n=this.schema;return t.$ref.startsWith("#")?An.Ref(this.Base(),t.$ref):An.Ref(n,t.$ref)};function ku(...e){let[t,n,o]=oe.Match(e,{3:(h,E,I)=>[h,E,I],2:(h,E)=>[{},h,E]}),i=rt.Get(),a=nT(),c=[],l=new go(t,n),m=new ls(h=>{if(!s.IsGreaterEqualThan(c.length,i.maxErrors))return c.push({...h,message:a(h)})});return[Ie(l,m,"#","",n,o),c]}function eg(...e){let[t,n,o]=oe.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),i=new go(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 eg(t,n,o)}function xn(...e){let[t,n,o]=oe.Match(e,{3:(c,l,m)=>[c,l,m],2:(c,l)=>[{},c,l]}),[i,a]=ku(t,n,o);return a}var Rn=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 hP(e,t,n){return s.IsArray(n)?n.map(o=>ct(e,t.items,o)):n}function yP(e,t,n){return ct({...e,...t.$defs},nt(t.$ref),n)}function lK(e,t){let n=s.HasPropertyKey(t,"unevaluatedProperties")?{additionalProperties:t.unevaluatedProperties}:{},o=Qt(e,t),i=ft(o);return D(i)?wp(i,n):i}function TP(e,t,n){let o=lK(e,t);return ct(e,o,n)}function Mu(e){return s.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function EP(e,t,n){if(!s.IsObject(n)||s.IsArray(n))return n;let o=Mu(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 _P(e,t,n){if(!s.IsObject(n))return n;let o=Mu(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 IP(e,t,n){return s.HasPropertyKey(e,t.$ref)?ct(e,e[t.$ref],n):n}function bP(e,t,n){if(!s.IsArray(n))return n;let o=Math.min(n.length,t.items.length);for(let i=0;i<o;i++)n[i]=ct(e,t.items[i],n[i]);return s.IsGreaterThan(n.length,o)?n.slice(0,o):n}function $e(e){return $n(e)}function SP(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)?hP(e,t,n):Te(t)?yP(e,t,n):M(t)?TP(e,t,n):D(t)?EP(e,t,n):de(t)?_P(e,t,n):ce(t)?IP(e,t,n):Y(t)?bP(e,t,n):R(t)?SP(e,t,n):n}function mK(e,t){for(let n of xc.Keys(e))xc.HasPropertyKey(t,n)||(t[n]=e[n]);return t}function dK(e){let t={};for(let n of xc.Keys(e))t[n]=gs(e[n]);return t}function fK(e){return tg(YA(e))}function tg(e){return e.map(t=>gs(t))}function gs(e){let t=Z(e)?Pt(gs(e.items),Uo(e)):M(e)?ut(tg(e.allOf)):R(e)?F(fK(e.anyOf)):D(e)?k(dK(e.properties)):de(e)?$o(pn(e),gs(Se(e))):Y(e)?ke(tg(e.items)):e;return mK(e,t)}function Pi(e){return gs(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?Pi(n):n;return ct(t,i,o)}var ie={};Yt(ie,{Fail:()=>yo,IsOk:()=>rg,Ok:()=>L,TryArray:()=>gK,TryBigInt:()=>ng,TryBoolean:()=>RK,TryNull:()=>vK,TryNumber:()=>MK,TryString:()=>DK,TryUndefined:()=>FK});function rg(e){return s.IsObject(e)&&s.HasPropertyKey(e,"value")}function L(e){return{value:e}}function yo(){}function gK(e){return s.IsArray(e)?L(e):L([e])}function hK(e){return s.IsEqual(e,!0)?L(BigInt(1)):L(BigInt(0))}var yK=/^-?(0|[1-9]\d*)n$/,TK=/^-?(0|[1-9]\d*)\.\d+$/,EK=/^-?(0|[1-9]\d*)$/;function _K(e){return yK.test(e)}function IK(e){return TK.test(e)}function bK(e){return EK.test(e)}function SK(e){let t=e.toLowerCase();return _K(e)?L(BigInt(e.slice(0,e.length-1))):IK(e)?L(BigInt(e.split(".")[0])):bK(e)?L(BigInt(e)):s.IsEqual(t,"false")?L(BigInt(0)):s.IsEqual(t,"true")?L(BigInt(1)):void 0}function ng(e){return s.IsBigInt(e)?L(e):s.IsBoolean(e)?hK(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 AK(e){return s.IsEqual(e,BigInt(0))?L(!1):s.IsEqual(e,BigInt(1))?L(!0):void 0}function OK(e){return s.IsEqual(e,0)?L(!1):s.IsEqual(e,1)?L(!0):void 0}function xK(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 RK(e){return s.IsBigInt(e)?AK(e):s.IsBoolean(e)?L(e):s.IsNumber(e)?OK(e):s.IsNull(e)?L(!1):s.IsString(e)?xK(e):s.IsUndefined(e)?L(!1):void 0}function CK(e){return s.IsEqual(e,BigInt(0))?L(null):void 0}function PK(e){return s.IsEqual(e,!1)?L(null):void 0}function UK(e){return s.IsEqual(e,0)?L(null):void 0}function wK(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 vK(e){return s.IsBigInt(e)?CK(e):s.IsBoolean(e)?PK(e):s.IsNumber(e)?UK(e):s.IsNull(e)?L(null):s.IsString(e)?wK(e):s.IsUndefined(e)?L(null):void 0}var AP=BigInt(Number.MAX_SAFE_INTEGER),OP=BigInt(Number.MIN_SAFE_INTEGER);function NK(e){return e<=AP&&e>=OP?L(Number(e)):void 0}function LK(e){return L(e?1:0)}function kK(e){let t=+e;if(s.IsNumber(t))return L(t);let n=e.toLowerCase();if(s.IsEqual(n,"false"))return L(0);if(s.IsEqual(n,"true"))return L(1);let o=ng(e);return rg(o)?o.value<=AP&&o.value>=OP?L(Number(o.value)):void 0:void 0}function MK(e){return s.IsBigInt(e)?NK(e):s.IsBoolean(e)?LK(e):s.IsNumber(e)?L(e):s.IsNull(e)?L(0):s.IsString(e)?kK(e):s.IsUndefined(e)?L(0):void 0}function DK(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 GK(e){return s.IsEqual(e,BigInt(0))?L(void 0):void 0}function $K(e){return s.IsEqual(e,!1)?L(void 0):void 0}function jK(e){return s.IsEqual(e,0)?L(void 0):void 0}function qK(e){let t=e.toLowerCase();return s.IsEqual(t,"undefined")||s.IsEqual(t,"null")||s.IsEqual(e,"")||s.IsEqual(e,"0")?L(void 0):void 0}function FK(e){return s.IsBigInt(e)?GK(e):s.IsBoolean(e)?$K(e):s.IsNumber(e)?jK(e):s.IsNull(e)?L(void 0):s.IsString(e)?qK(e):s.IsUndefined(e)?L(e):void 0}function xP(e,t,n){return ie.TryArray(n).value.map(i=>je(e,t.items,i))}function RP(e,t,n){let o=ie.TryBigInt(n);return ie.IsOk(o)?o.value:n}function CP(e,t,n){let o=ie.TryBoolean(n);return ie.IsOk(o)?o.value:n}function PP(e,t,n){return je({...e,...t.$defs},nt(t.$ref),n)}function UP(e,t,n){return je(e,ft(t),n)}function wP(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)?Math.trunc(o.value):n}function vP(e,t,n){let o=Qt(e,t),i=ft(o);return je(e,i,n)}function BK(e,t,n){let o=ie.TryBigInt(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function HK(e,t,n){let o=ie.TryBoolean(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function KK(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function zK(e,t,n){let o=ie.TryString(n);return ie.IsOk(o)&&s.IsEqual(t.const,o.value)?o.value:n}function NP(e,t,n){return s.IsEqual(t.const,n)?n:mT(t)?BK(e,t,n):dT(t)?HK(e,t,n):kc(t)?KK(e,t,n):Mc(t)?zK(e,t,n):fe()}function LP(e,t,n){let o=ie.TryNull(n);return ie.IsOk(o)?o.value:n}function kP(e,t,n){let o=ie.TryNumber(n);return ie.IsOk(o)?o.value:n}function Du(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 hs(e,t,n){return Je(e)&&s.IsUndefined(n[t])}function YK(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)||hs(c,l,n)||(n[l]=je(e,c,n[l]));return s.HasPropertyKey(t,"additionalProperties")&&s.IsObject(t.additionalProperties)?Du(e,o,t.additionalProperties,n):n}function MP(e,t,n){return s.IsObjectNotArray(n)?YK(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)?Du(e,o,t.additionalProperties,n):n}function DP(e,t,n){return s.IsObjectNotArray(n)?VK(e,t,n):n}function GP(e,t,n){return s.HasPropertyKey(e,t.$ref)?je(e,e[t.$ref],n):n}function $P(e,t,n){let o=ie.TryString(n);return ie.IsOk(o)?o.value:n}function jP(e,t,n){return je(e,ft(t),n)}function qP(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 FP(e,t,n){let o=ie.TryUndefined(n);return ie.IsOk(o)?o.value:n}function BP(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 HP(e,t,n){let o=ie.TryUndefined(n);return ie.IsOk(o)?void 0:n}function je(e,t,n){return Z(t)?xP(e,t,n):vt(t)?RP(e,t,n):_t(t)?CP(e,t,n):Te(t)?PP(e,t,n):ze(t)?UP(e,t,n):ot(t)?wP(e,t,n):M(t)?vP(e,t,n):Q(t)?NP(e,t,n):gr(t)?LP(e,t,n):Ce(t)?kP(e,t,n):D(t)?MP(e,t,n):de(t)?DP(e,t,n):ce(t)?GP(e,t,n):We(t)?$P(e,t,n):Ee(t)?jP(e,t,n):Y(t)?qP(e,t,n):nr(t)?FP(e,t,n):R(t)?BP(e,t,n):kt(t)?HP(e,t,n):n}function Cn(...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 KP(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 zP(e,t,n){return pt({...e,...t.$defs},nt(t.$ref),n)}function YP(e,t){return s.IsUndefined(t)?s.IsFunction(e.default)?e.default():$e(e.default):t}function VP(e,t,n){let o=Qt(e,t),i=ft(o);return pt(e,i,n)}function QP(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 WP(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 ZP(e,t,n){return s.HasPropertyKey(e,t.$ref)?pt(e,e[t.$ref],n):n}function XP(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 JP(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)?YP(t,n):n;return Z(t)?KP(e,t,o):Te(t)?zP(e,t,o):M(t)?VP(e,t,o):D(t)?QP(e,t,o):de(t)?WP(e,t,o):ce(t)?ZP(e,t,o):Y(t)?XP(e,t,o):R(t)?JP(e,t,o):o}function To(...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 Ui(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 QK(e,t,n){return t["~codec"].decode(n)}function WK(e,t,n){return t["~codec"].encode(n)}function xe(e,t,n,o){return Bn(n)?s.IsEqual(e,"Decode")?QK(t,n,o):WK(t,n,o):o}function ZK(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 XK(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 eU(e,t,n,o){return s.IsEqual(e,"Decode")?ZK(e,t,n,o):XK(e,t,n,o)}function tU(e,t,n,o){return o=Pe(e,{...t,...n.$defs},nt(n.$ref),o),xe(e,t,n,o)}function rU(e){return e.reduce((t,n)=>({...t,...n}),{})}function nU(e,t){for(let n of t)if(!s.IsDeepEqual(e,n))return n;return e}function JK(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))?rU(i):nU(o,i);return xe(e,t,n,c)}function ez(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))?rU(a):nU(i,a)}function oU(e,t,n,o){return s.IsEqual(e,"Decode")?JK(e,t,n,o):ez(e,t,n,o)}function tz(e,t,n,o){if(!s.IsObjectNotArray(o))return o;for(let i of s.Keys(n.properties))!s.HasPropertyKey(o,i)||hs(n.properties[i],i,o)||(o[i]=Pe(e,t,n.properties[i],o[i]));return xe(e,t,n,o)}function rz(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)||hs(n.properties[a],a,i)||(i[a]=Pe(e,t,n.properties[a],i[a]));return i}function iU(e,t,n,o){return s.IsEqual(e,"Decode")?tz(e,t,n,o):rz(e,t,n,o)}function nz(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 oz(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 aU(e,t,n,o){return s.IsEqual(e,"Decode")?nz(e,t,n,o):oz(e,t,n,o)}function sU(e,t,n,o){return s.HasPropertyKey(t,n.$ref)?Pe(e,t,t[n.$ref],o):o}function cU(e,t,n,o){return s.IsEqual(e,"Decode")?xe(e,t,n,sU(e,t,n,o)):sU(e,t,n,xe(e,t,n,o))}function iz(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 az(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 pU(e,t,n,o){return s.IsEqual(e,"Decode")?iz(e,t,n,o):az(e,t,n,o)}function sz(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 cz(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 uU(e,t,n,o){return s.IsEqual(e,"Decode")?sz(e,t,n,o):cz(e,t,n,o)}function Pe(e,t,n,o){return Z(n)?eU(e,t,n,o):Te(n)?tU(e,t,n,o):M(n)?oU(e,t,n,o):D(n)?iU(e,t,n,o):de(n)?aU(e,t,n,o):ce(n)?cU(e,t,n,o):Y(n)?pU(e,t,n,o):R(n)?uU(e,t,n,o):xe(e,t,n,o)}var og=class extends Rn{constructor(t,n){super("Decode",t,n)}};function pz(e,t,n){if(!he(e,t,n))throw new og(n,xn(e,t,n));return n}function uz(e,t,n){let o=rt.Get().unionPrioritySort?Pi(t):t;return Pe("Decode",e,o,n)}var YYe=Ui([(e,t,n)=>$e(n),(e,t,n)=>To(e,t,n),(e,t,n)=>Cn(e,t,n),(e,t,n)=>Ar(e,t,n),(e,t,n)=>pz(e,t,n),(e,t,n)=>uz(e,t,n)]);var ig=class extends Rn{constructor(t,n){super("Encode",t,n)}};function lz(e,t,n){if(!he(e,t,n))throw new ig(n,xn(e,t,n));return n}function mz(e,t,n){let o=rt.Get().unionPrioritySort?Pi(t):t;return Pe("Encode",e,o,n)}var a9e=Ui([(e,t,n)=>$e(n),(e,t,n)=>mz(e,t,n),(e,t,n)=>To(e,t,n),(e,t,n)=>Cn(e,t,n),(e,t,n)=>Ar(e,t,n),(e,t,n)=>lz(e,t,n)]);var Zt=class extends Error{constructor(t,n){super(n),this.type=t}};function lU(e,t){return s.IsFunction(t.default)?t.default(t):s.IsObject(t.default)?$e(t.default):t.default}function mU(e,t){if(bi(t)&&!Ht(t))throw new Zt(t,"Arrays with uniqueItems constraints must specify a default annotation");let n=_i(t)?t.minItems:0;return Array.from({length:n},()=>qe(e,t.items))}function dU(e,t){return Hr(t)?BigInt(t.exclusiveMinimum)+BigInt(1):zr(t)?BigInt(t.minimum):BigInt(0)}function fU(e,t){return!1}function gU(e,t){let n=qe(e,t.instanceType);return class{constructor(){Object.assign(this,n)}}}function hU(e,t){return qe({...e,...t.$defs},nt(t.$ref))}function yU(e,t){return qe(e,ft(t))}function TU(e,t){let n=qe(e,t.returnType);return()=>n}function EU(e,t){return Hr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:zr(t)?t.minimum:0}function _U(e,t){let n=Qt(e,t),o=ft(n);return qe(e,o)}function IU(e,t){return t.const}function bU(e,t){throw new Zt(t,"Cannot create TNever types")}function SU(e,t){return null}function AU(e,t){return Hr(t)&&s.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:zr(t)?t.minimum:0}function OU(e,t){return(s.IsUndefined(t.required)?[]:t.required).reduce((o,i)=>({...o,[i]:qe(e,t.properties[i])}),{})}function xU(e,t){if(ss(t)&&!Ht(t))throw new Zt(t,"Record with the minProperties constraint must have a default annotation");return{}}function RU(e,t){return s.HasPropertyKey(e,t.$ref)?qe(e,e[t.$ref]):(()=>{throw new Zt(t,"Unable to deref Ref")})()}function CU(e,t){if((cs(t)||is(t))&&!Ht(t))throw Error("Strings with format or pattern constraints must specify default");let o=as(t)?t.minLength:0;return"".padEnd(o)}function PU(e,t){return Symbol()}function UU(e,t){let n=Ta(t.pattern);if(We(n))throw new Zt(t,"Unable to create TemplateLiteral due to infinite type expansion");return qe(e,n)}function wU(e,t){return Array.from({length:t.minItems},(n,o)=>qe(e,t.items[o]))}function vU(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)?lU(e,t):Z(t)?mU(e,t):vt(t)?dU(e,t):_t(t)?fU(e,t):Be(t)?gU(e,t):Te(t)?hU(e,t):ze(t)?yU(e,t):He(t)?TU(e,t):ot(t)?EU(e,t):M(t)?_U(e,t):Q(t)?IU(e,t):tr(t)?bU(e,t):gr(t)?SU(e,t):Ce(t)?AU(e,t):D(t)?OU(e,t):de(t)?xU(e,t):ce(t)?RU(e,t):We(t)?CU(e,t):hr(t)?PU(e,t):Ee(t)?UU(e,t):Y(t)?wU(e,t):nr(t)?void 0:R(t)?vU(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 ag=class extends Rn{constructor(t,n){super("Parse",t,n)}};function dz(e,t,n){if(!he(e,t,n))throw new ag(n,xn(e,t,n));return n}var R6e=Ui([(e,t,n)=>$e(n),(e,t,n)=>To(e,t,n),(e,t,n)=>Cn(e,t,n),(e,t,n)=>Ar(e,t,n),(e,t,n)=>dz(e,t,n)]);var gz=k({type:z("insert"),path:It(),value:Qe()}),hz=Object({type:z("update"),path:It(),value:Qe()}),yz=k({type:z("delete"),path:It()}),L6e=F([gz,hz,yz]);function wi(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(wi(o));return}let c=Ti(a),l=await i()(o,{body:c});J(l)})}function kU(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",wR,t)}var MU=require("node:child_process"),DU=require("node:fs"),GU=require("node:os"),ju=require("node:path");var Eo=require("node:fs");function ys(e,t){let n=`${e}.tmp.${process.pid}`;(0,Eo.writeFileSync)(n,t),(0,Eo.renameSync)(n,e)}function Ts(e){try{return(0,Eo.readFileSync)(e,"utf8")}catch(t){if(t.code==="ENOENT")return;throw t}}function Es(e,t){if(t===void 0)return;let n=`${e}.bak.${new Date().toISOString().replaceAll(":","-")}`;return(0,Eo.writeFileSync)(n,t),n}function _o(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var sg="tsuga-dev/agent-plugins",Gu="tsuga";function $u(e,t){V(` $ ${e} ${t.join(" ")}`);try{(0,MU.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 _z(e,t){V("Claude Code \u2192 installing Tsuga plugin"),$u("claude",["plugin","marketplace","add",sg]),$u("claude",["plugin","install",`tsuga@${Gu}`]),t.autoUpdate&&Iz(e)}function Iz(e){let t=(0,ju.join)(e,".claude","settings.json");V(`Claude Code \u2192 ${t} (autoUpdate)`),(0,DU.mkdirSync)((0,ju.dirname)(t),{recursive:!0});let n=Ts(t),o=JSON.parse(n??"{}");if(!_o(o))throw new Error(`${t} must contain a JSON object`);let i=o.extraKnownMarketplaces??{};if(!_o(i))throw new Error(`${t} "extraKnownMarketplaces" must be a JSON object`);let a=i[Gu],c=_o(a)?a:{};o.extraKnownMarketplaces={...i,[Gu]:{source:{source:"github",repo:sg},...c,autoUpdate:!0}};let l=Es(t,n);ys(t,`${JSON.stringify(o,null,2)}
|
|
140
|
+
`),V(l===void 0?" created":` patched (backup: ${l})`)}function bz(){V("Codex \u2192 installing Tsuga plugin"),$u("codex",["plugin","marketplace","add",sg]),$u("codex",["plugin","add",`tsuga@${Gu}`])}function $U(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=>{_z((0,GU.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(()=>{bz(),V("Restart your codex session to load the new plugins.")})}var Sz=10,Az=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`."}))}),cg=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."})}),pg=r.Object({logs:r.Array(cg,{description:"Top log fields for the requested scope, ranked by score and mined from readable logs-sourced dashboards and monitors."}),traces:r.Array(cg,{description:"Top trace fields for the requested scope, ranked by score and mined from readable traces-sourced dashboards and monitors."}),metrics:r.Array(cg,{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."})}),ug=r.Object({scope:r.Array(Az,{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."})}),v8e=d({tags:["interesting-fields"],url:"/v0/interesting-fields",method:"POST",body:ug,response:pg});var Oz=`/${"v1"}/interesting-fields`,xz={scope:[{key:"context.service.name",value:"payments"},{key:"context.env",value:"prod",valueMustMatch:!0}]},Rz=r.Object(ug.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:[xz]}),jU=d({url:Oz,method:"POST",operationId:"getInterestingFields",tags:["public","interesting-fields"],body:Rz,response:pg,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 qU(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",jU,t)}var ar="/v0/kubernetes-explorer",Cz="^[a-z0-9.-]+$",Pz="^[A-Za-z0-9._-]+$",FU=256,BU=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})),HU={clusterId:BU,search:r.Optional(r.String({pattern:Cz,minLength:1,maxLength:FU,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."}))},KU={clusterId:BU,search:r.Optional(r.String({pattern:Pz,minLength:1,maxLength:FU,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."}))},zU=r.Object(HU),YU=r.Object(KU),_s={...HU,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},VU=["Pending","Running","Succeeded","Failed","Unknown","CrashLoopBackOff","Error"],Uz={..._s,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(VU),{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."}))},vi=r.Enum(["asc","desc"],{description:"Sort direction. Defaults to ascending."}),wz=["deployment","statefulset","daemonset"],QU=r.Object({kind:r.Enum(wz,{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."}),WU=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(VU,{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."}))}),lg=r.Object({...WU.properties,workload:r.Optional(QU),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."}))}),vz=["podName","namespace","cluster","team","env","node","phase","restarts","cpuUsageMilli","cpuUtilization","cpuRequestUtilization","memoryUsageBytes","memoryUtilization","memoryRequestUtilization","createdAt"],K8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/pods`,query:r.Object({...Uz,sortBy:r.Optional(r.Enum(vz,{description:"Field to sort pods by."})),sortDirection:r.Optional(vi)}),paginated:!0,response:r.Array(lg)}),mg=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."}))}),Nz=["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes"],z8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/clusters`,query:r.Object({...KU,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(Nz,{description:"Field to sort clusters by."})),sortDirection:r.Optional(vi),...ge}),paginated:!0,response:r.Array(mg)}),dg=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."}))}),Lz=["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],Y8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/namespaces`,query:r.Object({..._s,sortBy:r.Optional(r.Enum(Lz,{description:"Field to sort namespaces by."})),sortDirection:r.Optional(vi)}),paginated:!0,response:r.Array(dg)}),fg=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."}))}),kz=["deployment","namespace","cluster","team","env","pods","availableReplicas","cpuUsageMilli","memoryUsageBytes"],V8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/deployments`,query:r.Object({..._s,sortBy:r.Optional(r.Enum(kz,{description:"Field to sort deployments by."})),sortDirection:r.Optional(vi)}),paginated:!0,response:r.Array(fg)}),gg=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."}))}),Mz=["statefulSet","namespace","cluster","team","env","pods","cpuUsageMilli","memoryUsageBytes"],Q8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/statefulsets`,query:r.Object({..._s,sortBy:r.Optional(r.Enum(Mz,{description:"Field to sort StatefulSets by."})),sortDirection:r.Optional(vi)}),paginated:!0,response:r.Array(gg)}),hg=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."}))}),Dz=["daemonSet","namespace","cluster","team","env","pods","readyNodes","cpuUsageMilli","memoryUsageBytes"],W8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/daemonsets`,query:r.Object({..._s,sortBy:r.Optional(r.Enum(Dz,{description:"Field to sort DaemonSets by."})),sortDirection:r.Optional(vi)}),paginated:!0,response:r.Array(hg)}),yg=r.Object({overview:r.Object({...WU.properties,workload:r.Optional(QU)},{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."})}),ZU=r.Object({clusterId:r.Optional(u({allowEmpty:!1})),k8sCluster:u({allowEmpty:!1}),k8sNamespace:u({allowEmpty:!1}),podName:u({allowEmpty:!1})}),Z8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/pod-details`,query:ZU,response:yg}),Tg=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."}))}),X8e=d({tags:["kubernetes-explorer"],method:"GET",url:`${ar}/pod-manifest`,query:ZU,response:Tg}),Eg=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."}),_g=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(Eg,{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."})}),J8e=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:_g}),Gz=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(Eg,{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())}))}),eWe=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:Gz}),$z=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(Eg,{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())}))}),tWe=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:$z});var Wr=`/${"v1"}/kubernetes-explorer`,XU=r.Pick(lg,["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."}),jz={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(XU,{examples:[jz]});var JU=r.Pick(mg,["cluster","teams","envs","cpuUsageMilli","memoryUsageBytes","readyNodes","podPhaseCounts"],{description:"A Kubernetes cluster with aggregate resource usage, node readiness, and pod phase counts."}),qz={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(JU,{examples:[qz]});var ew=r.Pick(dg,["namespace","cluster","teams","envs","pods","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes namespace with pod count and aggregate resource usage."}),Fz={namespace:"production",cluster:"prod-us-east",teams:["platform"],envs:["production"],pods:24,cpuUsageMilli:1800,memoryUsageBytes:3221225472};Object.assign(ew,{examples:[Fz]});var tw=r.Pick(fg,["deployment","namespace","cluster","team","env","pods","availableReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes deployment with replica counts and aggregate resource usage."}),Bz={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(tw,{examples:[Bz]});var rw=r.Pick(gg,["statefulSet","namespace","cluster","team","env","pods","readyReplicas","desiredReplicas","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes StatefulSet with replica counts and aggregate resource usage."}),Hz={statefulSet:"postgres",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",pods:3,readyReplicas:3,desiredReplicas:3,cpuUsageMilli:900,memoryUsageBytes:2147483648};Object.assign(rw,{examples:[Hz]});var nw=r.Pick(hg,["daemonSet","namespace","cluster","team","env","pods","readyNodes","desiredNodes","cpuUsageMilli","memoryUsageBytes"],{description:"A Kubernetes DaemonSet with eligible-node readiness and aggregate resource usage."}),Kz={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(nw,{examples:[Kz]});var ow=r.Pick(yg,["overview","healthMetrics","searchFilters"],{description:"Metrics-derived information for a single Kubernetes pod: status, owning workload, CPU/memory metric identifiers, and log/trace filters."}),zz={overview:{podName:"api-gateway-7d9f8c6b5-2xk4p",namespace:"production",cluster:"prod-us-east",team:"platform",env:"production",node:"ip-10-0-1-23.ec2.internal",phase:"Running",readyContainers:1,totalContainers:1,restarts:0,createdAt:"2024-01-15T12:34:56.000Z",workload:{kind:"deployment",name:"api-gateway"}},healthMetrics:{cpu:{usage:"k8s.pod.cpu.usage",limit:"k8s.container.cpu_limit",request:"k8s.container.cpu_request"},memory:{usage:"k8s.pod.memory.usage",limit:"k8s.container.memory_limit",request:"k8s.container.memory_request"}},searchFilters:{logs:'context.k8s.cluster.name:"prod-us-east" AND context.k8s.namespace.name:"production" AND context.k8s.pod.name:"api-gateway-7d9f8c6b5-2xk4p"',traces:'context.k8s.cluster.name:"prod-us-east" AND context.k8s.namespace.name:"production" AND context.k8s.pod.name:"api-gateway-7d9f8c6b5-2xk4p"'}};Object.assign(ow,{examples:[zz]});var iw=r.Pick(Tg,["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."}),Yz={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(iw,{examples:[Yz]});var aw=r.Pick(_g,["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(aw,{examples:[Vz]});var sw=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."}))}),Is=r.Pick(zU,["clusterId","search"]),Qz=r.Pick(YU,["clusterId","search"]),cw=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:Is,response:r.Array(XU)}),pw=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:Qz,response:r.Array(JU)}),uw=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:Is,response:r.Array(ew)}),lw=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:Is,response:r.Array(tw)}),mw=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:Is,response:r.Array(rw)}),dw=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:Is,response:r.Array(nw)}),fw=r.Object({...sw.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."})}),gw=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:fw,response:ow}),hw=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:fw,response:iw}),yw=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({...sw.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:aw});var Wz="clusterId";function Tw(e,t,n){let o=t.query.properties??{},i=Object.keys(o).filter(a=>a!==Wz);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 Ni(e,t,n,o){let i=e.command(t).description(n.description??`List Kubernetes ${t}`),a=Tw(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 Ig(e,t,n,o){let i=e.command(t).description(n.description??`Get Kubernetes ${t}`),a=Tw(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 Ew(e,t){let n=e.command("kubernetes").description("Explore Kubernetes resources observed across the organization");Ni(n,"pods",cw,t),Ni(n,"clusters",pw,t),Ni(n,"namespaces",uw,t),Ni(n,"deployments",lw,t),Ni(n,"statefulsets",mw,t),Ni(n,"daemonsets",dw,t),Ig(n,"pod-details",gw,t),Ig(n,"pod-manifest",hw,t),Ig(n,"deployment-details",yw,t)}var Zz=r.Union([r.Literal("scalar"),r.Literal("timeseries")]),Xz="/v0/promql",qu=r.Object({query:u({type:"long",allowEmpty:!1,description:"PromQL expression to evaluate."}),timeRange:ai,step:u({allowEmpty:!1,description:"Evaluation step interval (e.g. `1m`, `5m`, `1h`). Must be a valid Prometheus duration string."}),returnType:r.Optional(Zz),executionOptions:sd,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."}))}),Jz={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(qu,{examples:[Jz]});var TWe=d({tags:["promql"],url:Xz,method:"POST",body:qu,response:jp});var _w=`/${"v1"}/aggregation`,Iw=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."})}),bw=r.Object({results:r.Array(r.Object({...Iw.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."}),e4={results:[{id:"q1",group:{host:"server-1"},value:123.45}]};Object.assign(bw,{examples:[e4]});var Fu=r.Object({series:r.Array(r.Object({...Iw.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."}),t4={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]};Object.assign(Fu,{examples:[t4]});var r4=r.Omit(Za.items,["fill"],{title:"AggregationQuery",description:"Aggregation query. Omit `filter` for an unfiltered query and omit `functions` when no post-processing is needed."}),n4=r.Optional(jr),Sw={timeRange:bt,queries:r.Array(r4,{maxItems:Wa,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 ${Wa} items. For dataSource "metrics", each aggregate's \`field\` is the metric name, not an attribute; to count distinct values of an attribute use unique-count with field "<metricName>.context.<attribute>" (e.g. "system.cpu.utilization.context.host.name").`}),groupBy:n4,dataSource:WO,formula:r.Optional(ao)},Aw=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."}))}),Ow=r.Object(Sw,{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."}),o4={timeRange:{from:1782201500,to:1782203400},dataSource:"logs",queries:[{aggregate:{type:"count"},filter:"context.service.name:checkout"}],groupBy:[{fields:["level"],limit:5}]};Object.assign(Ow,{examples:[o4]});var xw=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:`${_w}/multi-query/scalar`,method:"POST",body:Ow,query:Aw,response:bw}),Rw=r.Object({...Sw,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."}),i4={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(Rw,{examples:[i4]});var Cw=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:`${_w}/multi-query/timeseries`,method:"POST",body:Rw,query:Aw,response:Fu});var a4=`/${"v1"}/promql`,s4=r.Object({...r.Pick(qu,["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"}]}),c4=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."}))}),Pw=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:a4,method:"POST",body:s4,query:c4,response:Fu});function Uw(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",Pw,t)}var ki="/v0/dashboard-folders",Mi=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"}),bg=r.Object({...Mi.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."})}),Bu=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}),Hu=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"})),Li={IS_FAVORITE:"isFavorite",OWNER:"owner",TAGS:"tags",DASHBOARD_COUNT:"dashboardCount",UPDATED_AT:"updatedAt",NAME:"name"},Sg=[Li.OWNER,Li.TAGS,Li.DASHBOARD_COUNT,Li.UPDATED_AT,Li.NAME],p4=r.Partial(r.Object({...ge,filters:Hu,sort:r.Object({by:r.Enum([...Sg,Li.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"})})),HWe=d({tags:["dashboard-folders"],url:`${ki}/query`,method:"POST",paginated:!0,body:p4,response:r.Array(bg)}),KWe=d({tags:["dashboard-folders"],url:`${ki}/:id`,method:"GET",params:r.Object({id:u()}),response:Mi}),zWe=d({tags:["dashboard-folders"],url:ki,method:"POST",body:Bu,response:Mi}),YWe=d({tags:["dashboard-folders"],url:`${ki}/:id`,method:"PUT",params:r.Object({id:u()}),body:Bu,response:Mi}),VWe=d({tags:["dashboard-folders"],url:`${ki}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),QWe=d({tags:["dashboard-folders"],url:`${ki}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(Hu,["tags"]))}),response:Ft});var bs=`/${"v1"}/dashboard-folders`,Ku=r.Pick(Mi,["id","name","owner","parentFolderId","tags"],{$id:"DashboardFolder",description:"Folder used to organize dashboards into a two-level hierarchy"}),ww={id:"123-456-abc",name:"Platform",owner:"team-123-abc",tags:[{key:"team",value:"platform"}]};Object.assign(Ku,{examples:[ww]});var vw=r.Pick(bg,["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."}),u4={...ww,dashboardCount:10};Object.assign(vw,{examples:[u4]});var Ag=r.Pick(Bu,["name","owner","parentFolderId","tags"],{description:"Dashboard folder create or update request. Provide a name, owner team, optional parent folder, and optional tags."}),l4={name:"Platform",owner:"team-123-abc",parentFolderId:null,tags:[{key:"team",value:"platform"}]};Object.assign(Ag,{examples:[l4]});var m4=r.Object({by:r.Enum(Sg,{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"}),Nw=r.Object({...Ze,filters:r.Optional(r.Pick(Hu,["owners","searchQuery","tags","parentFolderId"])),sort:r.Optional(m4)},{description:"Dashboard folder query request. Use filters, sorting, limit, and offset to page through visible dashboard folders."}),d4={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(Nw,{examples:[d4]});var Lw=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:`${bs}/query`,method:"POST",paginated:!0,body:Nw,response:r.Array(vw)}),kw=d({description:"Retrieves one dashboard folder by ID.",operationId:"getDashboardFolder",tags:["dashboard-folders"],url:`${bs}/: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:Ku}),Mw=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:bs,method:"POST",body:Ag,response:Ku}),Dw=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:`${bs}/: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:Ag,response:Ku}),Gw=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:`${bs}/: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",jw=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],f4=["bar","distribution","gauge","heatmap","list","pie","query-value","table","timeseries","top-list"],g7e=[...f4,"note"];var g4=["ns","us","ms","s","m","h","days"];var h4=["B","KB","MB","GB","TB","PB"];var y4=20;var qw=r.Object({type:r.Literal("cpu",{description:"Normalizes values as CPU usage"})},{$id:"DataNormalizerCpu",title:"CPU"}),Fw=r.Object({type:r.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:r.Enum(g4,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),Bw=r.Object({type:r.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:r.Enum(h4,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),Hw=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"}),Kw=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"}),zw=r.Object({type:r.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),Yw=r.Object({type:r.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),Vw=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"}),T4=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"}),E4=r.Object({type:r.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:r.String({description:"Text label describing the custom unit. Must not be empty.",minLength:1,maxLength:y4})},{$id:"InputDataNormalizerCustom",title:"Custom"}),Rt=C("type",[Fw,Bw,Hw,Kw,zw,Yw,qw,Vw,T4],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Ct=C("type",[Fw,Bw,Hw,Kw,zw,Yw,qw,Vw,E4],{title:"Normalizer",description:"Display-value formatter for widget values or list/table columns."}),Og=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."}),xg=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."}),Di=["background","no-background"],_4=["table","legend-only","no-legend"];var I4=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],Qw=["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(Qw,{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."}),b4=r.Object({value:r.Number({description:"Y-axis value where the threshold marker is placed"}),level:r.Enum(Qw,{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"],Un=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 Pn=r.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),Gi=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."}),$i=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."}),Yu={source:or,queries:ux,formula:r.Optional(Hp),aliases:r.Optional(Gi),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},Vu={source:or,queries:Za,formula:r.Optional(ao),aliases:r.Optional($i),visibleSeries:r.Optional(r.Array(r.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},ji={...Yu,groupBy:r.Optional(si)},qi={...Vu,groupBy:r.Optional(jr)},Fe=r.Enum(_4,{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(b4,{description:"Threshold markers displayed on the chart"})),A4=r.Object({name:r.String({description:"Display name of the table column"}),...Yu,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`."}),O4=r.Object({name:u({description:"Display name of the table column"}),...Vu,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`."}),x4=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."}),R4=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."}),Rg=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."}),Cg=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."}),Ww=["horizontal","vertical"],C4=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(Og,{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(Rg)},{$id:"GraphVisualizationList",title:"List"}),P4=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(xg,{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(Cg)},{$id:"InputGraphVisualizationList",title:"List"}),zu=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"}),Fi=r.Object({min:zu,max:zu,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."}),Bi=r.Object({min:zu,max:zu,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."}),U4=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"}),w4=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 v4=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(Fi)},{$id:"GraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),N4=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(Bi)},{$id:"InputGraphVisualizationTimeseriesConnection",title:"TimeseriesConnection"}),L4=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(Og,{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(Rg)},{$id:"GraphVisualizationListConnection",title:"ListConnection"}),k4=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(xg,{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(Cg)},{$id:"InputGraphVisualizationListConnection",title:"ListConnection"}),M4=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"}),D4=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"}),G4=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"}),$4=r.Object({type:r.Literal("pie-connection",{description:"Displays the database rows-based aggregation as a pie chart"}),connectionId:u({allowEmpty:!1,description:"The ID of the connection to use to query the datastore."}),queries:r.Array(u({allowEmpty:!1,description:"The read-only SQL query to execute against the connection.",type:"readonly-sql-query"}),{minItems:1}),legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationPieConnection",title:"PieConnection"}),j4=r.Object({type:r.Literal("bar-connection",{description:"Displays the database rows-based aggregation as a bar chart"}),connectionId:r.String({description:"The ID of the connection to use to query the datastore."}),queries:r.Array(r.String({description:"The read-only SQL query to execute against the connection."})),legendMode:r.Optional(Fe),thresholds:Xt,yAxisSettings:r.Optional(Fi)},{$id:"GraphVisualizationBarConnection",title:"BarConnection"}),q4=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(Bi)},{$id:"InputGraphVisualizationBarConnection",title:"BarConnection"}),F4=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(Di,{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"}),B4=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(Di,{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"}),H4=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(Ww,{description:"Layout used to render log patterns"}))},{$id:"GraphVisualizationListLogPatterns",title:"ListLogPatterns"}),K4=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(Ww,{description:"Layout used to render log patterns"}))},{$id:"InputGraphVisualizationListLogPatterns",title:"ListLogPatterns"}),z4=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(Og,{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(Rg)},{$id:"GraphVisualizationListSpans",title:"ListSpans"}),Y4=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(xg,{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(Cg)},{$id:"InputGraphVisualizationListSpans",title:"ListSpans"}),Ss=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."}),As=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:Ss,aliases:r.Optional(Gi),timeBucket:r.Optional(Un),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe),thresholds:Xt,yAxisSettings:r.Optional(Fi),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),Q4=r.Object({type:r.Literal("timeseries-promql",{description:"Displays PromQL metrics query-based aggregation as a time series chart"}),queries:As,aliases:r.Optional($i),timeBucket:r.Optional(Un),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe),thresholds:Xt,yAxisSettings:r.Optional(Bi),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseriesPromql",title:"TimeseriesPromql"}),W4=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(Gi),backgroundMode:r.Optional(r.Enum(Di,{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"}),Z4=r.Object({type:r.Literal("query-value-promql",{description:"Configures a PromQL metrics query-based aggregation as a single value"}),queries:As,aliases:r.Optional($i),backgroundMode:r.Optional(r.Enum(Di,{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"}),X4=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(Gi),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"}),J4=r.Object({type:r.Literal("top-list-promql",{description:"Displays PromQL metrics query-based aggregation as a ranked top list"}),queries:As,aliases:r.Optional($i),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"}),e3=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:Ss,aliases:r.Optional(Gi),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe)},{$id:"GraphVisualizationPiePromql",title:"PiePromql"}),t3=r.Object({type:r.Literal("pie-promql",{description:"Displays PromQL metrics query-based aggregation as a pie chart"}),queries:As,aliases:r.Optional($i),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationPiePromql",title:"PiePromql"}),r3=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:Ss,aliases:r.Optional(Gi),timeBucket:r.Optional(Un),precision:ye,normalizer:r.Optional(Rt),thresholds:Xt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(Fi)},{$id:"GraphVisualizationBarPromql",title:"BarPromql"}),n3=r.Object({type:r.Literal("bar-promql",{description:"Displays PromQL metrics query-based aggregation as a bar chart"}),queries:As,aliases:r.Optional($i),timeBucket:r.Optional(Un),precision:ye,normalizer:r.Optional(Ct),thresholds:Xt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(Bi)},{$id:"InputGraphVisualizationBarPromql",title:"BarPromql"}),o3=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...ji,timeBucket:r.Optional(Un),normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe),thresholds:Xt,yAxisSettings:r.Optional(Fi),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),i3=r.Object({type:r.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...qi,timeBucket:r.Optional(Un),normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe),thresholds:Xt,yAxisSettings:r.Optional(Bi),smoothing:r.Optional(r.Boolean({description:"Whether to apply automatic smoothing to the rendered timeseries"}))},{$id:"InputGraphVisualizationTimeseries",title:"Timeseries"}),Zw="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.",a3=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...ji,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:Zw}))},{$id:"GraphVisualizationTopList",title:"TopList"}),s3=r.Object({type:r.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...qi,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:Zw}))},{$id:"InputGraphVisualizationTopList",title:"TopList"}),c3=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...ji,normalizer:r.Optional(Rt),precision:ye,legendMode:r.Optional(Fe)},{$id:"GraphVisualizationPie",title:"Pie"}),p3=r.Object({type:r.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...qi,normalizer:r.Optional(Ct),precision:ye,legendMode:r.Optional(Fe)},{$id:"InputGraphVisualizationPie",title:"Pie"}),u3=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Yu,backgroundMode:r.Optional(r.Enum(Di,{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"}),l3=r.Object({type:r.Literal("query-value",{description:"Displays the aggregation as a single value"}),...Vu,backgroundMode:r.Optional(r.Enum(Di,{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"}),m3=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...ji,timeBucket:r.Optional(Un),precision:ye,normalizer:r.Optional(Rt),thresholds:Xt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(Fi)},{$id:"GraphVisualizationBar",title:"Bar"}),d3=r.Object({type:r.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...qi,timeBucket:r.Optional(Un),precision:ye,normalizer:r.Optional(Ct),thresholds:Xt,legendMode:r.Optional(Fe),yAxisSettings:r.Optional(Bi)},{$id:"InputGraphVisualizationBar",title:"Bar"}),Xw='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.',Jw=r.String({description:Xw}),ev=u({description:Xw}),f3=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...ji,group:r.Optional(Jw),precision:ye,normalizer:r.Optional(Rt),percentileMarkers:r.Optional(U4),boundsScale:r.Optional(Bp)},{$id:"GraphVisualizationDistribution",title:"Distribution"}),g3=r.Object({type:r.Literal("distribution",{description:"Displays the aggregation as a distribution chart"}),...qi,group:r.Optional(ev),precision:ye,normalizer:r.Optional(Ct),percentileMarkers:r.Optional(w4),boundsScale:r.Optional(Bp)},{$id:"InputGraphVisualizationDistribution",title:"Distribution"}),tv=["red","pink","violet","blue","cyan","green","yellow","orange"],rv=r.Enum(tv,{description:"Color palette used to render the heatmap intensity gradient"}),h3=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...ji,group:r.Optional(Jw),precision:ye,normalizer:r.Optional(Rt),palette:r.Optional(rv)},{$id:"GraphVisualizationHeatmap",title:"Heatmap"}),y3=r.Object({type:r.Literal("heatmap",{description:"Displays the aggregation as a heatmap chart"}),...qi,group:r.Optional(ev),precision:ye,normalizer:r.Optional(Ct),palette:r.Optional(rv)},{$id:"InputGraphVisualizationHeatmap",title:"Heatmap"}),nv=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(tv,{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."}),T3=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Yu,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(nv,{description:"Color thresholds inside the gauge range"})),precision:ye,normalizer:r.Optional(Rt)},{$id:"GraphVisualizationGauge",title:"Gauge"}),E3=r.Object({type:r.Literal("gauge",{description:"Displays the aggregation as a gauge"}),...Vu,max:r.Optional(r.Number({description:"Gauge maximum value"})),colorThresholds:r.Optional(r.Array(nv,{description:"Color thresholds inside the gauge range"})),precision:ye,normalizer:r.Optional(Ct)},{$id:"InputGraphVisualizationGauge",title:"Gauge"}),_3=r.Object({type:r.Literal("table",{description:"Displays the aggregation as a table with multi-level grouping"}),columns:r.Array(A4,{description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(si),defaultSorting:r.Optional(x4),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(O4,{minItems:1,description:"Each column defines an independent aggregation displayed as a table column"}),groupBy:r.Optional(jr),defaultSorting:r.Optional(R4),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"}),b3=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(jw,{description:"Background color used to render the note"})),noteAlign:r.Optional(Pn),noteJustifyContent:r.Optional(Pn)},{$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(jw,{description:"Background color used to render the note"})),noteAlign:r.Optional(Pn),noteJustifyContent:r.Optional(Pn)},{$id:"InputGraphVisualizationNote",title:"Note"}),A3=C("type",[v4,L4,M4,G4,j4,F4,V4,W4,X4,e3,r3,o3,a3,c3,u3,T3,m3,f3,h3,_3,C4,b3,H4,z4],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),O3=C("type",[N4,k4,D4,$4,q4,B4,Q4,Z4,J4,t3,n3,i3,s3,p3,l3,E3,d3,g3,y3,I3,P4,S3,K4,Y4],{description:"Widget visualization configuration. The `type` discriminator selects the widget kind and its required fields."}),Qu=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(Pn),descriptionJustifyContent:r.Optional(Pn),visualization:A3,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 ${ld}\xD7${md} (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."}),Wu=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(Pn),descriptionJustifyContent:r.Optional(Pn),visualization:O3,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 ${ld}\xD7${md} (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."}),$w=10,x3=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."}),R3=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:$w,description:`Dashboard-wide filters applied to every widget on the dashboard. Up to ${$w} filters are allowed.`}),Hi=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(Qu,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(x3),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(Pl,{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."}))}),Zu=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(Wu,{description:"Ordered widgets that compose the dashboard"}),filters:r.Optional(R3),tags:Xe,timePreset:r.Optional(r.Enum(Pl,{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"},ov=[sr.OWNER,sr.TAGS,sr.WIDGET_COUNT,sr.UPDATED_AT,sr.NAME],Os=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"})),C3=r.Partial(r.Object({...ge,filters:Os,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"})})),h7e=d({tags:["dashboards"],url:`${Rr}/query`,method:"POST",paginated:!0,response:r.Array(Hi),body:C3}),y7e=d({tags:["dashboards"],url:`${Rr}/tags/query`,method:"POST",body:r.Object({filters:r.Optional(r.Omit(Os,["tags"]))}),response:Ft}),T7e=d({tags:["dashboards"],url:`${Rr}/counts/query`,method:"POST",body:r.Object({filters:r.Optional(r.Partial(Os))}),response:r.Object({all:r.Integer({description:"Total number of dashboards matching the filters that the user can read."})})}),E7e=d({tags:["dashboards"],url:`${Rr}/:id`,method:"GET",params:r.Object({id:u()}),response:Hi}),_7e=d({tags:["dashboards"],url:Rr,method:"POST",body:Zu,response:Hi}),I7e=d({tags:["dashboards"],url:`${Rr}/:id`,method:"PUT",params:r.Object({id:u()}),body:r.Partial(Zu),response:Hi}),b7e=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({})}),S7e=d({tags:["dashboards"],url:`${Rr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),A7e=d({tags:["dashboards"],url:`${Rr}/:id/graphs/:graphId`,method:"PUT",params:r.Object({id:u({allowEmpty:!1}),graphId:u({allowEmpty:!1})}),body:r.Omit(Wu,["id"]),response:Qu}),O7e=d({tags:["dashboards"],url:`${Rr}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})});var Ki=`/${"v1"}/dashboards`,xs=r.Pick(Hi,["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)."}),P3={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(xs,{examples:[P3]});var U3=r.Object({by:r.Enum([...ov],{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"}),iv=r.Object({...Ze,filters:r.Optional(r.Pick(Os,["owners","searchQuery","tags","folderId"])),sort:r.Optional(U3)},{description:"Dashboard query request. Use filters, sorting, limit, and offset to page through visible dashboards."}),w3={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(iv,{examples:[w3]});var av=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:`${Ki}/query`,method:"POST",paginated:!0,body:iv,response:r.Array(xs)}),sv=d({description:"Retrieves one dashboard by ID.",operationId:"getDashboard",tags:["dashboards"],url:`${Ki}/: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:xs}),Pg=r.Pick(Zu,["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."}),v3={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(Pg,{examples:[v3]});var N3=r.Omit(Wu,["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."}),cv=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:Ki,method:"POST",body:Pg,response:xs}),pv=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:`${Ki}/: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(Pg),response:xs}),L3=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."})}),uv=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:`${Ki}/:id`,method:"DELETE",params:L3,response:N}),N7e=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:`${Ki}/: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:N3,response:Qu});var lv=100,mv=3,zi=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."})}),Rs=r.Object({name:r.String({format:Xo,minLength:1,maxLength:lv,description:`Kebab-case name for the ingestion API key. Maximum length is ${lv} 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:mv,description:`Array form. Up to ${mv} 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."})}),Yi="/v0/ingestion-api-keys",F7e=d({tags:["ingestion-api-keys"],url:Yi,method:"POST",body:Rs,response:r.Intersect([zi,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."})})])}),B7e=d({tags:["ingestion-api-keys"],url:Yi,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(zi)}),H7e=d({tags:["ingestion-api-keys"],url:`${Yi}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1})}),response:zi}),K7e=d({tags:["ingestion-api-keys"],url:`${Yi}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1})}),body:Rs,response:zi}),z7e=d({tags:["ingestion-api-keys"],url:`${Yi}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1})}),response:N}),Y7e=d({tags:["ingestion-api-keys"],url:`${Yi}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u({allowEmpty:!1}))}),response:r.Object({})});var Cs=`/${"v1"}/ingestion-api-keys`,Ps=r.Pick(zi,["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)."}),dv={id:"123-456-abc",name:"production-logs-ingestion",keyLastCharacters:"x7Qm",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(Ps,{examples:[dv]});var fv=r.Pick(Rs,["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."}),gv=r.Pick(Rs,["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."}),hv={name:"production-logs-ingestion",owner:"team-123-abc",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(fv,{examples:[hv]});Object.assign(gv,{examples:[hv]});var k3={...dv,key:"tsuga_in:v1:abc123xyx7Qm"},yv=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:Cs,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Ps)}),tZe=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:`${Cs}/: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:Ps}),M3=r.Intersect([r.Pick(Ps,["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:k3}),Tv=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:Cs,method:"POST",body:fv,response:M3}),Ev=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:`${Cs}/: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:gv,response:Ps}),_v=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:`${Cs}/: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 D3={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"]}},[iZe,Xu,Us]=G3(D3),aZe=Object.fromEntries(Xu.map(e=>[e,e]));function G3(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[Ug(t),Ug(n),Ug(o)]}function Ug(e){if(e.length===0)throw new Error("Array must have at least one element.");return e}var wg=r.Enum(["HTTP","HTTPS","TCP","UDP","GENEVE","TLS","TLS_QUIC","TCP_UDP","TCP_QUIC","QUIC"]),$3=r.Object({versioningStatus:r.Optional(r.Enum(["Enabled","Disabled","Suspended","Not configured"]))}),j3=r.Object({domainName:r.Optional(r.String()),origins:r.Optional(r.Array(r.String()))}),q3=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())}),F3=r.Object({version:r.Optional(r.String()),virtualNetworkId:r.Optional(r.String()),subnets:r.Optional(r.Array(r.String()))}),B3=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())}),H3=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()))}),K3=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())}),z3=r.Object({isEncrypted:r.Optional(r.Boolean()),ownerId:r.Optional(r.String()),state:r.Optional(r.Enum(["creating","available","deleting","deleted","error","updating"]))}),Y3=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())}),Q3=r.Object({url:r.Optional(r.String()),maxMessageSizeBytes:r.Optional(r.Number()),messageRetentionHours:r.Optional(r.Number())}),W3=r.Object({runtime:r.Optional(r.String()),memoryAllocationMib:r.Optional(r.Number()),timeoutMs:r.Optional(r.Number()),codeSha256:r.Optional(r.String())}),Z3=r.Object({kind:r.Optional(r.String())}),X3=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())}),J3=r.Object({id:r.Optional(r.String()),ipCidrBlocks:r.Array(r.String())}),eY=r.Object({protocol:r.Optional(wg),port:r.Optional(r.Number()),instanceProtocol:r.Optional(wg),instancePort:r.Optional(r.Number())}),tY=r.Object({protocol:r.Optional(r.String()),ports:r.Optional(r.Array(r.String())),portRange:r.Optional(r.String()),allPorts:r.Optional(r.Boolean())}),rY=r.Object({name:r.String(),ip:r.Optional(r.String()),type:r.Enum(["public","private"])}),nY=r.Object({type:r.String(),name:r.String()}),oY=r.Object({frontendIp:r.Optional(rY),backendIpPools:r.Array(nY)}),iY=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())}),aY=r.Object({protocol:r.Optional(wg),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(iY)),targetCount:r.Optional(r.Number()),healthyTargetCount:r.Optional(r.Number()),loadBalancerArns:r.Optional(r.Array(r.String()))}),sY=r.Object({first:r.Optional(r.String()),last:r.Optional(r.String()),scope:r.Optional(r.Number())}),cY=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(),sY]))),target:r.Optional(r.String()),weight:r.Optional(r.Number()),priority:r.Optional(r.Number()),status:r.Optional(r.String())}),pY=r.Object({instanceId:r.Optional(r.String()),state:r.Optional(r.String()),reasonCode:r.Optional(r.String()),description:r.Optional(r.String())}),uY=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(eY),r.Array(tY)])),targets:r.Optional(r.Union([r.Array(r.String()),r.Array(pY),r.Array(cY)])),azureLoadBalancingRules:r.Optional(r.Array(oY))}),lY=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())}),mY=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"]))}),dY=r.Object({osType:r.Optional(r.Enum(["Windows","Linux"]))}),fY=r.Object({state:r.Optional(r.String()),volumeType:r.Optional(r.String())}),gY=r.Intersect([r.Object({isEncrypted:r.Optional(r.Boolean()),sizeGib:r.Optional(r.Number())}),r.Union([mY,fY,dY])]),hY=r.Object({instanceCount:r.Optional(r.Number()),hostnames:r.Optional(r.Array(r.String())),runtime:r.Optional(r.String())}),Ju=r.Union([r.Object({category:r.Literal("application"),resourceType:r.Literal("webService"),attributes:r.Optional(hY)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("bucket"),attributes:r.Optional($3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("messagingService"),attributes:r.Optional(Q3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("fileSystem"),attributes:r.Optional(z3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("contentDeliveryNetwork"),attributes:r.Optional(j3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("database"),attributes:r.Optional(q3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("storageAccount"),attributes:r.Optional(Z3)}),r.Object({category:r.Literal("data"),resourceType:r.Literal("volume"),attributes:r.Optional(gY)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("virtualMachine"),attributes:r.Optional(X3)}),r.Object({category:r.Literal("compute"),resourceType:r.Literal("serverless"),attributes:r.Optional(W3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("kubernetesCluster"),attributes:r.Optional(F3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerRepository"),attributes:r.Optional(B3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerCluster"),attributes:r.Optional(H3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerServiceTask"),attributes:r.Optional(K3)}),r.Object({category:r.Literal("container"),resourceType:r.Literal("containerService"),attributes:r.Optional(Y3)}),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(J3)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("loadBalancer"),attributes:uY}),r.Object({category:r.Literal("network"),resourceType:r.Literal("targetGroup"),attributes:r.Optional(aY)}),r.Object({category:r.Literal("network"),resourceType:r.Literal("certificate"),attributes:r.Optional(lY)})],{description:"Normalized public inventory category, resource type, and category-specific attributes. Attribute shape depends on the category and resourceType combination."});var Io="/v0/inventory",Iv=["scan_in_progress","success","failure","partial"],Ng=r.Object({id:r.String({description:"Identifier of the inventory resource. Generated by Tsuga."}),cloudPlatform:r.Enum(En,{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"}))}),Vi={DISPLAY_NAME:"displayName",CLOUD_ACCOUNT:"cloudAccount",NATIVE_RESOURCE_TYPE:"nativeResourceType",CLOUD_REGION:"cloudRegion",RESOURCE_TYPE:"resourceType",RESOURCE_CREATED_AT:"resourceCreatedAt"},bv=r.Object({cloudPlatforms:_e(r.Enum(En),{description:"Restrict results to resources discovered on any of these cloud platforms",maxItems:En.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(Us),{description:"Restrict results to resources of any of these cloud-native resource types",maxItems:Us.length}),resourceTypes:_e(r.Enum(Xu),{description:"Restrict results to resources of any of these normalized resource types",maxItems:Xu.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"}),Lg=r.Partial(r.Object({...ge,filters:r.Partial(bv,{description:"Filters applied to narrow the returned resources."}),sort:r.Object({by:r.Enum([Vi.DISPLAY_NAME,Vi.CLOUD_ACCOUNT,Vi.NATIVE_RESOURCE_TYPE,Vi.CLOUD_REGION,Vi.RESOURCE_TYPE,Vi.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."})})),gZe=d({tags:["inventory"],method:"POST",url:`${Io}/resources/query`,paginated:!0,body:Lg,response:r.Array(r.Intersect([Ng,Ju]))}),yY=["resourceType","cloudAccount","isIacManaged"],hZe=d({tags:["inventory"],method:"POST",url:`${Io}/resources/counts`,body:r.Object({filters:r.Optional(r.Partial(bv)),groupBy:r.Enum(yY,{description:"Dimension to group the resource counts by."})}),response:r.Array(r.Object({value:r.String({description:'The group value the count belongs to: a resource type, a cloud account id, or "true"/"false" for IaC coverage.'}),count:r.Integer({description:"Number of resources in this group matching the requested filters."})}))}),yZe=d({tags:["inventory"],method:"GET",url:`${Io}/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})}),TZe=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."})})]),TY="^[0-9]{12}$",EY="^arn:aws[a-z-]*:iam::[0-9]{12}:role/.+$",_Y="^[a-z][a-z0-9-]{4,28}[a-z0-9]$",IY="^[^@\\s]+@[^@\\s]+\\.iam\\.gserviceaccount\\.com$",bY="^//iam\\.googleapis\\.com/projects/[0-9]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$",vg="^[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:TY,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:EY,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"}),AY=r.Object({type:r.Literal("gcp",{description:"Discriminator identifying GCP connection settings."}),projectId:r.String({pattern:_Y,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:bY,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"}),OY=r.Object({type:r.Literal("azure",{description:"Discriminator identifying Azure connection settings."}),clientId:r.String({pattern:vg,minLength:1,description:"Client ID of the Azure application Tsuga authenticates as (GUID).",errorMessage:{pattern:"Must be a GUID."}}),subscriptionId:r.String({pattern:vg,minLength:1,description:"Azure subscription ID that Tsuga scans (GUID).",errorMessage:{pattern:"Must be a GUID."}}),tenantId:r.String({pattern:vg,minLength:1,description:"Azure tenant ID that owns the subscription (GUID).",errorMessage:{pattern:"Must be a GUID."}})},{$id:"AzureConnectionSettings"}),Sv=C("type",[SY,AY,OY],{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`."}),Qi=r.Object({id:r.String({description:"Identifier of the cloud account. Generated by Tsuga."}),cloudType:r.Enum(En,{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(Iv,{description:"Status of the most recent inventory scan."}))}),kg=r.Object({cloudType:r.Enum(En,{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:Sv,lastScanStatus:r.Optional(r.Enum(Iv,{description:"Status of the most recent inventory scan."}))}),bo=`${Io}/cloud-accounts`,EZe=d({tags:["inventory"],url:bo,method:"GET",response:r.Array(Qi)}),_Ze=d({tags:["inventory"],url:`${bo}/:id`,method:"GET",params:r.Object({id:u()}),response:Qi}),IZe=d({tags:["inventory"],url:bo,method:"POST",body:kg,response:Qi}),Mg=r.Object({accountFriendlyName:u({description:"Human-readable name for the account shown in Tsuga."})}),bZe=d({tags:["inventory"],url:`${bo}/:id`,method:"PUT",params:r.Object({id:u()}),body:Mg,response:Qi}),SZe=d({tags:["inventory"],url:`${bo}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),AZe=d({tags:["inventory"],url:`${Io}/trigger-scan`,method:"POST",body:r.Object({}),response:r.Object({success:r.Literal(!0)})}),OZe=d({tags:["inventory"],url:`${bo}/azure/onboarding`,method:"POST",body:r.Object({tenantId:u()}),response:r.Object({subjectId:r.String(),audience:r.String()})}),xZe=d({tags:["inventory"],method:"POST",url:`${bo}/validate/:type`,params:r.Object({type:u()}),body:r.Object({data:Sv,id:r.Optional(u())}),response:r.Object({areAccountSettingsValid:r.Boolean(),message:r.Optional(r.String())})}),Av=`${Io}/settings`,RZe=d({tags:["inventory"],url:Av,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())}))}))})}),xY=50,CZe=d({tags:["inventory"],url:Av,method:"POST",body:r.Object({infrastructureIdentifiers:r.Array(r.Object({name:u({allowEmpty:!1}),value:r.Optional(u({allowEmpty:!1}))}),{maxItems:xY})}),response:r.Object({})}),PZe=d({tags:["inventory"],url:`${Io}/iac-tags-proposal`,method:"GET",response:r.Array(r.Object({name:r.String(),value:r.Optional(r.String())}))});var Ov=`/${"v1"}/inventory`,RY=r.Omit(Ng,["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)."}),xv=r.Intersect([RY,Ju],{$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)."}),CY={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(xv,{examples:[CY]});var Rv=r.Object({...Lg.properties,...Ze},{description:"Inventory resource query request. Use filters, sorting, limit, and offset to page through discovered resources."}),PY={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(Rv,{examples:[PY]});var Cv=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:`${Ov}/resources/query`,method:"POST",paginated:!0,body:Rv,response:r.Array(xv)}),ws=`${Ov}/cloud-accounts`,vs=r.Pick(Qi,["id","cloudType","cloudAccountId","accountFriendlyName"],{$id:"CloudAccount"}),UY={id:"123-456-abc",cloudType:"aws",cloudAccountId:"123456789012",accountFriendlyName:"Production AWS"};Object.assign(vs,{examples:[UY]});var Pv=r.Pick(kg,["cloudType","cloudAccountId","accountFriendlyName","connectionSettings"]),wY={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(Pv,{examples:[wY]});var vY=r.Pick(Mg,["accountFriendlyName"]),GZe=d({description:"Lists cloud accounts connected to Tsuga that the authenticated operation key can read.",operationId:"listCloudAccounts",tags:["inventory"],url:ws,method:"GET",response:r.Array(vs)}),$Ze=d({description:"Retrieves one cloud account by ID.",operationId:"getCloudAccount",tags:["inventory"],url:`${ws}/: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:vs}),jZe=d({description:"Registers a cloud account for inventory scanning. Connection settings are stored as provided and are not validated at creation time; scan failures surface through `lastScanStatus`.",operationId:"createCloudAccount",tags:["inventory"],url:ws,method:"POST",body:Pv,response:vs}),qZe=d({description:"Updates the friendly name of a cloud account by ID.",operationId:"updateCloudAccount",tags:["inventory"],url:`${ws}/: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:vY,response:vs}),FZe=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:`${ws}/: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 Ns="/v0/investigations",NY=["dashboard","monitor","service","slo","log-route","adaptive-notification-rule"],LY=r.Object({type:r.String({description:'Kind of linked asset, e.g. "dashboard"'}),id:r.String({description:"Identifier of the linked asset"})}),kY=r.Object({type:r.Enum(NY,{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(LY,{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"}),el=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(kY,{maxItems:100,description:"Assets (dashboards, monitors, \u2026) referenced by this investigation"}))}),Dg=r.Object(r.Omit(el,["slug"]).properties),WZe=d({tags:["investigations"],url:Ns,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(Zr)}),ZZe=d({tags:["investigations"],url:`${Ns}/:id`,params:r.Object({id:u()}),method:"GET",response:Zr}),XZe=d({tags:["investigations"],url:Ns,method:"POST",body:el,response:Zr}),JZe=d({tags:["investigations"],url:`${Ns}/:id`,method:"PUT",body:Dg,params:r.Object({id:u()}),response:Zr}),eXe=d({tags:["investigations"],url:`${Ns}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N});var Ls=`/${"v1"}/investigations`,Uv=d({description:"Retrieve all investigations",tags:["private"],url:Ls,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Zr)}),wv=d({description:"Retrieve an investigation by its id",tags:["private"],url:`${Ls}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1})}),response:Zr}),vv=d({description:"Create a new investigation",tags:["private"],url:Ls,method:"POST",body:el,response:Zr}),Nv=d({description:"Update an investigation by its id",tags:["private"],url:`${Ls}/:id`,method:"PUT",body:Dg,params:r.Object({id:u({allowEmpty:!1})}),response:Zr}),Lv=d({description:"Delete an investigation by its id",tags:["private"],url:`${Ls}/:id`,method:"DELETE",params:r.Object({id:u({allowEmpty:!1})}),response:N});var kv=15,tl={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."}))},rl={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."}))},Mv={...tl,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},Dv={...rl,type:r.Literal("creator",{description:"Create processor. It writes a new attribute from a format string, formula, or category rule."})},MY=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."}),DY=C("subtype",[r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:u({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("format-string",{description:"Builds a string from literal text and existing attribute values."}),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))},{$id:"InputProcessorParamsCreatorFormatString"}),r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the computed value"}),formula:u({allowEmpty:!1,type:"long",description:"Mathematical formula evaluated to populate the target attribute"}),overrideTarget:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("math-formula",{description:"Evaluates a mathematical expression and writes the numeric result."}),replaceMissingBy0:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to evaluate as zero. Defaults to true."}))},{$id:"InputProcessorParamsCreatorMathFormula"}),r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:u({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:u({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:kv,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:r.Optional(u({description:"String category value used when no clause matches. If omitted and no clause matches, no category value is written."})),subtype:r.Literal("category",{description:"Assigns the first matching category value from ordered query clauses, with an optional default."})},{$id:"InputProcessorParamsCreatorCategory"})],{description:"Create processor configuration. The `subtype` discriminator selects how the value written to `targetAttribute` is built and which fields are required."}),GY=r.Object({...Mv,params:MY}),$Y=r.Object({...Dv,params:DY}),Gv={...tl,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},$v={...rl,type:r.Literal("mapper",{description:"Map processor. It moves, copies, or normalizes existing log attributes."})},jY=C("subtype",[r.Object({attributes:r.Array(r.Object({originAttribute:r.String({description:"Attribute name to map to the target attribute"}),keepOrigin:r.Optional(r.Boolean({description:"Whether the source attribute is preserved after mapping. If omitted, route processing treats this as false."})),overrideTarget:r.Optional(r.Boolean({description:"Whether to overwrite the target attribute when it already exists. If omitted, route processing treats this as true."})),targetAttribute:r.String({description:"Attribute name that will receive the mapped value"})}),{description:"Mappings that map individual attributes to new targets"}),subtype:r.Literal("map-attributes",{description:"Copies or moves one or more source attributes to target attributes."})},{$id:"ProcessorParamsMapperMapAttributes"}),r.Object({attributeName:r.String({description:"Attribute whose value will determine the log level"}),subtype:r.Literal("map-level",{description:"Normalizes a severity or status attribute into Tsuga log levels."})},{$id:"ProcessorParamsMapperMapLevel"}),r.Object({attributeName:r.String({description:"Attribute whose value will determine the log timestamp"}),subtype:r.Literal("map-timestamp",{description:"Uses an event-time attribute as the log timestamp."})},{$id:"ProcessorParamsMapperMapTimestamp"})],{description:"Map processor configuration. The `subtype` discriminator selects whether existing attributes are copied or moved to new names, or used to set the log level or timestamp."}),qY=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."}),FY=r.Object({...$v,params:qY}),BY=r.Object({...Gv,params:jY}),jv={...tl,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},qv={...rl,type:r.Literal("parse-attribute",{description:"Parse processor. It extracts structured fields from a text attribute."})},Fv=5,HY=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."}),KY=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:Fv,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."}),zY=r.Object({...jv,params:HY}),YY=r.Object({...qv,params:KY}),VY=r.Object({...Dv,params:C("subtype",[r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the formatted value"}),formatString:u({allowEmpty:!1,type:"long",description:"Template string used to build the target attribute value"}),overrideTarget:r.Optional(r.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:r.Literal("format-string"),replaceMissingByEmpty:r.Optional(r.Boolean({description:"Set to true for missing referenced attributes to render as empty strings. Defaults to true."}))}),r.Object({targetAttribute:u({allowEmpty:!1,description:"Attribute that will receive the category value"}),clauses:r.Array(r.Object({query:u({allowEmpty:!1,type:"tsuga-query",description:"Query that selects logs for this category clause. Clauses are evaluated in order."}),value:u({allowEmpty:!1,description:"String category value assigned when this clause matches."})}),{minItems:1,maxItems:kv,description:"Conditions evaluated in order to determine the category value. The first matching clause wins."}),defaultValue:r.Optional(u({description:"String category value used when no clause matches."})),subtype:r.Literal("category")})])}),QY=r.Object({...$v,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")})}),WY=r.Object({...qv,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:Fv,description:"Example log lines for validating the Grok rules."})),subtype:r.Literal("grok")})}),dXe=C("type",[QY,WY,VY]),ZY=r.Object({...Mv,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")})])}),XY=r.Object({...Gv,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")})}),JY=r.Object({...jv,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")})}),fXe=C("type",[XY,JY,ZY]),e9=11,Bv=r.Cyclic({OutputProcessor:r.Union([BY,zY,GY,r.Object({...tl,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"}),Hv=r.Cyclic({InputProcessor:r.Union([FY,YY,$Y,r.Object({...rl,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:e9,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 t9="/v0/logs",wn=`${t9}/routes`,vn=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(Bv,{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"}),ks=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(Hv,{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 SXe=d({tags:["routes"],url:wn,method:"GET",paginated:!0,query:r.Object(ge),response:r.Array(vn)}),AXe=d({tags:["routes"],url:`${wn}/:id`,params:r.Object({id:u()}),method:"GET",response:vn}),OXe=d({tags:["routes"],url:wn,method:"POST",body:ks,response:vn}),xXe=d({tags:["routes"],url:`${wn}/:id`,method:"PUT",body:ks,params:r.Object({id:u()}),response:vn}),RXe=d({tags:["routes"],url:`${wn}/:id/clone`,method:"POST",params:r.Object({id:u()}),body:ks,response:vn}),CXe=d({tags:["routes"],url:`${wn}/: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:`${wn}/: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:`${wn}/: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:vn});var Ms=`/${"v1"}/routes`,Kv={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}"]}}]},zv={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}}]},Ds=r.Pick(vn,["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)."}),r9={id:"123-456-abc",...Kv},n9={id:"456-789-def",...zv};Object.assign(Ds,{examples:[r9,n9]});var Yv=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:Ms,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(Ds)}),Vv=d({description:"Retrieves one log route by ID.",operationId:"getRoute",tags:["routes"],url:`${Ms}/: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:Ds}),Gg=r.Pick(ks,["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(Gg,{examples:[Kv,zv]});var Qv=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:Ms,method:"POST",body:Gg,response:Ds}),Wv=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:`${Ms}/:id`,method:"PUT",body:Gg,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:Ds}),Zv=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:`${Ms}/: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 Gs=`/${"v1"}/monitors`,$s=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)."}),Jv={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:[]},eN={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:[]},tN={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:[]},rN={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:[]},o9={id:"123-456-abc",...Jv},i9={id:"234-567-bcd",...eN},a9={id:"345-678-cde",...tN},s9={id:"456-789-def",...rN};Object.assign($s,{examples:[o9,i9,a9,s9]});var Xv=r.Pick(Od,["filters","sort","limit","offset"]),nN=r.Object({...Xv.properties,...Ze,filters:Xv.properties.filters},{description:"Monitor query request. Use filters, sorting, limit, and offset to page through visible monitors."}),c9={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(nN,{examples:[c9]});var oN=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:`${Gs}/query`,method:"POST",paginated:!0,body:nN,response:r.Array($s)}),iN=d({description:"Retrieves one monitor definition by ID.",operationId:"getMonitor",tags:["monitors"],url:`${Gs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Monitor ID returned by monitor query, create, or update operations."})}),response:$s}),aN=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],sN=r.Pick(Ja,aN,{$id:"CreateMonitorRequest",description:"Monitor creation request. Provide ownership, data access, alert configuration, priority, tags, and optional dashboard or cluster scope."}),cN=r.Pick(Ja,aN,{$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."}),pN=Jv,uN=eN,lN=tN,mN=rN;Object.assign(sN,{examples:[pN,uN,lN,mN]});Object.assign(cN,{examples:[pN,uN,lN,mN]});var dN=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:Gs,method:"POST",body:sN,response:$s}),fN=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:`${Gs}/: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:cN,response:$s}),p9=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."})}),gN=d({description:"Deletes a monitor by ID. Deleting a monitor stops future evaluations and alert transitions for that monitor.",operationId:"deleteMonitor",tags:["monitors"],url:`${Gs}/:id`,method:"DELETE",params:p9,response:N});var js=`/${"v1"}/notification-rules`,qs=r.Pick(gi,["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)."}),hN={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}}}]},u9={id:"123-456-abc",...hN};Object.assign(qs,{examples:[u9]});var yN=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:js,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(qs)}),TN=d({description:"Retrieves one notification rule by ID.",operationId:"getNotificationRule",tags:["notification-rules"],url:`${js}/: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:qs}),$g=r.Pick(rs,["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."}),l9=hN;Object.assign($g,{examples:[l9]});var EN=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:js,method:"POST",body:$g,response:qs}),_N=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:`${js}/: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:$g,response:qs}),m9=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."})}),IN=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:`${js}/:id`,method:"DELETE",params:m9,response:N});var Wi=`${di}/silences`,bN=r.Union([r.Literal("monday"),r.Literal("tuesday"),r.Literal("wednesday"),r.Literal("thursday"),r.Literal("friday"),r.Literal("saturday"),r.Literal("sunday")]),d9=r.Partial(r.Record(bN,r.Array(r.Object({startTime:r.String({format:Fm,description:"Local start time for this recurring silence window on this day, using the schedule time zone."}),endTime:r.String({format:Fm,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`."}),f9=r.Partial(r.Record(bN,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`."}),nl='IANA timezone identifier (e.g. "America/New_York"). Defaults to UTC if omitted.',SN="One-time silence schedule with specific start and end times",AN="Recurring weekly silence schedule",g9=C("type",[r.Object({type:r.Literal("one-time",{description:"Silence active once between the configured start and end times."}),startTime:r.String({format:Bm,description:"Local start date and time for the one-time silence, interpreted in `timeZone` when provided."}),endTime:r.String({format:Bm,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:qm,description:nl}))},{$id:"InputSilenceScheduleOneTime",description:SN}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:d9,timeZone:r.Optional(r.String({format:qm,description:nl}))},{$id:"InputSilenceScheduleRecurring",description:AN})],{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."}),h9=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:nl}))},{$id:"OutputSilenceScheduleOneTime",description:SN}),r.Object({type:r.Literal("recurring",{description:"Silence active on a recurring weekly schedule."}),weeklySchedule:f9,timeZone:r.Optional(r.String({description:nl}))},{$id:"OutputSilenceScheduleRecurring",description:AN})],{description:"Schedule defining when the silence is active. The `type` field discriminates between a `one-time` window and a `recurring` weekly window. Once a one-time schedule's `endTime` passes, or a recurring window closes, the silence stops suppressing notifications but is not deleted; delete it explicitly if it is no longer needed."}),y9="monitor_id",ON=`Query on the alerting monitor tags and group-by dimensions, e.g. \`env:prod AND service:bridge\`. The monitor itself can be targeted with \`${y9}:<monitor id>\`.`,ol=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:g9,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:ON})),teamsFilter:Ld,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(po),{maxItems:po.length,description:"Alert state transitions that must match for this silence to apply. An empty array matches every transition type."})}),Zi=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:h9,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:ON})),teamsFilter:Nd,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(po),{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)}),cJe=d({tags:["notification-silences"],url:Wi,method:"GET",response:r.Array(Zi)}),pJe=d({tags:["notification-silences"],url:`${Wi}/:id`,params:r.Object({id:u()}),method:"GET",response:Zi}),uJe=d({tags:["notification-silences"],url:Wi,method:"POST",body:ol,response:Zi}),lJe=d({tags:["notification-silences"],url:`${Wi}/:id`,method:"PUT",params:r.Object({id:u()}),body:ol,response:Zi}),mJe=d({tags:["notification-silences"],url:`${Wi}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),dJe=d({tags:["notification-silences"],url:`${Wi}/bulk-delete`,method:"DELETE",body:r.Object({ids:r.Array(u())}),response:r.Object({})});var Fs=`/${"v1"}/notification-silences`,Bs=r.Pick(Zi,["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)."}),T9={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"]},E9={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(Bs,{examples:[T9,E9]});var xN=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:Fs,method:"GET",response:r.Array(Bs)}),RN=d({description:"Retrieves one notification silence by ID.",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${Fs}/: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:Bs}),jg=r.Pick(ol,["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."}),_9={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(jg,{examples:[_9,I9]});var CN=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:Fs,method:"POST",body:jg,response:Bs}),PN=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:`${Fs}/:id`,method:"PUT",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the notification silence to update. Use the `id` returned by notification silence list, get, or create responses."})}),body:jg,response:Bs}),b9=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."})}),UN=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:`${Fs}/:id`,method:"DELETE",params:b9,response:N});var S9={critical:3,important:2,normal:1},se=e=>({label:e,weight:S9[e]}),A9={"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:`${dd} matches ${Kp}`,summary:`Detects logs and spans whose ${dd} resource attribute names a different team than the ${Kp} resolved at ingestion.`,rationale:`${Kp} 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:`${zp} present`,summary:`Logs and spans must populate ${zp} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:se("critical"),recommendation:`Populate ${zp} 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:`${Xa} presence`,summary:`Logs and spans must populate ${Xa} with a non-empty value.`,rationale:"Core identifier used to correlate telemetry across services.",objectType:"resource",category:"telemetry-hygiene",impact:se("important"),recommendation:`Populate ${Xa} 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 ${gx} 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"}},wN={"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_"]}},O9=Object.fromEntries(Object.keys(wN).map(e=>{let{label:t,receiver:n}=wN[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"}]})),x9=new Set(["azure_container_registry","azure_container_registry_image","azure_app_service_certificate","azure_virtual_network"]),R9=Us.filter(e=>e.startsWith("azure_")&&!x9.has(e)),vN={"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:R9,metricPrefixes:["azure_"]}},C9=Object.fromEntries(Object.keys(vN).map(e=>{let{label:t,source:n}=vN[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"}]})),P9={...A9,...O9,...C9},NN=Object.values(P9);var LN=["passed","failed","ignored"],U9=10,w9=r.Enum(LN,{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."}),v9=["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"],N9=["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"],Fg=["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",...N9,...v9],L9=r.Enum(Fg),k9=["log","metric","resource","span","api-key","dashboard","monitor","route"],M9=["collection-coverage","telemetry-hygiene","observability-assets","telemetry-adoption"],D9=["critical","important","normal"],G9=["team","global"],Bg=r.Object({key:r.Enum(Fg),title:r.String(),summary:r.String(),rationale:r.String(),objectType:r.Enum(k9),category:r.Enum(M9),impact:r.Object({label:r.Enum(D9),weight:r.Number()}),recommendation:r.String(),scope:r.Optional(r.Enum(G9))}),Hs=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."})}),qg=r.Intersect([Bg,r.Object({id:r.Optional(r.String()),status:w9,normalizedScore:r.Number(),details:r.Optional(r.Record(r.String(),r.Unknown())),recommendation:r.Optional(r.String()),examples:r.Optional(r.Array(Hs)),exampleCount:r.Optional(r.Integer())})]),$9=r.Object({generatedAt:r.String(),overallScore:r.Optional(r.Number()),rules:r.Array(Bg),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(qg)})),globalResults:r.Optional(r.Object({score:r.Optional(r.Number()),ruleResults:r.Array(qg)}))}),Hg=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(Fg,{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(LN,{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(Hs,{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 ${U9}; 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:$9}),Kg=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:Kg,team:r.Optional(u({allowEmpty:!1}))}),response:r.Array(Hg,{description:"Latest persisted rule evaluation rows for the cluster"})}),wJe=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(Hs)})}),vJe=d({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:r.Object({ruleKey:L9,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:Bg,result:qg,teamId:r.Optional(r.String()),teamName:r.Optional(r.String())})}),NJe=new Map(NN.map(e=>[e.key,e]));var kN=`/${"v1"}/quality-reports`,MN=r.Pick(Hg,["id","reportId","ruleId","owner","status","score","weight","reportOverallScore","reportTotalWeight","recommendation","examples","exampleCount","createdAt"],{$id:"QualityReportRow",description:"Persisted evaluation of one telemetry-quality rule for a team or cluster-wide scope. See [Quality reports](/documentation/account-and-settings/quality-reports)."}),j9={id:"01j9x3z4vyabcdfghjkmnpqrst",reportId:"01j9x3z4vyabcdfghjkmnpqrsu",ruleId:"team-has-route",owner:"01j9x3z4vyabcdfghjkmnpqrr",status:"passed",score:1,weight:2,reportOverallScore:.85,reportTotalWeight:2,createdAt:"2026-02-26T12:00:00.000Z"};Object.assign(MN,{examples:[j9]});var q9=r.Object({clusterId:Kg,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."}),DN=d({description:"Retrieves the latest persisted quality-report rows for a cluster, optionally scoped to one team. Use this to audit telemetry hygiene and routing recommendations.",operationId:"getLatestQualityReport",tags:["quality-reports"],url:`${kN}/latest`,method:"GET",query:q9,response:r.Array(MN)}),jJe=d({description:"Retrieves every example stored for one quality-report row. The latest-report endpoint returns only a preview of each row's examples, so use this to page past that preview when exampleCount exceeds the number of examples returned there.",operationId:"getQualityReportExamples",tags:["quality-reports"],url:`${kN}/:id/examples`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"Identifier of the quality-report row whose examples are returned. Use the id from the latest-report endpoint. Unknown ids, rows the caller cannot access, and cluster-wide rows requested by a non-admin all return RESOURCE_NOT_FOUND."})}),response:r.Object({examples:r.Array(Hs,{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 Ks="/v0/admin-center";var Pr=`${Ks}/retention-policies`,GN=3650,F9=r.Integer({description:"Number of days Tsuga retains matching telemetry."}),$N=r.Integer({minimum:1,maximum:GN,description:`Number of days Tsuga should retain matching telemetry. Valid values are 1 through ${GN}.`}),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:F9,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."})}),il=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:$N,isEnabled:r.Boolean({description:"Set to true for the policy to participate in retention resolution."})}),jN=r.Array(r.Object({env:u(),dataSource:r.Enum(Ir),durationDays:r.Union([$N,r.Null()]),isEnabled:r.Boolean()})),qN=r.Object({inserted:r.Array(Xr),updated:r.Array(Xr),deleted:r.Array(Xr)}),QJe=d({tags:["retention-policies"],url:Pr,method:"POST",body:il,response:Xr}),WJe=d({tags:["retention-policies"],url:Pr,method:"GET",response:r.Array(Xr)}),ZJe=d({tags:["retention-policies"],url:`${Pr}/:id`,method:"GET",params:r.Object({id:u()}),response:Xr}),XJe=d({tags:["retention-policies"],url:`${Pr}/:id`,method:"PUT",params:r.Object({id:u()}),body:il,response:Xr}),JJe=d({tags:["retention-policies"],url:`${Pr}/bulk-update`,method:"POST",body:jN,response:qN}),eet=d({tags:["retention-policies"],url:`${Pr}/bulk-update-for-team`,method:"POST",body:r.Object({teamId:u(),policies:jN}),response:qN}),tet=d({tags:["retention-policies"],url:`${Pr}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),zs=["past-24-hours","past-7-days","past-30-days"],ret=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(zs),dataSource:r.Enum(Ir)}),response:r.Object({percentile:r.Number(),observationWindow:r.Enum(zs),dataSource:r.Enum(Ir),teamId:r.String(),requestedHistoryDays:r.Number()})}),B9=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var H9=r.Array(r.Object({bucket:r.Enum(B9),count:r.Number()})),net=d({tags:["retention-policies"],url:`${Pr}/requested-history-histogram/:teamId`,method:"POST",params:r.Object({teamId:u()}),body:r.Object({observationWindow:r.Enum(zs),dataSource:r.Enum(Ir)}),response:r.Object({observationWindow:r.Enum(zs),dataSource:r.Enum(Ir),teamId:r.String(),histogram:H9})}),oet=d({tags:["retention-policies"],url:`${Pr}/top-teams-with-retention-surplus`,method:"POST",body:r.Object({dataSource:r.Enum(Ir),observationWindow:r.Enum(zs),percentile:r.Number({minimum:0,maximum:1}),topN:r.Optional(r.Number({minimum:1,maximum:20}))}),response:r.Array(r.Object({teamId:r.String(),retentionSurplusDays:r.Number()}))});var Ys=`/${"v1"}/retention-policies`,Vs=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)."}),K9={id:"123-456-abc",env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(Vs,{examples:[K9]});var FN=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:Ys,method:"GET",response:r.Array(Vs)}),BN=d({description:"Retrieves one retention policy by ID.",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${Ys}/: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:Vs}),zg=r.Pick(il,["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."}),z9={env:"production",teamId:"team-123-abc",dataSource:"logs",durationDays:30,isEnabled:!0};Object.assign(zg,{examples:[z9]});var HN=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:Ys,method:"POST",body:zg,response:Vs}),KN=d({description:"Replaces an existing retention policy by ID, including signal, scope fields, duration, and enabled state.",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${Ys}/: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:zg,response:Vs}),zN=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:`${Ys}/: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 Qs=`/${"v1"}/slos`,Y9=r.Pick(Pd,["id","sloId","priority","configuration"],{$id:"SloAlert",description:"Alert attached to an SLO, triggered on a burn-rate multiplier or an SLO target threshold"}),Ws=r.Object({...r.Pick(mi,["id","name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds"]).properties,alerts:r.Array(Y9,{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(Ws,{examples:[V9]});var YN=r.Pick(wd,["filters","sort","limit","offset"]),VN=r.Object({...YN.properties,...Ze,filters:YN.properties.filters},{description:"SLO query request. Use filters, sorting, limit, and offset to page through visible SLOs."}),Q9={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(VN,{examples:[Q9]});var QN=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:`${Qs}/query`,method:"POST",paginated:!0,body:VN,response:r.Array(Ws)}),WN=d({description:"Retrieves one SLO definition by ID.",operationId:"getSlo",tags:["slos"],url:`${Qs}/:id`,method:"GET",params:r.Object({id:u({allowEmpty:!1,description:"SLO ID returned by SLO query, create, or update operations."})}),response:Ws}),ZN=["name","description","tags","configuration","target","timeframeDays","owner","permissions","clusterIds","alerts"],XN=r.Pick(nu,ZN,{$id:"CreateSloRequest",description:"SLO creation request. Provide ownership, data access, SLI configuration, target, timeframe, optional cluster scope, and the alerts to create."}),JN=r.Pick(Ud,ZN,{$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."}),eL={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(XN,{examples:[eL]});Object.assign(JN,{examples:[eL]});var tL=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:Qs,method:"POST",body:XN,response:Ws}),rL=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:`${Qs}/: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:JN,response:Ws}),nL=d({description:"Deletes an SLO by ID. Deleting an SLO stops future evaluations and removes its attached alerts.",operationId:"deleteSlo",tags:["slos"],url:`${Qs}/: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 So=`${Ks}/tag-policies`;var W9=["logs","metrics","traces"],Yg=r.Array(r.Enum(W9,{description:"Telemetry signal covered by a data tag policy."}),{description:"Telemetry signals covered by the policy. An empty array means logs, metrics, and traces."}),Z9=r.Union([Lp,Yg]),X9=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."}),J9=C("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:Yg,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:Lp},{title:"TsugaAssetTagPolicy"})]),eV=C("type",[r.Object({type:r.Literal("telemetry",{description:"Policy applies to telemetry data points during ingestion or evaluation."}),assetTypes:Yg,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:Lp},{title:"TsugaAssetTagPolicy"})]),oL="Policy surface and enforcement behavior. Use `telemetry` for telemetry data or `tsuga_asset` for Tsuga-managed resources.",tV=r.Unsafe({...J9,description:oL}),rV=r.Unsafe({...eV,description:oL}),Xi=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(X9),configuration:tV,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 Zs=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:rV,owner:u({allowEmpty:!1,description:"Team ID that will own and manage the policy."})}),Pet=d({tags:["tag-policies"],url:So,method:"GET",query:r.Object({teamIds:r.Optional(r.Array(u(),{maxItems:100})),assetTypes:r.Optional(Z9),searchQuery:r.Optional(u())}),response:r.Array(Xi)}),Uet=d({tags:["tag-policies"],url:`${So}/:id`,method:"GET",params:r.Object({id:u()}),response:Xi}),wet=d({tags:["tag-policies"],url:So,method:"POST",body:Zs,response:Xi}),vet=d({tags:["tag-policies"],url:`${So}/:id`,method:"PUT",params:r.Object({id:u()}),body:Zs,response:Xi}),Net=d({tags:["tag-policies"],url:`${So}/:id`,method:"DELETE",params:r.Object({id:u()}),response:N}),Let=d({tags:["tag-policies"],url:`${Ks}/applicable-tag-rules`,method:"GET",query:r.Object({assetType:r.Enum(Fa),teamId:u()}),response:r.Array(r.Object({tagKey:r.String(),allowedTagValues:r.Array(r.String()),isRequired:r.Boolean(),tagPolicyId:r.String()}))}),iL=r.Object({total:r.Number(),totalNonCompliant:r.Number(),idsNonCompliant:r.Array(r.String())}),aL=r.Union([r.Literal("ingestion-api-key"),r.Literal("operation-api-key"),r.Literal("rum-public-token"),r.Literal("dashboard"),r.Literal("log-route"),r.Literal("metric-route"),r.Literal("monitor"),r.Literal("notification-rule"),r.Literal("notification-silence"),r.Literal("slo")]),nV=r.Object({total:r.Number(),totalNonCompliant:r.Number(),byAssetType:r.Record(aL,iL)}),oV=r.Omit(iL,["total"]),iV=r.Object({totalNonCompliant:r.Number(),byAssetType:r.Record(aL,oV)}),sL=r.Object({totals:nV,byTeam:r.Record(r.String(),iV)}),ket=d({tags:["tag-policies"],url:`${So}/:id/stats`,method:"GET",params:r.Object({id:u()}),response:sL}),Met=d({tags:["tag-policies"],url:`${So}/new-policy-stats`,method:"POST",body:Zs,response:sL});var Xs=`/${"v1"}/tag-policies`,cL={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"},pL={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"},aV={id:"123-456-abc",...cL},sV={id:"456-789-def",...pL},Js=r.Pick(Xi,["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)."}),cV=aV,pV=sV;Object.assign(Js,{examples:[cV,pV]});var Vg=r.Pick(Zs,["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."}),uV=cL,lV=pL;Object.assign(Vg,{examples:[uV,lV]});var uL=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:Xs,method:"GET",response:r.Array(Js)}),lL=d({description:"Retrieves one tag policy by ID.",operationId:"getTagPolicy",tags:["tag-policies"],url:`${Xs}/: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:Js}),mL=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:Xs,method:"POST",body:Vg,response:Js}),dL=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:`${Xs}/: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:Vg,response:Js}),fL=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:`${Xs}/: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 ec=`/${"v1"}/teams`,tc=r.Pick(pi,["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)."}),mV={id:"team-123-abc",name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(tc,{examples:[mV]});var gL=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:ec,method:"GET",paginated:!0,query:r.Object(Ze),response:r.Array(tc)}),hL=d({description:"Retrieves one team by ID.",operationId:"getTeam",tags:["teams"],url:`${ec}/: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:tc}),Qg=r.Pick(Jp,["name","description","visibility","tags"],{description:"Team create or update request. Provide the team name, optional description, visibility, and tags."}),dV={name:"platform-engineering",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Qg,{examples:[dV]});var yL=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:ec,method:"POST",body:Qg,response:tc}),TL=d({description:"Replaces a team definition by ID, including name, description, visibility, and tags.",operationId:"updateTeam",tags:["teams"],url:`${ec}/: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:tc}),EL=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:`${ec}/: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 fV(e){return/^[aeiou]/i.test(e)||e==="SLO"?"an":"a"}function _L(e,t){let n=Number(t);if(Number.isNaN(n))throw new Error(`--${e} must be a number (got: ${t})`);return n}function IL(e){let t={};return e.limit!==void 0&&(t.limit=_L("limit",e.limit)),e.offset!==void 0&&(t.offset=_L("offset",e.offset)),t}function Wg(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 bL(e,t,n){let o=e.command(t.commandName).description(t.description),i=t.singularOverride??yx(t.commandName).replace(/-/g," "),a=t.pluralOverride??t.commandName.replace(/-/g," "),c=fV(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 ${ei} (default: ${Np})`).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(wi(t.endpoints.list));return}let f=m.data?Ti({data:m.data}):{},h=await n()(t.endpoints.list,{body:{...f,...IL(m)}});J(h)}):l.action(async m=>{let f=IL(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=Wg(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(wi(m));return}let h=Ti(f),E=await n()(m,{body:h});J(E)})}if(t.endpoints.update){let m=t.endpoints.update,f=Wg(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(wi(m));return}let I=Ti(E),g=await n()(m,{params:{[f]:h},body:I});J(g)})}if(t.endpoints.delete){let m=t.endpoints.delete,f=Wg(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 gV=[{commandName:"cloud-resources",description:"List cloud resources discovered by inventory scans",endpoints:{list:Cv},enableListBody:!0},{commandName:"dashboard-folders",description:"Manage dashboard folders",endpoints:{list:Lw,get:kw,create:Mw,update:Dw,delete:Gw},enableListBody:!0},{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:av,get:sv,create:cv,update:pv,delete:uv},enableListBody:!0},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",singularOverride:"ingestion API key",pluralOverride:"ingestion API keys",endpoints:{list:yv,create:Tv,update:Ev,delete:_v}},{commandName:"investigations",description:"Manage investigations (beta)",endpoints:{list:Uv,get:wv,create:vv,update:Nv,delete:Lv}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:oN,get:iN,create:dN,update:fN,delete:gN},enableListBody:!0},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:yN,get:TN,create:EN,update:_N,delete:IN}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:xN,get:RN,create:CN,update:PN,delete:UN}},{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:DN},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:FN,get:BN,create:HN,update:KN,delete:zN}},{commandName:"log-routes",description:"Manage log routes",endpoints:{list:Yv,get:Vv,create:Qv,update:Wv,delete:Zv}},{commandName:"services",description:"List and inspect services (read-only; services are inferred from telemetry)",endpoints:{list:AR,get:OR}},{commandName:"slos",description:"Manage SLOs",singularOverride:"SLO",pluralOverride:"SLOs",endpoints:{list:QN,get:WN,create:tL,update:rL,delete:nL},enableListBody:!0},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:uL,get:lL,create:mL,update:dL,delete:fL}},{commandName:"teams",description:"Manage teams",endpoints:{list:gL,get:hL,create:yL,update:TL,delete:EL}}];function SL(e,t){for(let n of gV)bL(e,n,t)}var AL=require("node:child_process");var al="@tsuga/cli@latest";function hV(){V(`Updating ${al}`),V(` $ npm install -g ${al}`);try{(0,AL.execFileSync)("npm",["install","-g",al],{stdio:["ignore","inherit","inherit"]})}catch(e){let t=e.status??1;throw new Error(`npm install -g ${al} exited ${t}`,{cause:e})}V("Updated. Run `tsuga --version` to confirm the new version.")}function OL(e){e.command("self-update").description("Update the Tsuga CLI to the latest version via npm").action(()=>{hV()})}var nh=require("node:fs"),rh=require("node:os"),ea=require("node:path");var yV=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,rc=class e extends Date{#t=!1;#r=!1;#e=null;constructor(t){let n=!0,o=!0,i="Z";if(typeof t=="string"){let a=t.match(yV);a?(a[1]||(n=!1,t=`0000-01-01T${t}`),o=!!a[2],o&&t[10]===" "&&(t=t.replace(" ","T")),a[2]&&+a[2]>23?t="":(i=a[3]||null,t=t.toUpperCase(),!i&&o&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#t=n,this.#r=o,this.#e=i)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z")return t;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,n="Z"){let o=new e(t);return o.#e=n,o}static wrapAsLocalDateTime(t){let n=new e(t);return n.#e=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#r=!1,n.#e=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#t=!1,n.#e=null,n}};function TV(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function EV(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+=`
|
|
141
|
+
`,c===t&&(i+=" ".repeat(a+n+2),i+=`^
|
|
142
|
+
`))}return i}var X=class extends Error{line;column;codeblock;constructor(t,n){let[o,i]=TV(n.toml,n.ptr),a=EV(n.toml,o,i);super(`Invalid TOML document: ${t}
|
|
142
143
|
|
|
143
|
-
${a}`,n),this.line=o,this.column=i,this.codeblock=a}};var
|
|
144
|
-
`?
|
|
145
|
-
`&&(
|
|
144
|
+
${a}`,n),this.line=o,this.column=i,this.codeblock=a}};var _V=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,IV=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,bV=/^[+-]?0[0-9_]/;function sl(e,t){let n=e[t++],o=n,i=n==="'",a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
|
|
145
|
+
`?t++:e[t]==="\r"&&e[t+1]===`
|
|
146
|
+
`&&(t+=2));let c="",l=t,m=0;for(let f=t;f<e.length;f++)if(n=e[f],a&&(n===`
|
|
146
147
|
`||n==="\r"&&e[f+1]===`
|
|
147
|
-
`))
|
|
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,
|
|
149
|
-
`,
|
|
148
|
+
`))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+=`
|
|
149
|
+
`;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 xL(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=_V.test(e);if(i||IV.test(e)){if(bV.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 rc(e);if(!a.isValid())throw new X("invalid value",{toml:t,ptr:n});return a}function cl(e,t=0,n=e.length){let o=e.indexOf(`
|
|
150
|
+
`,t);return e[o-1]==="\r"&&o--,o<=n?o:-1}function Ji(e,t){for(let n=t;n<e.length;n++){let o=e[n];if(o===`
|
|
150
151
|
`)return n;if(o==="\r"&&e[n+1]===`
|
|
151
|
-
`)return n+1;if(o<" "&&o!==" "||o==="\x7F")throw new X("control characters are not allowed in comments",{toml:e,ptr:
|
|
152
|
-
`||i==="\r"&&e[
|
|
153
|
-
`);)
|
|
152
|
+
`)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===`
|
|
153
|
+
`||i==="\r"&&e[t+1]===`
|
|
154
|
+
`);)t++;if(o||i!=="#")break;t=Ji(e,t)}return t}function RL(e,t,n,o,i=!1){if(!o)return t=cl(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let c=e[a];if(c==="#"){if(a=cl(e,a),a<0)break}else{if(c===n)return a+1;if(c===o||i&&(c===`
|
|
154
155
|
`||c==="\r"&&e[a+1]===`
|
|
155
|
-
`))return a}}throw new X("cannot find end of structure",{toml:e,ptr:
|
|
156
|
-
`&&e[f]!=="\r")throw new X("unexpected character encountered",{toml:e,ptr:f});e[f]===","&&f++}return[
|
|
157
|
-
`&&c!=="\r"){let l,
|
|
158
|
-
`&&a!=="\r"){let c=
|
|
159
|
-
`&&e[l]!=="\r")throw new X("each key-value declaration must be followed by an end-of-line",{toml:e,ptr:l});l=
|
|
160
|
-
`}[[${
|
|
161
|
-
`,i
|
|
162
|
-
`)+
|
|
163
|
-
`)
|
|
156
|
+
`))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&&(Ji(e,i),o=o.slice(0,i)),[o.trimEnd(),i]}function nc(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==="["?PL(e,t,o,i):CL(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]=sl(e,t);if(n){if(f=Ur(e,f),e[f]&&e[f]!==","&&e[f]!==n&&e[f]!==`
|
|
157
|
+
`&&e[f]!=="\r")throw new X("unexpected character encountered",{toml:e,ptr:f});e[f]===","&&f++}return[m,f]}let c=RL(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++),[xL(l[0],e,t,i),c]}var AV=/^[a-zA-Z0-9-_]+[ \t]*$/;function pl(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]=sl(e,t);o=e.indexOf(".",m);let f=e.slice(m,o<0||o>a?a:o),h=cl(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(!AV.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 CL(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=Ji(e,t);else if(c!==" "&&c!==" "&&c!==`
|
|
158
|
+
`&&c!=="\r"){let l,m=i,f=!1,[h,E]=pl(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]=nc(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 PL(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=Ji(e,t);else if(a!==" "&&a!==" "&&a!==`
|
|
159
|
+
`&&a!=="\r"){let c=nc(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 UL(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 Zg(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=pl(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=UL(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=pl(e,l),f=UL(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=nc(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]!==`
|
|
160
|
+
`&&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 wL=/^[a-z0-9-_]+$/i;function oc(e){let t=typeof e;if(t==="object"){if(Array.isArray(e))return"array";if(e instanceof Date)return"date"}return t}function OV(e){for(let t=0;t<e.length;t++)if(oc(e[t])!=="object")return!1;return e.length!=0}function Xg(e){return JSON.stringify(e).replace(/\x7f/g,"\\u007f")}function Jg(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 Xg(e);if(t==="date"){if(isNaN(e.getTime()))throw new TypeError("cannot serialize invalid date");return e.toISOString()}if(t==="object")return xV(e,n,o);if(t==="array")return RV(e,n,o)}function xV(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+=wL.test(c)?c:Xg(c),i+=" = ",i+=Jg(e[c],oc(e[c]),t-1,n)}return i+" }"}function RV(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+=Jg(e[i],oc(e[i]),t-1,n)}return o+" ]"}function CV(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&&`
|
|
161
|
+
`}[[${t}]]
|
|
162
|
+
`,i+=eh(0,e[a],t,n,o);return i}function eh(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=oc(t[f]);if(h==="symbol"||h==="function")throw new TypeError(`cannot serialize values of type '${h}'`);let E=wL.test(f)?f:Xg(f);if(h==="array"&&OV(t[f]))c+=(c&&`
|
|
163
|
+
`)+CV(t[f],n?`${n}.${E}`:E,o-1,i);else if(h==="object"){let I=n?`${n}.${E}`:E;c+=(c&&`
|
|
164
|
+
`)+eh(I,t[f],I,o-1,i)}else a+=E,a+=" = ",a+=Jg(t[f],h,o,i),a+=`
|
|
164
165
|
`}}return e&&(a||!c)&&(a=a?`[${e}]
|
|
165
166
|
${a}`:`[${e}]`),a&&c?`${a}
|
|
166
|
-
${c}`:a||c}function
|
|
167
|
+
${c}`:a||c}function th(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(oc(e)!=="object")throw new TypeError("stringify can only be called with an object");let o=eh(0,e,"",t,n);return o[o.length-1]!==`
|
|
167
168
|
`?o+`
|
|
168
|
-
`:o}var
|
|
169
|
-
`),V(f===void 0?" created":` patched (backup: ${f})`)}function f9(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 g9(e,r,n,o){let i=(0,Bi.join)(e,".codex"),a=(0,Bi.join)(i,"config.toml");V(`Codex \u2192 ${a}`),(0,Bg.mkdirSync)(i,{recursive:!0});let c=ss(a),l=c===void 0?{}:Mg(c),d="otel"in l;delete l.otel,l.otel=f9(r,n,o);let f=cs(a,c);as(a,jg(l)),V(f===void 0?" created":d?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function KN(){return new wr("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function zN(){return new wr("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var YN="Restart your claude / codex session to load the new config.";function VN(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(KN()).addOption(zN()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{d9((0,qg.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),V(YN)}),r.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(KN()).addOption(zN()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{g9((0,qg.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),V(YN)})}var To="/v0/logs";var Fg=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var Vs=0,Hg=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(Fg,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[_A]:t.Optional(t.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),QN=100,y9="timestamp",h9=t.Union([t.Literal(y9)]),Un=t.Partial(t.Object({...it.properties,query:p({type:"tsuga-query",description:"Tsuga query used to filter logs in the selected time range."}),maxResults:t.Integer({minimum:1,maximum:1e3,description:"Maximum number of logs to return. Valid values are 1 through 1000."}),shouldRecommendAttributes:t.Boolean({description:"Whether Tsuga should return suggested attributes to highlight in results."}),triggeredBy:t.Literal("refresh",{description:"Indicates the query was triggered by a refresh action."}),startOffset:t.Number({minimum:Vs,description:"Result offset used when fetching additional log rows."}),startOffsets:t.Array(t.Number({minimum:Vs}),{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 ${Vs} for every cluster.`}),clusterId:p({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:Ga,sortBy:h9,sortDirection:t.Union([t.Literal("asc"),t.Literal("desc")],{description:"Timestamp sort direction for log results."})})),hJe=m({tags:["logs"],url:`${To}/count`,method:"GET",query:t.Pick(Un,["from","to","query","clusterId","clusterIds"]),response:t.Object({count:t.Number(),clusterResponses:t.Optional(Qo())})}),Qs=t.Object({value:t.String(),priority:t.Number()}),EJe=m({tags:["logs"],url:`${To}/search`,method:"GET",query:Un,response:t.Object({logs:t.Optional(t.Array(Hg)),attributesToHighlight:t.Optional(t.Array(Qs)),clusterResponses:t.Optional(Qo(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})}),E9=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"}),T9=t.Object({id:t.String(),pattern:t.Array(E9),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"}))}),TJe=m({tags:["logs"],url:`${To}/patterns`,method:"GET",query:t.Object({...it.properties,query:p({type:"tsuga-query"}),clusteringThreshold:t.Optional(t.Number()),clusterId:t.Optional(p({allowEmpty:!1}))}),response:t.Object({patterns:t.Array(T9),sampleSize:t.Number()})}),_Je=m({tags:["logs"],url:`${To}/attributes`,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),clusterIds:t.Optional(Ga)}),response:t.Object({attributes:t.Array(t.String()),clusterResponses:t.Optional(Qo())})});var _9=["pending","running","completed","incomplete","failed"],WN=t.Object({id:t.String({description:"ID of the export."}),status:t.Enum(_9,{description:"Lifecycle of the export. `pending` until the download is claimed, `running` while the CSV streams, then `completed`, `incomplete` when the file is usable but some matched logs could not be reached, or `failed` if the export was interrupted."}),rowsWritten:t.Number({description:"Logs written to the CSV so far. Updated periodically while the download streams, so it lags slightly behind the bytes on the wire."}),totalRows:t.Number({description:"Logs this export will write, already clamped to the export maximum. Use it as the denominator for progress."}),isTruncated:t.Boolean({description:"Whether the query matched more logs than the export maximum, so the CSV holds only the first logs in the requested sort order."}),errorMessage:t.Optional(t.String({description:"Why the export is incomplete or failed."}))}),IJe=m({tags:["logs"],url:`${To}/exports`,method:"POST",body:t.Object({...t.Pick(Un,["from","to","query","clusterId","clusterIds","sortBy","sortDirection"]).properties,columns:t.Array(p({allowEmpty:!1}),{minItems:1,description:"Log attributes to write as CSV columns, in order. Each becomes one column, resolved against the log with dotted-path lookup."})}),response:t.Object({...WN.properties,downloadUrl:t.String({description:"Relative URL to fetch the CSV from. It carries a single-use token that expires shortly after creation, so the caller must start the download immediately."})})}),bJe=m({tags:["logs"],url:`${To}/exports/:exportId`,method:"GET",params:t.Object({exportId:t.String()}),response:WN}),SJe=m({tags:["logs"],url:`${To}/exports/:exportId/download`,method:"GET",params:t.Object({exportId:t.String()}),query:t.Object({token:p({allowEmpty:!1,description:"Single-use token minted when the export was created."})}),response:t.String({description:"CSV file, streamed as it is produced."})});var Ws=`/${"v1"}/logs`,Kg=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(Hg,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),I9={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(Kg,{examples:[I9]});var ZN=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:QN,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."})),...It.properties},{description:"Log search query. Provide a time range, optional Tsuga query, and optional limit."}),b9={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(ZN,{examples:[b9]});var XN=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:`${Ws}/search`,method:"GET",query:ZN,response:t.Object({logs:t.Array(Kg,{description:"Log events matching the query and time range."})})}),S9=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`."}))}),JN=t.Object({patterns:t.Array(S9,{description:"Log patterns clustered from logs matching the query."}),sampleSize:t.Number({description:"Number of logs sampled while computing patterns."})},{}),O9={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(JN,{examples:[O9]});var eL=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:`${Ws}/patterns`,method:"GET",query:t.Object({...It.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:JN}),A9=t.Object({exampleLog:t.Optional(Kg),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."})}),tL=t.Object({newErrorPatterns:t.Array(A9,{description:"Error patterns first seen in the requested time range."})},{}),x9={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(tL,{examples:[x9]});var rL=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:`${Ws}/patterns/new`,method:"GET",query:t.Object({...It.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:tL}),R9=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."}))}),nL=t.Object({errorPatternIncreases:t.Array(R9,{description:"Error patterns with increased occurrence in the requested time range."})},{}),C9={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(nL,{examples:[C9]});var oL=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:`${Ws}/patterns/increase`,method:"GET",query:t.Object({...It.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:nL}),iL=t.Object({attributes:t.Array(t.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),P9={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(iL,{examples:[P9]});var U9=t.Object({...It.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."}),aL=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:`${Ws}/attributes`,method:"GET",query:U9,response:iL});var Jr="/v0/metrics",w9=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(Fg)},{additionalProperties:!0}),DJe=m({tags:["metrics"],url:`${Jr}/count`,method:"GET",query:t.Pick(Un,["from","to","query","clusterId"]),response:t.Object({count:t.Number()})}),GJe=m({tags:["metrics"],url:`${Jr}/search`,method:"GET",query:Un,response:t.Object({logs:t.Optional(t.Array(w9)),totalHits:t.Optional(t.Number()),attributesToHighlight:t.Optional(t.Array(Qs))},{additionalProperties:!0})}),Vu=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."}),zg=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."}),sL=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(zg),type:t.Optional(Vu),unit:t.Optional(t.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:t.Optional(sL)}),$Je=m({url:`${Jr}/metadata`,method:"GET",query:t.Object({...it.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:v9}),jJe=m({tags:["metrics"],url:Jr,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Array(t.String())}),Qu=t.Array(t.Object({name:t.String({description:"Metric name observed by Tsuga."}),type:Vu,lastSeen:t.Optional(sL)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),N9=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Qu,{examples:[N9]});var qJe=m({tags:["metrics"],url:`${Jr}/names-and-types`,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Qu}),Zs=t.Array(t.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),L9=["service","env","host","method","status_code"];Object.assign(Zs,{examples:[L9]});var BJe=m({tags:["metrics"],url:`${Jr}/attributes`,method:"GET",query:t.Object({...it.properties,metricName:p({allowEmpty:!1}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Zs}),FJe=m({tags:["metrics"],url:`${Jr}/attributes/batch`,method:"GET",query:t.Object({...it.properties,metricNames:t.Array(p({allowEmpty:!1}),{minItems:1,description:"Metric names to fetch attributes for"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:Zs}),Yg=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."})}),HJe=m({tags:["metrics"],url:`${Jr}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1})}),response:Yg}),KJe=m({url:`${Jr}/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 Vg=`/${"v1"}/metrics`,k9=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Qu,{examples:[k9]});var Qg=t.Object({name:t.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:Vu,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(zg),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."}))}),M9={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(Qg,{examples:[M9]});var cL=t.Object({...It.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."}),pL=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:Vg,method:"GET",query:cL,response:t.Array(Qg)}),uL=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:`${Vg}/:name`,method:"GET",params:t.Object({name:p({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:cL,response:Qg}),D9=["service","env","host","method","status_code"];Object.assign(Zs,{examples:[D9]});var lL=t.Pick(Yg,["assets"]),G9={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(lL,{examples:[G9]});var mL=m({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${Vg}/assets-usage`,method:"GET",query:t.Object({metricName:p({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:lL});var Fi="/v0/traces",iet=m({tags:["traces"],url:`${Fi}/count`,method:"GET",query:t.Pick(Un,["from","to","query","clusterId"]),response:t.Object({count:t.Number()})}),$9=["unset","ok","error"],j9=t.Enum($9),q9=["unspecified","internal","server","client","producer","consumer"],B9=t.Enum(q9),fL=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:B9,name:t.String()}),status_code:t.Optional(j9),trace_id:t.String()}),gL=100,F9="start_time",H9="duration_ns",K9=t.Union([t.Literal(F9),t.Literal(H9)]),z9={...it.properties,query:t.Optional(p({type:"tsuga-query"})),maxResults:t.Optional(t.Integer({minimum:1,maximum:1e4})),shouldRecommendAttributes:t.Optional(t.Boolean()),startOffset:t.Optional(t.Number({minimum:Vs})),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),sortBy:t.Optional(K9),sortDirection:t.Optional(t.Union([t.Literal("asc"),t.Literal("desc")]))},aet=m({tags:["traces"],url:`${Fi}/search`,method:"GET",query:t.Object(z9),response:t.Object({spans:t.Optional(t.Array(fL)),attributesToHighlight:t.Optional(t.Array(Qs))})});var Y9=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."})}),V9=t.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),...t.Partial(Y9).properties}),set=m({tags:["traces"],url:`${Fi}/summarize`,method:"GET",query:V9,response:t.Object({spans:t.Array(fL)})}),cet=m({tags:["traces"],url:`${Fi}/attributes`,method:"GET",query:t.Object({...it.properties,clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"}))}),response:t.Object({attributes:t.Array(t.String())})}),Q9=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."}))}),W9=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."})}),Z9=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."})}),Wg=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."})),Zg=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."})),Wu=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(Q9,{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(W9,{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(Z9,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),X9={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(Wu,{examples:[X9]});var pet=m({tags:["traces"],url:`${Fi}/latency-summary`,method:"GET",query:t.Object({...it.properties,traceId:p({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:t.Optional(p({allowEmpty:!1,description:"Cluster ID"})),minRangeDurationMs:Wg,includeRanges:Zg}),response:Wu}),dL=t.Object({filter:p({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:Wo}),J9=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number()}),eV=t.Object({value:t.String(),supportA:t.Number(),supportB:t.Number(),lift:t.Union([t.Number(),t.Null()]),pValue:t.Number()}),tV=t.Object({attr:t.String(),values:t.Array(eV),otherValues:t.Array(J9)}),uet=m({tags:["traces"],url:`${Fi}/contrast-sets`,method:"POST",body:t.Object({groupA:dL,groupB:dL,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(tV),groupACount:t.Number(),groupBCount:t.Number()})});var Xg=`/${"v1"}/traces`,Jg=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."}),rV={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(Jg,{examples:[rV]});var nV={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},yL=t.Object({...It.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:gL,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(yL,{examples:[nV]});var hL=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:`${Xg}/search`,method:"GET",query:yL,response:t.Object({spans:t.Array(Jg,{description:"Spans matching the query and time range."})})}),oV={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},EL=t.Object({...It.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(EL,{examples:[oV]});var TL=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:`${Xg}/summarize`,method:"GET",query:EL,response:t.Object({spans:t.Array(Jg,{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`."})})}),iV={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},_L=t.Object({...It.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:Wg,includeRanges:Zg},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(_L,{examples:[iV]});var IL=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:`${Xg}/latency-summary`,method:"GET",query:_L,response:Wu});var OL=["timestamp","level","message"],AL=["count","ratio","team","level","pattern"];function gt(e,r){let n=r??kr(e);if(!n)throw new Error(`--${e} is required`);return oc(n)}function bL(e){let r={from:gt("from",e.from),to:gt("to",e.to)},n=e.query??kr("query");n!==void 0&&(r.query=n);let o=e.maxResults??kr("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 ve(e){let r=kr(e);return r===void 0?"":` (default: ${r})`}function aV(e){let r=ul(e.output),n=e.fields===void 0?void 0:ll(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??OL}}function sV(e){let r=ul(e.output),n=e.fields===void 0?void 0:ll(e.fields);return r==="json"?{format:r,fields:n}:{format:r,fields:n??AL}}function SL(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 cV(e,r){if(r.format==="json"){if(r.fields===void 0){J(e);return}let{fields:i}=r;J({patterns:e.patterns.map(a=>SL(a,e.sampleSize)).map(a=>ml(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>SL(i,e.sampleSize)),o=dl(r.format,n,r.fields);o.length>0&&V(o)}function pV(e,r){if(r.format==="json"){if(r.fields===void 0){J(e);return}let{fields:o}=r;J({logs:e.logs.map(i=>ml(i,o))});return}let n=dl(r.format,e.logs,r.fields);n.length>0&&V(n)}function xL(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${Ge}${ve("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${ve("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs${ve("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-1000${ve("max-results")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each log (default for --output=tsv|csv: ${OL.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=aV(c),d=await r()(XN,{query:bL(c)});pV(d,l)}),n.command("attributes").description("List log attribute dot-paths observed in the time range").option("--from <TIMESTAMP>",`Start of time range${Ge}${ve("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${ve("to")}`).action(async c=>{let l=await r()(aL,{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}${ve("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${ve("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter logs before clustering into patterns${ve("query")}`).option("--fields <FIELDS>",`Comma-separated dot-paths to project from each pattern (default for --output=tsv|csv: ${AL.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=sV(c),d={from:gt("from",c.from),to:gt("to",c.to)},f=c.query??kr("query");f!==void 0&&(d.query=f);let y=await r()(eL,{query:d});cV(y,l)}),n.command("new-error-patterns").description("List error patterns first seen in this time range").option("--from <TIMESTAMP>",`Start of time range${Ge}${ve("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${ve("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 d=await r()(rL,{query:l});J(d)}),n.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <TIMESTAMP>",`Start of time range${Ge}${ve("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${ve("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 d=await r()(oL,{query:l});J(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${Ge}${ve("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${ve("to")}`).action(async c=>{let l=await r()(pL,{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}${ve("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${ve("to")}`).action(async(c,l)=>{let d=await r()(uL,{params:{name:c},query:{from:gt("from",l.from),to:gt("to",l.to)}});J(d)}),o.command("assets-usage <METRIC_NAME>").description("List dashboards and monitors that use a specific metric").action(async c=>{let l=await r()(mL,{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}${ve("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${ve("to")}`).option("--query <TSUGA_QUERY>",`Tsuga query to filter spans${ve("query")}`).option("--max-results <COUNT>",`Maximum number of results, 1-10000${ve("max-results")}`).action(async c=>{let l=await r()(hL,{query:bL(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}${ve("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${ve("to")}`).action(async c=>{let l=await r()(TL,{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}${ve("from")}`).option("--to <TIMESTAMP>",`End of time range${Ge}${ve("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 d=await r()(IL,{query:l});J(d)});let a=e.command("aggregation").description("Run aggregation queries");Vr(a,"scalar","Run aggregation queries and return scalar results",$U,r),Vr(a,"timeseries","Run aggregation queries and return timeseries results",qU,r)}var uV="x-tsuga-session-id",ey="x-tsuga-source",ty="x-tsuga-source-version",ry="x-tsuga-source-commit",ny="x-tsuga-source-date",oy="x-tsuga-rationale",lV="x-tsuga-dashboard-id",mV="x-tsuga-widget-id",dV="x-request-id",wet={[uV]:"Session identifier for request correlation",[ey]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[ty]:"SDK version",[ry]:"SDK commit hash",[ny]:"SDK commit date",[oy]:"Optional caller-supplied rationale for this request, recorded for telemetry",[lV]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[mV]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[dV]:"Unique identifier for this API request, useful for debugging and support"};var wn=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 RL(e){if(e instanceof wn){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(`
|
|
170
|
-
`)}return e instanceof Error?`Error: ${e.message}`:String(e)}function
|
|
169
|
+
`:o}var PV={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 UV(e,t,n,o){let i=(0,ea.join)(e,".claude","settings.json");V(`Claude Code \u2192 ${i}`),(0,nh.mkdirSync)((0,ea.dirname)(i),{recursive:!0});let a=Ts(i),c;try{c=JSON.parse(a??"{}")}catch{throw new Error(`${i} is not valid JSON. Fix or remove it before re-running.`)}if(!_o(c))throw new Error(`${i} must contain a JSON object at the top level.`);let l=c.env??{};if(!_o(l))throw new Error(`${i} "env" must be a JSON object.`);let m=o?"1":"0";c.env={...l,...PV,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=Es(i,a);ys(i,`${JSON.stringify(c,null,2)}
|
|
170
|
+
`),V(f===void 0?" created":` patched (backup: ${f})`)}function wV(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 vV(e,t,n,o){let i=(0,ea.join)(e,".codex"),a=(0,ea.join)(i,"config.toml");V(`Codex \u2192 ${a}`),(0,nh.mkdirSync)(i,{recursive:!0});let c=Ts(a),l=c===void 0?{}:Zg(c),m="otel"in l;delete l.otel,l.otel=wV(t,n,o);let f=Es(a,c);ys(a,th(l)),V(f===void 0?" created":m?` replaced existing [otel] tables (backup: ${f})`:` appended (backup: ${f})`)}function vL(){return new Lr("--endpoint <OTLP_ENDPOINT>","OTLP base URL").env("TSUGA_OTLP_ENDPOINT").makeOptionMandatory()}function NL(){return new Lr("--ingestion-api-key <INGESTION_API_KEY>","Tsuga ingestion API key").env("TSUGA_INGESTION_API_KEY").makeOptionMandatory()}var LL="Restart your claude / codex session to load the new config.";function kL(e){let t=e.command("setup").description("Configure local LLM CLIs to ship OTEL telemetry to Tsuga");t.command("claude-code").description("Patch ~/.claude/settings.json with Tsuga OTEL env").addOption(vL()).addOption(NL()).option("--no-include-prompts","Strip user prompts + tool content from telemetry (default: include)").action(n=>{UV((0,rh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),V(LL)}),t.command("codex").description("Patch ~/.codex/config.toml with Tsuga OTEL settings (replaces any existing [otel] table)").addOption(vL()).addOption(NL()).option("--no-include-prompts","Strip user prompts from telemetry (default: include)").action(n=>{vV((0,rh.homedir)(),n.endpoint.replace(/\/+$/,""),n.ingestionApiKey,n.includePrompts),V(LL)})}var Ao="/v0/logs";var oh=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var ic=0,ih=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(oh,{description:"Log severity, normalized from the source severity into one of the fixed Tsuga levels (ordered `CRITICAL` to `TRACE`)."}),[qO]:r.Optional(r.String({description:"ID of the cluster this log was read from. Only set when the request spanned several clusters."}))},{additionalProperties:!0}),ML=100,NV="timestamp",LV=r.Union([r.Literal(NV)]),Nn=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:ic,description:"Result offset used when fetching additional log rows."}),startOffsets:r.Array(r.Number({minimum:ic}),{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 ${ic} for every cluster.`}),clusterId:u({allowEmpty:!1,description:"ID of the cluster to target. Omit to use the default cluster."}),clusterIds:Va,sortBy:LV,sortDirection:r.Union([r.Literal("asc"),r.Literal("desc")],{description:"Timestamp sort direction for log results."})})),srt=d({tags:["logs"],url:`${Ao}/count`,method:"GET",query:r.Pick(Nn,["from","to","query","clusterId","clusterIds"]),response:r.Object({count:r.Number(),clusterResponses:r.Optional(ii())})}),ac=r.Object({value:r.String(),priority:r.Number()}),crt=d({tags:["logs"],url:`${Ao}/search`,method:"GET",query:Nn,response:r.Object({logs:r.Optional(r.Array(ih)),attributesToHighlight:r.Optional(r.Array(ac)),clusterResponses:r.Optional(ii(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})}),kV=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"}),MV=r.Object({id:r.String(),pattern:r.Array(kV),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"}))}),prt=d({tags:["logs"],url:`${Ao}/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(MV),sampleSize:r.Number()})}),urt=d({tags:["logs"],url:`${Ao}/attributes`,method:"GET",query:r.Object({...at.properties,clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),clusterIds:r.Optional(Va)}),response:r.Object({attributes:r.Array(r.String()),clusterResponses:r.Optional(ii())})});var DV=["pending","running","completed","incomplete","failed"],DL=r.Object({id:r.String({description:"ID of the export."}),status:r.Enum(DV,{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."}))}),lrt=d({tags:["logs"],url:`${Ao}/exports`,method:"POST",body:r.Object({...r.Pick(Nn,["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({...DL.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."})})}),mrt=d({tags:["logs"],url:`${Ao}/exports/:exportId`,method:"GET",params:r.Object({exportId:r.String()}),response:DL}),drt=d({tags:["logs"],url:`${Ao}/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 sc=`/${"v1"}/logs`,ah=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(ih,["message","timestamp","level"]).properties},{additionalProperties:!0,$id:"LogEvent",description:"Log event including message, timestamp, severity level, and optional enriched context attributes."}),GV={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(ah,{examples:[GV]});var GL=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:ML,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."}),$V={query:"level:ERROR",maxResults:100,from:1704067200,to:1704070800};Object.assign(GL,{examples:[$V]});var $L=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:`${sc}/search`,method:"GET",query:GL,response:r.Object({logs:r.Array(ah,{description:"Log events matching the query and time range."})})}),jV=r.Object({pattern:r.String({description:"Clustered log pattern formatted as a readable string."}),size:r.Integer({description:"Number of logs that matched the pattern"}),groups:r.Array(r.Object({key:r.String({description:"Attribute dot-path shared by all logs in the pattern."}),value:r.String({description:"Value of the attribute identified by `key`, common to all logs in the pattern."})},{description:"Attribute key-value pair that is constant across every log matching this pattern, e.g. a shared `level` or `context.team`."}))}),jL=r.Object({patterns:r.Array(jV,{description:"Log patterns clustered from logs matching the query."}),sampleSize:r.Number({description:"Number of logs sampled while computing patterns."})},{}),qV={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(jL,{examples:[qV]});var qL=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:`${sc}/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:jL}),FV=r.Object({exampleLog:r.Optional(ah),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."})}),FL=r.Object({newErrorPatterns:r.Array(FV,{description:"Error patterns first seen in the requested time range."})},{}),BV={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(FL,{examples:[BV]});var BL=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:`${sc}/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:FL}),HV=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."}))}),HL=r.Object({errorPatternIncreases:r.Array(HV,{description:"Error patterns with increased occurrence in the requested time range."})},{}),KV={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(HL,{examples:[KV]});var KL=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:`${sc}/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:HL}),zL=r.Object({attributes:r.Array(r.String(),{description:"Log attribute dot-paths observed in the time range"})},{}),zV={attributes:["context.env","context.k8s.pod.name","context.service.name","context.team","level","message","timestamp"]};Object.assign(zL,{examples:[zV]});var YV=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."}),YL=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:`${sc}/attributes`,method:"GET",query:YV,response:zL});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(oh)},{additionalProperties:!0}),Rrt=d({tags:["metrics"],url:`${Jr}/count`,method:"GET",query:r.Pick(Nn,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),Crt=d({tags:["metrics"],url:`${Jr}/search`,method:"GET",query:Nn,response:r.Object({logs:r.Optional(r.Array(VV)),totalHits:r.Optional(r.Number()),attributesToHighlight:r.Optional(r.Array(ac))},{additionalProperties:!0})}),ul=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."}),sh=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."}),VL=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."}),QV=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(sh),type:r.Optional(ul),unit:r.Optional(r.String({description:"Metric unit reported by instrumentation or inferred metadata."})),lastSeen:r.Optional(VL)}),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:QV}),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())}),ll=r.Array(r.Object({name:r.String({description:"Metric name observed by Tsuga."}),type:ul,lastSeen:r.Optional(VL)}),{description:"Metrics observed in the requested time range, with the instrument type each was reported as."}),WV=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(ll,{examples:[WV]});var wrt=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:ll}),cc=r.Array(r.String(),{description:"Attribute names available as dimensions for filtering or grouping the requested metric(s)."}),ZV=["service","env","host","method","status_code"];Object.assign(cc,{examples:[ZV]});var vrt=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:cc}),Nrt=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:cc}),ch=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."})}),Lrt=d({tags:["metrics"],url:`${Jr}/assets-usage`,method:"GET",query:r.Object({metricName:u({allowEmpty:!1})}),response:ch}),krt=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 ph=`/${"v1"}/metrics`,XV=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(ll,{examples:[XV]});var uh=r.Object({name:r.String({description:"Metric name observed by Tsuga. Use this value in metric queries and aggregations."}),type:ul,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(sh),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."}))}),JV={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(uh,{examples:[JV]});var QL=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."}),WL=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:ph,method:"GET",query:QL,response:r.Array(uh)}),ZL=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:`${ph}/:name`,method:"GET",params:r.Object({name:u({allowEmpty:!1,description:"Metric name to retrieve, for example `http.server.request.duration`."})}),query:QL,response:uh}),e6=["service","env","host","method","status_code"];Object.assign(cc,{examples:[e6]});var XL=r.Pick(ch,["assets"]),t6={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(XL,{examples:[t6]});var JL=d({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${ph}/assets-usage`,method:"GET",query:r.Object({metricName:u({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:XL});var ta="/v0/traces",Qrt=d({tags:["traces"],url:`${ta}/count`,method:"GET",query:r.Pick(Nn,["from","to","query","clusterId"]),response:r.Object({count:r.Number()})}),r6=["unset","ok","error"],n6=r.Enum(r6),o6=["unspecified","internal","server","client","producer","consumer"],i6=r.Enum(o6),tk=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:i6,name:r.String()}),status_code:r.Optional(n6),trace_id:r.String()}),rk=100,a6="start_time",s6="duration_ns",c6=r.Union([r.Literal(a6),r.Literal(s6)]),p6={...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:ic})),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),sortBy:r.Optional(c6),sortDirection:r.Optional(r.Union([r.Literal("asc"),r.Literal("desc")]))},Wrt=d({tags:["traces"],url:`${ta}/search`,method:"GET",query:r.Object(p6),response:r.Object({spans:r.Optional(r.Array(tk)),attributesToHighlight:r.Optional(r.Array(ac))})});var u6=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."})}),l6=r.Object({...at.properties,traceId:u({allowEmpty:!1,description:"Trace ID to summarize"}),clusterId:r.Optional(u({allowEmpty:!1,description:"Cluster ID"})),...r.Partial(u6).properties}),Zrt=d({tags:["traces"],url:`${ta}/summarize`,method:"GET",query:l6,response:r.Object({spans:r.Array(tk)})}),Xrt=d({tags:["traces"],url:`${ta}/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())})}),m6=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."}))}),d6=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."})}),f6=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."})}),lh=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."})),mh=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."})),ml=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(m6,{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(d6,{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(f6,{description:"Aggregated wall-clock contribution per service across the fetched trace. Use this for service-level latency ownership without processing the per-range timeline."})}),g6={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(ml,{examples:[g6]});var Jrt=d({tags:["traces"],url:`${ta}/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:lh,includeRanges:mh}),response:ml}),ek=r.Object({filter:u({type:"tsuga-query",description:"TQL filter defining the group"}),timeRange:ai}),h6=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number()}),y6=r.Object({value:r.String(),supportA:r.Number(),supportB:r.Number(),lift:r.Union([r.Number(),r.Null()]),pValue:r.Number()}),T6=r.Object({attr:r.String(),values:r.Array(y6),otherValues:r.Array(h6)}),ent=d({tags:["traces"],url:`${ta}/contrast-sets`,method:"POST",body:r.Object({groupA:ek,groupB:ek,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(T6),groupACount:r.Number(),groupBCount:r.Number()})});var dh=`/${"v1"}/traces`,fh=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."}),E6={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(fh,{examples:[E6]});var _6={from:1704067200,to:1704070800,query:"context.service.name:my-service",maxResults:100},nk=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:rk,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(nk,{examples:[_6]});var ok=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:`${dh}/search`,method:"GET",query:nk,response:r.Object({spans:r.Array(fh,{description:"Spans matching the query and time range."})})}),I6={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},ik=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(ik,{examples:[I6]});var ak=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:`${dh}/summarize`,method:"GET",query:ik,response:r.Object({spans:r.Array(fh,{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`."})})}),b6={from:1704067200,to:1704070800,traceId:"78c99c5bb1e4a30297fa134b9dbec64f"},sk=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:lh,includeRanges:mh},{description:"Trace latency summary query. Provide a trace ID, a time range covering the trace, and optional timeline tuning."});Object.assign(sk,{examples:[b6]});var ck=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:`${dh}/latency-summary`,method:"GET",query:sk,response:ml});var lk=["timestamp","level","message"],mk=["count","ratio","team","level","pattern"];function gt(e,t){let n=t??Gr(e);if(!n)throw new Error(`--${e} is required`);return yc(n)}function pk(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=Ul(e.output),n=e.fields===void 0?void 0:wl(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??lk}}function A6(e){let t=Ul(e.output),n=e.fields===void 0?void 0:wl(e.fields);return t==="json"?{format:t,fields:n}:{format:t,fields:n??mk}}function uk(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 O6(e,t){if(t.format==="json"){if(t.fields===void 0){J(e);return}let{fields:i}=t;J({patterns:e.patterns.map(a=>uk(a,e.sampleSize)).map(a=>vl(a,i)),sampleSize:e.sampleSize});return}let n=e.patterns.map(i=>uk(i,e.sampleSize)),o=Nl(t.format,n,t.fields);o.length>0&&V(o)}function x6(e,t){if(t.format==="json"){if(t.fields===void 0){J(e);return}let{fields:o}=t;J({logs:e.logs.map(i=>vl(i,o))});return}let n=Nl(t.format,e.logs,t.fields);n.length>0&&V(n)}function dk(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: ${lk.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=S6(c),m=await t()($L,{query:pk(c)});x6(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()(YL,{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: ${mk.join(",")})`).option("-o, --output <FORMAT>","Output format: json | tsv | csv","json").action(async c=>{let l=A6(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()(qL,{query:m});O6(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()(BL,{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()(KL,{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()(WL,{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()(ZL,{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()(JL,{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()(ok,{query:pk(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()(ak,{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()(ck,{query:l});J(m)});let a=e.command("aggregation").description("Run aggregation queries");Qr(a,"scalar","Run aggregation queries and return scalar results",xw,t),Qr(a,"timeseries","Run aggregation queries and return timeseries results",Cw,t)}var R6="x-tsuga-session-id",gh="x-tsuga-source",hh="x-tsuga-source-version",yh="x-tsuga-source-commit",Th="x-tsuga-source-date",Eh="x-tsuga-rationale",C6="x-tsuga-dashboard-id",P6="x-tsuga-widget-id",U6="x-request-id",Ent={[R6]:"Session identifier for request correlation",[gh]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[hh]:"SDK version",[yh]:"SDK commit hash",[Th]:"SDK commit date",[Eh]:"Optional caller-supplied rationale for this request, recorded for telemetry",[C6]:"ID of the dashboard a query is issued from, when the request originates from a dashboard widget",[P6]:"ID of the dashboard widget (graph) a query is issued from, when the request originates from a dashboard widget",[U6]:"Unique identifier for this API request, useful for debugging and support"};var Ln=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 fk(e){if(e instanceof Ln){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(`
|
|
171
|
+
`)}return e instanceof Error?`Error: ${e.message}`:String(e)}function w6(e){return e.replace(/\s+/g," ").replace(/[^\x20-\x7e\x80-\xff]/g,"").trim()}function gk(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 Ln("Internal error: params required for this endpoint");h=a.buildUrl(m)}else throw new Ln("Internal error: endpoint has neither url nor buildUrl");let E=n===void 0?f:{clusterId:n,...f},I=oO(`${e}${h}`,E),g={Accept:"application/json",Authorization:`Bearer ${t}`,[gh]:"cli",[hh]:"1.20.0",[yh]:"8dac6add9",[Th]:"2026-08-27T08:37:57.075Z"};l&&(g["Content-Type"]="application/json");let T=o?.(),S=T?w6(T):"";S&&(g[Eh]=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 Ln(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 Ln.fromErrorResponse(x.error,x.requestId);return N6(x,v6(c)),x.data}}function v6({body:e,query:t}){let n=t?.offset??e?.offset;return typeof n=="number"?n:0}function N6(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||ly(`Showing ${e.data.length} of ${n.totalCount} (offset ${t}). Use --limit (max ${ei}) and --offset ${o} for the next page.`)}function _h(e,t=n=>{process.exit(n)}){e.on("error",n=>{if(n.code==="EPIPE"){t(process.exitCode);return}throw n})}var L6=3e3,k6="https://registry.npmjs.org/@tsuga/cli/latest";function M6(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 hk(e){try{let t=PO();if(t&&Date.now()-new Date(t).getTime()<hc)return;let n=await fetch(k6,{signal:AbortSignal.timeout(L6)});if(!n.ok)return;let i=(await n.json()).version;M6(i,e)&&(process.stderr.write(`
|
|
171
172
|
Update available: ${e} \u2192 ${i}
|
|
172
|
-
`),process.stderr.write("Run `tsuga self-update` to update\n")),
|
|
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)"),
|
|
173
|
+
`),process.stderr.write("Run `tsuga self-update` to update\n")),UO(new Date().toISOString())}catch{}}_h(process.stdout);_h(process.stderr);var Re=new Oo().name("tsuga").description("Manage Tsuga resources, telemetry, and configuration from the command line").version("1.20.0").addHelpText("before",()=>`${Uh()}
|
|
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)"),dl,yk;function wr(){if(dl)return dl;let e=Re.opts(),t=ni({operationApiKey:e.operationApiKey,clusterId:e.cluster});mc(t.credential,new Date)&&(console.error("Your session expired. Run `tsuga auth login` to sign in again."),process.exit(1));let n=_O(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)),dl=gk(t.apiUrl,n,t.clusterId,()=>yk),dl}var Tk="Setup & config:",Ek="Documentation, help & feedback:";Re.commandsGroup(Tk);NO(Re);Rx(Re);var D6=new Set(Re.commands);Re.commandsGroup("Resources:");SL(Re,wr);Re.commandsGroup("Query & explore:");dk(Re,wr);CR(Re,wr);kU(Re,wr);qU(Re,wr);Ew(Re,wr);Uw(Re,wr);Re.commandsGroup(Ek);Nx(Re,wr);Dx(Re,wr);Re.commandsGroup(Tk);Sx(Re,wr);kL(Re);$U(Re);OL(Re);xx(Re);Re.commandsGroup(Ek).helpCommand("help [command]");function _k(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)_k(t)}var G6=new Set(["completion","self-update","install","setup","feedback"]);for(let e of Re.commands)!D6.has(e)&&!G6.has(e.name())&&_k(e);Re.hook("preAction",(e,t)=>{let{rationale:n}=t.opts();yk=n});Re.parseAsync().then(()=>hk("1.20.0")).catch(e=>{console.error(fk(e)),process.exitCode=1});
|
|
174
175
|
/**
|
|
175
176
|
* The following is a list of HTTP status codes and their meanings.
|
|
176
177
|
*
|