@tsuga/cli 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +5 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -34,12 +34,12 @@ Expecting one of '${n.join("', '")}'`);let i=`${t}Help`;return this.on(i,s=>{let
34
34
  MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDAC4AWkdwKYSd8
35
35
  Ks14IReLcYgADhoXk56ZzXI=
36
36
  -----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}"}],$0=EE.map(e=>e.key),iie=new Set($0),aie=EE.map(e=>e.key);var v0=["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"],hE=[...v0,"ABORT_ERROR","BAD_REQUEST","DUPLICATE_KEY_VIOLATION","FOREIGN_KEY_VIOLATION","FST_ERR_VALIDATION","INVALID_INPUT","MISSING_PERMISSION","PRIVILEGE_ESCALATION","ORG_NOT_FOUND_AUTHENTICATION_ERROR","RATE_LIMITED","RESERVED_TAG_POLICY_ERROR","RESOURCE_NOT_FOUND","INVALID_INVITATION","TAG_POLICY_ALREADY_EXISTS_ERROR","TAG_POLICY_VALIDATION_ERROR","URL_NOT_FOUND"],TE=["INTERNAL_ERROR","INVALID_QUERY_TO_CLUSTER"];var G0=["NETWORK_ERROR","RESPONSE_PARSE_ERROR"],D0=[...hE,...TE,...G0],mae=o.Object({code:o.Optional(o.Enum(D0,{description:"Machine readable error code describing what went wrong"})),message:o.String({description:"Human readable explanation of the error"}),statusCode:o.Number({description:"HTTP status code that was returned"})},{$id:"ErrorResponse",description:"Standard envelope for API errors"}),pae=o.Object({code:o.Optional(o.Enum(hE,{description:"Machine readable error code describing what went wrong"})),message:o.String({description:"Human readable explanation of the error"}),statusCode:o.Number({description:"HTTP status code that was returned"})},{$id:"ClientErrorResponse",description:"Standard envelope for client (4XX) API errors"}),cae=o.Object({code:o.Optional(o.Enum(TE,{description:"Machine readable error code describing what went wrong"})),message:o.String({description:"Human readable explanation of the error"}),statusCode:o.Number({description:"HTTP status code that was returned"})},{$id:"ServerErrorResponse",description:"Standard envelope for server (5XX) API errors"}),uae=o.Object({requestId:o.String({description:"Identifier used to trace the lifecycle of this API request"}),error:o.Ref("ClientErrorResponse")},{$id:"ClientErrorEnvelope",description:"Standard envelope wrapping all client (4XX) error responses"}),lae=o.Object({requestId:o.String({description:"Identifier used to trace the lifecycle of this API request"}),error:o.Ref("ServerErrorResponse")},{$id:"ServerErrorEnvelope",description:"Standard envelope wrapping all server (5XX) error responses"});function f({body:e,description:t,method:r,operationId:n,params:i,tags:s,query:p,response:c,url:l}){return i?{body:e,buildUrl:y=>l.replace(/:[a-zA-Z_]+/g,E=>y[E.slice(1)]),description:t,method:r,operationId:n,params:i,query:p,response:c,tags:s,templateUrl:l}:{body:e,description:t,method:r,operationId:n,query:p,response:c,tags:s,url:l,templateUrl:l}}function xE(e,t){if(!t||typeof t!="object")return e;let r=new URLSearchParams;return Object.entries(t).forEach(([n,i])=>{Array.isArray(i)?i.length>0&&i.forEach(s=>{s!==void 0&&(typeof s=="string"||typeof s=="number"||typeof s=="boolean")&&r.append(n,String(s))}):(typeof i=="boolean"||typeof i=="string"||typeof i=="number")&&r.append(n,String(i))}),`${e}?${r.toString()}`}var j0="x-tsuga-session-id",fm="x-tsuga-source",gm="x-tsuga-source-version",ym="x-tsuga-source-commit",Im="x-tsuga-source-date",F0="x-request-id",_ae={[j0]:"Session identifier for request correlation",[fm]:"SDK or client source identifier (e.g., web-frontend, terraform-provider)",[gm]:"SDK version",[ym]:"SDK commit hash",[Im]:"SDK commit date",[F0]:"Unique identifier for this API request, useful for debugging and support"};var qn=class e extends Error{constructor(r,n,i,s){super(r);this.statusCode=n;this.code=i;this.requestId=s;this.name="CliError"}static fromErrorResponse(r,n){return new e(r.message,r.statusCode,r.code,n)}};function _E(e){if(e instanceof qn){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}`),t.join(`
37
- `)}return e instanceof Error?`Error: ${e.message}`:String(e)}function AE(e,t){return async function(n,i={}){let{body:s,params:p,query:c}=i,l;if("url"in n)l=n.url;else{if(!p)throw new qn("Internal error: params required for this endpoint");l=n.buildUrl(p)}let g=xE(`${e}${l}`,c),y={Accept:"application/json",Authorization:`Bearer ${t}`,[fm]:"cli",[gm]:"1.0.5",[ym]:"e88ccf5",[Im]:"2026-03-26T10:02:23.235Z"};s&&(y["Content-Type"]="application/json");let C=await(await fetch(g,{method:n.method,headers:y,body:s?JSON.stringify(s):void 0})).json();if(C.error)throw qn.fromErrorResponse(C.error,C.requestId);return C.data}}var q0=1e3,B0=60*q0,H0=60*B0,Na=24*H0,kae=7*Na,Uae=30*Na;var Em=["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 K0="^\\S(.*\\S)?$",z0=o.Object({key:o.String({maxLength:128}),value:o.String({maxLength:256,pattern:K0})},{title:"Tag"}),V0=o.Array(z0,{title:"Tags",maxItems:50,description:"List of key/value tags applied to the resource"}),ce=o.Optional(V0);var Ar="/v0/teams",hm=["public","private"],bE=o.Object({color:o.Enum(lm),mode:o.Enum(dm),iconName:o.Enum(IE)}),Tm=o.Object({color:o.Enum(lm),mode:o.Enum(dm)}),Y0=100,W0=250,Bn=o.Object({id:o.String({description:"Identifier of the team"}),name:o.String({description:"Human readable team name displayed throughout the app"}),description:o.Optional(o.String()),visibility:o.Enum(hm,{description:"Controls whether the resources of the team are discoverable by users"}),tags:ce,createdAt:A(),updatedAt:A(),memberCount:o.Optional(o.Number({description:"Number of members currently in the team"})),avatar:o.Optional(bE)}),Ma=o.Object({name:o.String({minLength:1,maxLength:Y0,description:"Name to assign to the team"}),description:o.Optional(o.String({maxLength:W0})),visibility:o.Enum(hm,{description:"Controls whether the resources of the team are discoverable by users"}),tags:ce,avatar:o.Optional(bE)}),Q0=o.Object({id:o.String(),name:o.String(),email:o.String(),role:o.Enum(Dn),joinedTeamAt:A(),orgRole:o.Enum(oE),avatar:o.Optional(Tm)}),qae=f({tags:["teams"],url:Ar,method:"GET",response:o.Array(Bn),query:o.Optional(o.Object({includeMemberCount:o.Optional(o.Boolean())}))}),Bae=f({tags:["teams"],url:`${Ar}/:id`,method:"GET",params:o.Object({id:u()}),response:Bn}),Hae=f({tags:["teams"],url:`${Ar}/:id/members`,method:"GET",params:o.Object({id:u()}),response:o.Array(Q0)}),Kae=f({tags:["teams"],url:`${Ar}/:id/assets`,method:"GET",params:o.Object({id:u()}),response:o.Object({apiKeyCount:o.Number(),logRouteCount:o.Number(),monitorCount:o.Number(),notificationRuleCount:o.Number(),dashboardCount:o.Number()})}),zae=f({tags:["teams"],url:Ar,method:"POST",body:Ma,response:Bn}),Vae=f({tags:["teams"],url:`${Ar}/:id`,method:"PUT",params:o.Object({id:u()}),body:Ma,response:Bn}),Yae=f({tags:["teams"],url:`${Ar}/bulk-update`,method:"POST",body:o.Object({teamIds:o.Array(u(),{maxItems:100}),config:o.Object({visibility:o.Enum(hm)})}),response:o.Object({})}),Wae=f({tags:["teams"],url:`${Ar}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H});var Z0=o.Enum(["terraform-provider","web-frontend","mcp-server","cli"]),_e=F("type",[o.Object({type:o.Literal("user"),id:o.String(),name:o.String(),avatar:o.Optional(Tm)}),o.Object({type:o.Literal("operation-api-key"),id:o.String(),name:o.String(),source:o.Optional(Z0)})]);var Vr="/v0/dashboards",J0=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],X0=["timeseries","top-list","pie","query-value","bar","list"],pse=[...X0,"note"],eU=["ns","us","ms","s","m","h","days"];var tU=["B","KB","MB","GB","TB","PB"];var Hn=F("type",[o.Object({type:o.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:o.Enum(eU,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),o.Object({type:o.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:o.Enum(tU,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),o.Object({type:o.Literal("percent",{description:"Format values as percentages"})},{$id:"DataNormalizerPercent",title:"Percent"}),o.Object({type:o.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),o.Object({type:o.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),o.Object({type:o.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:o.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"})],{title:"Normalizer"}),rU=o.Object({attribute:o.String({description:"Attribute displayed as a column in the log list"}),normalizer:o.Optional(Hn)},{title:"WidgetListColumn"}),nU=["background","no-background"],oU=["table","legend-only","no-legend"];var iU=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],CE=["alert","warning","success"],aU=o.Object({operator:o.Enum(iU,{description:"Comparator used to evaluate the metric value"}),value:o.Number({description:"Threshold value used when evaluating the operator"}),color:o.Enum(CE,{description:"Color applied when the condition is met"})},{title:"ConditionalFormatting"}),sU=o.Object({value:o.Number({description:"Y-axis value where the threshold marker is placed"}),level:o.Enum(CE,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker"}),mU=["sec","min","hour","day"],OE=o.Object({time:o.Number({description:"Number of units that make up each bar bucket"}),metric:o.Enum(mU,{description:"Unit used to measure the bucket width"})});var SE=o.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),PE={source:fE,queries:Vo,formula:o.Optional(Yo),visibleSeries:o.Optional(o.Array(o.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},wa={...PE,groupBy:o.Optional(Wo)},$a=o.Enum(oU,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),Qo=o.Optional(o.Number({description:"Number of decimal places to display in the value"})),RE=o.Optional(o.Array(sU,{description:"Threshold markers displayed on the chart"})),pU=o.Object({type:o.Literal("list",{description:"Displays matching logs or database rows in a tabular list"}),source:o.Union([o.Literal("logs",{description:"Indicates that the widget queries logs"}),o.Literal("connections",{description:"Indicates that the widget queries connections like PostgreSQL, BigQuery, etc."})]),query:u({type:"long",description:"Query that selects logs or database rows for the list"}),listColumns:o.Optional(o.Array(rU,{description:"Custom columns to display for each log or database row"})),connectionId:o.Optional(u({description:"Identifier of the connection to query"}))}),cU=o.Unsafe({...pU,$id:"GraphVisualizationList",title:"List"}),uU=F("type",[o.Object({type:o.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...wa,timeBucket:o.Optional(OE),normalizer:o.Optional(Hn),precision:Qo,legendMode:o.Optional($a),thresholds:RE},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),o.Object({type:o.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...wa,normalizer:o.Optional(Hn),precision:Qo},{$id:"GraphVisualizationTopList",title:"TopList"}),o.Object({type:o.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...wa,normalizer:o.Optional(Hn),precision:Qo,legendMode:o.Optional($a)},{$id:"GraphVisualizationPie",title:"Pie"}),o.Object({type:o.Literal("query-value",{description:"Displays the aggregation as a single value"}),...PE,backgroundMode:o.Optional(o.Enum(nU,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:o.Optional(o.Array(aU,{description:"Conditional formatting rules applied to the displayed value"})),precision:Qo,normalizer:o.Optional(Hn),legendMode:o.Optional($a)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),o.Object({type:o.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...wa,timeBucket:o.Optional(OE),precision:Qo,normalizer:o.Optional(Hn),thresholds:RE,legendMode:o.Optional($a)},{$id:"GraphVisualizationBar",title:"Bar"}),cU,o.Object({type:o.Literal("note",{description:"Displays static text on the dashboard"}),note:o.Optional(u({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:o.Optional(o.Enum(J0,{description:"Background color used to render the note"})),noteAlign:o.Optional(SE),noteJustifyContent:o.Optional(SE)},{$id:"GraphVisualizationNote",title:"Note"})]),kE=o.Object({id:u({description:"Identifier of the graph widget"}),name:o.Optional(u({description:"Display name of the graph widget"})),description:o.Optional(o.String({minLength:1,maxLength:800,description:"Description of the graph widget"})),visualization:uU,layout:o.Optional(o.Object({x:o.Number({description:"Horizontal grid position of the widget"}),y:o.Number({description:"Vertical grid position of the widget"}),w:o.Number({description:"Width of the widget in grid units"}),h:o.Number({description:"Height of the widget in grid units"})},{description:"Grid layout coordinates for this widget"}))},{title:"Graph"}),lU=10,UE=o.Array(o.Object({key:u({description:"Filter key"}),values:o.Array(u({description:"Filter value"}))}),{maxItems:lU,description:"Filters applied to every widget on the dashboard"}),Kn=o.Object({id:o.String({description:"Identifier of the dashboard"}),name:o.String({description:"Display name of the dashboard"}),owner:o.String({description:"Team ID that owns and manages the dashboard"}),graphs:o.Array(kE,{description:"Ordered widgets that compose the dashboard"}),filters:o.Optional(UE),createdAt:A(),updatedAt:A(),creator:o.Optional(_e),updater:o.Optional(_e),tags:ce,timePreset:o.Optional(o.Enum(Em))}),va=o.Object({name:u({description:"Display name of the dashboard"}),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the dashboard"}),graphs:o.Array(kE,{description:"Ordered widgets that compose the dashboard"}),filters:o.Optional(UE),tags:ce,timePreset:o.Optional(o.Enum(Em))}),xm=o.Object({owners:o.Optional(o.Array(u({allowEmpty:!1}),{description:"Filter by owner team IDs"}))}),cse=f({tags:["dashboards"],url:Vr,method:"GET",query:xm,response:o.Array(Kn)}),use=f({tags:["dashboards"],url:`${Vr}/:id`,method:"GET",params:o.Object({id:u()}),response:Kn}),lse=f({tags:["dashboards"],url:Vr,method:"POST",body:va,response:Kn}),dse=f({tags:["dashboards"],url:`${Vr}/:id`,method:"PUT",params:o.Object({id:u()}),body:o.Partial(va),response:Kn}),fse=f({tags:["dashboards"],url:`${Vr}/bulk-update`,method:"PUT",body:o.Object({dashboardIds:o.Array(u()),owner:u({allowEmpty:!1})}),response:o.Object({})}),gse=f({tags:["dashboards"],url:`${Vr}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),yse=f({tags:["dashboards"],url:`${Vr}/bulk-delete`,method:"DELETE",body:o.Object({ids:o.Array(u())}),response:o.Object({})});var Zo=`/${"v1"}/dashboards`,Jo=o.Pick(Kn,["id","name","owner","graphs","filters","tags","timePreset"],{$id:"Dashboard",description:"Visualization of telemetry data with customizable graphs and filters"}),dU={id:"123-456-abc",name:"API Performance Overview",owner:"abc-123-def",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(Jo,{examples:[dU]});var fU=o.Pick(xm,["owners"]),LE=f({description:"Retrieve all dashboards",operationId:"listDashboards",tags:["dashboards"],url:Zo,method:"GET",query:fU,response:o.Array(Jo)}),NE=f({description:"Retrieve a dashboard by its id",operationId:"getDashboard",tags:["dashboards"],url:`${Zo}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:Jo}),_m=o.Pick(va,["name","owner","graphs","filters","tags","timePreset"]),gU={name:"API Performance Overview",owner:"abc-123-def",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(_m,{examples:[gU]});var ME=f({description:"Create a new dashboard",operationId:"createDashboard",tags:["dashboards"],url:Zo,method:"POST",body:_m,response:Jo}),wE=f({description:"Update a dashboard by its id",operationId:"updateDashboard",tags:["dashboards"],url:`${Zo}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:o.Partial(_m),response:Jo}),$E=f({description:"Delete a dashboard by its id",operationId:"deleteDashboard",tags:["dashboards"],url:`${Zo}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var yU=100,IU=3,zn=o.Object({id:o.String(),name:o.String(),keyLastCharacters:o.String(),owner:o.String(),tags:ce,teamOverrideFields:o.Optional(o.Array(o.String())),updatedAt:A(),createdAt:A(),creator:o.Optional(_e),updater:o.Optional(_e),lastSyncedAt:o.Optional(A()),assetUpdatedAt:A()}),Xo=o.Object({name:o.String({minLength:1,maxLength:yU}),owner:u({allowEmpty:!1}),tags:ce,teamOverrideFields:o.Optional(o.Array(u({allowEmpty:!1}),{minItems:1,maxItems:IU}))}),ei="/v0/ingestion-api-keys",Lse=f({tags:["ingestion-api-keys"],url:ei,method:"POST",body:Xo,response:o.Intersect([zn,o.Object({key:o.String()})])}),Nse=f({tags:["ingestion-api-keys"],url:ei,method:"GET",response:o.Array(zn)}),Mse=f({tags:["ingestion-api-keys"],url:`${ei}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:zn}),wse=f({tags:["ingestion-api-keys"],url:`${ei}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:Xo,response:zn}),$se=f({tags:["ingestion-api-keys"],url:`${ei}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var ti=`/${"v1"}/ingestion-api-keys`,ri=o.Pick(zn,["id","name","owner","tags","teamOverrideFields","keyLastCharacters"],{$id:"IngestionApiKey",description:"API key used to send telemetry data to Tsuga"}),vE={id:"123-456-abc",name:"Production Logs Ingestion",keyLastCharacters:"x7Qm",owner:"abc-123-def",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(ri,{examples:[vE]});var GE=o.Pick(Xo,["name","owner","tags","teamOverrideFields"],{$id:"CreateIngestionApiKeyRequest"}),DE=o.Pick(Xo,["name","owner","tags","teamOverrideFields"],{$id:"UpdateIngestionApiKeyRequest"}),jE={name:"Production Logs Ingestion",owner:"abc-123-def",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(GE,{examples:[jE]});Object.assign(DE,{examples:[jE]});var EU={...vE,key:"tsuga_in:v1:abc123xyx7Qm"},FE=f({description:"Retrieve all ingestion API keys",operationId:"listIngestionApiKeys",tags:["ingestion-api-keys"],url:ti,method:"GET",response:o.Array(ri)}),Hse=f({description:"Retrieve an ingestion API key by its id",operationId:"getIngestionApiKey",tags:["ingestion-api-keys"],url:`${ti}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:ri}),hU=o.Intersect([o.Pick(ri,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),o.Object({key:o.String({description:"The full API key value, returned only at creation time"})})],{title:"IngestionApiKeyCreated",example:EU}),qE=f({description:"Create a new ingestion API key",operationId:"createIngestionApiKey",tags:["ingestion-api-keys"],url:ti,method:"POST",body:GE,response:hU}),BE=f({description:"Update an ingestion API key by its id",operationId:"updateIngestionApiKey",tags:["ingestion-api-keys"],url:`${ti}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:DE,response:ri}),HE=f({description:"Delete an ingestion API key by its id",operationId:"deleteIngestionApiKey",tags:["ingestion-api-keys"],url:`${ti}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var TU=["all","owning-team-and-public","owning-team-only"],Am=o.Enum(TU,{description:"This controls which data the resource can see"});var Ot="/v0/monitors",bm=["alert","resolve","keep_last_status","consider_zero"],KE=["alert","resolve","keep_last_status"];var xU=["no_aggregation","all","any","each","proportion"],_U=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var AU=o.Object({formula:u({type:"math-formula"}),operator:o.Enum(_U),threshold:o.Number()}),Om=o.Array(AU),zE=o.Object({formula:u({type:"math-formula"}),conditionType:o.Enum(["rate","error","cpu","general","to_be_set"])}),ome=o.Enum(["rate","error","cpu","general"]),Gt=[1,2,3,4,5];var ni={timeframe:o.Number({description:"Timeframe of the monitor in minutes"}),groupByFields:o.Array(o.Object({fields:o.Array(u(),{description:"Fields used by the monitor group by."}),limit:o.Number({description:"Configured limit for this group by. Warning! This setting is currently ignored. Monitor evaluation will instead apply a fixed limit of 100 groups per field."})}),{maxItems:1,description:"Monitor group by configuration. Warning! Note that the limit setting is currently ignored."}),aggregationAlertLogic:o.Optional(o.Enum(xU)),proportionAlertThreshold:o.Optional(o.Integer({minimum:1,maximum:99}))},Sm=o.Object({type:o.Literal("metric"),conditions:Om,noDataBehavior:o.Enum(bm),...ni,queries:Fn},{$id:"MonitorConfigurationMetric"}),Rm=o.Object({type:o.Literal("log"),conditions:Om,noDataBehavior:o.Enum(bm),...ni,queries:Fn},{$id:"MonitorConfigurationLog"}),VE=o.Object({type:o.Literal("trace"),conditions:Om,noDataBehavior:o.Enum(bm),...ni,queries:Fn},{$id:"MonitorConfigurationTrace"}),Cm=o.Object({type:o.Literal("anomaly-log"),condition:zE,noDataBehavior:o.Enum(KE),...ni,queries:Fn},{$id:"MonitorConfigurationAnomalyLog"}),Pm=o.Object({type:o.Literal("anomaly-metric"),condition:zE,noDataBehavior:o.Enum(KE),...ni,queries:Fn},{$id:"MonitorConfigurationAnomalyMetric"}),YE=o.Object({type:o.Literal("certificate-expiry"),warnBeforeInDays:o.Integer({minimum:1,maximum:365}),cloudAccounts:o.Optional(o.Array(o.String(),{minItems:1})),aggregationAlertLogic:o.Literal("each"),noDataBehavior:o.Literal("resolve")},{$id:"MonitorConfigurationCertificateExpiry"}),bU=o.Object({type:o.Literal("log-error-pattern"),aggregationAlertLogic:o.Literal("each"),noDataBehavior:o.Literal("keep_last_status"),filter:o.Object({teamIds:o.Array(o.String()),env:o.String(),service:o.Optional(o.String())})},{$id:"MonitorConfigurationLogErrorPattern"}),WE=F("type",[Sm,Rm,VE,Cm,Pm,bU,YE]);var Vt=o.Object({id:o.String({description:"Identifier of the monitor"}),name:o.String({description:"Display name of the monitor"}),owner:o.String({description:"Team ID that owns and manages the monitor"}),message:o.Optional(o.String({description:"Message to be displayed if a notification is triggered"})),tags:ce,configuration:WE,priority:o.Enum(Gt,{description:"Priority of the monitor"}),permissions:Am,dashboardId:o.Optional(o.String({description:"Identifier of a dashboard related to the monitor"})),pauseUntil:o.Optional(A()),creator:o.Optional(_e),updater:o.Optional(_e),createdAt:A(),updatedAt:A(),lastSyncedAt:o.Optional(A()),assetUpdatedAt:A(),clusterIds:o.Array(o.String())},{title:"Monitor"}),OU=F("type",[Sm,Rm,VE,Cm,Pm,YE]),ime=o.Object({...Vt.properties,configuration:OU},{title:"Monitor"}),ame=o.Object({...Vt.properties,configuration:F("type",[Sm,Rm,Cm,Pm])},{title:"Monitor"}),oi=o.Object({name:u(),message:o.Optional(u({type:"long"})),tags:ce,configuration:WE,priority:o.Enum(Gt),owner:u({allowEmpty:!1}),dashboardId:o.Optional(u()),pauseUntil:o.Optional(u({allowEmpty:!1,type:"date-time"})),permissions:Am,clusterIds:o.Optional(o.Array(u({allowEmpty:!1})))});var sme=f({tags:["monitors"],url:Ot,method:"GET",response:o.Array(Vt),query:o.Optional(o.Object({owners:o.Optional(o.Array(u({allowEmpty:!1})))}))}),mme=f({tags:["monitors"],url:`${Ot}/:id`,method:"GET",params:o.Object({id:u()}),response:Vt}),pme=f({tags:["monitors"],url:Ot,method:"POST",body:oi,response:Vt}),cme=f({tags:["monitors"],url:`${Ot}/:id`,method:"PUT",params:o.Object({id:u()}),body:oi,response:Vt}),ume=f({tags:["monitors"],url:`${Ot}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),lme=f({tags:["monitors"],url:`${Ot}/:id/snooze`,method:"POST",params:o.Object({id:u()}),body:o.Object({pauseUntil:u({allowEmpty:!1,type:"date-time"})}),response:Vt}),SU=["alert","ok","alert_consider_zero","ok_consider_zero","alert_no_data","ok_no_data","keep_last_status_ok","keep_last_status_alert"],Yr=o.Enum(SU),RU=F("type",[o.Object({type:o.Literal("each"),subStates:o.Record(o.String(),o.Object({stateValue:o.Union([Yr,o.Null()]),lastChangedAt:A()}))}),o.Object({type:o.Literal("no_aggregation"),stateValue:o.Optional(Yr)}),o.Object({type:o.Literal("any"),stateValue:o.Optional(Yr)}),o.Object({type:o.Literal("all"),stateValue:o.Optional(Yr)}),o.Object({type:o.Literal("proportion"),stateValue:o.Optional(Yr)})]),CU=o.Object({monitorId:o.String(),currentState:RU,lastChangedAt:o.Optional(A())}),dme=f({tags:["monitors"],url:`${Ot}/states/:id`,method:"GET",params:o.Object({id:u()}),response:CU}),fme=f({tags:["monitors"],url:`${Ot}/:id/transitions`,method:"GET",params:o.Object({id:u()}),query:o.Object({from:o.Number(),to:o.Number()}),response:o.Array(o.Object({id:o.String(),createdAt:A(),fromState:o.Optional(Yr),toState:o.Optional(Yr),dimension:o.Optional(o.String())}))}),PU=["unprocessed","processed","failed-to-process"],gme=f({tags:["monitors"],url:`${Ot}/:id/results`,method:"GET",params:o.Object({id:u()}),query:o.Object({from:o.Number(),to:o.Number()}),response:o.Object({isTruncated:o.Boolean(),results:o.Array(o.Object({id:o.String(),evaluationAt:A(),formulaResult:o.Object({groups:o.Array(o.Object({groupKey:o.Record(o.String(),mm),results:o.Array(o.Union([o.Number(),o.Null()])),conditionMet:o.Enum(["true","false","nan-no-data"])}))}),createdAt:A(),status:o.Enum(PU)}))})});var ii=`/${"v1"}/monitors`,ai=o.Pick(Vt,["id","name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],{$id:"Monitor",description:"Monitor allowing to send alerts based on telemetry data"}),kU={id:"123-456-abc",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:[],queries:[{aggregate:{type:"count"},filter:"level:ERROR service:api-gateway"}],conditions:[{formula:"q1",operator:"greater_than",threshold:100}],noDataBehavior:"resolve"},priority:1,owner:"abc-123-def",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},UU={id:"456-789-def",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:["abc-123-def"],env:"production",service:"api-gateway"}},priority:2,owner:"abc-123-def",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]};Object.assign(ai,{examples:[kU,UU]});var QE=f({description:"Retrieve all monitors",operationId:"listMonitors",tags:["monitors"],url:ii,method:"GET",response:o.Array(ai)}),ZE=f({description:"Retrieve a monitor by its id",operationId:"getMonitor",tags:["monitors"],url:`${ii}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:ai}),JE=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],XE=o.Pick(oi,JE,{$id:"CreateMonitorRequest"}),eh=o.Pick(oi,JE,{$id:"UpdateMonitorRequest"}),th={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:[],queries:[{aggregate:{type:"count"},filter:"level:ERROR service:api-gateway"}],conditions:[{formula:"q1",operator:"greater_than",threshold:100}],noDataBehavior:"resolve"},priority:1,owner:"abc-123-def",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},rh={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:["abc-123-def"],env:"production",service:"api-gateway"}},priority:2,owner:"abc-123-def",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]};Object.assign(XE,{examples:[th,rh]});Object.assign(eh,{examples:[th,rh]});var nh=f({description:"Create a new monitor",operationId:"createMonitor",tags:["monitors"],url:ii,method:"POST",body:XE,response:ai}),oh=f({description:"Update a monitor by its id",operationId:"updateMonitor",tags:["monitors"],url:`${ii}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:eh,response:ai}),ih=f({description:"Delete a monitor by its id",operationId:"deleteMonitor",tags:["monitors"],url:`${ii}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var si="/v0/notifications",Qr=`${si}/rules`,ah=`${si}/slack/setup`,Ga=`${si}/integrations`,Wr=["triggered","resolved","no-data"],LU=["sent","stale","pending","rate-limited","failed","silenced"],sh=o.Optional(o.Object({maxMessages:o.Integer({minimum:1,description:"Maximum number of messages allowed during the rate-limiting window"}),minutes:o.Integer({minimum:1,description:"Length of the rate-limiting window in minutes"})},{description:"Per-target rate-limiting configuration"})),mh=o.Optional(o.Object({mode:o.Literal("each"),renotificationStates:o.Array(o.Enum(["alert","alert_no_data"]),{description:"Alert states that will trigger a renotification"}),renotifyIntervalMinutes:o.Integer({minimum:1,description:"Minimum number of minutes to wait before renotifying"})},{description:"Configuration for repeating notifications over time"})),NU=o.Object({id:u({description:"Identifier of the notification target"}),rateLimit:sh,config:F("type",[o.Object({type:o.Literal("slack"),channel:u({description:"Slack channel ID that receives the notification"}),integrationId:u({description:"Slack workspace ID that receives the notification"})},{$id:"RuleTargetInputSlack"}),o.Object({type:o.Literal("incident-io"),integrationId:u({description:"Identifier of the incident.io integration to use"})},{$id:"RuleTargetInputIncidentIo"}),o.Object({type:o.Literal("pagerduty"),integrationId:u({description:"Identifier of the PagerDuty integration to use"})},{$id:"RuleTargetInputPagerDuty"}),o.Object({type:o.Literal("email"),addresses:o.Array(u({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"})},{$id:"RuleTargetInputEmail"}),o.Object({type:o.Literal("grafana-irm"),integrationId:u({description:"Identifier of the Grafana IRM integration to use"})},{$id:"RuleTargetInputGrafanaIrm"}),o.Object({type:o.Literal("microsoft-teams"),integrationId:u({description:"Identifier of the Microsoft Teams integration to use"})},{$id:"RuleTargetInputMicrosoftTeams"}),o.Object({type:o.Literal("webhook"),integrationId:u({description:"Identifier of the webhook integration to use"})},{$id:"RuleTargetInputWebhook"}),o.Object({type:o.Literal("servicenow"),integrationId:u({description:"Identifier of the ServiceNow integration to use"})},{$id:"RuleTargetInputServiceNow"}),o.Object({type:o.Literal("google-chat"),integrationId:u({description:"Identifier of the Google Chat integration to use"})},{$id:"RuleTargetInputGoogleChat"}),o.Object({type:o.Literal("squadcast"),integrationId:u({description:"Identifier of the Squadcast integration to use"})},{$id:"RuleTargetInputSquadcast"})],{description:"Configuration describing how the alert should be delivered"}),renotifyConfig:mh}),MU=o.Object({id:o.String({description:"Identifier of the notification target"}),rateLimit:sh,renotifyConfig:mh,config:F("type",[o.Object({type:o.Literal("slack"),channel:o.String({description:"Slack channel ID that receives the notification"}),integrationId:o.String({description:"Slack workspace ID that receives the notification"}),integrationName:o.String({description:"Human readable name of the Slack integration"})},{$id:"RuleTargetConfigSlack"}),o.Object({type:o.Literal("incident-io"),integrationId:o.String({description:"Identifier of the incident.io integration to use"}),integrationName:o.String({description:"Human readable name of the incident.io integration"})},{$id:"RuleTargetConfigIncidentIo"}),o.Object({type:o.Literal("email"),addresses:o.Array(o.String({format:"email"}),{description:"Email addresses that will receive the alert"})},{$id:"RuleTargetConfigEmail"}),o.Object({type:o.Literal("grafana-irm"),integrationId:o.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:o.String({description:"Human readable name of the Grafana IRM integration"})},{$id:"RuleTargetConfigGrafanaIrm"}),o.Object({type:o.Literal("pagerduty"),integrationId:o.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:o.String({description:"Human readable name of the PagerDuty integration"})},{$id:"RuleTargetConfigPagerDuty"}),o.Object({type:o.Literal("microsoft-teams"),integrationId:o.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:o.String({description:"Human readable name of the Microsoft Teams integration"})},{$id:"RuleTargetConfigMicrosoftTeams"}),o.Object({type:o.Literal("webhook"),integrationId:o.String({description:"Identifier of the webhook integration to use"}),integrationName:o.String({description:"Human readable name of the webhook integration"})},{$id:"RuleTargetConfigWebhook"}),o.Object({type:o.Literal("servicenow"),integrationId:o.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:o.String({description:"Human readable name of the ServiceNow integration"})},{$id:"RuleTargetConfigServiceNow"}),o.Object({type:o.Literal("google-chat"),integrationId:o.String({description:"Identifier of the Google Chat integration to use"}),integrationName:o.String({description:"Human readable name of the Google Chat integration"})},{$id:"RuleTargetConfigGoogleChat"}),o.Object({type:o.Literal("squadcast"),integrationId:o.String({description:"Identifier of the Squadcast integration to use"}),integrationName:o.String({description:"Human readable name of the Squadcast integration"})},{$id:"RuleTargetConfigSquadcast"})],{description:"Configuration describing how the alert was delivered"})}),km=F("type",[o.Object({type:o.Literal("specific-teams"),teams:o.Array(u(),{minItems:1,maxItems:100,description:"Team IDs to select"})}),o.Object({type:o.Literal("all-teams")}),o.Object({type:o.Literal("all-public-teams")})]),mi=o.Object({name:u({description:"Display name of the notification rule"}),queryString:o.Optional(u({type:"tags-query",description:"Query string that narrows down which alerts trigger the rule"})),teamsFilter:km,prioritiesFilter:o.Array(o.Enum(Gt),{maxItems:Gt.length,description:"Priorities that narrow down the alerts that can trigger a notification"}),transitionTypesFilter:o.Array(o.Enum(Wr),{maxItems:Wr.length,description:"Alert state transitions that can trigger a notification"}),clusterIdsFilter:o.Optional(o.Array(u({allowEmpty:!1}),{description:"Cluster IDs that can trigger a notification"})),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:ce,isActive:o.Boolean(),targets:o.Array(NU,{minItems:1,description:"Notification targets that can receive notifications when the rule matches"})}),Um=F("type",[o.Object({type:o.Literal("specific-teams"),teams:o.Array(o.String(),{description:"Team IDs to select"})}),o.Object({type:o.Literal("all-teams")}),o.Object({type:o.Literal("all-public-teams")})]),Vn=o.Object({id:o.String({description:"Identifier of the notification rule"}),name:o.String({description:"Display name of the notification rule"}),queryString:o.Optional(o.String({description:"Query string that narrows down which alerts trigger the rule"})),teamsFilter:Um,prioritiesFilter:o.Array(o.Enum(Gt),{description:"Priorities that narrow down the alerts that can trigger a notification"}),transitionTypesFilter:o.Array(o.Enum(Wr),{description:"Alert state transitions that can trigger a notification"}),clusterIdsFilter:o.Array(o.String(),{description:"Cluster IDs that can trigger a notification"}),owner:o.String({description:"Team ID that owns and manages the rule"}),createdAt:A(),updatedAt:A(),isActive:o.Boolean(),tags:ce,targets:o.Array(MU,{description:"Notification targets that can receive notifications when the rule matches"}),creator:o.Optional(_e),updater:o.Optional(_e)}),Ume=f({tags:["notification-rules"],url:Qr,method:"GET",response:o.Array(Vn)}),Lme=f({tags:["notification-rules"],url:`${Qr}/:id`,params:o.Object({id:u()}),method:"GET",response:Vn}),Nme=f({tags:["notification-rules"],url:Qr,method:"POST",body:mi,response:Vn}),Mme=f({tags:["notification-rules"],url:`${Qr}/:id`,method:"PUT",params:o.Object({id:u()}),body:mi,response:Vn}),wme=f({tags:["notification-rules"],url:`${Qr}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),$me=f({tags:["notification-integrations"],url:`${ah}/start`,method:"POST",response:o.Object({redirectUrl:o.String()})}),wU=o.Object({id:o.String(),name:o.String(),type:o.Enum(["slack","incident-io","grafana-irm","pagerduty","microsoft-teams","webhook","servicenow","google-chat","squadcast"]),createdAt:A(),ruleCount:o.Number(),creator:o.Optional(_e)}),vme=f({tags:["notification-integrations"],url:`${Qr}/integrations`,method:"GET",response:o.Array(wU)}),Gme=f({tags:["notification-integrations"],url:`${ah}/callback`,method:"GET",query:o.Object({code:u()}),response:o.Object({success:o.Boolean()})}),Lm=["POST","PUT"],$U=o.Record(o.String(),o.String()),vU=o.Record(o.String(),o.Unknown()),GU=o.Record(o.String(),o.Union([o.String(),o.Number(),o.Boolean(),o.Null(),o.Array(o.Union([o.String(),o.Number(),o.Boolean()]))])),DU=F("type",[o.Object({type:o.Literal("json"),value:vU}),o.Object({type:o.Literal("form"),value:GU})]),jU=o.Object({ok:o.String(),alert:o.String()}),Nm=o.Object({id:o.String(),name:o.String(),setting:F("type",[o.Object({type:o.Literal("incident-io"),alertSourceConfigId:o.String(),tokenLastChars:o.String()}),o.Object({type:o.Literal("grafana-irm"),urlLastChars:o.String()}),o.Object({type:o.Literal("pagerduty"),integrationKeyLastChars:o.String()}),o.Object({type:o.Literal("microsoft-teams"),webhookUrlLastChars:o.String()}),o.Object({type:o.Literal("webhook"),urlLastChars:o.String(),method:o.Enum(Lm),authentication:F("type",[o.Object({type:o.Literal("bearer"),tokenLastChars:o.String()}),o.Object({type:o.Literal("basic"),username:o.String(),passwordLastChars:o.String()}),o.Object({type:o.Literal("custom-header"),key:o.String(),valueLastChars:o.String()}),o.Object({type:o.Literal("none")})]),customHeaders:o.Optional($U),payloadTemplate:DU,eventNameMapping:o.Optional(jU)}),o.Object({type:o.Literal("servicenow"),instanceName:o.String(),username:o.String(),passwordLastChars:o.String()}),o.Object({type:o.Literal("google-chat"),webhookUrlLastChars:o.String()}),o.Object({type:o.Literal("squadcast"),webhookUrlLastChars:o.String()})]),tags:ce}),FU=o.Object({type:o.Literal("webhook"),url:u({type:"uri"}),method:o.Enum(Lm),authentication:F("type",[o.Object({type:o.Literal("bearer"),token:u({allowEmpty:!1})}),o.Object({type:o.Literal("basic"),username:u({allowEmpty:!1}),password:u({allowEmpty:!1})}),o.Object({type:o.Literal("custom-header"),key:u({allowEmpty:!1}),value:u({allowEmpty:!1})}),o.Object({type:o.Literal("none")})]),customHeaders:o.Record(u({allowEmpty:!1}),u()),payloadTemplate:F("type",[o.Object({type:o.Literal("json"),value:o.Record(u({allowEmpty:!1}),o.Unknown())}),o.Object({type:o.Literal("form"),value:o.Record(u({allowEmpty:!1}),o.Union([o.String(),o.Number(),o.Boolean(),o.Null(),o.Array(o.Union([o.String(),o.Number(),o.Boolean()]))]))})]),eventNameMapping:o.Optional(o.Object({ok:u({allowEmpty:!1}),alert:u({allowEmpty:!1})}))}),ph=o.Object({type:o.Literal("incident-io"),alertSourceConfigId:u(),token:u()}),ch=o.Object({type:o.Literal("grafana-irm"),url:u({type:"uri"})}),uh=o.Object({type:o.Literal("pagerduty"),integrationKey:u()}),lh=o.Object({type:o.Literal("microsoft-teams"),webhookUrl:u({type:"uri"})}),qU=o.Object({type:o.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})}),BU=o.Object({type:o.Literal("google-chat"),webhookUrl:u({type:"uri"})}),HU=o.Object({type:o.Literal("squadcast"),webhookUrl:u({type:"uri"})}),KU=o.Object({name:u(),setting:F("type",[ph,ch,uh,lh,FU,qU,BU,HU]),tags:ce}),zU=o.Object({type:o.Literal("webhook"),url:o.Optional(u({type:"uri"})),method:o.Optional(o.Enum(Lm)),authentication:o.Optional(F("type",[o.Object({type:o.Literal("bearer"),token:o.Optional(u({allowEmpty:!1}))}),o.Object({type:o.Literal("basic"),username:o.Optional(u({allowEmpty:!1})),password:o.Optional(u({allowEmpty:!1}))}),o.Object({type:o.Literal("custom-header"),key:o.Optional(u({allowEmpty:!1})),value:o.Optional(u({allowEmpty:!1}))}),o.Object({type:o.Literal("none")})])),customHeaders:o.Optional(o.Record(u({allowEmpty:!1}),u())),payloadTemplate:o.Optional(F("type",[o.Object({type:o.Literal("json"),value:o.Record(u({allowEmpty:!1}),o.Unknown())}),o.Object({type:o.Literal("form"),value:o.Record(u({allowEmpty:!1}),o.Union([o.String(),o.Number(),o.Boolean(),o.Null(),o.Array(o.Union([o.String(),o.Number(),o.Boolean()]))]))})])),eventNameMapping:o.Optional(o.Object({ok:o.Optional(u({allowEmpty:!1})),alert:o.Optional(u({allowEmpty:!1}))}))}),VU=o.Object({type:o.Literal("servicenow"),instanceName:o.Optional(u({allowEmpty:!1})),username:o.Optional(u({allowEmpty:!1})),password:o.Optional(u({allowEmpty:!1}))}),YU=o.Object({type:o.Literal("google-chat"),webhookUrl:u({type:"uri"})}),WU=o.Object({type:o.Literal("squadcast"),webhookUrl:u({type:"uri"})}),QU=o.Object({name:o.Optional(u()),setting:o.Optional(F("type",[ph,ch,uh,lh,zU,VU,YU,WU]))}),Dme=f({tags:["notification-integrations"],url:Ga,method:"POST",body:KU,response:Nm}),jme=f({tags:["notification-integrations"],url:`${Ga}/:id`,method:"GET",params:o.Object({id:u()}),response:Nm}),Fme=f({tags:["notification-integrations"],url:`${Ga}/:id`,method:"PUT",params:o.Object({id:u()}),body:QU,response:Nm}),qme=f({tags:["notification-integrations"],url:`${Ga}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),Bme=f({tags:["notification-rules"],url:`${Ot}/:id/notifications`,method:"GET",params:o.Object({id:u()}),query:o.Optional(o.Object({from:o.Optional(o.Number()),to:o.Optional(o.Number())})),response:o.Object({notifications:o.Array(o.Object({id:o.String(),monitorId:o.String(),monitorResultId:o.String(),ruleId:o.Optional(o.String()),targetId:o.Optional(o.String()),status:o.Enum(LU),tryCount:o.Number(),nextTryAt:A(),createdAt:A(),updatedAt:A(),sentAt:o.Optional(A())})),isTruncated:o.Boolean()})}),ZU=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast"],Hme=f({tags:["notification-rules"],url:`${Qr}/test`,method:"POST",body:o.Object({notificationRule:mi,targetIds:o.Optional(o.Array(u({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:F("success",[o.Object({success:o.Literal(!1),overallMessage:o.String({description:"Message when there is an overall error"})}),o.Object({success:o.Boolean(),results:o.Array(o.Object({targetId:o.String({description:"The ID of the target that was tested"}),targetType:o.Enum(ZU,{description:"The type of the target (e.g., slack, webhook)"}),status:o.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:o.Optional(o.String({description:"Message if the notification failed for this specific target"}))}))})])});var pi=`/${"v1"}/notification-rules`,ci=o.Pick(Vn,["id","name","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","isActive","tags","targets"],{$id:"Rule",description:"Rules to trigger notifications to targets based on alert events"}),JU={id:"123-456-abc",name:"Critical Alerts",teamsFilter:{type:"all-teams"},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"],clusterIdsFilter:[],owner:"abc-123-def",isActive:!0,tags:[{key:"channel",value:"alerts"}],targets:[{id:"789-abc-def",config:{type:"email",addresses:["oncall@example.com"]}}]};Object.assign(ci,{examples:[JU]});var dh=f({description:"Retrieve all notification rules",operationId:"listNotificationRules",tags:["notification-rules"],url:pi,method:"GET",response:o.Array(ci)}),fh=f({description:"Retrieve a notification rule by its id",operationId:"getNotificationRule",tags:["notification-rules"],url:`${pi}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:ci}),Mm=o.Pick(mi,["name","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","tags","isActive","targets"]),XU={name:"Critical Alerts",teamsFilter:{type:"all-teams"},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"],clusterIdsFilter:[],owner:"abc-123-def",isActive:!0,tags:[{key:"channel",value:"alerts"}],targets:[{id:"789-abc-def",config:{type:"email",addresses:["oncall@example.com"]}}]};Object.assign(Mm,{examples:[XU]});var gh=f({description:"Create a new notification rule",operationId:"createNotificationRule",tags:["notification-rules"],url:pi,method:"POST",body:Mm,response:ci}),yh=f({description:"Update a notification rule by its id",operationId:"updateNotificationRule",tags:["notification-rules"],url:`${pi}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:Mm,response:ci}),Ih=f({description:"Delete a notification rule by its id",operationId:"deleteNotificationRule",tags:["notification-rules"],url:`${pi}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var ui=`${si}/silences`,eL=o.Partial(o.Record(o.Union([o.Literal("monday"),o.Literal("tuesday"),o.Literal("wednesday"),o.Literal("thursday"),o.Literal("friday"),o.Literal("saturday"),o.Literal("sunday")]),o.Array(o.Object({startTime:o.String({format:"time"}),endTime:o.String({format:"time"})},{title:"SilenceTimeRange"}),{minItems:1,description:"Time ranges for this day"}),{description:"Weekly schedule mapping day of week to time ranges"})),Eh=F("type",[o.Object({type:o.Literal("one-time"),startTime:o.String({format:"date-time"}),endTime:o.String({format:"date-time"})},{$id:"SilenceScheduleOneTime",description:"One-time silence schedule with specific start and end times"}),o.Object({type:o.Literal("recurring"),weeklySchedule:eL},{$id:"SilenceScheduleRecurring",description:"Recurring weekly silence schedule"})],{description:"Schedule defining when the silence is active"}),Da=o.Object({name:u({description:"Display name of the silence"}),reason:u({allowEmpty:!1,description:"Reason for the silence"}),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the silence"}),tags:ce,isActive:o.Boolean({description:"Whether the silence is currently enabled"}),schedule:Eh,notificationRuleIds:o.Optional(o.Array(u(),{description:"Notification rule IDs this silence applies to"})),queryString:o.Optional(u({type:"tags-query",description:"Query string to filter which alerts this silence applies to"})),teamsFilter:km,prioritiesFilter:o.Array(o.Enum(Gt),{maxItems:Gt.length,description:"Monitor priorities to filter which alerts this silence applies to"}),transitionTypesFilter:o.Array(o.Enum(Wr),{maxItems:Wr.length,description:"Transition types to filter which alerts this silence applies to"})}),Yn=o.Object({id:o.String({description:"Unique identifier of the silence"}),name:o.String({description:"Display name of the silence"}),reason:o.String({description:"Reason for the silence"}),owner:o.String({description:"Team ID that owns and manages the silence"}),tags:ce,isActive:o.Boolean({description:"Whether the silence is currently enabled"}),schedule:Eh,notificationRuleIds:o.Optional(o.Array(o.String(),{description:"Notification rule IDs this silence applies to"})),queryString:o.Optional(o.String({description:"Query string filtering which alerts this silence applies to"})),teamsFilter:Um,prioritiesFilter:o.Array(o.Enum(Gt),{description:"Monitor priorities filtering which alerts this silence applies to"}),transitionTypesFilter:o.Array(o.Enum(Wr),{description:"Transition types filtering which alerts this silence applies to"}),createdAt:A(),updatedAt:A(),creator:o.Optional(_e),updater:o.Optional(_e)}),spe=f({tags:["notification-silences"],url:ui,method:"GET",response:o.Array(Yn)}),mpe=f({tags:["notification-silences"],url:`${ui}/:id`,params:o.Object({id:u()}),method:"GET",response:Yn}),ppe=f({tags:["notification-silences"],url:ui,method:"POST",body:Da,response:Yn}),cpe=f({tags:["notification-silences"],url:`${ui}/:id`,method:"PUT",params:o.Object({id:u()}),body:Da,response:Yn}),upe=f({tags:["notification-silences"],url:`${ui}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H});var li=`/${"v1"}/notification-silences`,ja=o.Pick(Yn,["id","name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"],{$id:"NotificationSilence",description:"Silences to suppress notifications based on schedules and filters"}),hh=f({description:"Retrieve all notification silences",operationId:"listNotificationSilences",tags:["notification-silences"],url:li,method:"GET",response:o.Array(ja)}),Th=f({description:"Retrieve a notification silence by its id",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${li}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:ja}),xh=o.Pick(Da,["name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"]),_h=f({description:"Create a new notification silence",operationId:"createNotificationSilence",tags:["notification-silences"],url:li,method:"POST",body:xh,response:ja}),Ah=f({description:"Update a notification silence by its id",operationId:"updateNotificationSilence",tags:["notification-silences"],url:`${li}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:xh,response:ja}),bh=f({description:"Delete a notification silence by its id",operationId:"deleteNotificationSilence",tags:["notification-silences"],url:`${li}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var tL=["passed","failed","ignored"],rL=o.Enum(tL),Oh=["unrouted-logs","team-has-route","service-name-present","no-orphan-spans","metric-unit-consistency","host-name-present","no-casing-drift","no-duplicate-attr-values","no-debug-logs-in-prod","no-multiline-logs","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"],nL=o.Enum(Oh),oL=["log","metric","resource","span"],iL=["team","global"],wm=o.Object({key:o.Enum(Oh),title:o.String(),summary:o.String(),rationale:o.String(),objectType:o.Enum(oL),category:o.Enum(["hygiene","routing","integrity","consistency","redundancy","cost"]),impact:o.Object({label:o.Enum(["critical","important","normal"]),weight:o.Number({minimum:0})}),recommendation:o.String(),scope:o.Optional(o.Enum(iL))}),$m=o.Intersect([wm,o.Object({status:rL,normalizedScore:o.Number({minimum:0,maximum:1}),details:o.Optional(o.Record(o.String(),o.Unknown())),recommendation:o.Optional(o.String()),examples:o.Optional(o.Array(o.Object({type:o.String(),label:o.String(),link:o.Object({to:o.String(),search:o.Optional(o.Unknown()),params:o.Optional(o.Unknown())})})))})]),aL=o.Object({teamId:o.String(),teamName:o.String(),teamWeight:o.Number({minimum:0}),score:o.Number({minimum:0,maximum:1}),weightedScore:o.Number({minimum:0}),totalWeight:o.Number({minimum:0}),ruleResults:o.Array($m)}),sL=o.Object({score:o.Optional(o.Number({minimum:0,maximum:1})),ruleResults:o.Array($m)}),Fa=o.Object({generatedAt:o.String({format:"date-time"}),overallScore:o.Optional(o.Number({minimum:0,maximum:1})),rules:o.Array(wm),teamResults:o.Array(aL),globalResults:o.Optional(sL)}),Ape=f({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:Fa}),bpe=f({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:o.Object({clusterId:o.Optional(u({allowEmpty:!1}))}),response:o.Object({report:o.Optional(Fa)})}),Ope=f({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:o.Object({ruleKey:nL,teamId:u(),lookbackMinutes:o.Optional(o.Integer({minimum:1,maximum:60})),clusterId:o.Optional(u({allowEmpty:!1}))}),response:o.Object({rule:wm,result:$m,teamId:o.String(),teamName:o.String()})});var mL=`/${"v1"}/quality-reports`,Sh=o.Pick(Fa,["generatedAt","overallScore","rules","teamResults","globalResults"],{$id:"QualityReport",description:"Aggregated quality report with per-team rule evaluations and scores"}),pL={generatedAt:"2026-02-26T12:00:00.000Z",overallScore:.85,rules:[{key:"team-has-route",title:"\u22651 route per team",summary:"Each team owns at least one active route.",rationale:"Provides clear governance boundaries for routing and enrichment.",objectType:"resource",category:"routing",impact:{label:"important",weight:2},recommendation:"Ensure every team manages a dedicated route scoped to its context.team value."}],teamResults:[{teamId:"abc-123-def",teamName:"platform",teamWeight:1,score:.85,weightedScore:.85,totalWeight:2,ruleResults:[{key:"team-has-route",title:"\u22651 route per team",summary:"Each team owns at least one active route.",rationale:"Provides clear governance boundaries for routing and enrichment.",objectType:"resource",category:"routing",impact:{label:"important",weight:2},recommendation:"Ensure every team manages a dedicated route scoped to its context.team value.",status:"passed",normalizedScore:1}]}]};Object.assign(Sh,{examples:[pL]});var Rh=f({description:"Retrieve the latest quality report",operationId:"getLatestQualityReport",tags:["quality-reports"],url:`${mL}/latest`,method:"GET",query:o.Object({clusterId:o.Optional(u({allowEmpty:!1}))}),response:o.Object({report:o.Optional(Sh)})});var di="/v0/admin-center";var Dt=`${di}/retention-policies`,vm=["1-day","3-days","15-days","30-days","60-days","90-days","120-days","180-days","360-days","10-years"],Yt=o.Object({id:o.String(),env:o.Optional(o.String()),teamId:o.Optional(o.String()),dataSource:o.Enum(bt),durationDays:o.Enum(vm),isEnabled:o.Boolean(),createdAt:A(),updatedAt:A()}),qa=o.Object({env:o.Optional(u()),teamId:o.Optional(u()),dataSource:o.Enum(bt),durationDays:o.Enum(vm),isEnabled:o.Boolean()}),Ch=o.Array(o.Object({env:u(),dataSource:o.Enum(bt),durationDays:o.Enum([...vm,"default"]),isEnabled:o.Boolean()})),Ph=o.Object({inserted:o.Array(Yt),updated:o.Array(Yt),deleted:o.Array(Yt)}),jpe=f({tags:["retention-policies"],url:Dt,method:"POST",body:qa,response:Yt}),Fpe=f({tags:["retention-policies"],url:Dt,method:"GET",response:o.Array(Yt)}),qpe=f({tags:["retention-policies"],url:`${Dt}/:id`,method:"GET",params:o.Object({id:u()}),response:Yt}),Bpe=f({tags:["retention-policies"],url:`${Dt}/:id`,method:"PUT",params:o.Object({id:u()}),body:qa,response:Yt}),Hpe=f({tags:["retention-policies"],url:`${Dt}/bulk-update`,method:"POST",body:Ch,response:Ph}),Kpe=f({tags:["retention-policies"],url:`${Dt}/bulk-update-for-team`,method:"POST",body:o.Object({teamId:u(),policies:Ch}),response:Ph}),zpe=f({tags:["retention-policies"],url:`${Dt}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),fi=["past-24-hours","past-7-days","past-30-days"],Vpe=f({tags:["retention-policies"],url:`${Dt}/requested-history-percentile/:teamId`,method:"POST",params:o.Object({teamId:u()}),body:o.Object({percentile:o.Number({minimum:0,maximum:1}),observationWindow:o.Enum(fi),dataSource:o.Enum(bt)}),response:o.Object({percentile:o.Number({minimum:0,maximum:1}),observationWindow:o.Enum(fi),dataSource:o.Enum(bt),teamId:o.String(),requestedHistoryDays:o.Number()})}),cL=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var uL=o.Array(o.Object({bucket:o.Enum(cL),count:o.Number()})),Ype=f({tags:["retention-policies"],url:`${Dt}/requested-history-histogram/:teamId`,method:"POST",params:o.Object({teamId:u()}),body:o.Object({observationWindow:o.Enum(fi),dataSource:o.Enum(bt)}),response:o.Object({observationWindow:o.Enum(fi),dataSource:o.Enum(bt),teamId:o.String(),histogram:uL})}),Wpe=f({tags:["retention-policies"],url:`${Dt}/top-teams-with-retention-surplus`,method:"POST",body:o.Object({dataSource:o.Enum(bt),observationWindow:o.Enum(fi),percentile:o.Number({minimum:0,maximum:1}),topN:o.Optional(o.Number({minimum:1,maximum:20}))}),response:o.Array(o.Object({teamId:o.String(),retentionSurplusDays:o.Number()}))});var gi=`/${"v1"}/retention-policies`,yi=o.Pick(Yt,["id","env","teamId","dataSource","durationDays","isEnabled"],{$id:"RetentionPolicy",description:"Data retention rule for a data source within an environment"}),lL={id:"123-456-abc",env:"production",teamId:"abc-123-def",dataSource:"logs",durationDays:"30-days",isEnabled:!0};Object.assign(yi,{examples:[lL]});var kh=f({description:"Retrieve all retention policies",operationId:"listRetentionPolicies",tags:["retention-policies"],url:gi,method:"GET",response:o.Array(yi)}),Uh=f({description:"Retrieve a retention policy by its id",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${gi}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:yi}),Gm=o.Pick(qa,["env","teamId","dataSource","durationDays","isEnabled"]),dL={env:"production",teamId:"abc-123-def",dataSource:"logs",durationDays:"30-days",isEnabled:!0};Object.assign(Gm,{examples:[dL]});var Lh=f({description:"Create a new retention policy",operationId:"createRetentionPolicy",tags:["retention-policies"],url:gi,method:"POST",body:Gm,response:yi}),Nh=f({description:"Update a retention policy by its id",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${gi}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:Gm,response:yi}),Mh=f({description:"Delete a retention policy by its id",operationId:"deleteRetentionPolicy",tags:["retention-policies"],url:`${gi}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var Ba={id:u({allowEmpty:!1,description:"Identifier of the processor"}),description:o.Optional(u({type:"long"})),tags:ce,updatedAt:o.Optional(A())},fL={...Ba,type:o.Literal("creator")},gL=F("subtype",[o.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:o.Optional(o.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:o.Literal("format-string"),replaceMissingByEmpty:o.Optional(o.Boolean())},{$id:"ProcessorParamsCreatorFormatString"}),o.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:o.Optional(o.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:o.Literal("math-formula"),replaceMissingBy0:o.Optional(o.Boolean())},{$id:"ProcessorParamsCreatorMathFormula"})]),yL=o.Object({...fL,params:gL}),IL={...Ba,type:o.Literal("mapper")},EL=F("subtype",[o.Object({attributes:o.Array(o.Object({originAttribute:u({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:o.Optional(o.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:o.Optional(o.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:o.Literal("map-attributes")},{$id:"ProcessorParamsMapperMapAttributes"}),o.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:o.Literal("map-level")},{$id:"ProcessorParamsMapperMapLevel"}),o.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:o.Literal("map-timestamp")},{$id:"ProcessorParamsMapperMapTimestamp"})]),hL=o.Object({...IL,params:EL}),TL={...Ba,type:o.Literal("parse-attribute")},xL=5,_L=F("subtype",[o.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:o.Array(u({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text"}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches"}),samples:o.Optional(o.Array(u({type:"long"}),{maxItems:xL,description:"Example log lines for validation"})),subtype:o.Literal("grok")}),o.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:o.Literal("url")}),o.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:o.Literal("user-agent")}),o.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the key/value string segment to parse"}),targetAttribute:u({description:"Attribute prefix 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. Will default to whitespace if not set."}),acceptStandaloneKey:o.Boolean(),subtype:o.Literal("key-value")})]),AL=o.Object({...TL,params:_L}),bL=11,Dm=o.Cyclic({Processor:o.Union([hL,AL,yL,o.Object({...Ba,params:o.Object({items:o.Array(o.Object({query:u({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:o.Array(o.Ref("Processor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:bL,description:"Conditional branches evaluated in order before falling back to the default"})}),type:o.Literal("split")})])},"Processor",{description:"Processing step executed sequentially on route logs"});var OL="/v0/logs",br=`${OL}/routes`,Zr=o.Object({id:o.String({description:"Identifier of the log route"}),name:o.String({description:"Human readable name shown for the route"}),description:o.Optional(o.String()),isEnabled:o.Boolean(),query:o.String({description:"Query that selects which logs should enter the route"}),rank:o.Number(),tags:ce,owner:o.String({description:"Team ID owning and managing the route"}),processors:o.Array(Dm,{description:"Ordered processors applied to logs that match the route"}),creator:o.Optional(_e),updater:o.Optional(_e),updatedAt:A(),createdAt:A(),assetUpdatedAt:A(),lastSyncedAt:o.Optional(A())},{title:"Route"}),Ii=o.Object({name:u({allowEmpty:!1,description:"Human readable name shown for the route"}),description:o.Optional(u({type:"long"})),isEnabled:o.Boolean(),query:u({type:"tsuga-query",description:"Query that selects which logs should enter the route"}),tags:ce,owner:u({allowEmpty:!1,description:"Team ID owning and managing the route"}),processors:o.Array(Dm,{maxItems:50,description:"Ordered processors applied to logs that match the route"})}),yce=f({tags:["routes"],url:br,method:"GET",response:o.Array(Zr)}),Ice=f({tags:["routes"],url:`${br}/:id`,params:o.Object({id:u()}),method:"GET",response:Zr}),Ece=f({tags:["routes"],url:br,method:"POST",body:Ii,response:Zr}),hce=f({tags:["routes"],url:`${br}/:id`,method:"PUT",body:Ii,params:o.Object({id:u()}),response:Zr}),Tce=f({tags:["routes"],url:`${br}/:id/clone`,method:"POST",params:o.Object({id:u()}),body:Ii,response:Zr}),xce=f({tags:["routes"],url:`${br}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),_ce=f({tags:["routes"],url:`${br}/:id/modify-ranking`,method:"PUT",params:o.Object({id:u()}),body:o.Object({rank:o.Number()}),response:o.Object({})}),Ace=f({tags:["routes"],url:`${br}/:id/enable`,method:"PUT",params:o.Object({id:u()}),body:o.Object({enable:o.Boolean()}),response:o.Object({})});var Ei=`/${"v1"}/routes`,hi=o.Pick(Zr,["id","name","description","isEnabled","query","tags","owner","processors"],{$id:"Route",description:"Log route allowing to standardize logs and enrich them with additional data"}),SL={id:"123-456-abc",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:"abc-123-def",processors:[{id:"789-abc-def",type:"parse-attribute",tags:[],params:{subtype:"grok",attributeName:"message",rules:["%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:msg}"]}}]};Object.assign(hi,{examples:[SL]});var wh=f({description:"Retrieve all routes",operationId:"listRoutes",tags:["routes"],url:Ei,method:"GET",response:o.Array(hi)}),$h=f({description:"Retrieve a route by its id",operationId:"getRoute",tags:["routes"],url:`${Ei}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:hi}),jm=o.Pick(Ii,["name","description","isEnabled","query","tags","owner","processors"]),RL={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:"abc-123-def",processors:[{id:"789-abc-def",type:"parse-attribute",tags:[],params:{subtype:"grok",attributeName:"message",rules:["%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:msg}"]}}]};Object.assign(jm,{examples:[RL]});var vh=f({description:"Create a new route",operationId:"createRoute",tags:["routes"],url:Ei,method:"POST",body:jm,response:hi}),Gh=f({description:"Update a route by its id",operationId:"updateRoute",tags:["routes"],url:`${Ei}/:id`,method:"PUT",body:jm,params:o.Object({id:u({allowEmpty:!1})}),response:hi}),Dh=f({description:"Delete a route by its id",operationId:"deleteRoute",tags:["routes"],url:`${Ei}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var nt="context",Lce=`${nt}.team`,Nce=`${nt}.env`,Mce=`${nt}.api_key_id`,wce=`${nt}.service.name`,$ce=`${nt}.service.version`,CL=`${nt}.host.name`,PL=`${nt}.instance`,kL=`${nt}.instanceid`,UL=`${nt}.instance_name`,vce=`${nt}.telemetry.sdk.language`;var Gce={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${nt}.batch_kind`,batchKindMetricsFilter:`${nt}.batch_kind:metrics`,sourceApiKeyId:`${nt}.source_api_key_id`,sourceEnv:`${nt}.source_env`,sourceTeam:`${nt}.source_team`}};var Wn="/v0/service-catalog";var jh=o.Object({team:o.String(),lastSeenAt:A()}),LL=o.Object({ingestionApiKey:o.String(),lastSeenAt:A()}),Fh=o.Object({version:o.String(),firstSeenAt:A(),lastSeenAt:A(),faulty:o.Optional(o.Boolean())}),NL=o.Object({language:o.String(),lastSeenAt:A()}),Ha=o.Object({id:o.String(),serviceName:o.String(),serviceNamespace:o.Optional(o.String()),env:o.Optional(o.String()),teams:o.Array(jh),ingestionApiKeys:o.Array(LL),versions:o.Array(Fh),languages:o.Array(NL),lastSeenAt:A(),firstSeenAt:A(),sources:o.Array(o.String()),additionalUserFields:o.Optional(o.Unsafe({type:"object",additionalProperties:!0})),logsCount24h:o.Number(),errorLogsCount24h:o.Number(),tracesCount24h:o.Number(),errorTracesCount24h:o.Number(),createdAt:A(),updatedAt:A()}),Hce=f({tags:["service-catalog"],query:o.Optional(o.Object({clusterId:o.Optional(u())})),method:"GET",url:`${Wn}/services`,response:o.Array(Ha)}),Kce=f({tags:["service-catalog"],method:"GET",url:`${Wn}/services/:serviceId`,params:o.Object({serviceId:u()}),response:Ha}),ML=o.Object({id:o.String(),endpointName:o.String(),serviceName:o.String(),serviceNamespace:o.Optional(o.String()),env:o.Optional(o.String()),teams:o.Array(jh),versions:o.Array(Fh),lastSeenAt:A(),firstSeenAt:A(),sources:o.Array(o.String()),additionalUserFields:o.Optional(o.Unsafe({type:"object",additionalProperties:!0})),createdAt:A(),updatedAt:A()}),zce=f({tags:["service-catalog"],method:"GET",url:`${Wn}/endpoints`,response:o.Array(ML)}),wL=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var qh=o.Object({id:o.String(),hostName:o.String(),env:o.Optional(o.String()),cpuUtilizationAverage:o.Number(),hostType:o.Enum(wL),teams:o.Array(o.String()),tags:o.Array(o.String()),firstSeenAt:A(),lastSeenAt:A(),clusterId:o.String()}),Vce=f({tags:["service-catalog"],method:"GET",url:`${Wn}/hosts`,response:o.Array(qh)}),Yce=f({tags:["service-catalog"],method:"GET",url:`${Wn}/hosts/:hostId`,params:o.Object({hostId:u()}),response:qh}),Wce=f({tags:["service-catalog"],method:"GET",url:`${Wn}/services/by-api-keys`,response:o.Record(o.String(),o.Array(o.Object({serviceName:o.String(),serviceNamespace:o.Optional(o.String())})))});var Bh=`/${"v1"}/services`,Fm=o.Pick(Ha,["id","serviceName","serviceNamespace","env","teams","versions","languages","lastSeenAt","firstSeenAt","sources","logsCount24h","errorLogsCount24h","tracesCount24h","errorTracesCount24h"],{$id:"Service",description:"Observed telemetry service with metadata, activity stats and version signals"}),$L={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:!1}],languages:[{language:"go",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(Fm,{examples:[$L]});var Hh=f({description:"Retrieve all services",operationId:"listServices",tags:["services"],url:Bh,method:"GET",response:o.Array(Fm)}),Kh=f({description:"Retrieve a service by its id",operationId:"getService",tags:["services"],url:`${Bh}/:serviceId`,method:"GET",params:o.Object({serviceId:u({allowEmpty:!1})}),response:Fm});var Jr=`${di}/tag-policies`;var zh=["ingestion-api-key","operation-api-key","dashboard","log-route","monitor","notification-rule","notification-silence"],vL=["logs","metrics","traces"],Vh=o.Array(o.Enum(zh)),Yh=o.Array(o.Enum(vL)),GL=o.Union([Vh,Yh]),Wh=o.Object({teamIds:o.Array(u(),{minItems:1,maxItems:100}),mode:o.Enum(["include","exclude"])}),Qh=F("type",[o.Object({type:o.Literal("telemetry"),assetTypes:Yh,shouldInsertWarning:o.Boolean(),dropSample:o.Optional(o.Number({minimum:0,maximum:100}))}),o.Object({type:o.Literal("tsuga_asset"),assetTypes:Vh})]),Qn=o.Object({id:o.String(),name:o.String(),description:o.Optional(o.String()),isActive:o.Boolean(),tagKey:o.String(),allowedTagValues:o.Array(o.String()),isRequired:o.Boolean(),teamScope:o.Optional(Wh),configuration:Qh,creator:o.Optional(_e),updater:o.Optional(_e),owner:o.Optional(o.String()),createdAt:A(),updatedAt:A(),assetUpdatedAt:A()});var Ti=o.Object({name:u(),description:o.Optional(u()),isActive:o.Boolean(),tagKey:u({allowEmpty:!1}),allowedTagValues:o.Array(u({allowEmpty:!1}),{maxItems:1e3}),isRequired:o.Boolean(),teamScope:o.Optional(Wh),configuration:Qh,owner:u({allowEmpty:!1})}),pue=f({tags:["tag-policies"],url:Jr,method:"GET",query:o.Object({teamIds:o.Optional(o.Array(u(),{maxItems:100})),assetTypes:o.Optional(GL),searchQuery:o.Optional(u())}),response:o.Array(Qn)}),cue=f({tags:["tag-policies"],url:`${Jr}/:id`,method:"GET",params:o.Object({id:u()}),response:Qn}),uue=f({tags:["tag-policies"],url:Jr,method:"POST",body:Ti,response:Qn}),lue=f({tags:["tag-policies"],url:`${Jr}/:id`,method:"PUT",params:o.Object({id:u()}),body:Ti,response:Qn}),due=f({tags:["tag-policies"],url:`${Jr}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),fue=f({tags:["tag-policies"],url:`${di}/applicable-tag-rules`,method:"GET",query:o.Object({assetType:o.Enum(zh),teamId:u()}),response:o.Array(o.Object({tagKey:o.String(),allowedTagValues:o.Array(o.String()),isRequired:o.Boolean()}))}),Zh=o.Object({total:o.Number(),totalNonCompliant:o.Number(),idsNonCompliant:o.Array(u())}),Jh=o.Union([o.Literal("ingestion-api-key"),o.Literal("operation-api-key"),o.Literal("dashboard"),o.Literal("log-route"),o.Literal("monitor"),o.Literal("notification-rule"),o.Literal("notification-silence")]),DL=o.Object({total:o.Number(),totalNonCompliant:o.Number(),byAssetType:o.Record(Jh,Zh)}),jL=o.Omit(Zh,["total"]),FL=o.Object({totalNonCompliant:o.Number(),byAssetType:o.Record(Jh,jL)}),Xh=o.Object({totals:DL,byTeam:o.Record(o.String(),FL)}),gue=f({tags:["tag-policies"],url:`${Jr}/:id/stats`,method:"GET",params:o.Object({id:u()}),response:Xh}),yue=f({tags:["tag-policies"],url:`${Jr}/new-policy-stats`,method:"POST",body:Ti,response:Xh});var xi=`/${"v1"}/tag-policies`,Ka=o.Pick(Qn,["id","name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"],{$id:"TagPolicy",description:"Policy that enforces tag requirements on Tsuga assets or telemetry data"}),eT=o.Pick(Ti,["name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"]),tT=f({description:"Retrieve all tag policies",operationId:"listTagPolicies",tags:["tag-policies"],url:xi,method:"GET",response:o.Array(Ka)}),rT=f({description:"Retrieve a tag policy by its id",operationId:"getTagPolicy",tags:["tag-policies"],url:`${xi}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:Ka}),nT=f({description:"Create a new tag policy",operationId:"createTagPolicy",tags:["tag-policies"],url:xi,method:"POST",body:eT,response:Ka}),oT=f({description:"Update a tag policy by its id",operationId:"updateTagPolicy",tags:["tag-policies"],url:`${xi}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:eT,response:Ka}),iT=f({description:"Delete a tag policy by its id",operationId:"deleteTagPolicy",tags:["tag-policies"],url:`${xi}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var _i=`/${"v1"}/teams`,Ai=o.Pick(Bn,["id","name","description","visibility","tags"],{$id:"Team",description:"Collection of users used to manage ownership and access to resources"}),qL={id:"abc-123-def",name:"Platform Engineering",description:"Responsible for internal developer tooling and infrastructure",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Ai,{examples:[qL]});var aT=f({description:"Retrieve all teams",operationId:"listTeams",tags:["teams"],url:_i,method:"GET",response:o.Array(Ai)}),sT=f({description:"Retrieve a team by its id",operationId:"getTeam",tags:["teams"],url:`${_i}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:Ai}),qm=o.Pick(Ma,["name","description","visibility","tags"]),BL={name:"Platform Engineering",description:"Responsible for internal developer tooling and infrastructure",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(qm,{examples:[BL]});var mT=f({description:"Create a new team",operationId:"createTeam",tags:["teams"],url:_i,method:"POST",body:qm,response:Ai}),pT=f({description:"Update a team by its id",operationId:"updateTeam",tags:["teams"],url:`${_i}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:qm,response:Ai}),cT=f({description:"Delete a team by its id",operationId:"deleteTeam",tags:["teams"],url:`${_i}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});function HL(e){return a.IsObject(e)&&a.HasPropertyKey(e,"check")&&a.HasPropertyKey(e,"errors")&&a.IsFunction(e.check)&&a.IsFunction(e.errors)}function Bm(e){return a.HasPropertyKey(e,"~guard")&&HL(e["~guard"])}function Hm(e){return a.HasPropertyKey(e,"~refine")&&a.IsArray(e["~refine"])&&a.Every(e["~refine"],0,t=>a.IsObject(t)&&a.HasPropertyKey(t,"refine")&&a.HasPropertyKey(t,"message")&&a.IsFunction(t.refine)&&a.IsString(t.message))}function Wt(e){return a.IsObject(e)&&!a.IsArray(e)}function za(e){return a.IsBoolean(e)}function $(e){return Wt(e)||za(e)}function Km(e){return a.HasPropertyKey(e,"additionalItems")&&$(e.additionalItems)}function Qt(e){return a.HasPropertyKey(e,"additionalProperties")&&$(e.additionalProperties)}function zm(e){return a.HasPropertyKey(e,"allOf")&&a.IsArray(e.allOf)&&e.allOf.every(t=>$(t))}function bi(e){return a.HasPropertyKey(e,"$anchor")&&a.IsString(e.$anchor)}function Vm(e){return a.HasPropertyKey(e,"anyOf")&&a.IsArray(e.anyOf)&&e.anyOf.every(t=>$(t))}function Ym(e){return a.HasPropertyKey(e,"const")}function Xr(e){return a.HasPropertyKey(e,"contains")&&$(e.contains)}function dt(e){return a.HasPropertyKey(e,"default")}function Wm(e){return a.HasPropertyKey(e,"dependencies")&&a.IsObject(e.dependencies)&&Object.values(e.dependencies).every(t=>$(t)||a.IsArray(t)&&t.every(r=>a.IsString(r)))}function Qm(e){return a.HasPropertyKey(e,"dependentRequired")&&a.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>a.IsArray(t)&&t.every(r=>a.IsString(r)))}function Zm(e){return a.HasPropertyKey(e,"dependentSchemas")&&a.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>$(t))}function Jm(e){return a.HasPropertyKey(e,"$dynamicAnchor")&&a.IsString(e.$dynamicAnchor)}function Xm(e){return a.HasPropertyKey(e,"else")&&$(e.else)}function ep(e){return a.HasPropertyKey(e,"enum")&&a.IsArray(e.enum)}function tp(e){return a.HasPropertyKey(e,"exclusiveMaximum")&&(a.IsNumber(e.exclusiveMaximum)||a.IsBigInt(e.exclusiveMaximum))}function Zt(e){return a.HasPropertyKey(e,"exclusiveMinimum")&&(a.IsNumber(e.exclusiveMinimum)||a.IsBigInt(e.exclusiveMinimum))}function Oi(e){return a.HasPropertyKey(e,"format")&&a.IsString(e.format)}function en(e){return a.HasPropertyKey(e,"$id")&&a.IsString(e.$id)}function rp(e){return a.HasPropertyKey(e,"if")&&$(e.if)}function Zn(e){return a.HasPropertyKey(e,"items")&&($(e.items)||a.IsArray(e.items)&&e.items.every(t=>$(t)))}function np(e){return Zn(e)&&a.IsArray(e.items)}function op(e){return a.HasPropertyKey(e,"maximum")&&(a.IsNumber(e.maximum)||a.IsBigInt(e.maximum))}function ip(e){return a.HasPropertyKey(e,"maxContains")&&a.IsNumber(e.maxContains)}function Va(e){return a.HasPropertyKey(e,"maxItems")&&a.IsNumber(e.maxItems)}function ap(e){return a.HasPropertyKey(e,"maxLength")&&a.IsNumber(e.maxLength)}function sp(e){return a.HasPropertyKey(e,"maxProperties")&&a.IsNumber(e.maxProperties)}function Jt(e){return a.HasPropertyKey(e,"minimum")&&(a.IsNumber(e.minimum)||a.IsBigInt(e.minimum))}function tn(e){return a.HasPropertyKey(e,"minContains")&&a.IsNumber(e.minContains)}function Jn(e){return a.HasPropertyKey(e,"minItems")&&a.IsNumber(e.minItems)}function Si(e){return a.HasPropertyKey(e,"minLength")&&a.IsNumber(e.minLength)}function Ri(e){return a.HasPropertyKey(e,"minProperties")&&a.IsNumber(e.minProperties)}function mp(e){return a.HasPropertyKey(e,"multipleOf")&&(a.IsNumber(e.multipleOf)||a.IsBigInt(e.multipleOf))}function pp(e){return a.HasPropertyKey(e,"not")&&$(e.not)}function cp(e){return a.HasPropertyKey(e,"oneOf")&&a.IsArray(e.oneOf)&&e.oneOf.every(t=>$(t))}function Ci(e){return a.HasPropertyKey(e,"pattern")&&(a.IsString(e.pattern)||e.pattern instanceof RegExp)}function Pi(e){return a.HasPropertyKey(e,"patternProperties")&&a.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>$(t))}function Xn(e){return a.HasPropertyKey(e,"prefixItems")&&a.IsArray(e.prefixItems)&&e.prefixItems.every(t=>$(t))}function ki(e){return a.HasPropertyKey(e,"properties")&&a.IsObject(e.properties)&&Object.values(e.properties).every(t=>$(t))}function up(e){return a.HasPropertyKey(e,"propertyNames")&&(a.IsObject(e.propertyNames)||$(e.propertyNames))}function KL(e){return a.HasPropertyKey(e,"$recursiveAnchor")&&a.IsBoolean(e.$recursiveAnchor)}function Ya(e){return KL(e)&&a.IsEqual(e.$recursiveAnchor,!0)}function lp(e){return a.HasPropertyKey(e,"$recursiveRef")&&a.IsString(e.$recursiveRef)}function dp(e){return a.HasPropertyKey(e,"$ref")&&a.IsString(e.$ref)}function rn(e){return a.HasPropertyKey(e,"required")&&a.IsArray(e.required)&&e.required.every(t=>a.IsString(t))}function fp(e){return a.HasPropertyKey(e,"then")&&$(e.then)}function gp(e){return a.HasPropertyKey(e,"type")&&(a.IsString(e.type)||a.IsArray(e.type)&&e.type.every(t=>a.IsString(t)))}function eo(e){return a.HasPropertyKey(e,"uniqueItems")&&a.IsBoolean(e.uniqueItems)}function Wa(e){return a.HasPropertyKey(e,"unevaluatedItems")&&$(e.unevaluatedItems)}function Qa(e){return a.HasPropertyKey(e,"unevaluatedProperties")&&$(e.unevaluatedProperties)}var Qe=class{constructor(){this.indices=new Set,this.keys=new Set}AddIndex(t){return this.indices.add(t),!0}AddKey(t){return this.keys.add(t),!0}GetIndices(){return this.indices}GetKeys(){return this.keys}Merge(t){for(let r of t)r.indices.forEach(n=>this.indices.add(n)),r.keys.forEach(n=>this.keys.add(n));return!0}},Ui=class extends Qe{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}},Le=class extends Ui{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}};var zL="external_",VL=0,tge={identifier:`${zL}${VL}`,variables:[]};function uT(e,t,r,n){return r["~guard"].check(n)}function lT(e,t,r,n,i,s){return i["~guard"].check(s)||t.AddError({keyword:"~guard",schemaPath:r,instancePath:n,params:{errors:i["~guard"].errors(s)}})}function dT(e,t,r,n){return a.Every(r["~refine"],0,(i,s)=>i.refine(n))}function fT(e,t,r,n,i,s){return a.EveryAll(i["~refine"],0,(p,c)=>p.refine(s)||t.AddError({keyword:"~refine",schemaPath:r,instancePath:n,params:{index:c,message:p.message}}))}function gT(e){return Zn(e)&&a.IsArray(e.items)}function yT(e,t,r,n){return gT(r)?n.every((s,p)=>a.IsLessThan(p,r.items.length)||w(e,t,r.additionalItems,s)&&t.AddIndex(p)):!0}function IT(e,t,r,n,i,s){return gT(i)?s.every((c,l)=>{let g=`${r}/additionalItems`,y=`${n}/${l}`;return a.IsLessThan(l,i.items.length)||K(e,t,g,y,i.additionalItems,c)&&t.AddIndex(l)}):!0}function YL(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function ET(e){let t=[];return Pi(e)&&t.push(...a.Keys(e.patternProperties)),ki(e)&&t.push(...a.Keys(e.properties).map(YL)),a.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function hT(e,t,r,n){let i=new RegExp(ET(r));return a.Every(a.Keys(n),0,(p,c)=>i.test(p)||w(e,t,r.additionalProperties,n[p])&&t.AddKey(p))}function TT(e,t,r,n,i,s){let p=new RegExp(ET(i)),c=[];return a.EveryAll(a.Keys(s),0,(g,y)=>{let E=`${r}/additionalProperties`,C=`${n}/${g}`,Pe=new Le,ot=p.test(g)||K(e,Pe,E,C,i.additionalProperties,s[g])&&t.AddKey(g);return ot||c.push(g),ot})||t.AddError({keyword:"additionalProperties",schemaPath:r,instancePath:n,params:{additionalProperties:c}})}function xT(e,t,r,n){let i=r.allOf.reduce((s,p)=>{let c=new Qe;return w(e,c,p,n)?[...s,c]:s},[]);return a.IsEqual(i.length,r.allOf.length)&&t.Merge(i)}function _T(e,t,r,n,i,s){let p=[],c=i.allOf.reduce((g,y,E)=>{let C=`${r}/allOf/${E}`,Pe=new Le,ot=K(e,Pe,C,n,y,s);return ot||p.push(Pe),ot?[...g,Pe]:g},[]),l=a.IsEqual(c.length,i.allOf.length)&&t.Merge(c);return l||p.forEach(g=>g.GetErrors().forEach(y=>t.AddError(y))),l}function AT(e,t,r,n){let i=r.anyOf.reduce((s,p,c)=>{let l=new Qe;return w(e,l,p,n)?[...s,l]:s},[]);return a.IsGreaterThan(i.length,0)&&t.Merge(i)}function bT(e,t,r,n,i,s){let p=[],c=i.anyOf.reduce((g,y,E)=>{let C=new Le,Pe=`${r}/anyOf/${E}`,ot=K(e,C,Pe,n,y,s);return ot||p.push(C),ot?[...g,C]:g},[]),l=a.IsGreaterThan(c.length,0)&&t.Merge(c);return l||p.forEach(g=>g.GetErrors().forEach(y=>t.AddError(y))),l||t.AddError({keyword:"anyOf",schemaPath:r,instancePath:n,params:{}})}function Ip(e,t,r,n){return r}function OT(e,t,r,n,i,s){return Ip(e,t,i,s)||t.AddError({keyword:"boolean",schemaPath:r,instancePath:n,params:{}})}function Ep(e,t,r,n){return a.IsValueLike(r.const)?a.IsEqual(n,r.const):a.IsDeepEqual(n,r.const)}function ST(e,t,r,n,i,s){return Ep(e,t,i,s)||t.AddError({keyword:"const",schemaPath:r,instancePath:n,params:{allowedValue:i.const}})}function WL(e){return!(tn(e)&&a.IsEqual(e.minContains,0))}function hp(e,t,r,n){return WL(r)?!a.IsEqual(n.length,0)&&n.some(i=>w(e,t,r.contains,i)):!0}function RT(e,t,r,n,i,s){return hp(e,t,i,s)||t.AddError({keyword:"contains",schemaPath:r,instancePath:n,params:{minContains:1}})}function CT(e,t,r,n){let i=a.IsEqual(a.Keys(n).length,0),s=a.Every(a.Entries(r.dependencies),0,([p,c])=>!a.HasPropertyKey(n,p)||(a.IsArray(c)?c.every(l=>a.HasPropertyKey(n,l)):w(e,t,c,n)));return i||s}function PT(e,t,r,n,i,s){let p=a.IsEqual(a.Keys(s).length,0),c=a.EveryAll(a.Entries(i.dependencies),0,([l,g])=>{let y=`${r}/dependencies/${l}`;return!a.HasPropertyKey(s,l)||(a.IsArray(g)?g.every(E=>a.HasPropertyKey(s,E)||t.AddError({keyword:"dependencies",schemaPath:r,instancePath:n,params:{property:l,dependencies:g}})):K(e,t,y,n,g,s))});return p||c}function kT(e,t,r,n){let i=a.IsEqual(a.Keys(n).length,0),s=a.Every(a.Entries(r.dependentRequired),0,([p,c])=>!a.HasPropertyKey(n,p)||c.every(l=>a.HasPropertyKey(n,l)));return i||s}function UT(e,t,r,n,i,s){let p=a.IsEqual(a.Keys(s).length,0),c=a.EveryAll(a.Entries(i.dependentRequired),0,([l,g])=>!a.HasPropertyKey(s,l)||a.EveryAll(g,0,y=>a.HasPropertyKey(s,y)||t.AddError({keyword:"dependentRequired",schemaPath:r,instancePath:n,params:{property:l,dependencies:g}})));return p||c}function LT(e,t,r,n){let i=a.IsEqual(a.Keys(n).length,0),s=a.Every(a.Entries(r.dependentSchemas),0,([p,c])=>!a.HasPropertyKey(n,p)||w(e,t,c,n));return i||s}function NT(e,t,r,n,i,s){let p=a.IsEqual(a.Keys(s).length,0),c=a.EveryAll(a.Entries(i.dependentSchemas),0,([l,g])=>{let y=`${r}/dependentSchemas/${l}`;return!a.HasPropertyKey(s,l)||K(e,t,y,n,g,s)});return p||c}function Tp(e,t,r,n){return r.enum.some(i=>a.IsValueLike(i)?a.IsEqual(n,i):a.IsDeepEqual(n,i))}function MT(e,t,r,n,i,s){return Tp(e,t,i,s)||t.AddError({keyword:"enum",schemaPath:r,instancePath:n,params:{allowedValues:i.enum}})}function xp(e,t,r,n){return a.IsLessThan(n,r.exclusiveMaximum)}function wT(e,t,r,n,i,s){return xp(e,t,i,s)||t.AddError({keyword:"exclusiveMaximum",schemaPath:r,instancePath:n,params:{comparison:"<",limit:i.exclusiveMaximum}})}function _p(e,t,r,n){return a.IsGreaterThan(n,r.exclusiveMinimum)}function $T(e,t,r,n,i,s){return _p(e,t,i,s)||t.AddError({keyword:"exclusiveMinimum",schemaPath:r,instancePath:n,params:{comparison:">",limit:i.exclusiveMinimum}})}var ro={};ft(ro,{Clear:()=>GT,Entries:()=>fN,Get:()=>IN,Has:()=>yN,IsDate:()=>Li,IsDateTime:()=>Ap,IsDuration:()=>bp,IsEmail:()=>Op,IsHostname:()=>Sp,IsIPv4:()=>kp,IsIPv6:()=>Up,IsIdnEmail:()=>Rp,IsIdnHostname:()=>Pp,IsIri:()=>Np,IsIriReference:()=>Lp,IsJsonPointer:()=>wp,IsJsonPointerUriFragment:()=>Mp,IsRegex:()=>$p,IsRelativeJsonPointer:()=>vp,IsTime:()=>Ni,IsUri:()=>jp,IsUriReference:()=>Gp,IsUriTemplate:()=>Dp,IsUrl:()=>Fp,IsUuid:()=>qp,Reset:()=>DT,Set:()=>gN,Test:()=>EN});var QL=[0,31,28,31,30,31,30,31,31,30,31,30,31],ZL=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function JL(e){return e%4===0&&(e%100!==0||e%400===0)}function Li(e){let t=ZL.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&JL(r)?29:QL[n])}var XL=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Ni(e,t=!0){let r=XL.exec(e);if(!r)return!1;let n=+r[1],i=+r[2],s=+r[3],p=r[4]==="-"?-1:1,c=+(r[5]||0),l=+(r[6]||0);if(c>23||l>59||t&&!r[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(n<=23&&i<=59&&s<60)return!0;let g=i-l*p,y=n-c*p-(g<0?1:0);return(y===23||y===-1)&&(g===59||g===-1)&&s<61}function Ap(e,t=!0){let r=e.split(/T/i);return r.length===2&&Li(r[0])&&Ni(r[1],t)}var eN=/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/;function bp(e){return eN.test(e)}var tN=/^(?!.*\.\.)[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 Op(e){return tN.test(e)}var rN=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;function Sp(e){return rN.test(e)}var nN=/^(?!.*\.\.)[\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 Rp(e){return nN.test(e)}function Cp(e){let t=e.codePointAt(0);return t===void 0?!1:t>=12352&&t<=12447||t>=12448&&t<=12543&&t!==12539||t>=19968&&t<=40959}function Pp(e){if(e.length===0||e.includes(" "))return!1;let t=/[\u002E\u3002\uFF0E\uFF61]/g,r=e.normalize("NFC").replace(t,".");if(r.length>253)return!1;let n=r.split(".");if(n.some(i=>i.length===0))return!1;for(let i of n){if(i.length>63||i.startsWith("-")||i.endsWith("-"))return!1;if(/^xn--/i.test(i)){let l=i.slice(4);if(l.length<2||l.includes("---"))return!1;continue}if(/[\u302E\u302F\u3031\u3032\u3033\u3034\u3035\u303B\u0640\u07FA]/.test(i))return!1;let s=i.charAt(0);if(/[\u0903\u0300\u0488]/.test(s))return!1;for(let l=0;l<i.length;l++){let g=i.charAt(l);if(g==="\xB7"){if(l===0||l===i.length-1)return!1;let y=i.charAt(l-1),E=i.charAt(l+1);if(!/^[lL]$/.test(y)||!/^[lL]$/.test(E))return!1}if(g==="\u30FB"){if(i.length===1)return!1;if(l===0){let y=i.charAt(l+1);if(!Cp(y))return!1}else{let y=i.charAt(l-1),E=i.charAt(l+1);if(!Cp(y)||!Cp(E))return!1}}if(g==="\u0375"){if(l===i.length-1)return!1;let y=i.charAt(l+1);if(!/[\u0370-\u03FF]/.test(y))return!1}if(g==="\u05F3"||g==="\u05F4"){if(l===0)return!1;let y=i.charAt(l-1);if(!/[\u05D0-\u05EA]/.test(y))return!1}if(g==="\u200D"&&(l===0||i.charAt(l-1)!=="\u094D"))return!1}let p=!1,c=!1;for(let l=0;l<i.length;l++){let g=i.charAt(l);/[\u0660-\u0669]/.test(g)&&(p=!0),/[\u06F0-\u06F9]/.test(g)&&(c=!0)}if(p&&c)return!1}return!0}var oN=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function kp(e){return oN.test(e)}var iN=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function Up(e){return iN.test(e)}function vT(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function Lp(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))?vT(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:vT(e)}function Np(e){try{return new URL(e),!0}catch{return!1}}var aN=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Mp(e){return aN.test(e)}var sN=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function wp(e){return sN.test(e)}function $p(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var mN=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function vp(e){return mN.test(e)}var pN=/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i;function Gp(e){return pN.test(e)}var cN=/^(?:(?:[^\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 Dp(e){return cN.test(e)}var uN=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i;function jp(e){return uN.test(e)}var lN=/^(?: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 Fp(e){return lN.test(e)}var dN=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function qp(e){return dN.test(e)}var se=new Map;function GT(){se.clear()}function fN(){return[...se.entries()]}function gN(e,t){se.set(e,t)}function yN(e){return se.has(e)}function IN(e){return se.get(e)}function EN(e,t){return se.get(e)?.(t)??!0}function DT(){GT(),se.set("date-time",Ap),se.set("date",Li),se.set("duration",bp),se.set("email",Op),se.set("hostname",Sp),se.set("idn-email",Rp),se.set("idn-hostname",Pp),se.set("ipv4",kp),se.set("ipv6",Up),se.set("iri-reference",Lp),se.set("iri",Np),se.set("json-pointer-uri-fragment",Mp),se.set("json-pointer",wp),se.set("regex",$p),se.set("relative-json-pointer",vp),se.set("time",Ni),se.set("uri-reference",Gp),se.set("uri-template",Dp),se.set("uri",jp),se.set("url",Fp),se.set("uuid",qp)}DT();function Bp(e,t,r,n){return ro.Test(r.format,n)}function jT(e,t,r,n,i,s){return Bp(e,t,i,s)||t.AddError({keyword:"format",schemaPath:r,instancePath:n,params:{format:i.format}})}function FT(e,t,r,n){let i=fp(r)?r.then:!0,s=Xm(r)?r.else:!0;return w(e,t,r.if,n)?w(e,t,i,n):w(e,t,s,n)}function qT(e,t,r,n,i,s){let p=fp(i)?i.then:!0,c=Xm(i)?i.else:!0,l=new Le,g=K(e,l,`${r}/if`,n,i.if,s)?K(e,l,`${r}/then`,n,p,s)||t.AddError({keyword:"if",schemaPath:r,instancePath:n,params:{failingKeyword:"then"}}):K(e,t,`${r}/else`,n,c,s)||t.AddError({keyword:"if",schemaPath:r,instancePath:n,params:{failingKeyword:"else"}});return g&&t.Merge([l]),g}function hN(e,t,r,n){return a.Every(r.items,0,(i,s)=>a.IsLessEqualThan(n.length,s)||w(e,t,i,n[s])&&t.AddIndex(s))}function TN(e,t,r,n,i,s){return a.EveryAll(i.items,0,(p,c)=>{let l=`${r}/items/${c}`,g=`${n}/${c}`;return a.IsLessEqualThan(s.length,c)||K(e,t,l,g,p,s[c])&&t.AddIndex(c)})}function xN(e,t,r,n){let i=Xn(r)?r.prefixItems.length:0;return a.Every(n,i,(s,p)=>w(e,t,r.items,s)&&t.AddIndex(p))}function _N(e,t,r,n,i,s){let p=Xn(i)?i.prefixItems.length:0;return a.EveryAll(s,p,(c,l)=>{let g=`${r}/items`,y=`${n}/${l}`;return K(e,t,g,y,i.items,c)&&t.AddIndex(l)})}function BT(e,t,r,n){return np(r)?hN(e,t,r,n):xN(e,t,r,n)}function HT(e,t,r,n,i,s){return np(i)?TN(e,t,r,n,i,s):_N(e,t,r,n,i,s)}function AN(e){return Xr(e)}function Hp(e,t,r,n){if(!AN(r))return!0;let i=n.reduce((s,p)=>w(e,t,r.contains,p)?++s:s,0);return a.IsLessEqualThan(i,r.maxContains)}function KT(e,t,r,n,i,s){let p=tn(i)?i.minContains:1;return Hp(e,t,i,s)||t.AddError({keyword:"contains",schemaPath:r,instancePath:n,params:{minContains:p,maxContains:i.maxContains}})}function Kp(e,t,r,n){return a.IsLessEqualThan(n,r.maximum)}function zT(e,t,r,n,i,s){return Kp(e,t,i,s)||t.AddError({keyword:"maximum",schemaPath:r,instancePath:n,params:{comparison:"<=",limit:i.maximum}})}function zp(e,t,r,n){return a.IsLessEqualThan(n.length,r.maxItems)}function VT(e,t,r,n,i,s){return zp(e,t,i,s)||t.AddError({keyword:"maxItems",schemaPath:r,instancePath:n,params:{limit:i.maxItems}})}function Vp(e,t,r,n){return a.IsMaxLength(n,r.maxLength)}function YT(e,t,r,n,i,s){return Vp(e,t,i,s)||t.AddError({keyword:"maxLength",schemaPath:r,instancePath:n,params:{limit:i.maxLength}})}function Yp(e,t,r,n){return a.IsLessEqualThan(a.Keys(n).length,r.maxProperties)}function WT(e,t,r,n,i,s){return Yp(e,t,i,s)||t.AddError({keyword:"maxProperties",schemaPath:r,instancePath:n,params:{limit:i.maxProperties}})}function bN(e){return Xr(e)}function Wp(e,t,r,n){if(!bN(r))return!0;let i=n.reduce((s,p)=>w(e,t,r.contains,p)?++s:s,0);return a.IsGreaterEqualThan(i,r.minContains)}function QT(e,t,r,n,i,s){return Wp(e,t,i,s)||t.AddError({keyword:"contains",schemaPath:r,instancePath:n,params:{minContains:i.minContains}})}function Qp(e,t,r,n){return a.IsGreaterEqualThan(n,r.minimum)}function ZT(e,t,r,n,i,s){return Qp(e,t,i,s)||t.AddError({keyword:"minimum",schemaPath:r,instancePath:n,params:{comparison:">=",limit:i.minimum}})}function Zp(e,t,r,n){return a.IsGreaterEqualThan(n.length,r.minItems)}function JT(e,t,r,n,i,s){return Zp(e,t,i,s)||t.AddError({keyword:"minItems",schemaPath:r,instancePath:n,params:{limit:i.minItems}})}function Jp(e,t,r,n){return a.IsMinLength(n,r.minLength)}function XT(e,t,r,n,i,s){return Jp(e,t,i,s)||t.AddError({keyword:"minLength",schemaPath:r,instancePath:n,params:{limit:i.minLength}})}function Xp(e,t,r,n){return a.IsGreaterEqualThan(a.Keys(n).length,r.minProperties)}function ex(e,t,r,n,i,s){return Xp(e,t,i,s)||t.AddError({keyword:"minProperties",schemaPath:r,instancePath:n,params:{limit:i.minProperties}})}function ec(e,t,r,n){return a.IsMultipleOf(n,r.multipleOf)}function tx(e,t,r,n,i,s){return ec(e,t,i,s)||t.AddError({keyword:"multipleOf",schemaPath:r,instancePath:n,params:{multipleOf:i.multipleOf}})}function tc(e,t,r,n){let i=new Qe;return!w(e,i,r.not,n)&&t.Merge([i])}function rx(e,t,r,n,i,s){return tc(e,t,i,s)||t.AddError({keyword:"not",schemaPath:r,instancePath:n,params:{}})}function nx(e,t,r,n){let i=r.oneOf.reduce((s,p)=>{let c=new Qe;return w(e,c,p,n)?[...s,c]:s},[]);return a.IsEqual(i.length,1)&&t.Merge(i)}function ox(e,t,r,n,i,s){let p=[],c=[],l=i.oneOf.reduce((y,E,C)=>{let Pe=new Le,ot=`${r}/oneOf/${C}`,ao=K(e,Pe,ot,n,E,s);return ao&&c.push(C),ao||p.push(Pe),ao?[...y,Pe]:y},[]),g=a.IsEqual(l.length,1)&&t.Merge(l);return!g&&a.IsEqual(c.length,0)&&p.forEach(y=>y.GetErrors().forEach(E=>t.AddError(E))),g||t.AddError({keyword:"oneOf",schemaPath:r,instancePath:n,params:{passingSchemas:c}})}function rc(e,t,r,n){return(a.IsString(r.pattern)?new RegExp(r.pattern):r.pattern).test(n)}function ix(e,t,r,n,i,s){return rc(e,t,i,s)||t.AddError({keyword:"pattern",schemaPath:r,instancePath:n,params:{pattern:i.pattern}})}function ax(e,t,r,n){return a.Every(a.Entries(r.patternProperties),0,([i,s])=>{let p=new RegExp(i);return a.Every(a.Entries(n),0,([c,l])=>!p.test(c)||w(e,t,s,l)&&t.AddKey(c))})}function sx(e,t,r,n,i,s){return a.EveryAll(a.Entries(i.patternProperties),0,([p,c])=>{let l=`${r}/patternProperties/${p}`,g=new RegExp(p);return a.EveryAll(a.Entries(s),0,([y,E])=>{let C=`${n}/${y}`;return!g.test(y)||K(e,t,l,C,c,E)&&t.AddKey(y)})})}function mx(e,t,r,n){return a.IsEqual(n.length,0)||a.Every(r.prefixItems,0,(i,s)=>a.IsLessEqualThan(n.length,s)||w(e,t,i,n[s])&&t.AddIndex(s))}function px(e,t,r,n,i,s){return a.IsEqual(s.length,0)||a.EveryAll(i.prefixItems,0,(p,c)=>{let l=`${r}/prefixItems/${c}`,g=`${n}/${c}`;return a.IsLessEqualThan(s.length,c)||K(e,t,l,g,p,s[c])&&t.AddIndex(c)})}function nc(e,t){return e.includes(t)||pt.Get().exactOptionalPropertyTypes}function oc(e,t){return a.IsUndefined(e[t])}function cx(e,t,r,n){let i=rn(r)?r.required:[];return a.Every(a.Entries(r.properties),0,([p,c])=>{let l=!a.HasPropertyKey(n,p)||w(e,t,c,n[p])&&t.AddKey(p);return nc(i,p)?l:oc(n,p)||l})}function ux(e,t,r,n,i,s){let p=rn(i)?i.required:[];return a.EveryAll(a.Entries(i.properties),0,([l,g])=>{let y=`${r}/properties/${l}`,E=`${n}/${l}`,C=()=>!a.HasPropertyKey(s,l)||K(e,t,y,E,g,s[l])&&t.AddKey(l);return nc(p,l)?C():oc(s,l)||C()})}function lx(e,t,r,n){return a.Every(a.Keys(n),0,(i,s)=>w(e,t,r.propertyNames,i))}function dx(e,t,r,n,i,s){let p=[];return a.EveryAll(a.Keys(s),0,(l,g)=>{let y=`${n}/${l}`,E=`${r}/propertyNames`,C=new Le,Pe=K(e,C,E,y,i.propertyNames,l);return Pe||p.push(l),Pe})||t.AddError({keyword:"propertyNames",schemaPath:r,instancePath:n,params:{propertyNames:p}})}function fx(e,t,r,n){let i=e.RecursiveRef(r.$recursiveRef)??!1;return $(i)&&w(e,t,i,n)}function gx(e,t,r,n,i,s){let p=e.RecursiveRef(i.$recursiveRef)??!1;return $(p)&&K(e,t,"#",n,p,s)}function Ex(e,t,r,n){let i=e.Ref(r.$ref)??!1,s=new Qe,p=$(i)&&w(e,s,i,n);return p&&t.Merge([s]),p}function hx(e,t,r,n,i,s){let p=e.Ref(i.$ref)??!1,c=new Le,l=$(p)&&K(e,c,"#",n,p,s);return l&&t.Merge([c]),l||c.GetErrors().forEach(g=>t.AddError(g)),l}function Tx(e,t,r,n){return a.Every(r.required,0,i=>a.HasPropertyKey(n,i))}function xx(e,t,r,n,i,s){let p=[];return a.EveryAll(i.required,0,l=>{let g=a.HasPropertyKey(s,l);return g||p.push(l),g})||t.AddError({keyword:"required",schemaPath:r,instancePath:n,params:{requiredProperties:p}})}function ic(e,t,r,n,i){return a.IsEqual(r,"object")?a.IsObjectNotArray(i):a.IsEqual(r,"array")?a.IsArray(i):a.IsEqual(r,"boolean")?a.IsBoolean(i):a.IsEqual(r,"integer")?a.IsInteger(i):a.IsEqual(r,"number")?a.IsNumber(i):a.IsEqual(r,"null")?a.IsNull(i):a.IsEqual(r,"string")?a.IsString(i):a.IsEqual(r,"asyncIterator")?a.IsAsyncIterator(i):a.IsEqual(r,"bigint")?a.IsBigInt(i):a.IsEqual(r,"constructor")?a.IsConstructor(i):a.IsEqual(r,"function")?a.IsFunction(i):a.IsEqual(r,"iterator")?a.IsIterator(i):a.IsEqual(r,"symbol")?a.IsSymbol(i):a.IsEqual(r,"undefined")?a.IsUndefined(i):a.IsEqual(r,"void")?a.IsUndefined(i):!0}function _x(e,t,r,n,i){return r.some(s=>ic(e,t,s,n,i))}function Ax(e,t,r,n){return a.IsArray(r.type)?_x(e,t,r.type,r,n):ic(e,t,r.type,r,n)}function bx(e,t,r,n,i,s){return(a.IsArray(i.type)?_x(e,t,i.type,i,s):ic(e,t,i.type,i,s))||t.AddError({keyword:"type",schemaPath:r,instancePath:n,params:{type:i.type}})}function Ox(e,t,r,n){let i=t.GetIndices();return a.Every(n,0,(s,p)=>(i.has(p)||w(e,t,r.unevaluatedItems,s))&&t.AddIndex(p))}function Sx(e,t,r,n,i,s){let p=t.GetIndices(),c=[];return a.EveryAll(s,0,(g,y)=>{let E=new Le,C=(p.has(y)||K(e,E,r,n,i.unevaluatedItems,g))&&t.AddIndex(y);return C||c.push(y),C})||t.AddError({keyword:"unevaluatedItems",schemaPath:r,instancePath:n,params:{unevaluatedItems:c}})}function Rx(e,t,r,n){let i=t.GetKeys();return a.Every(a.Entries(n),0,([s,p])=>i.has(s)||w(e,t,r.unevaluatedProperties,p)&&t.AddKey(s))}function Cx(e,t,r,n,i,s){let p=t.GetKeys(),c=[];return a.EveryAll(a.Entries(s),0,([g,y])=>{let E=new Le,C=p.has(g)||K(e,E,r,n,i.unevaluatedProperties,y)&&t.AddKey(g);return C||c.push(g),C})||t.AddError({keyword:"unevaluatedProperties",schemaPath:r,instancePath:n,params:{unevaluatedProperties:c}})}function Px(e){return!a.IsEqual(e.uniqueItems,!1)}function kx(e,t,r,n){if(!Px(r))return!0;let i=new Set(n.map(pr.Hash)).size,s=n.length;return a.IsEqual(i,s)}function Ux(e,t,r,n,i,s){if(!Px(i))return!0;let p=new Set,c=s.reduce((g,y,E)=>{let C=pr.Hash(y);return p.has(C)?[...g,E]:(p.add(C),g)},[]);return a.IsEqual(c.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:r,instancePath:n,params:{duplicateItems:c}})}function w(e,t,r,n){e.Push(r);let i=za(r)?Ip(e,t,r,n):(!gp(r)||Ax(e,t,r,n))&&(!(a.IsObject(n)&&!a.IsArray(n))||(!rn(r)||Tx(e,t,r,n))&&(!Qt(r)||hT(e,t,r,n))&&(!Wm(r)||CT(e,t,r,n))&&(!Qm(r)||kT(e,t,r,n))&&(!Zm(r)||LT(e,t,r,n))&&(!Pi(r)||ax(e,t,r,n))&&(!ki(r)||cx(e,t,r,n))&&(!up(r)||lx(e,t,r,n))&&(!Ri(r)||Xp(e,t,r,n))&&(!sp(r)||Yp(e,t,r,n)))&&(!a.IsArray(n)||(!Km(r)||yT(e,t,r,n))&&(!Xr(r)||hp(e,t,r,n))&&(!Zn(r)||BT(e,t,r,n))&&(!ip(r)||Hp(e,t,r,n))&&(!Va(r)||zp(e,t,r,n))&&(!tn(r)||Wp(e,t,r,n))&&(!Jn(r)||Zp(e,t,r,n))&&(!Xn(r)||mx(e,t,r,n))&&(!eo(r)||kx(e,t,r,n)))&&(!a.IsString(n)||(!Oi(r)||Bp(e,t,r,n))&&(!ap(r)||Vp(e,t,r,n))&&(!Si(r)||Jp(e,t,r,n))&&(!Ci(r)||rc(e,t,r,n)))&&(!(a.IsNumber(n)||a.IsBigInt(n))||(!tp(r)||xp(e,t,r,n))&&(!Zt(r)||_p(e,t,r,n))&&(!op(r)||Kp(e,t,r,n))&&(!Jt(r)||Qp(e,t,r,n))&&(!mp(r)||ec(e,t,r,n)))&&(!lp(r)||fx(e,t,r,n))&&(!dp(r)||Ex(e,t,r,n))&&(!Bm(r)||uT(e,t,r,n))&&(!Ym(r)||Ep(e,t,r,n))&&(!ep(r)||Tp(e,t,r,n))&&(!rp(r)||FT(e,t,r,n))&&(!pp(r)||tc(e,t,r,n))&&(!zm(r)||xT(e,t,r,n))&&(!Vm(r)||AT(e,t,r,n))&&(!cp(r)||nx(e,t,r,n))&&(!Wa(r)||!a.IsArray(n)||Ox(e,t,r,n))&&(!Qa(r)||!a.IsObject(n)||Rx(e,t,r,n))&&(!Hm(r)||dT(e,t,r,n));return e.Pop(r),i}function K(e,t,r,n,i,s){e.Push(i);let p=za(i)?OT(e,t,r,n,i,s):!!(+(!gp(i)||bx(e,t,r,n,i,s))&+(!(a.IsObject(s)&&!a.IsArray(s))||!!(+(!rn(i)||xx(e,t,r,n,i,s))&+(!Qt(i)||TT(e,t,r,n,i,s))&+(!Wm(i)||PT(e,t,r,n,i,s))&+(!Qm(i)||UT(e,t,r,n,i,s))&+(!Zm(i)||NT(e,t,r,n,i,s))&+(!Pi(i)||sx(e,t,r,n,i,s))&+(!ki(i)||ux(e,t,r,n,i,s))&+(!up(i)||dx(e,t,r,n,i,s))&+(!Ri(i)||ex(e,t,r,n,i,s))&+(!sp(i)||WT(e,t,r,n,i,s))))&+(!a.IsArray(s)||!!(+(!Km(i)||IT(e,t,r,n,i,s))&+(!Xr(i)||RT(e,t,r,n,i,s))&+(!Zn(i)||HT(e,t,r,n,i,s))&+(!ip(i)||KT(e,t,r,n,i,s))&+(!Va(i)||VT(e,t,r,n,i,s))&+(!tn(i)||QT(e,t,r,n,i,s))&+(!Jn(i)||JT(e,t,r,n,i,s))&+(!Xn(i)||px(e,t,r,n,i,s))&+(!eo(i)||Ux(e,t,r,n,i,s))))&+(!a.IsString(s)||!!(+(!Oi(i)||jT(e,t,r,n,i,s))&+(!ap(i)||YT(e,t,r,n,i,s))&+(!Si(i)||XT(e,t,r,n,i,s))&+(!Ci(i)||ix(e,t,r,n,i,s))))&+(!(a.IsNumber(s)||a.IsBigInt(s))||!!(+(!tp(i)||wT(e,t,r,n,i,s))&+(!Zt(i)||$T(e,t,r,n,i,s))&+(!op(i)||zT(e,t,r,n,i,s))&+(!Jt(i)||ZT(e,t,r,n,i,s))&+(!mp(i)||tx(e,t,r,n,i,s))))&+(!lp(i)||gx(e,t,r,n,i,s))&+(!dp(i)||hx(e,t,r,n,i,s))&+(!Bm(i)||lT(e,t,r,n,i,s))&+(!Ym(i)||ST(e,t,r,n,i,s))&+(!ep(i)||MT(e,t,r,n,i,s))&+(!rp(i)||qT(e,t,r,n,i,s))&+(!pp(i)||rx(e,t,r,n,i,s))&+(!zm(i)||_T(e,t,r,n,i,s))&+(!Vm(i)||bT(e,t,r,n,i,s))&+(!cp(i)||ox(e,t,r,n,i,s))&+(!Wa(i)||!a.IsArray(s)||Sx(e,t,r,n,i,s))&+(!Qa(i)||!a.IsObject(s)||Cx(e,t,r,n,i,s)))&&(!Hm(i)||fT(e,t,r,n,i,s));return e.Pop(i),p}var on={};ft(on,{Ref:()=>vN});var Xt={};ft(Xt,{Delete:()=>UN,Get:()=>PN,Has:()=>CN,Indices:()=>Mi,Set:()=>kN});function Lx(e){if(e.length===0)throw Error("Cannot set root")}function Nx(e){if(!a.IsObject(e))throw Error("Cannot set value")}function ON(e){return/^(0|[1-9]\d*)$/.test(e)}function Mx(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function SN(e,t){return a.IsObject(t)&&a.HasPropertyKey(t,e)}function RN(e,t){return a.IsObject(t)?t[e]:void 0}function ac(e,t){return e.reduce((r,n)=>RN(n,r),t)}function Mi(e){if(a.IsEqual(e.length,0))return[];let t=e.split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));return t.length>0&&t[0]===""?t.slice(1):t}function CN(e,t){let r=e;return Mi(t).every(n=>SN(n,r)?(r=r[n],!0):!1)}function PN(e,t){let r=Mi(t);return ac(r,e)}function kN(e,t,r){let n=Mi(t);Lx(n);let[i,s]=Mx(n),p=ac(i,e);return Nx(p),p[s]=r,e}function UN(e,t){let r=Mi(t);Lx(r);let[n,i]=Mx(r),s=ac(n,e);return Nx(s),a.IsArray(s)&&ON(i)?s.splice(+i,1):delete s[i],e}function LN(e,t,r){if(e.$id===r.hash)return e;let n=new URL(e.$id,t.href),i=new URL(r.href,t.href);if(a.IsEqual(n.pathname,i.pathname))return r.hash.startsWith("#")?wx(e,t,r):e}function NN(e,t,r){let n=new URL(`#${e.$anchor}`,t.href),i=new URL(r.href,t.href);if(a.IsEqual(n.href,i.href))return e}function wx(e,t,r){return r.href.endsWith("#")?e:r.hash.startsWith("#")?Xt.Get(e,decodeURIComponent(r.hash.slice(1))):void 0}function MN(e,t,r){if(en(e)){let n=LN(e,t,r);if(!a.IsUndefined(n))return n}if(bi(e)){let n=NN(e,t,r);if(!a.IsUndefined(n))return n}return wx(e,t,r)}function wN(e,t,r){return e.reduce((n,i)=>{let s=sc(i,t,r);return a.IsUndefined(s)?n:s},void 0)}function $N(e,t,r){return a.Keys(e).reduce((n,i)=>{let s=sc(e[i],t,r);return a.IsUndefined(s)?n:s},void 0)}function sc(e,t,r){if(t=Wt(e)&&en(e)?new URL(e.$id,t.href):t,Wt(e)){let n=MN(e,t,r);if(!a.IsUndefined(n))return n}if(a.IsArray(e))return wN(e,t,r);if(a.IsObject(e))return $N(e,t,r)}function vN(e,t){let r=new URL("http://unknown"),n=en(e)?new URL(e.$id,r.href):r,i=new URL(t,n.href);return sc(e,n,i)}var an=class{constructor(t,r){this.context=t,this.schema=r,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((t,r)=>new URL(r.$id,t),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(t){Wt(t)&&(en(t)&&this.ids.push(t),bi(t)&&this.anchors.push(t),Ya(t)&&this.recursiveAnchors.push(t),Jm(t)&&this.dynamicAnchors.push(t))}Pop(t){Wt(t)&&(en(t)&&this.ids.pop(),bi(t)&&this.anchors.pop(),Ya(t)&&this.recursiveAnchors.pop(),Jm(t)&&this.dynamicAnchors.pop())}FromContext(t){return a.HasPropertyKey(this.context,t)?this.context[t]:void 0}FromRef(t){return t.startsWith("#")?on.Ref(this.Base(),t):on.Ref(this.schema,t)}Ref(t){return this.FromContext(t)??this.FromRef(t)}RecursiveRef(t){return Ya(this.Base())?on.Ref(this.recursiveAnchors[0],t):on.Ref(this.Base(),t)}};function $x(...e){let[t,r,n]=X.Match(e,{3:(p,c,l)=>[p,c,l],2:(p,c)=>[{},p,c]}),i=new an(t,r),s=new Qe;return w(i,s,r,n)}function vx(...e){let[t,r,n]=X.Match(e,{3:(y,E,C)=>[y,E,C],2:(y,E)=>[{},y,E]}),i=pt.Get(),s=Lu(),p=[],c=new an(t,r),l=new Ui(y=>{if(!a.IsGreaterEqualThan(p.length,i.maxErrors))return p.push({...y,message:s(y)})});return[K(c,l,"#","",r,n),p]}function ie(...e){let[t,r,n]=X.Match(e,{3:(i,s,p)=>[i,s,p],2:(i,s)=>[{},i,s]});return $x(t,r,n)}function Sr(...e){let[t,r,n]=X.Match(e,{3:(p,c,l)=>[p,c,l],2:(p,c)=>[{},p,c]}),[i,s]=vx(t,r,n);return s}var Rr=class extends Error{constructor(t,r,n){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:n,value:r},writable:!1,configurable:!1,enumerable:!1})}};function Gx(e,t,r){return a.IsArray(r)?r.map(n=>Me(e,t.items,n)):r}function Dx(e,t,r){return t.Clean(r)}function jx(e,t,r){return Me({...e,...t.$defs},Te(t.$ref),r)}function DN(e){let t=a.HasPropertyKey(e,"unevaluatedProperties")?{additionalProperties:e.unevaluatedProperties}:{},r=At(e);return N(r)?Pa(r,t):r}function Fx(e,t,r){let n=DN(t);return Me(e,n,r)}function Za(e){return a.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function qx(e,t,r){if(!a.IsObject(r)||a.IsArray(r))return r;let n=Za(t);for(let i of a.Keys(r)){if(a.HasPropertyKey(t.properties,i)){r[i]=Me(e,t.properties[i],r[i]);continue}if(a.IsBoolean(n)&&a.IsEqual(n,!0)||_(n)&&ie(e,n,r[i])){r[i]=Me(e,n,r[i]);continue}delete r[i]}return r}function Bx(e,t,r){if(!a.IsObject(r))return r;let n=Za(t),[i,s]=[new RegExp(at(t)),Ge(t)];for(let p of a.Keys(r)){if(i.test(p)){r[p]=Me(e,s,r[p]);continue}if(a.IsBoolean(n)&&a.IsEqual(n,!0)||_(n)&&ie(e,n,r[p])){r[p]=Me(e,n,r[p]);continue}delete r[p]}return r}function Hx(e,t,r){return a.HasPropertyKey(e,t.$ref)?Me(e,e[t.$ref],r):r}function Kx(e,t,r){if(!a.IsArray(r))return r;let n=Math.min(r.length,t.items.length);for(let i=0;i<n;i++)r[i]=Me(e,t.items[i],r[i]);return a.IsGreaterThan(r.length,n)?r.slice(0,n):r}function jN(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=ae(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=ae(e[r]);return t}function FN(e){return a.IsClassInstance(e)?e:jN(e)}function qN(e){return e.map(t=>ae(t))}function BN(e){return e.slice()}function HN(e){return new Map(ae([...e.entries()]))}function KN(e){return new Set(ae([...e.values()]))}function ae(e){return Ke.IsTypeArray(e)?BN(e):Ke.IsMap(e)?HN(e):Ke.IsSet(e)?KN(e):a.IsArray(e)?qN(e):a.IsObject(e)?FN(e):e}function zx(e,t,r){for(let n of t.anyOf){let i=Me(e,n,ae(r));if(ie(e,n,i))return i}return r}function Me(e,t,r){return Q(t)?Gx(e,t,r):ct(t)?Dx(e,t,r):ne(t)?jx(e,t,r):P(t)?Fx(e,t,r):N(t)?qx(e,t,r):le(t)?Bx(e,t,r):re(t)?Hx(e,t,r):B(t)?Kx(e,t,r):x(t)?zx(e,t,r):r}function mn(...e){let[t,r,n]=X.Match(e,{3:(i,s,p)=>[i,s,p],2:(i,s)=>[{},i,s]});return Me(t,r,n)}function Vx(e,t,r){return a.IsArray(r)?r.map(n=>Ae(e,t.items,n)):r}function Yx(e,t,r){return t.Convert(r)}var J={};ft(J,{Fail:()=>pn,IsOk:()=>pc,Ok:()=>R,TryBigInt:()=>cc,TryBoolean:()=>cM,TryNull:()=>IM,TryNumber:()=>SM,TryString:()=>NM,TryUndefined:()=>jM});function pc(e){return a.IsObject(e)&&a.HasPropertyKey(e,"value")}function R(e){return{value:e}}function pn(){}function zN(e){return R(e)}function VN(e){return a.IsEqual(e,!0)?R(BigInt(1)):R(BigInt(0))}function YN(e){return R(BigInt(Math.trunc(e)))}function WN(e){return R(BigInt(0))}var QN=/^-?(0|[1-9]\d*)n$/,ZN=/^-?(0|[1-9]\d*)\.\d+$/,JN=/^-?(0|[1-9]\d*)$/;function XN(e){return QN.test(e)}function eM(e){return ZN.test(e)}function tM(e){return JN.test(e)}function rM(e){let t=e.toLowerCase();return XN(e)?R(BigInt(e.slice(0,e.length-1))):eM(e)?R(BigInt(e.split(".")[0])):tM(e)?R(BigInt(e)):a.IsEqual(t,"false")?R(BigInt(0)):a.IsEqual(t,"true")?R(BigInt(1)):void 0}function nM(e){return R(BigInt(0))}function cc(e){return a.IsBigInt(e)?zN(e):a.IsBoolean(e)?VN(e):a.IsNumber(e)?YN(e):a.IsNull(e)?WN(e):a.IsString(e)?rM(e):a.IsUndefined(e)?nM(e):void 0}function oM(e){return a.IsEqual(e,BigInt(0))?R(!1):a.IsEqual(e,BigInt(1))?R(!0):void 0}function iM(e){return R(e)}function aM(e){return a.IsEqual(e,0)?R(!1):a.IsEqual(e,1)?R(!0):void 0}function sM(e){return R(!1)}function mM(e){return a.IsEqual(e.toLowerCase(),"false")?R(!1):a.IsEqual(e.toLowerCase(),"true")?R(!0):a.IsEqual(e,"0")?R(!1):a.IsEqual(e,"1")?R(!0):void 0}function pM(e){return R(!1)}function cM(e){return a.IsBigInt(e)?oM(e):a.IsBoolean(e)?iM(e):a.IsNumber(e)?aM(e):a.IsNull(e)?sM(e):a.IsString(e)?mM(e):a.IsUndefined(e)?pM(e):void 0}function uM(e){return a.IsEqual(e,BigInt(0))?R(null):void 0}function lM(e){return a.IsEqual(e,!1)?R(null):void 0}function dM(e){return a.IsEqual(e,0)?R(null):void 0}function fM(e){return R(null)}function gM(e){let t=e.toLowerCase();return a.IsEqual(t,"undefined")||a.IsEqual(t,"null")||a.IsEqual(e,"")||a.IsEqual(e,"0")?R(null):void 0}function yM(e){return R(null)}function IM(e){return a.IsBigInt(e)?uM(e):a.IsBoolean(e)?lM(e):a.IsNumber(e)?dM(e):a.IsNull(e)?fM(e):a.IsString(e)?gM(e):a.IsUndefined(e)?yM(e):void 0}var EM=BigInt(Number.MAX_SAFE_INTEGER),hM=BigInt(Number.MIN_SAFE_INTEGER);function TM(e){return e<=EM&&e>=hM}function Wx(e){return TM(e)?R(Number(e)):void 0}function xM(e){return e?R(1):R(0)}function _M(e){return R(e)}function AM(e){return R(0)}function bM(e){let t=+e;if(a.IsNumber(t))return R(t);let r=e.toLowerCase();if(a.IsEqual(r,"false"))return R(0);if(a.IsEqual(r,"true"))return R(1);let n=cc(e);return pc(n)?Wx(n.value):void 0}function OM(e){return R(0)}function SM(e){return a.IsBigInt(e)?Wx(e):a.IsBoolean(e)?xM(e):a.IsNumber(e)?_M(e):a.IsNull(e)?AM(e):a.IsString(e)?bM(e):a.IsUndefined(e)?OM(e):void 0}function RM(e){return R(e.toString())}function CM(e){return R(e.toString())}function PM(e){return R(e.toString())}function kM(e){return R("null")}function UM(e){return R(e)}function LM(e){return R("")}function NM(e){return a.IsBigInt(e)?RM(e):a.IsBoolean(e)?CM(e):a.IsNumber(e)?PM(e):a.IsNull(e)?kM(e):a.IsString(e)?UM(e):a.IsUndefined(e)?LM(e):void 0}function MM(e){return a.IsEqual(e,BigInt(0))?R(void 0):void 0}function wM(e){return a.IsEqual(e,!1)?R(void 0):void 0}function $M(e){return a.IsEqual(e,0)?R(void 0):void 0}function vM(e){return R(void 0)}function GM(e){let t=e.toLowerCase();return a.IsEqual(t,"undefined")||a.IsEqual(t,"null")||a.IsEqual(e,"")||a.IsEqual(e,"0")?R(void 0):void 0}function DM(e){return R(void 0)}function jM(e){return a.IsBigInt(e)?MM(e):a.IsBoolean(e)?wM(e):a.IsNumber(e)?$M(e):a.IsNull(e)?vM(e):a.IsString(e)?GM(e):a.IsUndefined(e)?DM(e):void 0}function Qx(e,t,r){if(a.IsBigInt(r))return r;let n=J.TryBigInt(r);return J.IsOk(n)?n.value:r}function Zx(e,t,r){if(a.IsBoolean(r))return r;let n=J.TryBoolean(r);return J.IsOk(n)?n.value:r}function Jx(e,t,r){return Ae({...e,...t.$defs},Te(t.$ref),r)}function Ja(e,t,r){if(t.anyOf.some(p=>ie(e,p,r)))return r;let s=t.anyOf.map(p=>Ae(e,p,ae(r))).find(p=>ie(e,t,p));return a.IsUndefined(s)?r:s}function Xx(e,t,r){let n=qr(t);return Ja(e,n,r)}function e_(e,t,r){if(a.IsInteger(r))return r;let n=J.TryNumber(r);return J.IsOk(n)?Math.trunc(n.value):r}function t_(e,t,r){let n=At(t);return Ae(e,n,r)}function FM(e,t,r){let n=J.TryBigInt(r);return J.IsOk(n)&&a.IsEqual(t.const,n.value)?n.value:r}function qM(e,t,r){let n=J.TryBoolean(r);return J.IsOk(n)&&a.IsEqual(t.const,n.value)?n.value:r}function BM(e,t,r){let n=J.TryNumber(r);return J.IsOk(n)&&a.IsEqual(t.const,n.value)?n.value:r}function HM(e,t,r){let n=J.TryString(r);return J.IsOk(n)&&a.IsEqual(t.const,n.value)?n.value:r}function r_(e,t,r){return a.IsEqual(t.const,r)?r:ju(t)?FM(e,t,r):Fu(t)?qM(e,t,r):In(t)?BM(e,t,r):En(t)?HM(e,t,r):D()}function n_(e,t,r){if(a.IsNull(r))return r;let n=J.TryNull(r);return J.IsOk(n)?n.value:r}function o_(e,t,r){if(a.IsNumber(r))return r;let n=J.TryNumber(r);return J.IsOk(n)?n.value:r}function Xa(e,t,r,n){let i=a.Keys(n);for(let[s,p]of t)for(let c of i)s.test(c)||(n[c]=Ae(e,r,n[c]));return n}function wi(e,t,r){return be(e)&&a.IsUndefined(r[t])}function KM(e,t,r){let n=a.EntriesRegExp(t.properties),i=a.Keys(r);for(let[s,p]of n)for(let c of i)!s.test(c)||wi(p,c,r)||(r[c]=Ae(e,p,r[c]));return a.HasPropertyKey(t,"additionalProperties")&&a.IsObject(t.additionalProperties)?Xa(e,n,t.additionalProperties,r):r}function i_(e,t,r){return a.IsObjectNotArray(r)?KM(e,t,r):r}function zM(e,t,r){let n=a.EntriesRegExp(t.patternProperties),i=a.Keys(r);for(let[s,p]of n)for(let c of i)s.test(c)&&(r[c]=Ae(e,p,r[c]));return a.HasPropertyKey(t,"additionalProperties")&&a.IsObject(t.additionalProperties)?Xa(e,n,t.additionalProperties,r):r}function a_(e,t,r){return a.IsObjectNotArray(r)?zM(e,t,r):r}function s_(e,t,r){return a.HasPropertyKey(e,t.$ref)?Ae(e,e[t.$ref],r):r}function m_(e,t,r){if(a.IsString(r))return r;let n=J.TryString(r);return J.IsOk(n)?n.value:r}function p_(e,t,r){let n=De(t.pattern);return Ae(e,n,r)}function c_(e,t,r){if(!a.IsArray(r))return r;for(let n=0;n<Math.min(t.items.length,r.length);n++)r[n]=Ae(e,t.items[n],r[n]);return r}function u_(e,t,r){if(a.IsUndefined(r))return r;let n=J.TryUndefined(r);return J.IsOk(n)?n.value:r}function l_(e,t,r){if(a.IsUndefined(r))return r;let n=J.TryUndefined(r);return J.IsOk(n)?void 0:r}function Ae(e,t,r){return Q(t)?Vx(e,t,r):ct(t)?Yx(e,t,r):it(t)?Qx(e,t,r):Ye(t)?Zx(e,t,r):ne(t)?Jx(e,t,r):Ie(t)?Xx(e,t,r):ke(t)?e_(e,t,r):P(t)?t_(e,t,r):V(t)?r_(e,t,r):Pt(t)?n_(e,t,r):ue(t)?o_(e,t,r):N(t)?i_(e,t,r):le(t)?a_(e,t,r):re(t)?s_(e,t,r):xe(t)?m_(e,t,r):Ee(t)?p_(e,t,r):B(t)?c_(e,t,r):Nt(t)?u_(e,t,r):x(t)?Ja(e,t,r):st(t)?l_(e,t,r):r}function Cr(...e){let[t,r,n]=X.Match(e,{3:(i,s,p)=>[i,s,p],2:(i,s)=>[{},i,s]});return Ae(t,r,n)}function d_(e,t,r){if(!a.IsArray(r))return r;for(let n=0;n<r.length;n++)r[n]=Ce(e,t.items,r[n]);return r}function f_(e,t,r){return t.Default(r)}function g_(e,t,r){return Ce({...e,...t.$defs},Te(t.$ref),r)}function y_(e,t){return a.IsUndefined(t)?a.IsFunction(e.default)?e.default():ae(e.default):t}function I_(e,t,r){let n=At(t);return Ce(e,n,r)}function E_(e,t,r){if(!a.IsObject(r))return r;let n=a.Keys(t.properties);for(let i of n){let s=Ce(e,t.properties[i],r[i]);a.IsUndefined(s)&&(be(t.properties[i])||!a.HasPropertyKey(t.properties[i],"default"))||(r[i]=Ce(e,t.properties[i],r[i]))}if(!Qt(t)||a.IsBoolean(t.additionalProperties))return r;for(let i of a.Keys(r))n.includes(i)||(r[i]=Ce(e,t.additionalProperties,r[i]));return r}function h_(e,t,r){if(!a.IsObject(r))return r;let[n,i]=[new RegExp(at(t)),Ge(t)];for(let s of a.Keys(r))n.test(s)&&dt(i)&&(r[s]=Ce(e,i,r[s]));if(!Qt(t))return r;for(let s of a.Keys(r))n.test(s)||(r[s]=Ce(e,t.additionalProperties,r[s]));return r}function T_(e,t,r){return a.HasPropertyKey(e,t.$ref)?Ce(e,e[t.$ref],r):r}function x_(e,t,r){if(!a.IsArray(r))return r;let[n,i]=[t.items,Math.max(t.items.length,r.length)];for(let s=0;s<i;s++)s<n.length&&(r[s]=Ce(e,n[s],r[s]));return r}function __(e,t,r){for(let n of t.anyOf){let i=Ce(e,n,ae(r));if(ie(e,n,i))return i}return r}function Ce(e,t,r){let n=dt(t)?y_(t,r):r;return Q(t)?d_(e,t,n):ct(t)?f_(e,t,n):ne(t)?g_(e,t,n):P(t)?I_(e,t,n):N(t)?E_(e,t,n):le(t)?h_(e,t,n):re(t)?T_(e,t,n):B(t)?x_(e,t,n):x(t)?__(e,t,n):n}function cn(...e){let[t,r,n]=X.Match(e,{3:(i,s,p)=>[i,s,p],2:(i,s)=>[{},i,s]});return Ce(t,r,n)}function no(e){return(...t)=>{let[r,n,i]=X.Match(t,{3:(s,p,c)=>[s,p,c],2:(s,p)=>[{},s,p]});return e.reduce((s,p)=>p(r,n,s),i)}}function VM(e,t,r){return t["~codec"].decode(r)}function YM(e,t,r){return t["~codec"].encode(r)}function ge(e,t,r,n){return vr(r)?a.IsEqual(e,"Decode")?VM(t,r,n):YM(t,r,n):n}function WM(e,t,r,n){if(!a.IsArray(n))return D();for(let i=0;i<n.length;i++)n[i]=me(e,t,r.items,n[i]);return ge(e,t,r,n)}function QM(e,t,r,n){let i=ge(e,t,r,n);if(!a.IsArray(i))return i;for(let s=0;s<i.length;s++)i[s]=me(e,t,r.items,i[s]);return i}function A_(e,t,r,n){return a.IsEqual(e,"Decode")?WM(e,t,r,n):QM(e,t,r,n)}function b_(e,t,r,n){return n=me(e,{...t,...r.$defs},Te(r.$ref),n),ge(e,t,r,n)}function ZM(e,t,r,n){for(let i of r.allOf)n=me(e,t,i,n);return ge(e,t,r,n)}function JM(e,t,r,n){let i=ge(e,t,r,n);for(let s of r.allOf)i=me(e,t,s,i);return i}function O_(e,t,r,n){return a.IsEqual(e,"Decode")?ZM(e,t,r,n):JM(e,t,r,n)}function XM(e,t,r,n){if(!a.IsObjectNotArray(n))return D();for(let i of a.Keys(r.properties))!a.HasPropertyKey(n,i)||wi(r.properties[i],i,n)||(n[i]=me(e,t,r.properties[i],n[i]));return ge(e,t,r,n)}function ew(e,t,r,n){let i=ge(e,t,r,n);if(!a.IsObjectNotArray(i))return i;for(let s of a.Keys(r.properties))!a.HasPropertyKey(i,s)||wi(r.properties[s],s,i)||(i[s]=me(e,t,r.properties[s],i[s]));return i}function S_(e,t,r,n){return a.IsEqual(e,"Decode")?XM(e,t,r,n):ew(e,t,r,n)}function tw(e,t,r,n){if(!a.IsObjectNotArray(n))return D();let i=new RegExp(at(r));for(let s of a.Keys(n))i.test(s)||D(),n[s]=me(e,t,Ge(r),n[s]);return ge(e,t,r,n)}function rw(e,t,r,n){let i=ge(e,t,r,n);if(!a.IsObjectNotArray(i))return i;let s=new RegExp(at(r));for(let p of a.Keys(i))s.test(p)&&(i[p]=me(e,t,Ge(r),i[p]));return i}function R_(e,t,r,n){return a.IsEqual(e,"Decode")?tw(e,t,r,n):rw(e,t,r,n)}function C_(e,t,r,n){return n=a.HasPropertyKey(t,r.$ref)?me(e,t,t[r.$ref],n):n,ge(e,t,r,n)}function nw(e,t,r,n){if(!a.IsArray(n))return D();for(let i=0;i<Math.min(r.items.length,n.length);i++)n[i]=me(e,t,r.items[i],n[i]);return ge(e,t,r,n)}function ow(e,t,r,n){let i=ge(e,t,r,n);if(!a.IsArray(i))return n;for(let s=0;s<Math.min(r.items.length,i.length);s++)i[s]=me(e,t,r.items[s],i[s]);return i}function P_(e,t,r,n){return a.IsEqual(e,"Decode")?nw(e,t,r,n):ow(e,t,r,n)}function iw(e,t,r,n){for(let i of r.anyOf){if(!ie(t,i,n))continue;let s=me(e,t,i,n);return ge(e,t,r,s)}return D()}function aw(e,t,r,n){let i=ge(e,t,r,n);for(let s of r.anyOf){let p=me(e,t,s,ae(i));if(ie(t,s,p))return p}return i}function k_(e,t,r,n){return a.IsEqual(e,"Decode")?iw(e,t,r,n):aw(e,t,r,n)}function me(e,t,r,n){return Q(r)?A_(e,t,r,n):ne(r)?b_(e,t,r,n):P(r)?O_(e,t,r,n):N(r)?S_(e,t,r,n):le(r)?R_(e,t,r,n):re(r)?C_(e,t,r,n):B(r)?P_(e,t,r,n):x(r)?k_(e,t,r,n):ge(e,t,r,n)}var uc=class extends Rr{constructor(t,r){super("Decode",t,r)}};function sw(e,t,r){if(!ie(e,t,r))throw new uc(r,Sr(e,t,r));return r}function mw(e,t,r){return me("Decode",e,t,r)}var cCe=no([(e,t,r)=>ae(r),(e,t,r)=>cn(e,t,r),(e,t,r)=>Cr(e,t,r),(e,t,r)=>mn(e,t,r),(e,t,r)=>sw(e,t,r),(e,t,r)=>mw(e,t,r)]);var lc=class extends Rr{constructor(t,r){super("Encode",t,r)}};function pw(e,t,r){if(!ie(e,t,r))throw new lc(r,Sr(e,t,r));return r}function cw(e,t,r){return me("Encode",e,t,r)}var _Ce=no([(e,t,r)=>ae(r),(e,t,r)=>cw(e,t,r),(e,t,r)=>cn(e,t,r),(e,t,r)=>Cr(e,t,r),(e,t,r)=>mn(e,t,r),(e,t,r)=>pw(e,t,r)]);var It=class extends Error{constructor(t,r){super(r),this.type=t}};function U_(e,t){return a.IsFunction(t.default)?t.default(t):a.IsObject(t.default)?ae(t.default):t.default}function L_(e,t){if(eo(t)&&!dt(t))throw new It(t,"Arrays with uniqueItems constraints must specify a default annotation");let r=Jn(t)?t.minItems:0;return Array.from({length:r},()=>pe(e,t.items))}async function*uw(){}function N_(e,t){return uw()}function M_(e,t){return t.Create()}function w_(e,t){return Zt(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Jt(t)?BigInt(t.minimum):BigInt(0)}function $_(e,t){return!1}function v_(e,t){let r=pe(e,t.instanceType);return class{constructor(){Object.assign(this,r)}}}function G_(e,t){return pe({...e,...t.$defs},Te(t.$ref))}function D_(e,t){return pe(e,qr(t))}function j_(e,t){let r=pe(e,t.returnType);return()=>r}function F_(e,t){return Zt(t)&&a.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Jt(t)?t.minimum:0}function q_(e,t){return pe(e,At(t))}function*lw(){}function B_(e,t){return lw()}function H_(e,t){return t.const}function K_(e,t){throw new It(t,"Cannot create TNever types")}function z_(e,t){return null}function V_(e,t){return Zt(t)&&a.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Jt(t)?t.minimum:0}function Y_(e,t){return(a.IsUndefined(t.required)?[]:t.required).reduce((n,i)=>({...n,[i]:pe(e,t.properties[i])}),{})}function W_(e,t){return Promise.resolve(pe(e,t.item))}function Q_(e,t){if(Ri(t)&&!dt(t))throw new It(t,"Record with the minProperties constraint must have a default annotation");return{}}function Z_(e,t){return a.HasPropertyKey(e,t.$ref)?pe(e,e[t.$ref]):(()=>{throw new It(t,"Unable to deref Ref")})()}function J_(e,t){if((Ci(t)||Oi(t))&&!dt(t))throw Error("Strings with format or pattern constraints must specify default");let n=Si(t)?t.minLength:0;return"".padEnd(n)}function X_(e,t){return Symbol()}function eA(e,t){let r=De(t.pattern);if(xe(r))throw new It(t,"Unable to create TemplateLiteral due to infinite type expansion");return pe(e,r)}function tA(e,t){return Array.from({length:t.minItems},(r,n)=>pe(e,t.items[n]))}function rA(e,t){if(a.IsEqual(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return pe(e,t.anyOf[0])}function pe(e,t){return dt(t)?U_(e,t):Q(t)?L_(e,t):Be(t)?N_(e,t):ct(t)?M_(e,t):it(t)?w_(e,t):Ye(t)?$_(e,t):Oe(t)?v_(e,t):ne(t)?G_(e,t):Ie(t)?D_(e,t):Se(t)?j_(e,t):ke(t)?F_(e,t):P(t)?q_(e,t):He(t)?B_(e,t):V(t)?H_(e,t):qt(t)?K_(e,t):Pt(t)?z_(e,t):ue(t)?V_(e,t):N(t)?Y_(e,t):ve(t)?W_(e,t):le(t)?Q_(e,t):re(t)?Z_(e,t):xe(t)?J_(e,t):kt(t)?X_(e,t):Ee(t)?eA(e,t):B(t)?tA(e,t):Nt(t)?void 0:x(t)?rA(e,t):st(t)?void 0:void 0}function jt(...e){let[t,r]=X.Match(e,{2:(n,i)=>[n,i],1:n=>[{},n]});return pe(t,r)}var dc=class extends Rr{constructor(t,r){super("Parse",t,r)}};function dw(e,t,r){if(!ie(e,t,r))throw new dc(r,Sr(e,t,r));return r}var R0e=no([(e,t,r)=>ae(r),(e,t,r)=>cn(e,t,r),(e,t,r)=>Cr(e,t,r),(e,t,r)=>mn(e,t,r),(e,t,r)=>dw(e,t,r)]);var gw=k({type:q("insert"),path:et(),value:we()}),yw=Object({type:q("update"),path:et(),value:we()}),Iw=k({type:q("delete"),path:et()}),M0e=v([gw,yw,Iw]);function $i(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]:jt(t)}var iA=Lc(require("node:fs"));function vi(e){if(e.file){let t=iA.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> or -d <json>. Use --generate-skeleton to get a template.")}function qe(e){process.stdout.write(`${JSON.stringify(e,null,2)}
38
- `)}function xw(e){return e.replace(/-/g," ").replace(/ies$/,"y").replace(/s$/,"")}function gc(e){let t=e.params;if(t?.properties){let r=Object.keys(t.properties);if(r.length===1&&r[0])return r[0]}return"id"}function aA(e,t,r){let n=e.command(t.commandName).description(t.description),i=xw(t.commandName),s=n.command("list").description(`List all ${t.commandName}`);if(t.listOptions)for(let p of t.listOptions)s.option(p.flag,p.description);if(s.action(async p=>{let c={};if(t.listOptions)for(let g of t.listOptions){let y=p[g.queryParam];y!==void 0&&(c[g.queryParam]=y)}let l=await r()(t.endpoints.list,Object.keys(c).length>0?{query:c}:void 0);qe(l)}),t.endpoints.get){let p=t.endpoints.get,c=gc(p);n.command("get <id>").description(`Get a ${i} by ID`).action(async l=>{let g=await r()(p,{params:{[c]:l}});qe(g)})}if(t.endpoints.create){let p=t.endpoints.create;n.command("create").description(`Create a new ${i}`).option("-f, --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 c=>{if(c.generateSkeleton){qe($i(p));return}let l=vi(c),g=await r()(p,{body:l});qe(g)})}if(t.endpoints.update){let p=t.endpoints.update,c=gc(p);n.command("update <id>").description(`Update a ${i} by ID`).option("-f, --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(l,g)=>{if(g.generateSkeleton){qe($i(p));return}let y=vi(g),E=await r()(p,{params:{[c]:l},body:y});qe(E)})}if(t.endpoints.delete){let p=t.endpoints.delete,c=gc(p);n.command("delete <id>").description(`Delete a ${i} by ID`).action(async l=>{let g=await r()(p,{params:{[c]:l}});qe(g)})}}var _w=[{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:LE,get:NE,create:ME,update:wE,delete:$E},listOptions:[{flag:"--owners <ids...>",description:"Filter by owner team IDs",queryParam:"owners"}]},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",endpoints:{list:FE,create:qE,update:BE,delete:HE}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:QE,get:ZE,create:nh,update:oh,delete:ih}},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:dh,get:fh,create:gh,update:yh,delete:Ih}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:hh,get:Th,create:_h,update:Ah,delete:bh}},{commandName:"quality-reports",description:"Manage quality reports",endpoints:{list:Rh}},{commandName:"retention-policies",description:"Manage retention policies",endpoints:{list:kh,get:Uh,create:Lh,update:Nh,delete:Mh}},{commandName:"routes",description:"Manage routes",endpoints:{list:wh,get:$h,create:vh,update:Gh,delete:Dh}},{commandName:"services",description:"Manage services",endpoints:{list:Hh,get:Kh}},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:tT,get:rT,create:nT,update:oT,delete:iT}},{commandName:"teams",description:"Manage teams",endpoints:{list:aT,get:sT,create:mT,update:pT,delete:cT}}];function sA(e,t){for(let r of _w)aA(e,r,t)}var mA=`/${"v1"}/aggregation`,pA=o.Object({id:o.String({description:'Query identifier (q1, q2, ...) or "formula" for formula'}),group:o.Record(o.String(),o.Union([o.String(),o.Number()]),{description:"Group-by field values"})}),Aw={results:[{id:"q1",group:{host:"server-1"},value:123.45}]},cA=o.Object({results:o.Array(o.Object({...pA.properties,value:o.Number({description:"Aggregated value"})},{title:"ScalarResult"}),{description:"Aggregated results per query and group"})},{$id:"ScalarAggregationResponse",title:"ScalarAggregationResponse",description:"Scalar aggregation response with single values"});Object.assign(cA,{examples:[Aw]});var bw={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]},uA=o.Object({series:o.Array(o.Object({...pA.properties,points:o.Array(o.Object({timestamp:o.Integer({description:"Timestamp in milliseconds"}),value:o.Number({description:"Value"})}),{description:"Array of data points"})},{title:"Series"}),{description:"Time series data per query and group"})},{$id:"TimeseriesAggregationResponse",title:"TimeseriesAggregationResponse",description:"Timeseries aggregation response with points over time"});Object.assign(uA,{examples:[bw]});var lA={timeRange:yt,queries:o.Array(o.Omit(Vo.items,["fill"],{title:"AggregationQuery"}),{maxItems:um,description:"Aggregations that may be combined together in the same query"}),groupBy:o.Optional(Wo),dataSource:cm,formula:o.Optional(Yo)},Ow=o.Object(lA),dA=f({description:"Run aggregation queries and return scalar results",operationId:"aggregateScalar",tags:["public","aggregation"],url:`${mA}/multi-query/scalar`,method:"POST",body:Ow,response:cA}),Sw=o.Object({...lA,aggregationWindow:u({description:'Time bucket size for aggregation (e.g. "10s", "1m", "1h")'})}),fA=f({description:"Run aggregation queries and return timeseries results",operationId:"aggregateTimeseries",tags:["public","aggregation"],url:`${mA}/multi-query/timeseries`,method:"POST",body:Sw,response:uA});var es="/v0/logs";var Gi=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var Rw=0,Cw=o.Object({__tsuga_metadata__:o.Object({id:o.String(),source:o.Optional(o.String())},{additionalProperties:!0}),context:o.Optional(o.Object({team:o.Optional(o.String()),tag_policy_warnings:o.Optional(o.Record(o.String(),o.String()))},{additionalProperties:!0})),message:o.Optional(o.String()),timestamp:o.Number(),level:o.Enum(Gi)},{additionalProperties:!0});var Pw="log_timestamp",kw=o.Union([o.Literal(Pw)]),un={...zt.properties,query:o.Optional(u({type:"tsuga-query"})),maxResults:o.Optional(o.Integer({minimum:1,maximum:1e3})),shouldRecommendAttributes:o.Optional(o.Boolean()),defaultAttributesToHighlight:o.Optional(o.Array(u(),{maxItems:50})),triggeredBy:o.Optional(o.Literal("refresh")),startOffset:o.Optional(o.Number({minimum:Rw})),clusterId:o.Optional(u({allowEmpty:!1})),sortBy:o.Optional(kw),sortDirection:o.Optional(o.Union([o.Literal("asc"),o.Literal("desc")]))},FNe=f({tags:["logs"],url:`${es}/count`,method:"GET",query:o.Pick(o.Object(un),["from","to","query","clusterId"]),response:o.Object({count:o.Number()})}),yc=o.Object({value:o.String(),priority:o.Number({minimum:0,maximum:1})}),qNe=f({tags:["logs"],url:`${es}/search`,method:"GET",query:o.Object(un),response:o.Object({logs:o.Optional(o.Array(Cw)),attributesToHighlight:o.Optional(o.Array(yc))},{additionalProperties:!0})}),Ic=o.Cyclic({TokenOutput:o.Union([o.Object({type:o.Literal("top"),values:o.Array(o.String())}),o.Object({type:o.Literal("ip"),value:o.String()}),o.Object({type:o.Literal("range"),min:o.Number(),max:o.Number()}),o.Object({type:o.Literal("variable"),value:o.String()}),o.Object({type:o.Literal("text"),value:o.String()}),o.Object({type:o.Literal("date"),value:o.String()}),o.Object({type:o.Literal("url"),value:o.String()}),o.Object({type:o.Literal("structure"),key:o.Array(o.String()),value:o.Array(o.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),Uw=o.Object({id:o.String(),pattern:o.Array(Ic),size:o.Integer({description:"Number of logs that matched the pattern"}),examples:o.Array(o.Object({id:o.Any(),timestampUnix:o.Number()})),timeDistribution:o.Array(o.Number()),staticFeatures:o.Array(o.Object({key:o.String(),value:o.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),BNe=f({tags:["logs"],url:`${es}/patterns`,method:"GET",query:o.Object({...zt.properties,query:u({type:"tsuga-query"}),clusteringThreshold:o.Optional(o.Number()),clusterId:o.Optional(u({allowEmpty:!1}))}),response:o.Object({patterns:o.Array(Uw),sampleSize:o.Number()})}),HNe=f({tags:["logs"],url:`${es}/attributes`,method:"GET",query:o.Object({...zt.properties,clusterId:o.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:o.Object({attributes:o.Array(o.String())})});var ts=`/${"v1"}/logs`,Ec=o.Object({context:o.Optional(o.Object({team:o.Optional(o.String())},{additionalProperties:!0,$id:"LogContext"})),message:o.Optional(o.String()),timestamp:o.Number(),level:o.Enum(Gi)},{additionalProperties:!0,$id:"LogEvent"}),Lw={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(Ec,{examples:[Lw]});var Nw={query:"level:ERROR",maxResults:100,from:1704067200,to:1704067200},gA=o.Object({...o.Pick(o.Object(un),["query","maxResults"]).properties,...yt.properties});Object.assign(gA,{examples:[Nw]});var yA=f({description:"Search logs",operationId:"searchLogs",tags:["public","logs"],url:`${ts}/search`,method:"GET",query:gA,response:o.Object({logs:o.Array(Ec)})}),Mw=o.Object({pattern:o.Array(Ic),size:o.Integer({description:"Number of logs that matched the pattern"}),groups:o.Array(o.Object({key:o.String(),value:o.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),IA=o.Object({patterns:o.Array(Mw),sampleSize:o.Number()}),ww={patterns:[{pattern:[{type:"text",value:"Resolved"},{type:"text",value:" "},{type:"text",value:"segment"},{type:"text",value:" "},{type:"text",value:"SegmentId("},{type:"range",min:0,max:1},{type:"text",value:")"},{type:"text",value:" "},{type:"text",value:"from"},{type:"text",value:" "},{type:"text",value:"cache"}],size:37004,groups:[{key:"level",value:"DEBUG"},{key:"context.team",value:"infra"}]}],sampleSize:100};Object.assign(IA,{examples:[ww]});var EA=f({description:"Get log patterns",operationId:"getLogPatterns",tags:["public","logs"],url:`${ts}/patterns`,method:"GET",query:o.Object({...yt.properties,query:u({type:"tsuga-query"})}),response:IA}),$w=o.Object({exampleLog:o.Optional(Ec),team:o.String(),env:o.String(),service:o.String(),firstSeen:o.Number({description:"Timestamp in milliseconds when this pattern was first seen"}),lastSeen:o.Number({description:"Timestamp in milliseconds when this pattern was last seen"})}),hA=o.Object({newErrorPatterns:o.Array($w)}),vw={newErrorPatterns:[{team:"platform",env:"production",service:"api-gateway",firstSeen:17040672e5,lastSeen:17041536e5,exampleLog:{message:"ConnectionError: Failed to connect to database",timestamp:17041536e5,level:"ERROR"}}]};Object.assign(hA,{examples:[vw]});var TA=f({description:"Get new error patterns",operationId:"getNewErrorPatterns",tags:["public","logs"],url:`${ts}/patterns/new`,method:"GET",query:o.Object({...yt.properties,team:o.Optional(u()),env:o.Optional(u()),service:o.Optional(u())}),response:hA}),Gw=o.Object({team:o.String(),env:o.String(),pattern:o.String({description:"The error pattern formatted"}),increaseTimestamps:o.Array(o.Number({description:"Timestamps in milliseconds when there were increases in this pattern"}))}),xA=o.Object({errorPatternIncreases:o.Array(Gw)}),Dw={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(xA,{examples:[Dw]});var _A=f({description:"Get error pattern increase",operationId:"getErrorPatternIncrease",tags:["public","logs"],url:`${ts}/patterns/increase`,method:"GET",query:o.Object({...yt.properties,team:o.Optional(u()),env:o.Optional(u())}),response:xA});var Pr="/v0/metrics",jw=o.Object({__tsuga_metadata__:o.Object({id:o.Optional(o.String())},{additionalProperties:!0}),context:o.Optional(o.Object({},{additionalProperties:!0})),message:o.Optional(o.String()),timestamp:o.Number(),level:o.Enum(Gi)},{additionalProperties:!0}),oMe=f({tags:["metrics"],url:`${Pr}/count`,method:"GET",query:o.Pick(o.Object(un),["from","to","query"]),response:o.Object({count:o.Number()})}),iMe=f({tags:["metrics"],url:`${Pr}/search`,method:"GET",query:o.Object(un),response:o.Object({logs:o.Optional(o.Array(jw)),totalHits:o.Optional(o.Number()),attributesToHighlight:o.Optional(o.Array(yc))},{additionalProperties:!0})}),rs=o.Enum(["counter","gauge","histogram","summary"]),hc=o.Enum(["delta","cumulative","none"]),Fw=o.Object({capabilities:o.Optional(o.Array(o.String())),description:o.Optional(o.String()),tags:o.Optional(o.Array(o.String())),temporality:o.Optional(hc),type:o.Optional(rs),unit:o.Optional(o.String())}),aMe=f({url:`${Pr}/metadata`,method:"GET",query:o.Object({...zt.properties,metricName:u({allowEmpty:!1}),clusterId:o.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:Fw}),sMe=f({tags:["metrics"],url:Pr,method:"GET",query:o.Object({...zt.properties,clusterId:o.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:o.Array(o.String())}),Tc=o.Array(o.Object({name:o.String(),type:rs}),{description:"List of metric names and their types"}),mMe=f({tags:["metrics"],url:`${Pr}/names-and-types`,method:"GET",query:o.Object({...zt.properties,clusterId:o.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:Tc}),xc=o.Array(o.String(),{description:"List of attribute names"}),pMe=f({tags:["metrics"],url:`${Pr}/attributes`,method:"GET",query:o.Object({...zt.properties,metricName:u({allowEmpty:!1}),clusterId:o.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:xc}),_c=o.Object({assets:o.Array(o.Object({type:o.Enum(["dashboard","monitor"]),id:o.String(),name:o.String(),owner:o.String()},{description:"An asset that uses a metric"}),{description:"List of assets (dashboards and monitors) using this metric"})}),cMe=f({tags:["metrics"],url:`${Pr}/assets-usage`,method:"GET",query:o.Object({metricName:u({allowEmpty:!1})}),response:_c}),uMe=f({url:`${Pr}/per-attribute`,method:"GET",query:o.Object({from:o.Optional(o.Number()),to:o.Optional(o.Number()),attribute:u(),clusterId:o.Optional(u({allowEmpty:!1}))}),response:o.Array(o.String())});var Ac=`/${"v1"}/metrics`,qw=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Tc,{examples:[qw]});var bc=o.Object({name:o.String({description:"Name of the metric"}),type:rs,description:o.Optional(o.String({description:"Human-readable description of the metric"})),unit:o.Optional(o.String({description:"Unit of the metric"})),temporality:o.Optional(hc),capabilities:o.Optional(o.Array(o.String(),{description:"Supported capabilities, an empty array means all capabilities are supported"})),attributes:o.Optional(o.Array(o.String(),{description:"Metric attributes"}))}),Bw={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(bc,{examples:[Bw]});var AA=f({description:"Get all metrics with their metadata",operationId:"listMetrics",tags:["public","metrics"],url:Ac,method:"GET",query:yt,response:o.Array(bc)}),bA=f({description:"Retrieve a metric by name with its metadata",operationId:"getMetric",tags:["public","metrics"],url:`${Ac}/:name`,method:"GET",params:o.Object({name:u({allowEmpty:!1,description:"The metric name"})}),query:yt,response:bc}),Hw=["service","env","host","method","status_code"];Object.assign(xc,{examples:[Hw]});var OA=o.Pick(_c,["assets"]),Kw={assets:[{type:"dashboard",id:"dash-123-abc",name:"API Performance Overview",owner:"user-456-def"},{type:"monitor",id:"mon-789-ghi",name:"High Latency Alert",owner:"user-456-def"}]};Object.assign(OA,{examples:[Kw]});var hMe=f({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${Ac}/assets-usage`,method:"GET",query:o.Object({metricName:u({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:OA});var zw=`/${"v1"}/traces`,SA=o.Object({context:o.Optional(o.Object({service:o.Optional(o.Object({name:o.Optional(o.String()),version:o.Optional(o.String())},{additionalProperties:!0}))},{additionalProperties:!0})),parentSpanId:o.Optional(o.String()),resourceAttributes:o.Object({},{additionalProperties:!0}),spanAttributes:o.Object({},{additionalProperties:!0}),duration:o.Number({description:"In milliseconds."}),startTime:o.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),endTime:o.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:o.Optional(o.Object({message:o.String()})),events:o.Optional(o.Array(o.Object({event_attributes:o.Object({},{additionalProperties:!0}),event_name:o.String(),event_timestamp_nanos:o.String()}))),spanId:o.String(),span:o.Object({kind:o.String(),name:o.String()}),statusCode:o.Optional(o.String()),traceId:o.String()},{additionalProperties:!0,$id:"SpanEvent"}),Vw={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(SA,{examples:[Vw]});var Yw={from:1704067200,to:1704067200,query:"context.service.name:my-service",maxResults:100},RA=o.Object({...yt.properties,query:o.Optional(u({type:"tsuga-query"})),maxResults:o.Optional(o.Integer({minimum:1,maximum:1e4}))});Object.assign(RA,{examples:[Yw]});var CA=f({description:"Search spans",operationId:"searchSpans",tags:["public","traces"],url:`${zw}/search`,method:"GET",query:RA,response:o.Object({spans:o.Array(SA)})});var tr=require("node:fs"),PA=require("node:os"),Oc=require("node:path"),kA=(0,Oc.join)((0,PA.homedir)(),".config","tsuga"),oo=(0,Oc.join)(kA,"config.json"),Ww="https://api.tsuga.com";function ln(){if(!(0,tr.existsSync)(oo))return{};try{return JSON.parse((0,tr.readFileSync)(oo,"utf-8"))}catch{throw new Error(`Config file corrupted: ${oo}
37
+ `)}return e instanceof Error?`Error: ${e.message}`:String(e)}function AE(e,t){return async function(n,i={}){let{body:s,params:p,query:c}=i,l;if("url"in n)l=n.url;else{if(!p)throw new qn("Internal error: params required for this endpoint");l=n.buildUrl(p)}let g=xE(`${e}${l}`,c),y={Accept:"application/json",Authorization:`Bearer ${t}`,[fm]:"cli",[gm]:"1.0.6",[ym]:"16228c1",[Im]:"2026-03-26T14:04:40.670Z"};s&&(y["Content-Type"]="application/json");let C=await(await fetch(g,{method:n.method,headers:y,body:s?JSON.stringify(s):void 0})).json();if(C.error)throw qn.fromErrorResponse(C.error,C.requestId);return C.data}}var q0=1e3,B0=60*q0,H0=60*B0,Na=24*H0,kae=7*Na,Uae=30*Na;var Em=["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 K0="^\\S(.*\\S)?$",z0=o.Object({key:o.String({maxLength:128}),value:o.String({maxLength:256,pattern:K0})},{title:"Tag"}),V0=o.Array(z0,{title:"Tags",maxItems:50,description:"List of key/value tags applied to the resource"}),ce=o.Optional(V0);var Ar="/v0/teams",hm=["public","private"],bE=o.Object({color:o.Enum(lm),mode:o.Enum(dm),iconName:o.Enum(IE)}),Tm=o.Object({color:o.Enum(lm),mode:o.Enum(dm)}),Y0=100,W0=250,Bn=o.Object({id:o.String({description:"Identifier of the team"}),name:o.String({description:"Human readable team name displayed throughout the app"}),description:o.Optional(o.String()),visibility:o.Enum(hm,{description:"Controls whether the resources of the team are discoverable by users"}),tags:ce,createdAt:A(),updatedAt:A(),memberCount:o.Optional(o.Number({description:"Number of members currently in the team"})),avatar:o.Optional(bE)}),Ma=o.Object({name:o.String({minLength:1,maxLength:Y0,description:"Name to assign to the team"}),description:o.Optional(o.String({maxLength:W0})),visibility:o.Enum(hm,{description:"Controls whether the resources of the team are discoverable by users"}),tags:ce,avatar:o.Optional(bE)}),Q0=o.Object({id:o.String(),name:o.String(),email:o.String(),role:o.Enum(Dn),joinedTeamAt:A(),orgRole:o.Enum(oE),avatar:o.Optional(Tm)}),qae=f({tags:["teams"],url:Ar,method:"GET",response:o.Array(Bn),query:o.Optional(o.Object({includeMemberCount:o.Optional(o.Boolean())}))}),Bae=f({tags:["teams"],url:`${Ar}/:id`,method:"GET",params:o.Object({id:u()}),response:Bn}),Hae=f({tags:["teams"],url:`${Ar}/:id/members`,method:"GET",params:o.Object({id:u()}),response:o.Array(Q0)}),Kae=f({tags:["teams"],url:`${Ar}/:id/assets`,method:"GET",params:o.Object({id:u()}),response:o.Object({apiKeyCount:o.Number(),logRouteCount:o.Number(),monitorCount:o.Number(),notificationRuleCount:o.Number(),dashboardCount:o.Number()})}),zae=f({tags:["teams"],url:Ar,method:"POST",body:Ma,response:Bn}),Vae=f({tags:["teams"],url:`${Ar}/:id`,method:"PUT",params:o.Object({id:u()}),body:Ma,response:Bn}),Yae=f({tags:["teams"],url:`${Ar}/bulk-update`,method:"POST",body:o.Object({teamIds:o.Array(u(),{maxItems:100}),config:o.Object({visibility:o.Enum(hm)})}),response:o.Object({})}),Wae=f({tags:["teams"],url:`${Ar}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H});var Z0=o.Enum(["terraform-provider","web-frontend","mcp-server","cli"]),_e=F("type",[o.Object({type:o.Literal("user"),id:o.String(),name:o.String(),avatar:o.Optional(Tm)}),o.Object({type:o.Literal("operation-api-key"),id:o.String(),name:o.String(),source:o.Optional(Z0)})]);var Vr="/v0/dashboards",J0=["white","gray.100","amber.200","lime.200","emerald.200","cyan.200","blue.200","violet.200","fuchsia.200","pink.200","red.200"],X0=["timeseries","top-list","pie","query-value","bar","list"],pse=[...X0,"note"],eU=["ns","us","ms","s","m","h","days"];var tU=["B","KB","MB","GB","TB","PB"];var Hn=F("type",[o.Object({type:o.Literal("duration",{description:"Normalizes values as durations using standard time units"}),unit:o.Enum(eU,{description:"Time unit used to present the normalized values"})},{$id:"DataNormalizerDuration",title:"Duration"}),o.Object({type:o.Literal("data",{description:"Normalizes values as data sizes using byte units"}),unit:o.Enum(tU,{description:"Data size unit used to present the normalized values"})},{$id:"DataNormalizerData",title:"Data"}),o.Object({type:o.Literal("percent",{description:"Format values as percentages"})},{$id:"DataNormalizerPercent",title:"Percent"}),o.Object({type:o.Literal("date",{description:"Formats values as calendar dates"})},{$id:"DataNormalizerDate",title:"Date"}),o.Object({type:o.Literal("level",{description:"Displays values using their log level name"})},{$id:"DataNormalizerLevel",title:"Level"}),o.Object({type:o.Literal("custom",{description:"Normalizes values using a custom unit label"}),unit:o.String({description:"Text label describing the custom unit"})},{$id:"DataNormalizerCustom",title:"Custom"})],{title:"Normalizer"}),rU=o.Object({attribute:o.String({description:"Attribute displayed as a column in the log list"}),normalizer:o.Optional(Hn)},{title:"WidgetListColumn"}),nU=["background","no-background"],oU=["table","legend-only","no-legend"];var iU=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"],CE=["alert","warning","success"],aU=o.Object({operator:o.Enum(iU,{description:"Comparator used to evaluate the metric value"}),value:o.Number({description:"Threshold value used when evaluating the operator"}),color:o.Enum(CE,{description:"Color applied when the condition is met"})},{title:"ConditionalFormatting"}),sU=o.Object({value:o.Number({description:"Y-axis value where the threshold marker is placed"}),level:o.Enum(CE,{description:"Level applied to the threshold marker"})},{title:"ThresholdMarker"}),mU=["sec","min","hour","day"],OE=o.Object({time:o.Number({description:"Number of units that make up each bar bucket"}),metric:o.Enum(mU,{description:"Unit used to measure the bucket width"})});var SE=o.Enum(["flex-start","center","flex-end"],{description:"Flex alignment keyword used for widget layout"}),PE={source:fE,queries:Vo,formula:o.Optional(Yo),visibleSeries:o.Optional(o.Array(o.Boolean(),{description:"Flags indicating whether each query or formula series is visible"}))},wa={...PE,groupBy:o.Optional(Wo)},$a=o.Enum(oU,{description:"Controls whether and how the widget displays legend or series details (e.g. table, legend-only, or no legend)"}),Qo=o.Optional(o.Number({description:"Number of decimal places to display in the value"})),RE=o.Optional(o.Array(sU,{description:"Threshold markers displayed on the chart"})),pU=o.Object({type:o.Literal("list",{description:"Displays matching logs or database rows in a tabular list"}),source:o.Union([o.Literal("logs",{description:"Indicates that the widget queries logs"}),o.Literal("connections",{description:"Indicates that the widget queries connections like PostgreSQL, BigQuery, etc."})]),query:u({type:"long",description:"Query that selects logs or database rows for the list"}),listColumns:o.Optional(o.Array(rU,{description:"Custom columns to display for each log or database row"})),connectionId:o.Optional(u({description:"Identifier of the connection to query"}))}),cU=o.Unsafe({...pU,$id:"GraphVisualizationList",title:"List"}),uU=F("type",[o.Object({type:o.Literal("timeseries",{description:"Displays the aggregation as a time series chart"}),...wa,timeBucket:o.Optional(OE),normalizer:o.Optional(Hn),precision:Qo,legendMode:o.Optional($a),thresholds:RE},{$id:"GraphVisualizationTimeseries",title:"Timeseries"}),o.Object({type:o.Literal("top-list",{description:"Displays the aggregation as a ranked list of top results"}),...wa,normalizer:o.Optional(Hn),precision:Qo},{$id:"GraphVisualizationTopList",title:"TopList"}),o.Object({type:o.Literal("pie",{description:"Displays the aggregation as a pie chart"}),...wa,normalizer:o.Optional(Hn),precision:Qo,legendMode:o.Optional($a)},{$id:"GraphVisualizationPie",title:"Pie"}),o.Object({type:o.Literal("query-value",{description:"Displays the aggregation as a single value"}),...PE,backgroundMode:o.Optional(o.Enum(nU,{description:"Controls whether the widget uses a solid or transparent background"})),conditions:o.Optional(o.Array(aU,{description:"Conditional formatting rules applied to the displayed value"})),precision:Qo,normalizer:o.Optional(Hn),legendMode:o.Optional($a)},{$id:"GraphVisualizationQueryValue",title:"QueryValue"}),o.Object({type:o.Literal("bar",{description:"Displays the aggregation as a bar chart"}),...wa,timeBucket:o.Optional(OE),precision:Qo,normalizer:o.Optional(Hn),thresholds:RE,legendMode:o.Optional($a)},{$id:"GraphVisualizationBar",title:"Bar"}),cU,o.Object({type:o.Literal("note",{description:"Displays static text on the dashboard"}),note:o.Optional(u({type:"long",description:"Markdown-compatible text shown in the note"})),noteColor:o.Optional(o.Enum(J0,{description:"Background color used to render the note"})),noteAlign:o.Optional(SE),noteJustifyContent:o.Optional(SE)},{$id:"GraphVisualizationNote",title:"Note"})]),kE=o.Object({id:u({description:"Identifier of the graph widget"}),name:o.Optional(u({description:"Display name of the graph widget"})),description:o.Optional(o.String({minLength:1,maxLength:800,description:"Description of the graph widget"})),visualization:uU,layout:o.Optional(o.Object({x:o.Number({description:"Horizontal grid position of the widget"}),y:o.Number({description:"Vertical grid position of the widget"}),w:o.Number({description:"Width of the widget in grid units"}),h:o.Number({description:"Height of the widget in grid units"})},{description:"Grid layout coordinates for this widget"}))},{title:"Graph"}),lU=10,UE=o.Array(o.Object({key:u({description:"Filter key"}),values:o.Array(u({description:"Filter value"}))}),{maxItems:lU,description:"Filters applied to every widget on the dashboard"}),Kn=o.Object({id:o.String({description:"Identifier of the dashboard"}),name:o.String({description:"Display name of the dashboard"}),owner:o.String({description:"Team ID that owns and manages the dashboard"}),graphs:o.Array(kE,{description:"Ordered widgets that compose the dashboard"}),filters:o.Optional(UE),createdAt:A(),updatedAt:A(),creator:o.Optional(_e),updater:o.Optional(_e),tags:ce,timePreset:o.Optional(o.Enum(Em))}),va=o.Object({name:u({description:"Display name of the dashboard"}),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the dashboard"}),graphs:o.Array(kE,{description:"Ordered widgets that compose the dashboard"}),filters:o.Optional(UE),tags:ce,timePreset:o.Optional(o.Enum(Em))}),xm=o.Object({owners:o.Optional(o.Array(u({allowEmpty:!1}),{description:"Filter by owner team IDs"}))}),cse=f({tags:["dashboards"],url:Vr,method:"GET",query:xm,response:o.Array(Kn)}),use=f({tags:["dashboards"],url:`${Vr}/:id`,method:"GET",params:o.Object({id:u()}),response:Kn}),lse=f({tags:["dashboards"],url:Vr,method:"POST",body:va,response:Kn}),dse=f({tags:["dashboards"],url:`${Vr}/:id`,method:"PUT",params:o.Object({id:u()}),body:o.Partial(va),response:Kn}),fse=f({tags:["dashboards"],url:`${Vr}/bulk-update`,method:"PUT",body:o.Object({dashboardIds:o.Array(u()),owner:u({allowEmpty:!1})}),response:o.Object({})}),gse=f({tags:["dashboards"],url:`${Vr}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),yse=f({tags:["dashboards"],url:`${Vr}/bulk-delete`,method:"DELETE",body:o.Object({ids:o.Array(u())}),response:o.Object({})});var Zo=`/${"v1"}/dashboards`,Jo=o.Pick(Kn,["id","name","owner","graphs","filters","tags","timePreset"],{$id:"Dashboard",description:"Visualization of telemetry data with customizable graphs and filters"}),dU={id:"123-456-abc",name:"API Performance Overview",owner:"abc-123-def",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(Jo,{examples:[dU]});var fU=o.Pick(xm,["owners"]),LE=f({description:"Retrieve all dashboards",operationId:"listDashboards",tags:["dashboards"],url:Zo,method:"GET",query:fU,response:o.Array(Jo)}),NE=f({description:"Retrieve a dashboard by its id",operationId:"getDashboard",tags:["dashboards"],url:`${Zo}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:Jo}),_m=o.Pick(va,["name","owner","graphs","filters","tags","timePreset"]),gU={name:"API Performance Overview",owner:"abc-123-def",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(_m,{examples:[gU]});var ME=f({description:"Create a new dashboard",operationId:"createDashboard",tags:["dashboards"],url:Zo,method:"POST",body:_m,response:Jo}),wE=f({description:"Update a dashboard by its id",operationId:"updateDashboard",tags:["dashboards"],url:`${Zo}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:o.Partial(_m),response:Jo}),$E=f({description:"Delete a dashboard by its id",operationId:"deleteDashboard",tags:["dashboards"],url:`${Zo}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var yU=100,IU=3,zn=o.Object({id:o.String(),name:o.String(),keyLastCharacters:o.String(),owner:o.String(),tags:ce,teamOverrideFields:o.Optional(o.Array(o.String())),updatedAt:A(),createdAt:A(),creator:o.Optional(_e),updater:o.Optional(_e),lastSyncedAt:o.Optional(A()),assetUpdatedAt:A()}),Xo=o.Object({name:o.String({minLength:1,maxLength:yU}),owner:u({allowEmpty:!1}),tags:ce,teamOverrideFields:o.Optional(o.Array(u({allowEmpty:!1}),{minItems:1,maxItems:IU}))}),ei="/v0/ingestion-api-keys",Lse=f({tags:["ingestion-api-keys"],url:ei,method:"POST",body:Xo,response:o.Intersect([zn,o.Object({key:o.String()})])}),Nse=f({tags:["ingestion-api-keys"],url:ei,method:"GET",response:o.Array(zn)}),Mse=f({tags:["ingestion-api-keys"],url:`${ei}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:zn}),wse=f({tags:["ingestion-api-keys"],url:`${ei}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:Xo,response:zn}),$se=f({tags:["ingestion-api-keys"],url:`${ei}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var ti=`/${"v1"}/ingestion-api-keys`,ri=o.Pick(zn,["id","name","owner","tags","teamOverrideFields","keyLastCharacters"],{$id:"IngestionApiKey",description:"API key used to send telemetry data to Tsuga"}),vE={id:"123-456-abc",name:"Production Logs Ingestion",keyLastCharacters:"x7Qm",owner:"abc-123-def",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(ri,{examples:[vE]});var GE=o.Pick(Xo,["name","owner","tags","teamOverrideFields"],{$id:"CreateIngestionApiKeyRequest"}),DE=o.Pick(Xo,["name","owner","tags","teamOverrideFields"],{$id:"UpdateIngestionApiKeyRequest"}),jE={name:"Production Logs Ingestion",owner:"abc-123-def",tags:[{key:"env",value:"production"}],teamOverrideFields:["service"]};Object.assign(GE,{examples:[jE]});Object.assign(DE,{examples:[jE]});var EU={...vE,key:"tsuga_in:v1:abc123xyx7Qm"},FE=f({description:"Retrieve all ingestion API keys",operationId:"listIngestionApiKeys",tags:["ingestion-api-keys"],url:ti,method:"GET",response:o.Array(ri)}),Hse=f({description:"Retrieve an ingestion API key by its id",operationId:"getIngestionApiKey",tags:["ingestion-api-keys"],url:`${ti}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:ri}),hU=o.Intersect([o.Pick(ri,["id","name","keyLastCharacters","owner","tags","teamOverrideFields"]),o.Object({key:o.String({description:"The full API key value, returned only at creation time"})})],{title:"IngestionApiKeyCreated",example:EU}),qE=f({description:"Create a new ingestion API key",operationId:"createIngestionApiKey",tags:["ingestion-api-keys"],url:ti,method:"POST",body:GE,response:hU}),BE=f({description:"Update an ingestion API key by its id",operationId:"updateIngestionApiKey",tags:["ingestion-api-keys"],url:`${ti}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:DE,response:ri}),HE=f({description:"Delete an ingestion API key by its id",operationId:"deleteIngestionApiKey",tags:["ingestion-api-keys"],url:`${ti}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var TU=["all","owning-team-and-public","owning-team-only"],Am=o.Enum(TU,{description:"This controls which data the resource can see"});var Ot="/v0/monitors",bm=["alert","resolve","keep_last_status","consider_zero"],KE=["alert","resolve","keep_last_status"];var xU=["no_aggregation","all","any","each","proportion"],_U=["greater_than","less_than","equal","not_equal","greater_than_or_equal","less_than_or_equal"];var AU=o.Object({formula:u({type:"math-formula"}),operator:o.Enum(_U),threshold:o.Number()}),Om=o.Array(AU),zE=o.Object({formula:u({type:"math-formula"}),conditionType:o.Enum(["rate","error","cpu","general","to_be_set"])}),ome=o.Enum(["rate","error","cpu","general"]),Gt=[1,2,3,4,5];var ni={timeframe:o.Number({description:"Timeframe of the monitor in minutes"}),groupByFields:o.Array(o.Object({fields:o.Array(u(),{description:"Fields used by the monitor group by."}),limit:o.Number({description:"Configured limit for this group by. Warning! This setting is currently ignored. Monitor evaluation will instead apply a fixed limit of 100 groups per field."})}),{maxItems:1,description:"Monitor group by configuration. Warning! Note that the limit setting is currently ignored."}),aggregationAlertLogic:o.Optional(o.Enum(xU)),proportionAlertThreshold:o.Optional(o.Integer({minimum:1,maximum:99}))},Sm=o.Object({type:o.Literal("metric"),conditions:Om,noDataBehavior:o.Enum(bm),...ni,queries:Fn},{$id:"MonitorConfigurationMetric"}),Rm=o.Object({type:o.Literal("log"),conditions:Om,noDataBehavior:o.Enum(bm),...ni,queries:Fn},{$id:"MonitorConfigurationLog"}),VE=o.Object({type:o.Literal("trace"),conditions:Om,noDataBehavior:o.Enum(bm),...ni,queries:Fn},{$id:"MonitorConfigurationTrace"}),Cm=o.Object({type:o.Literal("anomaly-log"),condition:zE,noDataBehavior:o.Enum(KE),...ni,queries:Fn},{$id:"MonitorConfigurationAnomalyLog"}),Pm=o.Object({type:o.Literal("anomaly-metric"),condition:zE,noDataBehavior:o.Enum(KE),...ni,queries:Fn},{$id:"MonitorConfigurationAnomalyMetric"}),YE=o.Object({type:o.Literal("certificate-expiry"),warnBeforeInDays:o.Integer({minimum:1,maximum:365}),cloudAccounts:o.Optional(o.Array(o.String(),{minItems:1})),aggregationAlertLogic:o.Literal("each"),noDataBehavior:o.Literal("resolve")},{$id:"MonitorConfigurationCertificateExpiry"}),bU=o.Object({type:o.Literal("log-error-pattern"),aggregationAlertLogic:o.Literal("each"),noDataBehavior:o.Literal("keep_last_status"),filter:o.Object({teamIds:o.Array(o.String()),env:o.String(),service:o.Optional(o.String())})},{$id:"MonitorConfigurationLogErrorPattern"}),WE=F("type",[Sm,Rm,VE,Cm,Pm,bU,YE]);var Vt=o.Object({id:o.String({description:"Identifier of the monitor"}),name:o.String({description:"Display name of the monitor"}),owner:o.String({description:"Team ID that owns and manages the monitor"}),message:o.Optional(o.String({description:"Message to be displayed if a notification is triggered"})),tags:ce,configuration:WE,priority:o.Enum(Gt,{description:"Priority of the monitor"}),permissions:Am,dashboardId:o.Optional(o.String({description:"Identifier of a dashboard related to the monitor"})),pauseUntil:o.Optional(A()),creator:o.Optional(_e),updater:o.Optional(_e),createdAt:A(),updatedAt:A(),lastSyncedAt:o.Optional(A()),assetUpdatedAt:A(),clusterIds:o.Array(o.String())},{title:"Monitor"}),OU=F("type",[Sm,Rm,VE,Cm,Pm,YE]),ime=o.Object({...Vt.properties,configuration:OU},{title:"Monitor"}),ame=o.Object({...Vt.properties,configuration:F("type",[Sm,Rm,Cm,Pm])},{title:"Monitor"}),oi=o.Object({name:u(),message:o.Optional(u({type:"long"})),tags:ce,configuration:WE,priority:o.Enum(Gt),owner:u({allowEmpty:!1}),dashboardId:o.Optional(u()),pauseUntil:o.Optional(u({allowEmpty:!1,type:"date-time"})),permissions:Am,clusterIds:o.Optional(o.Array(u({allowEmpty:!1})))});var sme=f({tags:["monitors"],url:Ot,method:"GET",response:o.Array(Vt),query:o.Optional(o.Object({owners:o.Optional(o.Array(u({allowEmpty:!1})))}))}),mme=f({tags:["monitors"],url:`${Ot}/:id`,method:"GET",params:o.Object({id:u()}),response:Vt}),pme=f({tags:["monitors"],url:Ot,method:"POST",body:oi,response:Vt}),cme=f({tags:["monitors"],url:`${Ot}/:id`,method:"PUT",params:o.Object({id:u()}),body:oi,response:Vt}),ume=f({tags:["monitors"],url:`${Ot}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),lme=f({tags:["monitors"],url:`${Ot}/:id/snooze`,method:"POST",params:o.Object({id:u()}),body:o.Object({pauseUntil:u({allowEmpty:!1,type:"date-time"})}),response:Vt}),SU=["alert","ok","alert_consider_zero","ok_consider_zero","alert_no_data","ok_no_data","keep_last_status_ok","keep_last_status_alert"],Yr=o.Enum(SU),RU=F("type",[o.Object({type:o.Literal("each"),subStates:o.Record(o.String(),o.Object({stateValue:o.Union([Yr,o.Null()]),lastChangedAt:A()}))}),o.Object({type:o.Literal("no_aggregation"),stateValue:o.Optional(Yr)}),o.Object({type:o.Literal("any"),stateValue:o.Optional(Yr)}),o.Object({type:o.Literal("all"),stateValue:o.Optional(Yr)}),o.Object({type:o.Literal("proportion"),stateValue:o.Optional(Yr)})]),CU=o.Object({monitorId:o.String(),currentState:RU,lastChangedAt:o.Optional(A())}),dme=f({tags:["monitors"],url:`${Ot}/states/:id`,method:"GET",params:o.Object({id:u()}),response:CU}),fme=f({tags:["monitors"],url:`${Ot}/:id/transitions`,method:"GET",params:o.Object({id:u()}),query:o.Object({from:o.Number(),to:o.Number()}),response:o.Array(o.Object({id:o.String(),createdAt:A(),fromState:o.Optional(Yr),toState:o.Optional(Yr),dimension:o.Optional(o.String())}))}),PU=["unprocessed","processed","failed-to-process"],gme=f({tags:["monitors"],url:`${Ot}/:id/results`,method:"GET",params:o.Object({id:u()}),query:o.Object({from:o.Number(),to:o.Number()}),response:o.Object({isTruncated:o.Boolean(),results:o.Array(o.Object({id:o.String(),evaluationAt:A(),formulaResult:o.Object({groups:o.Array(o.Object({groupKey:o.Record(o.String(),mm),results:o.Array(o.Union([o.Number(),o.Null()])),conditionMet:o.Enum(["true","false","nan-no-data"])}))}),createdAt:A(),status:o.Enum(PU)}))})});var ii=`/${"v1"}/monitors`,ai=o.Pick(Vt,["id","name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],{$id:"Monitor",description:"Monitor allowing to send alerts based on telemetry data"}),kU={id:"123-456-abc",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:[],queries:[{aggregate:{type:"count"},filter:"level:ERROR service:api-gateway"}],conditions:[{formula:"q1",operator:"greater_than",threshold:100}],noDataBehavior:"resolve"},priority:1,owner:"abc-123-def",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},UU={id:"456-789-def",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:["abc-123-def"],env:"production",service:"api-gateway"}},priority:2,owner:"abc-123-def",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]};Object.assign(ai,{examples:[kU,UU]});var QE=f({description:"Retrieve all monitors",operationId:"listMonitors",tags:["monitors"],url:ii,method:"GET",response:o.Array(ai)}),ZE=f({description:"Retrieve a monitor by its id",operationId:"getMonitor",tags:["monitors"],url:`${ii}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:ai}),JE=["name","message","tags","configuration","priority","owner","dashboardId","permissions","clusterIds"],XE=o.Pick(oi,JE,{$id:"CreateMonitorRequest"}),eh=o.Pick(oi,JE,{$id:"UpdateMonitorRequest"}),th={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:[],queries:[{aggregate:{type:"count"},filter:"level:ERROR service:api-gateway"}],conditions:[{formula:"q1",operator:"greater_than",threshold:100}],noDataBehavior:"resolve"},priority:1,owner:"abc-123-def",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]},rh={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:["abc-123-def"],env:"production",service:"api-gateway"}},priority:2,owner:"abc-123-def",dashboardId:"789-abc-def",permissions:"all",clusterIds:[]};Object.assign(XE,{examples:[th,rh]});Object.assign(eh,{examples:[th,rh]});var nh=f({description:"Create a new monitor",operationId:"createMonitor",tags:["monitors"],url:ii,method:"POST",body:XE,response:ai}),oh=f({description:"Update a monitor by its id",operationId:"updateMonitor",tags:["monitors"],url:`${ii}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:eh,response:ai}),ih=f({description:"Delete a monitor by its id",operationId:"deleteMonitor",tags:["monitors"],url:`${ii}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var si="/v0/notifications",Qr=`${si}/rules`,ah=`${si}/slack/setup`,Ga=`${si}/integrations`,Wr=["triggered","resolved","no-data"],LU=["sent","stale","pending","rate-limited","failed","silenced"],sh=o.Optional(o.Object({maxMessages:o.Integer({minimum:1,description:"Maximum number of messages allowed during the rate-limiting window"}),minutes:o.Integer({minimum:1,description:"Length of the rate-limiting window in minutes"})},{description:"Per-target rate-limiting configuration"})),mh=o.Optional(o.Object({mode:o.Literal("each"),renotificationStates:o.Array(o.Enum(["alert","alert_no_data"]),{description:"Alert states that will trigger a renotification"}),renotifyIntervalMinutes:o.Integer({minimum:1,description:"Minimum number of minutes to wait before renotifying"})},{description:"Configuration for repeating notifications over time"})),NU=o.Object({id:u({description:"Identifier of the notification target"}),rateLimit:sh,config:F("type",[o.Object({type:o.Literal("slack"),channel:u({description:"Slack channel ID that receives the notification"}),integrationId:u({description:"Slack workspace ID that receives the notification"})},{$id:"RuleTargetInputSlack"}),o.Object({type:o.Literal("incident-io"),integrationId:u({description:"Identifier of the incident.io integration to use"})},{$id:"RuleTargetInputIncidentIo"}),o.Object({type:o.Literal("pagerduty"),integrationId:u({description:"Identifier of the PagerDuty integration to use"})},{$id:"RuleTargetInputPagerDuty"}),o.Object({type:o.Literal("email"),addresses:o.Array(u({type:"email"}),{minItems:1,maxItems:20,description:"Email addresses that will receive the alert"})},{$id:"RuleTargetInputEmail"}),o.Object({type:o.Literal("grafana-irm"),integrationId:u({description:"Identifier of the Grafana IRM integration to use"})},{$id:"RuleTargetInputGrafanaIrm"}),o.Object({type:o.Literal("microsoft-teams"),integrationId:u({description:"Identifier of the Microsoft Teams integration to use"})},{$id:"RuleTargetInputMicrosoftTeams"}),o.Object({type:o.Literal("webhook"),integrationId:u({description:"Identifier of the webhook integration to use"})},{$id:"RuleTargetInputWebhook"}),o.Object({type:o.Literal("servicenow"),integrationId:u({description:"Identifier of the ServiceNow integration to use"})},{$id:"RuleTargetInputServiceNow"}),o.Object({type:o.Literal("google-chat"),integrationId:u({description:"Identifier of the Google Chat integration to use"})},{$id:"RuleTargetInputGoogleChat"}),o.Object({type:o.Literal("squadcast"),integrationId:u({description:"Identifier of the Squadcast integration to use"})},{$id:"RuleTargetInputSquadcast"})],{description:"Configuration describing how the alert should be delivered"}),renotifyConfig:mh}),MU=o.Object({id:o.String({description:"Identifier of the notification target"}),rateLimit:sh,renotifyConfig:mh,config:F("type",[o.Object({type:o.Literal("slack"),channel:o.String({description:"Slack channel ID that receives the notification"}),integrationId:o.String({description:"Slack workspace ID that receives the notification"}),integrationName:o.String({description:"Human readable name of the Slack integration"})},{$id:"RuleTargetConfigSlack"}),o.Object({type:o.Literal("incident-io"),integrationId:o.String({description:"Identifier of the incident.io integration to use"}),integrationName:o.String({description:"Human readable name of the incident.io integration"})},{$id:"RuleTargetConfigIncidentIo"}),o.Object({type:o.Literal("email"),addresses:o.Array(o.String({format:"email"}),{description:"Email addresses that will receive the alert"})},{$id:"RuleTargetConfigEmail"}),o.Object({type:o.Literal("grafana-irm"),integrationId:o.String({description:"Identifier of the Grafana IRM integration to use"}),integrationName:o.String({description:"Human readable name of the Grafana IRM integration"})},{$id:"RuleTargetConfigGrafanaIrm"}),o.Object({type:o.Literal("pagerduty"),integrationId:o.String({description:"Identifier of the PagerDuty integration to use"}),integrationName:o.String({description:"Human readable name of the PagerDuty integration"})},{$id:"RuleTargetConfigPagerDuty"}),o.Object({type:o.Literal("microsoft-teams"),integrationId:o.String({description:"Identifier of the Microsoft Teams integration to use"}),integrationName:o.String({description:"Human readable name of the Microsoft Teams integration"})},{$id:"RuleTargetConfigMicrosoftTeams"}),o.Object({type:o.Literal("webhook"),integrationId:o.String({description:"Identifier of the webhook integration to use"}),integrationName:o.String({description:"Human readable name of the webhook integration"})},{$id:"RuleTargetConfigWebhook"}),o.Object({type:o.Literal("servicenow"),integrationId:o.String({description:"Identifier of the ServiceNow integration to use"}),integrationName:o.String({description:"Human readable name of the ServiceNow integration"})},{$id:"RuleTargetConfigServiceNow"}),o.Object({type:o.Literal("google-chat"),integrationId:o.String({description:"Identifier of the Google Chat integration to use"}),integrationName:o.String({description:"Human readable name of the Google Chat integration"})},{$id:"RuleTargetConfigGoogleChat"}),o.Object({type:o.Literal("squadcast"),integrationId:o.String({description:"Identifier of the Squadcast integration to use"}),integrationName:o.String({description:"Human readable name of the Squadcast integration"})},{$id:"RuleTargetConfigSquadcast"})],{description:"Configuration describing how the alert was delivered"})}),km=F("type",[o.Object({type:o.Literal("specific-teams"),teams:o.Array(u(),{minItems:1,maxItems:100,description:"Team IDs to select"})}),o.Object({type:o.Literal("all-teams")}),o.Object({type:o.Literal("all-public-teams")})]),mi=o.Object({name:u({description:"Display name of the notification rule"}),queryString:o.Optional(u({type:"tags-query",description:"Query string that narrows down which alerts trigger the rule"})),teamsFilter:km,prioritiesFilter:o.Array(o.Enum(Gt),{maxItems:Gt.length,description:"Priorities that narrow down the alerts that can trigger a notification"}),transitionTypesFilter:o.Array(o.Enum(Wr),{maxItems:Wr.length,description:"Alert state transitions that can trigger a notification"}),clusterIdsFilter:o.Optional(o.Array(u({allowEmpty:!1}),{description:"Cluster IDs that can trigger a notification"})),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the rule"}),tags:ce,isActive:o.Boolean(),targets:o.Array(NU,{minItems:1,description:"Notification targets that can receive notifications when the rule matches"})}),Um=F("type",[o.Object({type:o.Literal("specific-teams"),teams:o.Array(o.String(),{description:"Team IDs to select"})}),o.Object({type:o.Literal("all-teams")}),o.Object({type:o.Literal("all-public-teams")})]),Vn=o.Object({id:o.String({description:"Identifier of the notification rule"}),name:o.String({description:"Display name of the notification rule"}),queryString:o.Optional(o.String({description:"Query string that narrows down which alerts trigger the rule"})),teamsFilter:Um,prioritiesFilter:o.Array(o.Enum(Gt),{description:"Priorities that narrow down the alerts that can trigger a notification"}),transitionTypesFilter:o.Array(o.Enum(Wr),{description:"Alert state transitions that can trigger a notification"}),clusterIdsFilter:o.Array(o.String(),{description:"Cluster IDs that can trigger a notification"}),owner:o.String({description:"Team ID that owns and manages the rule"}),createdAt:A(),updatedAt:A(),isActive:o.Boolean(),tags:ce,targets:o.Array(MU,{description:"Notification targets that can receive notifications when the rule matches"}),creator:o.Optional(_e),updater:o.Optional(_e)}),Ume=f({tags:["notification-rules"],url:Qr,method:"GET",response:o.Array(Vn)}),Lme=f({tags:["notification-rules"],url:`${Qr}/:id`,params:o.Object({id:u()}),method:"GET",response:Vn}),Nme=f({tags:["notification-rules"],url:Qr,method:"POST",body:mi,response:Vn}),Mme=f({tags:["notification-rules"],url:`${Qr}/:id`,method:"PUT",params:o.Object({id:u()}),body:mi,response:Vn}),wme=f({tags:["notification-rules"],url:`${Qr}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),$me=f({tags:["notification-integrations"],url:`${ah}/start`,method:"POST",response:o.Object({redirectUrl:o.String()})}),wU=o.Object({id:o.String(),name:o.String(),type:o.Enum(["slack","incident-io","grafana-irm","pagerduty","microsoft-teams","webhook","servicenow","google-chat","squadcast"]),createdAt:A(),ruleCount:o.Number(),creator:o.Optional(_e)}),vme=f({tags:["notification-integrations"],url:`${Qr}/integrations`,method:"GET",response:o.Array(wU)}),Gme=f({tags:["notification-integrations"],url:`${ah}/callback`,method:"GET",query:o.Object({code:u()}),response:o.Object({success:o.Boolean()})}),Lm=["POST","PUT"],$U=o.Record(o.String(),o.String()),vU=o.Record(o.String(),o.Unknown()),GU=o.Record(o.String(),o.Union([o.String(),o.Number(),o.Boolean(),o.Null(),o.Array(o.Union([o.String(),o.Number(),o.Boolean()]))])),DU=F("type",[o.Object({type:o.Literal("json"),value:vU}),o.Object({type:o.Literal("form"),value:GU})]),jU=o.Object({ok:o.String(),alert:o.String()}),Nm=o.Object({id:o.String(),name:o.String(),setting:F("type",[o.Object({type:o.Literal("incident-io"),alertSourceConfigId:o.String(),tokenLastChars:o.String()}),o.Object({type:o.Literal("grafana-irm"),urlLastChars:o.String()}),o.Object({type:o.Literal("pagerduty"),integrationKeyLastChars:o.String()}),o.Object({type:o.Literal("microsoft-teams"),webhookUrlLastChars:o.String()}),o.Object({type:o.Literal("webhook"),urlLastChars:o.String(),method:o.Enum(Lm),authentication:F("type",[o.Object({type:o.Literal("bearer"),tokenLastChars:o.String()}),o.Object({type:o.Literal("basic"),username:o.String(),passwordLastChars:o.String()}),o.Object({type:o.Literal("custom-header"),key:o.String(),valueLastChars:o.String()}),o.Object({type:o.Literal("none")})]),customHeaders:o.Optional($U),payloadTemplate:DU,eventNameMapping:o.Optional(jU)}),o.Object({type:o.Literal("servicenow"),instanceName:o.String(),username:o.String(),passwordLastChars:o.String()}),o.Object({type:o.Literal("google-chat"),webhookUrlLastChars:o.String()}),o.Object({type:o.Literal("squadcast"),webhookUrlLastChars:o.String()})]),tags:ce}),FU=o.Object({type:o.Literal("webhook"),url:u({type:"uri"}),method:o.Enum(Lm),authentication:F("type",[o.Object({type:o.Literal("bearer"),token:u({allowEmpty:!1})}),o.Object({type:o.Literal("basic"),username:u({allowEmpty:!1}),password:u({allowEmpty:!1})}),o.Object({type:o.Literal("custom-header"),key:u({allowEmpty:!1}),value:u({allowEmpty:!1})}),o.Object({type:o.Literal("none")})]),customHeaders:o.Record(u({allowEmpty:!1}),u()),payloadTemplate:F("type",[o.Object({type:o.Literal("json"),value:o.Record(u({allowEmpty:!1}),o.Unknown())}),o.Object({type:o.Literal("form"),value:o.Record(u({allowEmpty:!1}),o.Union([o.String(),o.Number(),o.Boolean(),o.Null(),o.Array(o.Union([o.String(),o.Number(),o.Boolean()]))]))})]),eventNameMapping:o.Optional(o.Object({ok:u({allowEmpty:!1}),alert:u({allowEmpty:!1})}))}),ph=o.Object({type:o.Literal("incident-io"),alertSourceConfigId:u(),token:u()}),ch=o.Object({type:o.Literal("grafana-irm"),url:u({type:"uri"})}),uh=o.Object({type:o.Literal("pagerduty"),integrationKey:u()}),lh=o.Object({type:o.Literal("microsoft-teams"),webhookUrl:u({type:"uri"})}),qU=o.Object({type:o.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})}),BU=o.Object({type:o.Literal("google-chat"),webhookUrl:u({type:"uri"})}),HU=o.Object({type:o.Literal("squadcast"),webhookUrl:u({type:"uri"})}),KU=o.Object({name:u(),setting:F("type",[ph,ch,uh,lh,FU,qU,BU,HU]),tags:ce}),zU=o.Object({type:o.Literal("webhook"),url:o.Optional(u({type:"uri"})),method:o.Optional(o.Enum(Lm)),authentication:o.Optional(F("type",[o.Object({type:o.Literal("bearer"),token:o.Optional(u({allowEmpty:!1}))}),o.Object({type:o.Literal("basic"),username:o.Optional(u({allowEmpty:!1})),password:o.Optional(u({allowEmpty:!1}))}),o.Object({type:o.Literal("custom-header"),key:o.Optional(u({allowEmpty:!1})),value:o.Optional(u({allowEmpty:!1}))}),o.Object({type:o.Literal("none")})])),customHeaders:o.Optional(o.Record(u({allowEmpty:!1}),u())),payloadTemplate:o.Optional(F("type",[o.Object({type:o.Literal("json"),value:o.Record(u({allowEmpty:!1}),o.Unknown())}),o.Object({type:o.Literal("form"),value:o.Record(u({allowEmpty:!1}),o.Union([o.String(),o.Number(),o.Boolean(),o.Null(),o.Array(o.Union([o.String(),o.Number(),o.Boolean()]))]))})])),eventNameMapping:o.Optional(o.Object({ok:o.Optional(u({allowEmpty:!1})),alert:o.Optional(u({allowEmpty:!1}))}))}),VU=o.Object({type:o.Literal("servicenow"),instanceName:o.Optional(u({allowEmpty:!1})),username:o.Optional(u({allowEmpty:!1})),password:o.Optional(u({allowEmpty:!1}))}),YU=o.Object({type:o.Literal("google-chat"),webhookUrl:u({type:"uri"})}),WU=o.Object({type:o.Literal("squadcast"),webhookUrl:u({type:"uri"})}),QU=o.Object({name:o.Optional(u()),setting:o.Optional(F("type",[ph,ch,uh,lh,zU,VU,YU,WU]))}),Dme=f({tags:["notification-integrations"],url:Ga,method:"POST",body:KU,response:Nm}),jme=f({tags:["notification-integrations"],url:`${Ga}/:id`,method:"GET",params:o.Object({id:u()}),response:Nm}),Fme=f({tags:["notification-integrations"],url:`${Ga}/:id`,method:"PUT",params:o.Object({id:u()}),body:QU,response:Nm}),qme=f({tags:["notification-integrations"],url:`${Ga}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),Bme=f({tags:["notification-rules"],url:`${Ot}/:id/notifications`,method:"GET",params:o.Object({id:u()}),query:o.Optional(o.Object({from:o.Optional(o.Number()),to:o.Optional(o.Number())})),response:o.Object({notifications:o.Array(o.Object({id:o.String(),monitorId:o.String(),monitorResultId:o.String(),ruleId:o.Optional(o.String()),targetId:o.Optional(o.String()),status:o.Enum(LU),tryCount:o.Number(),nextTryAt:A(),createdAt:A(),updatedAt:A(),sentAt:o.Optional(A())})),isTruncated:o.Boolean()})}),ZU=["slack","incident-io","pagerduty","email","grafana-irm","microsoft-teams","webhook","servicenow","google-chat","squadcast"],Hme=f({tags:["notification-rules"],url:`${Qr}/test`,method:"POST",body:o.Object({notificationRule:mi,targetIds:o.Optional(o.Array(u({allowEmpty:!1}),{description:"Target IDs to test specific targets",minItems:1,maxItems:10}))}),response:F("success",[o.Object({success:o.Literal(!1),overallMessage:o.String({description:"Message when there is an overall error"})}),o.Object({success:o.Boolean(),results:o.Array(o.Object({targetId:o.String({description:"The ID of the target that was tested"}),targetType:o.Enum(ZU,{description:"The type of the target (e.g., slack, webhook)"}),status:o.Enum(["success","failure"],{description:"Whether the test notification was sent successfully"}),message:o.Optional(o.String({description:"Message if the notification failed for this specific target"}))}))})])});var pi=`/${"v1"}/notification-rules`,ci=o.Pick(Vn,["id","name","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","isActive","tags","targets"],{$id:"Rule",description:"Rules to trigger notifications to targets based on alert events"}),JU={id:"123-456-abc",name:"Critical Alerts",teamsFilter:{type:"all-teams"},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"],clusterIdsFilter:[],owner:"abc-123-def",isActive:!0,tags:[{key:"channel",value:"alerts"}],targets:[{id:"789-abc-def",config:{type:"email",addresses:["oncall@example.com"]}}]};Object.assign(ci,{examples:[JU]});var dh=f({description:"Retrieve all notification rules",operationId:"listNotificationRules",tags:["notification-rules"],url:pi,method:"GET",response:o.Array(ci)}),fh=f({description:"Retrieve a notification rule by its id",operationId:"getNotificationRule",tags:["notification-rules"],url:`${pi}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:ci}),Mm=o.Pick(mi,["name","teamsFilter","prioritiesFilter","transitionTypesFilter","clusterIdsFilter","owner","tags","isActive","targets"]),XU={name:"Critical Alerts",teamsFilter:{type:"all-teams"},prioritiesFilter:[1,2],transitionTypesFilter:["triggered","resolved"],clusterIdsFilter:[],owner:"abc-123-def",isActive:!0,tags:[{key:"channel",value:"alerts"}],targets:[{id:"789-abc-def",config:{type:"email",addresses:["oncall@example.com"]}}]};Object.assign(Mm,{examples:[XU]});var gh=f({description:"Create a new notification rule",operationId:"createNotificationRule",tags:["notification-rules"],url:pi,method:"POST",body:Mm,response:ci}),yh=f({description:"Update a notification rule by its id",operationId:"updateNotificationRule",tags:["notification-rules"],url:`${pi}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:Mm,response:ci}),Ih=f({description:"Delete a notification rule by its id",operationId:"deleteNotificationRule",tags:["notification-rules"],url:`${pi}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var ui=`${si}/silences`,eL=o.Partial(o.Record(o.Union([o.Literal("monday"),o.Literal("tuesday"),o.Literal("wednesday"),o.Literal("thursday"),o.Literal("friday"),o.Literal("saturday"),o.Literal("sunday")]),o.Array(o.Object({startTime:o.String({format:"time"}),endTime:o.String({format:"time"})},{title:"SilenceTimeRange"}),{minItems:1,description:"Time ranges for this day"}),{description:"Weekly schedule mapping day of week to time ranges"})),Eh=F("type",[o.Object({type:o.Literal("one-time"),startTime:o.String({format:"date-time"}),endTime:o.String({format:"date-time"})},{$id:"SilenceScheduleOneTime",description:"One-time silence schedule with specific start and end times"}),o.Object({type:o.Literal("recurring"),weeklySchedule:eL},{$id:"SilenceScheduleRecurring",description:"Recurring weekly silence schedule"})],{description:"Schedule defining when the silence is active"}),Da=o.Object({name:u({description:"Display name of the silence"}),reason:u({allowEmpty:!1,description:"Reason for the silence"}),owner:u({allowEmpty:!1,description:"Team ID that owns and manages the silence"}),tags:ce,isActive:o.Boolean({description:"Whether the silence is currently enabled"}),schedule:Eh,notificationRuleIds:o.Optional(o.Array(u(),{description:"Notification rule IDs this silence applies to"})),queryString:o.Optional(u({type:"tags-query",description:"Query string to filter which alerts this silence applies to"})),teamsFilter:km,prioritiesFilter:o.Array(o.Enum(Gt),{maxItems:Gt.length,description:"Monitor priorities to filter which alerts this silence applies to"}),transitionTypesFilter:o.Array(o.Enum(Wr),{maxItems:Wr.length,description:"Transition types to filter which alerts this silence applies to"})}),Yn=o.Object({id:o.String({description:"Unique identifier of the silence"}),name:o.String({description:"Display name of the silence"}),reason:o.String({description:"Reason for the silence"}),owner:o.String({description:"Team ID that owns and manages the silence"}),tags:ce,isActive:o.Boolean({description:"Whether the silence is currently enabled"}),schedule:Eh,notificationRuleIds:o.Optional(o.Array(o.String(),{description:"Notification rule IDs this silence applies to"})),queryString:o.Optional(o.String({description:"Query string filtering which alerts this silence applies to"})),teamsFilter:Um,prioritiesFilter:o.Array(o.Enum(Gt),{description:"Monitor priorities filtering which alerts this silence applies to"}),transitionTypesFilter:o.Array(o.Enum(Wr),{description:"Transition types filtering which alerts this silence applies to"}),createdAt:A(),updatedAt:A(),creator:o.Optional(_e),updater:o.Optional(_e)}),spe=f({tags:["notification-silences"],url:ui,method:"GET",response:o.Array(Yn)}),mpe=f({tags:["notification-silences"],url:`${ui}/:id`,params:o.Object({id:u()}),method:"GET",response:Yn}),ppe=f({tags:["notification-silences"],url:ui,method:"POST",body:Da,response:Yn}),cpe=f({tags:["notification-silences"],url:`${ui}/:id`,method:"PUT",params:o.Object({id:u()}),body:Da,response:Yn}),upe=f({tags:["notification-silences"],url:`${ui}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H});var li=`/${"v1"}/notification-silences`,ja=o.Pick(Yn,["id","name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"],{$id:"NotificationSilence",description:"Silences to suppress notifications based on schedules and filters"}),hh=f({description:"Retrieve all notification silences",operationId:"listNotificationSilences",tags:["notification-silences"],url:li,method:"GET",response:o.Array(ja)}),Th=f({description:"Retrieve a notification silence by its id",operationId:"getNotificationSilence",tags:["notification-silences"],url:`${li}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:ja}),xh=o.Pick(Da,["name","reason","owner","tags","isActive","schedule","notificationRuleIds","queryString","teamsFilter","prioritiesFilter","transitionTypesFilter"]),_h=f({description:"Create a new notification silence",operationId:"createNotificationSilence",tags:["notification-silences"],url:li,method:"POST",body:xh,response:ja}),Ah=f({description:"Update a notification silence by its id",operationId:"updateNotificationSilence",tags:["notification-silences"],url:`${li}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:xh,response:ja}),bh=f({description:"Delete a notification silence by its id",operationId:"deleteNotificationSilence",tags:["notification-silences"],url:`${li}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var tL=["passed","failed","ignored"],rL=o.Enum(tL),Oh=["unrouted-logs","team-has-route","service-name-present","no-orphan-spans","metric-unit-consistency","host-name-present","no-casing-drift","no-duplicate-attr-values","no-debug-logs-in-prod","no-multiline-logs","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"],nL=o.Enum(Oh),oL=["log","metric","resource","span"],iL=["team","global"],wm=o.Object({key:o.Enum(Oh),title:o.String(),summary:o.String(),rationale:o.String(),objectType:o.Enum(oL),category:o.Enum(["hygiene","routing","integrity","consistency","redundancy","cost"]),impact:o.Object({label:o.Enum(["critical","important","normal"]),weight:o.Number({minimum:0})}),recommendation:o.String(),scope:o.Optional(o.Enum(iL))}),$m=o.Intersect([wm,o.Object({status:rL,normalizedScore:o.Number({minimum:0,maximum:1}),details:o.Optional(o.Record(o.String(),o.Unknown())),recommendation:o.Optional(o.String()),examples:o.Optional(o.Array(o.Object({type:o.String(),label:o.String(),link:o.Object({to:o.String(),search:o.Optional(o.Unknown()),params:o.Optional(o.Unknown())})})))})]),aL=o.Object({teamId:o.String(),teamName:o.String(),teamWeight:o.Number({minimum:0}),score:o.Number({minimum:0,maximum:1}),weightedScore:o.Number({minimum:0}),totalWeight:o.Number({minimum:0}),ruleResults:o.Array($m)}),sL=o.Object({score:o.Optional(o.Number({minimum:0,maximum:1})),ruleResults:o.Array($m)}),Fa=o.Object({generatedAt:o.String({format:"date-time"}),overallScore:o.Optional(o.Number({minimum:0,maximum:1})),rules:o.Array(wm),teamResults:o.Array(aL),globalResults:o.Optional(sL)}),Ape=f({tags:["quality-reports"],url:"/v0/quality-reports",method:"POST",response:Fa}),bpe=f({tags:["quality-reports"],url:"/v0/quality-reports/latest",method:"GET",query:o.Object({clusterId:o.Optional(u({allowEmpty:!1}))}),response:o.Object({report:o.Optional(Fa)})}),Ope=f({tags:["quality-reports"],url:"/v0/quality-reports/preview",method:"POST",body:o.Object({ruleKey:nL,teamId:u(),lookbackMinutes:o.Optional(o.Integer({minimum:1,maximum:60})),clusterId:o.Optional(u({allowEmpty:!1}))}),response:o.Object({rule:wm,result:$m,teamId:o.String(),teamName:o.String()})});var mL=`/${"v1"}/quality-reports`,Sh=o.Pick(Fa,["generatedAt","overallScore","rules","teamResults","globalResults"],{$id:"QualityReport",description:"Aggregated quality report with per-team rule evaluations and scores"}),pL={generatedAt:"2026-02-26T12:00:00.000Z",overallScore:.85,rules:[{key:"team-has-route",title:"\u22651 route per team",summary:"Each team owns at least one active route.",rationale:"Provides clear governance boundaries for routing and enrichment.",objectType:"resource",category:"routing",impact:{label:"important",weight:2},recommendation:"Ensure every team manages a dedicated route scoped to its context.team value."}],teamResults:[{teamId:"abc-123-def",teamName:"platform",teamWeight:1,score:.85,weightedScore:.85,totalWeight:2,ruleResults:[{key:"team-has-route",title:"\u22651 route per team",summary:"Each team owns at least one active route.",rationale:"Provides clear governance boundaries for routing and enrichment.",objectType:"resource",category:"routing",impact:{label:"important",weight:2},recommendation:"Ensure every team manages a dedicated route scoped to its context.team value.",status:"passed",normalizedScore:1}]}]};Object.assign(Sh,{examples:[pL]});var Rh=f({description:"Retrieve the latest quality report",operationId:"getLatestQualityReport",tags:["quality-reports"],url:`${mL}/latest`,method:"GET",query:o.Object({clusterId:o.Optional(u({allowEmpty:!1}))}),response:o.Object({report:o.Optional(Sh)})});var di="/v0/admin-center";var Dt=`${di}/retention-policies`,vm=["1-day","3-days","15-days","30-days","60-days","90-days","120-days","180-days","360-days","10-years"],Yt=o.Object({id:o.String(),env:o.Optional(o.String()),teamId:o.Optional(o.String()),dataSource:o.Enum(bt),durationDays:o.Enum(vm),isEnabled:o.Boolean(),createdAt:A(),updatedAt:A()}),qa=o.Object({env:o.Optional(u()),teamId:o.Optional(u()),dataSource:o.Enum(bt),durationDays:o.Enum(vm),isEnabled:o.Boolean()}),Ch=o.Array(o.Object({env:u(),dataSource:o.Enum(bt),durationDays:o.Enum([...vm,"default"]),isEnabled:o.Boolean()})),Ph=o.Object({inserted:o.Array(Yt),updated:o.Array(Yt),deleted:o.Array(Yt)}),jpe=f({tags:["retention-policies"],url:Dt,method:"POST",body:qa,response:Yt}),Fpe=f({tags:["retention-policies"],url:Dt,method:"GET",response:o.Array(Yt)}),qpe=f({tags:["retention-policies"],url:`${Dt}/:id`,method:"GET",params:o.Object({id:u()}),response:Yt}),Bpe=f({tags:["retention-policies"],url:`${Dt}/:id`,method:"PUT",params:o.Object({id:u()}),body:qa,response:Yt}),Hpe=f({tags:["retention-policies"],url:`${Dt}/bulk-update`,method:"POST",body:Ch,response:Ph}),Kpe=f({tags:["retention-policies"],url:`${Dt}/bulk-update-for-team`,method:"POST",body:o.Object({teamId:u(),policies:Ch}),response:Ph}),zpe=f({tags:["retention-policies"],url:`${Dt}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),fi=["past-24-hours","past-7-days","past-30-days"],Vpe=f({tags:["retention-policies"],url:`${Dt}/requested-history-percentile/:teamId`,method:"POST",params:o.Object({teamId:u()}),body:o.Object({percentile:o.Number({minimum:0,maximum:1}),observationWindow:o.Enum(fi),dataSource:o.Enum(bt)}),response:o.Object({percentile:o.Number({minimum:0,maximum:1}),observationWindow:o.Enum(fi),dataSource:o.Enum(bt),teamId:o.String(),requestedHistoryDays:o.Number()})}),cL=["1-day","3-days","7-days","1-month","6-months","more-than-6-months"];var uL=o.Array(o.Object({bucket:o.Enum(cL),count:o.Number()})),Ype=f({tags:["retention-policies"],url:`${Dt}/requested-history-histogram/:teamId`,method:"POST",params:o.Object({teamId:u()}),body:o.Object({observationWindow:o.Enum(fi),dataSource:o.Enum(bt)}),response:o.Object({observationWindow:o.Enum(fi),dataSource:o.Enum(bt),teamId:o.String(),histogram:uL})}),Wpe=f({tags:["retention-policies"],url:`${Dt}/top-teams-with-retention-surplus`,method:"POST",body:o.Object({dataSource:o.Enum(bt),observationWindow:o.Enum(fi),percentile:o.Number({minimum:0,maximum:1}),topN:o.Optional(o.Number({minimum:1,maximum:20}))}),response:o.Array(o.Object({teamId:o.String(),retentionSurplusDays:o.Number()}))});var gi=`/${"v1"}/retention-policies`,yi=o.Pick(Yt,["id","env","teamId","dataSource","durationDays","isEnabled"],{$id:"RetentionPolicy",description:"Data retention rule for a data source within an environment"}),lL={id:"123-456-abc",env:"production",teamId:"abc-123-def",dataSource:"logs",durationDays:"30-days",isEnabled:!0};Object.assign(yi,{examples:[lL]});var kh=f({description:"Retrieve all retention policies",operationId:"listRetentionPolicies",tags:["retention-policies"],url:gi,method:"GET",response:o.Array(yi)}),Uh=f({description:"Retrieve a retention policy by its id",operationId:"getRetentionPolicy",tags:["retention-policies"],url:`${gi}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:yi}),Gm=o.Pick(qa,["env","teamId","dataSource","durationDays","isEnabled"]),dL={env:"production",teamId:"abc-123-def",dataSource:"logs",durationDays:"30-days",isEnabled:!0};Object.assign(Gm,{examples:[dL]});var Lh=f({description:"Create a new retention policy",operationId:"createRetentionPolicy",tags:["retention-policies"],url:gi,method:"POST",body:Gm,response:yi}),Nh=f({description:"Update a retention policy by its id",operationId:"updateRetentionPolicy",tags:["retention-policies"],url:`${gi}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:Gm,response:yi}),Mh=f({description:"Delete a retention policy by its id",operationId:"deleteRetentionPolicy",tags:["retention-policies"],url:`${gi}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var Ba={id:u({allowEmpty:!1,description:"Identifier of the processor"}),description:o.Optional(u({type:"long"})),tags:ce,updatedAt:o.Optional(A())},fL={...Ba,type:o.Literal("creator")},gL=F("subtype",[o.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:o.Optional(o.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:o.Literal("format-string"),replaceMissingByEmpty:o.Optional(o.Boolean())},{$id:"ProcessorParamsCreatorFormatString"}),o.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:o.Optional(o.Boolean({description:"Set to true to overwrite an existing target attribute value (defaults to true)"})),subtype:o.Literal("math-formula"),replaceMissingBy0:o.Optional(o.Boolean())},{$id:"ProcessorParamsCreatorMathFormula"})]),yL=o.Object({...fL,params:gL}),IL={...Ba,type:o.Literal("mapper")},EL=F("subtype",[o.Object({attributes:o.Array(o.Object({originAttribute:u({allowEmpty:!1,description:"Attribute name to map to the target attribute"}),keepOrigin:o.Optional(o.Boolean({description:"Preserve the source attribute after mapping (defaults to false)"})),overrideTarget:o.Optional(o.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:o.Literal("map-attributes")},{$id:"ProcessorParamsMapperMapAttributes"}),o.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will determine the log level"}),subtype:o.Literal("map-level")},{$id:"ProcessorParamsMapperMapLevel"}),o.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will determine the log timestamp"}),subtype:o.Literal("map-timestamp")},{$id:"ProcessorParamsMapperMapTimestamp"})]),hL=o.Object({...IL,params:EL}),TL={...Ba,type:o.Literal("parse-attribute")},xL=5,_L=F("subtype",[o.Object({attributeName:u({allowEmpty:!1,description:"Attribute whose value will be parsed with Grok rules"}),rules:o.Array(u({allowEmpty:!1,type:"long",description:"Grok rule applied to parse text"}),{minItems:1,maxItems:5,description:"Ordered Grok rules evaluated until one matches"}),samples:o.Optional(o.Array(u({type:"long"}),{maxItems:xL,description:"Example log lines for validation"})),subtype:o.Literal("grok")}),o.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the URL to parse"}),subtype:o.Literal("url")}),o.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the user agent string to parse"}),subtype:o.Literal("user-agent")}),o.Object({sourceAttribute:u({allowEmpty:!1,description:"Attribute containing the key/value string segment to parse"}),targetAttribute:u({description:"Attribute prefix 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. Will default to whitespace if not set."}),acceptStandaloneKey:o.Boolean(),subtype:o.Literal("key-value")})]),AL=o.Object({...TL,params:_L}),bL=11,Dm=o.Cyclic({Processor:o.Union([hL,AL,yL,o.Object({...Ba,params:o.Object({items:o.Array(o.Object({query:u({type:"tsuga-query",description:"Query that determines whether logs enter this branch"}),processors:o.Array(o.Ref("Processor"),{maxItems:50,description:"Processors executed when the branch query matches"})}),{minItems:2,maxItems:bL,description:"Conditional branches evaluated in order before falling back to the default"})}),type:o.Literal("split")})])},"Processor",{description:"Processing step executed sequentially on route logs"});var OL="/v0/logs",br=`${OL}/routes`,Zr=o.Object({id:o.String({description:"Identifier of the log route"}),name:o.String({description:"Human readable name shown for the route"}),description:o.Optional(o.String()),isEnabled:o.Boolean(),query:o.String({description:"Query that selects which logs should enter the route"}),rank:o.Number(),tags:ce,owner:o.String({description:"Team ID owning and managing the route"}),processors:o.Array(Dm,{description:"Ordered processors applied to logs that match the route"}),creator:o.Optional(_e),updater:o.Optional(_e),updatedAt:A(),createdAt:A(),assetUpdatedAt:A(),lastSyncedAt:o.Optional(A())},{title:"Route"}),Ii=o.Object({name:u({allowEmpty:!1,description:"Human readable name shown for the route"}),description:o.Optional(u({type:"long"})),isEnabled:o.Boolean(),query:u({type:"tsuga-query",description:"Query that selects which logs should enter the route"}),tags:ce,owner:u({allowEmpty:!1,description:"Team ID owning and managing the route"}),processors:o.Array(Dm,{maxItems:50,description:"Ordered processors applied to logs that match the route"})}),yce=f({tags:["routes"],url:br,method:"GET",response:o.Array(Zr)}),Ice=f({tags:["routes"],url:`${br}/:id`,params:o.Object({id:u()}),method:"GET",response:Zr}),Ece=f({tags:["routes"],url:br,method:"POST",body:Ii,response:Zr}),hce=f({tags:["routes"],url:`${br}/:id`,method:"PUT",body:Ii,params:o.Object({id:u()}),response:Zr}),Tce=f({tags:["routes"],url:`${br}/:id/clone`,method:"POST",params:o.Object({id:u()}),body:Ii,response:Zr}),xce=f({tags:["routes"],url:`${br}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),_ce=f({tags:["routes"],url:`${br}/:id/modify-ranking`,method:"PUT",params:o.Object({id:u()}),body:o.Object({rank:o.Number()}),response:o.Object({})}),Ace=f({tags:["routes"],url:`${br}/:id/enable`,method:"PUT",params:o.Object({id:u()}),body:o.Object({enable:o.Boolean()}),response:o.Object({})});var Ei=`/${"v1"}/routes`,hi=o.Pick(Zr,["id","name","description","isEnabled","query","tags","owner","processors"],{$id:"Route",description:"Log route allowing to standardize logs and enrich them with additional data"}),SL={id:"123-456-abc",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:"abc-123-def",processors:[{id:"789-abc-def",type:"parse-attribute",tags:[],params:{subtype:"grok",attributeName:"message",rules:["%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:msg}"]}}]};Object.assign(hi,{examples:[SL]});var wh=f({description:"Retrieve all routes",operationId:"listRoutes",tags:["routes"],url:Ei,method:"GET",response:o.Array(hi)}),$h=f({description:"Retrieve a route by its id",operationId:"getRoute",tags:["routes"],url:`${Ei}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:hi}),jm=o.Pick(Ii,["name","description","isEnabled","query","tags","owner","processors"]),RL={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:"abc-123-def",processors:[{id:"789-abc-def",type:"parse-attribute",tags:[],params:{subtype:"grok",attributeName:"message",rules:["%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} %{GREEDYDATA:msg}"]}}]};Object.assign(jm,{examples:[RL]});var vh=f({description:"Create a new route",operationId:"createRoute",tags:["routes"],url:Ei,method:"POST",body:jm,response:hi}),Gh=f({description:"Update a route by its id",operationId:"updateRoute",tags:["routes"],url:`${Ei}/:id`,method:"PUT",body:jm,params:o.Object({id:u({allowEmpty:!1})}),response:hi}),Dh=f({description:"Delete a route by its id",operationId:"deleteRoute",tags:["routes"],url:`${Ei}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var nt="context",Lce=`${nt}.team`,Nce=`${nt}.env`,Mce=`${nt}.api_key_id`,wce=`${nt}.service.name`,$ce=`${nt}.service.version`,CL=`${nt}.host.name`,PL=`${nt}.instance`,kL=`${nt}.instanceid`,UL=`${nt}.instance_name`,vce=`${nt}.telemetry.sdk.language`;var Gce={name:"tsuga.internal.event_size_bytes",attributes:{batchKind:`${nt}.batch_kind`,batchKindMetricsFilter:`${nt}.batch_kind:metrics`,sourceApiKeyId:`${nt}.source_api_key_id`,sourceEnv:`${nt}.source_env`,sourceTeam:`${nt}.source_team`}};var Wn="/v0/service-catalog";var jh=o.Object({team:o.String(),lastSeenAt:A()}),LL=o.Object({ingestionApiKey:o.String(),lastSeenAt:A()}),Fh=o.Object({version:o.String(),firstSeenAt:A(),lastSeenAt:A(),faulty:o.Optional(o.Boolean())}),NL=o.Object({language:o.String(),lastSeenAt:A()}),Ha=o.Object({id:o.String(),serviceName:o.String(),serviceNamespace:o.Optional(o.String()),env:o.Optional(o.String()),teams:o.Array(jh),ingestionApiKeys:o.Array(LL),versions:o.Array(Fh),languages:o.Array(NL),lastSeenAt:A(),firstSeenAt:A(),sources:o.Array(o.String()),additionalUserFields:o.Optional(o.Unsafe({type:"object",additionalProperties:!0})),logsCount24h:o.Number(),errorLogsCount24h:o.Number(),tracesCount24h:o.Number(),errorTracesCount24h:o.Number(),createdAt:A(),updatedAt:A()}),Hce=f({tags:["service-catalog"],query:o.Optional(o.Object({clusterId:o.Optional(u())})),method:"GET",url:`${Wn}/services`,response:o.Array(Ha)}),Kce=f({tags:["service-catalog"],method:"GET",url:`${Wn}/services/:serviceId`,params:o.Object({serviceId:u()}),response:Ha}),ML=o.Object({id:o.String(),endpointName:o.String(),serviceName:o.String(),serviceNamespace:o.Optional(o.String()),env:o.Optional(o.String()),teams:o.Array(jh),versions:o.Array(Fh),lastSeenAt:A(),firstSeenAt:A(),sources:o.Array(o.String()),additionalUserFields:o.Optional(o.Unsafe({type:"object",additionalProperties:!0})),createdAt:A(),updatedAt:A()}),zce=f({tags:["service-catalog"],method:"GET",url:`${Wn}/endpoints`,response:o.Array(ML)}),wL=["otel_kube","otel_host_kube","otel_host","prometheus","aws_ec2","gcp_compute_engine"];var qh=o.Object({id:o.String(),hostName:o.String(),env:o.Optional(o.String()),cpuUtilizationAverage:o.Number(),hostType:o.Enum(wL),teams:o.Array(o.String()),tags:o.Array(o.String()),firstSeenAt:A(),lastSeenAt:A(),clusterId:o.String()}),Vce=f({tags:["service-catalog"],method:"GET",url:`${Wn}/hosts`,response:o.Array(qh)}),Yce=f({tags:["service-catalog"],method:"GET",url:`${Wn}/hosts/:hostId`,params:o.Object({hostId:u()}),response:qh}),Wce=f({tags:["service-catalog"],method:"GET",url:`${Wn}/services/by-api-keys`,response:o.Record(o.String(),o.Array(o.Object({serviceName:o.String(),serviceNamespace:o.Optional(o.String())})))});var Bh=`/${"v1"}/services`,Fm=o.Pick(Ha,["id","serviceName","serviceNamespace","env","teams","versions","languages","lastSeenAt","firstSeenAt","sources","logsCount24h","errorLogsCount24h","tracesCount24h","errorTracesCount24h"],{$id:"Service",description:"Observed telemetry service with metadata, activity stats and version signals"}),$L={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:!1}],languages:[{language:"go",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(Fm,{examples:[$L]});var Hh=f({description:"Retrieve all services",operationId:"listServices",tags:["services"],url:Bh,method:"GET",response:o.Array(Fm)}),Kh=f({description:"Retrieve a service by its id",operationId:"getService",tags:["services"],url:`${Bh}/:serviceId`,method:"GET",params:o.Object({serviceId:u({allowEmpty:!1})}),response:Fm});var Jr=`${di}/tag-policies`;var zh=["ingestion-api-key","operation-api-key","dashboard","log-route","monitor","notification-rule","notification-silence"],vL=["logs","metrics","traces"],Vh=o.Array(o.Enum(zh)),Yh=o.Array(o.Enum(vL)),GL=o.Union([Vh,Yh]),Wh=o.Object({teamIds:o.Array(u(),{minItems:1,maxItems:100}),mode:o.Enum(["include","exclude"])}),Qh=F("type",[o.Object({type:o.Literal("telemetry"),assetTypes:Yh,shouldInsertWarning:o.Boolean(),dropSample:o.Optional(o.Number({minimum:0,maximum:100}))}),o.Object({type:o.Literal("tsuga_asset"),assetTypes:Vh})]),Qn=o.Object({id:o.String(),name:o.String(),description:o.Optional(o.String()),isActive:o.Boolean(),tagKey:o.String(),allowedTagValues:o.Array(o.String()),isRequired:o.Boolean(),teamScope:o.Optional(Wh),configuration:Qh,creator:o.Optional(_e),updater:o.Optional(_e),owner:o.Optional(o.String()),createdAt:A(),updatedAt:A(),assetUpdatedAt:A()});var Ti=o.Object({name:u(),description:o.Optional(u()),isActive:o.Boolean(),tagKey:u({allowEmpty:!1}),allowedTagValues:o.Array(u({allowEmpty:!1}),{maxItems:1e3}),isRequired:o.Boolean(),teamScope:o.Optional(Wh),configuration:Qh,owner:u({allowEmpty:!1})}),pue=f({tags:["tag-policies"],url:Jr,method:"GET",query:o.Object({teamIds:o.Optional(o.Array(u(),{maxItems:100})),assetTypes:o.Optional(GL),searchQuery:o.Optional(u())}),response:o.Array(Qn)}),cue=f({tags:["tag-policies"],url:`${Jr}/:id`,method:"GET",params:o.Object({id:u()}),response:Qn}),uue=f({tags:["tag-policies"],url:Jr,method:"POST",body:Ti,response:Qn}),lue=f({tags:["tag-policies"],url:`${Jr}/:id`,method:"PUT",params:o.Object({id:u()}),body:Ti,response:Qn}),due=f({tags:["tag-policies"],url:`${Jr}/:id`,method:"DELETE",params:o.Object({id:u()}),response:H}),fue=f({tags:["tag-policies"],url:`${di}/applicable-tag-rules`,method:"GET",query:o.Object({assetType:o.Enum(zh),teamId:u()}),response:o.Array(o.Object({tagKey:o.String(),allowedTagValues:o.Array(o.String()),isRequired:o.Boolean()}))}),Zh=o.Object({total:o.Number(),totalNonCompliant:o.Number(),idsNonCompliant:o.Array(u())}),Jh=o.Union([o.Literal("ingestion-api-key"),o.Literal("operation-api-key"),o.Literal("dashboard"),o.Literal("log-route"),o.Literal("monitor"),o.Literal("notification-rule"),o.Literal("notification-silence")]),DL=o.Object({total:o.Number(),totalNonCompliant:o.Number(),byAssetType:o.Record(Jh,Zh)}),jL=o.Omit(Zh,["total"]),FL=o.Object({totalNonCompliant:o.Number(),byAssetType:o.Record(Jh,jL)}),Xh=o.Object({totals:DL,byTeam:o.Record(o.String(),FL)}),gue=f({tags:["tag-policies"],url:`${Jr}/:id/stats`,method:"GET",params:o.Object({id:u()}),response:Xh}),yue=f({tags:["tag-policies"],url:`${Jr}/new-policy-stats`,method:"POST",body:Ti,response:Xh});var xi=`/${"v1"}/tag-policies`,Ka=o.Pick(Qn,["id","name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"],{$id:"TagPolicy",description:"Policy that enforces tag requirements on Tsuga assets or telemetry data"}),eT=o.Pick(Ti,["name","description","isActive","tagKey","allowedTagValues","isRequired","teamScope","configuration","owner"]),tT=f({description:"Retrieve all tag policies",operationId:"listTagPolicies",tags:["tag-policies"],url:xi,method:"GET",response:o.Array(Ka)}),rT=f({description:"Retrieve a tag policy by its id",operationId:"getTagPolicy",tags:["tag-policies"],url:`${xi}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:Ka}),nT=f({description:"Create a new tag policy",operationId:"createTagPolicy",tags:["tag-policies"],url:xi,method:"POST",body:eT,response:Ka}),oT=f({description:"Update a tag policy by its id",operationId:"updateTagPolicy",tags:["tag-policies"],url:`${xi}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:eT,response:Ka}),iT=f({description:"Delete a tag policy by its id",operationId:"deleteTagPolicy",tags:["tag-policies"],url:`${xi}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});var _i=`/${"v1"}/teams`,Ai=o.Pick(Bn,["id","name","description","visibility","tags"],{$id:"Team",description:"Collection of users used to manage ownership and access to resources"}),qL={id:"abc-123-def",name:"Platform Engineering",description:"Responsible for internal developer tooling and infrastructure",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(Ai,{examples:[qL]});var aT=f({description:"Retrieve all teams",operationId:"listTeams",tags:["teams"],url:_i,method:"GET",response:o.Array(Ai)}),sT=f({description:"Retrieve a team by its id",operationId:"getTeam",tags:["teams"],url:`${_i}/:id`,method:"GET",params:o.Object({id:u({allowEmpty:!1})}),response:Ai}),qm=o.Pick(Ma,["name","description","visibility","tags"]),BL={name:"Platform Engineering",description:"Responsible for internal developer tooling and infrastructure",visibility:"public",tags:[{key:"department",value:"engineering"}]};Object.assign(qm,{examples:[BL]});var mT=f({description:"Create a new team",operationId:"createTeam",tags:["teams"],url:_i,method:"POST",body:qm,response:Ai}),pT=f({description:"Update a team by its id",operationId:"updateTeam",tags:["teams"],url:`${_i}/:id`,method:"PUT",params:o.Object({id:u({allowEmpty:!1})}),body:qm,response:Ai}),cT=f({description:"Delete a team by its id",operationId:"deleteTeam",tags:["teams"],url:`${_i}/:id`,method:"DELETE",params:o.Object({id:u({allowEmpty:!1})}),response:H});function HL(e){return a.IsObject(e)&&a.HasPropertyKey(e,"check")&&a.HasPropertyKey(e,"errors")&&a.IsFunction(e.check)&&a.IsFunction(e.errors)}function Bm(e){return a.HasPropertyKey(e,"~guard")&&HL(e["~guard"])}function Hm(e){return a.HasPropertyKey(e,"~refine")&&a.IsArray(e["~refine"])&&a.Every(e["~refine"],0,t=>a.IsObject(t)&&a.HasPropertyKey(t,"refine")&&a.HasPropertyKey(t,"message")&&a.IsFunction(t.refine)&&a.IsString(t.message))}function Wt(e){return a.IsObject(e)&&!a.IsArray(e)}function za(e){return a.IsBoolean(e)}function $(e){return Wt(e)||za(e)}function Km(e){return a.HasPropertyKey(e,"additionalItems")&&$(e.additionalItems)}function Qt(e){return a.HasPropertyKey(e,"additionalProperties")&&$(e.additionalProperties)}function zm(e){return a.HasPropertyKey(e,"allOf")&&a.IsArray(e.allOf)&&e.allOf.every(t=>$(t))}function bi(e){return a.HasPropertyKey(e,"$anchor")&&a.IsString(e.$anchor)}function Vm(e){return a.HasPropertyKey(e,"anyOf")&&a.IsArray(e.anyOf)&&e.anyOf.every(t=>$(t))}function Ym(e){return a.HasPropertyKey(e,"const")}function Xr(e){return a.HasPropertyKey(e,"contains")&&$(e.contains)}function dt(e){return a.HasPropertyKey(e,"default")}function Wm(e){return a.HasPropertyKey(e,"dependencies")&&a.IsObject(e.dependencies)&&Object.values(e.dependencies).every(t=>$(t)||a.IsArray(t)&&t.every(r=>a.IsString(r)))}function Qm(e){return a.HasPropertyKey(e,"dependentRequired")&&a.IsObject(e.dependentRequired)&&Object.values(e.dependentRequired).every(t=>a.IsArray(t)&&t.every(r=>a.IsString(r)))}function Zm(e){return a.HasPropertyKey(e,"dependentSchemas")&&a.IsObject(e.dependentSchemas)&&Object.values(e.dependentSchemas).every(t=>$(t))}function Jm(e){return a.HasPropertyKey(e,"$dynamicAnchor")&&a.IsString(e.$dynamicAnchor)}function Xm(e){return a.HasPropertyKey(e,"else")&&$(e.else)}function ep(e){return a.HasPropertyKey(e,"enum")&&a.IsArray(e.enum)}function tp(e){return a.HasPropertyKey(e,"exclusiveMaximum")&&(a.IsNumber(e.exclusiveMaximum)||a.IsBigInt(e.exclusiveMaximum))}function Zt(e){return a.HasPropertyKey(e,"exclusiveMinimum")&&(a.IsNumber(e.exclusiveMinimum)||a.IsBigInt(e.exclusiveMinimum))}function Oi(e){return a.HasPropertyKey(e,"format")&&a.IsString(e.format)}function en(e){return a.HasPropertyKey(e,"$id")&&a.IsString(e.$id)}function rp(e){return a.HasPropertyKey(e,"if")&&$(e.if)}function Zn(e){return a.HasPropertyKey(e,"items")&&($(e.items)||a.IsArray(e.items)&&e.items.every(t=>$(t)))}function np(e){return Zn(e)&&a.IsArray(e.items)}function op(e){return a.HasPropertyKey(e,"maximum")&&(a.IsNumber(e.maximum)||a.IsBigInt(e.maximum))}function ip(e){return a.HasPropertyKey(e,"maxContains")&&a.IsNumber(e.maxContains)}function Va(e){return a.HasPropertyKey(e,"maxItems")&&a.IsNumber(e.maxItems)}function ap(e){return a.HasPropertyKey(e,"maxLength")&&a.IsNumber(e.maxLength)}function sp(e){return a.HasPropertyKey(e,"maxProperties")&&a.IsNumber(e.maxProperties)}function Jt(e){return a.HasPropertyKey(e,"minimum")&&(a.IsNumber(e.minimum)||a.IsBigInt(e.minimum))}function tn(e){return a.HasPropertyKey(e,"minContains")&&a.IsNumber(e.minContains)}function Jn(e){return a.HasPropertyKey(e,"minItems")&&a.IsNumber(e.minItems)}function Si(e){return a.HasPropertyKey(e,"minLength")&&a.IsNumber(e.minLength)}function Ri(e){return a.HasPropertyKey(e,"minProperties")&&a.IsNumber(e.minProperties)}function mp(e){return a.HasPropertyKey(e,"multipleOf")&&(a.IsNumber(e.multipleOf)||a.IsBigInt(e.multipleOf))}function pp(e){return a.HasPropertyKey(e,"not")&&$(e.not)}function cp(e){return a.HasPropertyKey(e,"oneOf")&&a.IsArray(e.oneOf)&&e.oneOf.every(t=>$(t))}function Ci(e){return a.HasPropertyKey(e,"pattern")&&(a.IsString(e.pattern)||e.pattern instanceof RegExp)}function Pi(e){return a.HasPropertyKey(e,"patternProperties")&&a.IsObject(e.patternProperties)&&Object.values(e.patternProperties).every(t=>$(t))}function Xn(e){return a.HasPropertyKey(e,"prefixItems")&&a.IsArray(e.prefixItems)&&e.prefixItems.every(t=>$(t))}function ki(e){return a.HasPropertyKey(e,"properties")&&a.IsObject(e.properties)&&Object.values(e.properties).every(t=>$(t))}function up(e){return a.HasPropertyKey(e,"propertyNames")&&(a.IsObject(e.propertyNames)||$(e.propertyNames))}function KL(e){return a.HasPropertyKey(e,"$recursiveAnchor")&&a.IsBoolean(e.$recursiveAnchor)}function Ya(e){return KL(e)&&a.IsEqual(e.$recursiveAnchor,!0)}function lp(e){return a.HasPropertyKey(e,"$recursiveRef")&&a.IsString(e.$recursiveRef)}function dp(e){return a.HasPropertyKey(e,"$ref")&&a.IsString(e.$ref)}function rn(e){return a.HasPropertyKey(e,"required")&&a.IsArray(e.required)&&e.required.every(t=>a.IsString(t))}function fp(e){return a.HasPropertyKey(e,"then")&&$(e.then)}function gp(e){return a.HasPropertyKey(e,"type")&&(a.IsString(e.type)||a.IsArray(e.type)&&e.type.every(t=>a.IsString(t)))}function eo(e){return a.HasPropertyKey(e,"uniqueItems")&&a.IsBoolean(e.uniqueItems)}function Wa(e){return a.HasPropertyKey(e,"unevaluatedItems")&&$(e.unevaluatedItems)}function Qa(e){return a.HasPropertyKey(e,"unevaluatedProperties")&&$(e.unevaluatedProperties)}var Qe=class{constructor(){this.indices=new Set,this.keys=new Set}AddIndex(t){return this.indices.add(t),!0}AddKey(t){return this.keys.add(t),!0}GetIndices(){return this.indices}GetKeys(){return this.keys}Merge(t){for(let r of t)r.indices.forEach(n=>this.indices.add(n)),r.keys.forEach(n=>this.keys.add(n));return!0}},Ui=class extends Qe{constructor(t){super(),this.callback=t}AddError(t){return this.callback(t),!1}},Le=class extends Ui{constructor(){super(t=>this.errors.push(t)),this.errors=[]}AddError(t){return this.errors.push(t),!1}GetErrors(){return this.errors}};var zL="external_",VL=0,tge={identifier:`${zL}${VL}`,variables:[]};function uT(e,t,r,n){return r["~guard"].check(n)}function lT(e,t,r,n,i,s){return i["~guard"].check(s)||t.AddError({keyword:"~guard",schemaPath:r,instancePath:n,params:{errors:i["~guard"].errors(s)}})}function dT(e,t,r,n){return a.Every(r["~refine"],0,(i,s)=>i.refine(n))}function fT(e,t,r,n,i,s){return a.EveryAll(i["~refine"],0,(p,c)=>p.refine(s)||t.AddError({keyword:"~refine",schemaPath:r,instancePath:n,params:{index:c,message:p.message}}))}function gT(e){return Zn(e)&&a.IsArray(e.items)}function yT(e,t,r,n){return gT(r)?n.every((s,p)=>a.IsLessThan(p,r.items.length)||w(e,t,r.additionalItems,s)&&t.AddIndex(p)):!0}function IT(e,t,r,n,i,s){return gT(i)?s.every((c,l)=>{let g=`${r}/additionalItems`,y=`${n}/${l}`;return a.IsLessThan(l,i.items.length)||K(e,t,g,y,i.additionalItems,c)&&t.AddIndex(l)}):!0}function YL(e){return`^${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`}function ET(e){let t=[];return Pi(e)&&t.push(...a.Keys(e.patternProperties)),ki(e)&&t.push(...a.Keys(e.properties).map(YL)),a.IsEqual(t.length,0)?"(?!)":`(${t.join("|")})`}function hT(e,t,r,n){let i=new RegExp(ET(r));return a.Every(a.Keys(n),0,(p,c)=>i.test(p)||w(e,t,r.additionalProperties,n[p])&&t.AddKey(p))}function TT(e,t,r,n,i,s){let p=new RegExp(ET(i)),c=[];return a.EveryAll(a.Keys(s),0,(g,y)=>{let E=`${r}/additionalProperties`,C=`${n}/${g}`,Pe=new Le,ot=p.test(g)||K(e,Pe,E,C,i.additionalProperties,s[g])&&t.AddKey(g);return ot||c.push(g),ot})||t.AddError({keyword:"additionalProperties",schemaPath:r,instancePath:n,params:{additionalProperties:c}})}function xT(e,t,r,n){let i=r.allOf.reduce((s,p)=>{let c=new Qe;return w(e,c,p,n)?[...s,c]:s},[]);return a.IsEqual(i.length,r.allOf.length)&&t.Merge(i)}function _T(e,t,r,n,i,s){let p=[],c=i.allOf.reduce((g,y,E)=>{let C=`${r}/allOf/${E}`,Pe=new Le,ot=K(e,Pe,C,n,y,s);return ot||p.push(Pe),ot?[...g,Pe]:g},[]),l=a.IsEqual(c.length,i.allOf.length)&&t.Merge(c);return l||p.forEach(g=>g.GetErrors().forEach(y=>t.AddError(y))),l}function AT(e,t,r,n){let i=r.anyOf.reduce((s,p,c)=>{let l=new Qe;return w(e,l,p,n)?[...s,l]:s},[]);return a.IsGreaterThan(i.length,0)&&t.Merge(i)}function bT(e,t,r,n,i,s){let p=[],c=i.anyOf.reduce((g,y,E)=>{let C=new Le,Pe=`${r}/anyOf/${E}`,ot=K(e,C,Pe,n,y,s);return ot||p.push(C),ot?[...g,C]:g},[]),l=a.IsGreaterThan(c.length,0)&&t.Merge(c);return l||p.forEach(g=>g.GetErrors().forEach(y=>t.AddError(y))),l||t.AddError({keyword:"anyOf",schemaPath:r,instancePath:n,params:{}})}function Ip(e,t,r,n){return r}function OT(e,t,r,n,i,s){return Ip(e,t,i,s)||t.AddError({keyword:"boolean",schemaPath:r,instancePath:n,params:{}})}function Ep(e,t,r,n){return a.IsValueLike(r.const)?a.IsEqual(n,r.const):a.IsDeepEqual(n,r.const)}function ST(e,t,r,n,i,s){return Ep(e,t,i,s)||t.AddError({keyword:"const",schemaPath:r,instancePath:n,params:{allowedValue:i.const}})}function WL(e){return!(tn(e)&&a.IsEqual(e.minContains,0))}function hp(e,t,r,n){return WL(r)?!a.IsEqual(n.length,0)&&n.some(i=>w(e,t,r.contains,i)):!0}function RT(e,t,r,n,i,s){return hp(e,t,i,s)||t.AddError({keyword:"contains",schemaPath:r,instancePath:n,params:{minContains:1}})}function CT(e,t,r,n){let i=a.IsEqual(a.Keys(n).length,0),s=a.Every(a.Entries(r.dependencies),0,([p,c])=>!a.HasPropertyKey(n,p)||(a.IsArray(c)?c.every(l=>a.HasPropertyKey(n,l)):w(e,t,c,n)));return i||s}function PT(e,t,r,n,i,s){let p=a.IsEqual(a.Keys(s).length,0),c=a.EveryAll(a.Entries(i.dependencies),0,([l,g])=>{let y=`${r}/dependencies/${l}`;return!a.HasPropertyKey(s,l)||(a.IsArray(g)?g.every(E=>a.HasPropertyKey(s,E)||t.AddError({keyword:"dependencies",schemaPath:r,instancePath:n,params:{property:l,dependencies:g}})):K(e,t,y,n,g,s))});return p||c}function kT(e,t,r,n){let i=a.IsEqual(a.Keys(n).length,0),s=a.Every(a.Entries(r.dependentRequired),0,([p,c])=>!a.HasPropertyKey(n,p)||c.every(l=>a.HasPropertyKey(n,l)));return i||s}function UT(e,t,r,n,i,s){let p=a.IsEqual(a.Keys(s).length,0),c=a.EveryAll(a.Entries(i.dependentRequired),0,([l,g])=>!a.HasPropertyKey(s,l)||a.EveryAll(g,0,y=>a.HasPropertyKey(s,y)||t.AddError({keyword:"dependentRequired",schemaPath:r,instancePath:n,params:{property:l,dependencies:g}})));return p||c}function LT(e,t,r,n){let i=a.IsEqual(a.Keys(n).length,0),s=a.Every(a.Entries(r.dependentSchemas),0,([p,c])=>!a.HasPropertyKey(n,p)||w(e,t,c,n));return i||s}function NT(e,t,r,n,i,s){let p=a.IsEqual(a.Keys(s).length,0),c=a.EveryAll(a.Entries(i.dependentSchemas),0,([l,g])=>{let y=`${r}/dependentSchemas/${l}`;return!a.HasPropertyKey(s,l)||K(e,t,y,n,g,s)});return p||c}function Tp(e,t,r,n){return r.enum.some(i=>a.IsValueLike(i)?a.IsEqual(n,i):a.IsDeepEqual(n,i))}function MT(e,t,r,n,i,s){return Tp(e,t,i,s)||t.AddError({keyword:"enum",schemaPath:r,instancePath:n,params:{allowedValues:i.enum}})}function xp(e,t,r,n){return a.IsLessThan(n,r.exclusiveMaximum)}function wT(e,t,r,n,i,s){return xp(e,t,i,s)||t.AddError({keyword:"exclusiveMaximum",schemaPath:r,instancePath:n,params:{comparison:"<",limit:i.exclusiveMaximum}})}function _p(e,t,r,n){return a.IsGreaterThan(n,r.exclusiveMinimum)}function $T(e,t,r,n,i,s){return _p(e,t,i,s)||t.AddError({keyword:"exclusiveMinimum",schemaPath:r,instancePath:n,params:{comparison:">",limit:i.exclusiveMinimum}})}var ro={};ft(ro,{Clear:()=>GT,Entries:()=>fN,Get:()=>IN,Has:()=>yN,IsDate:()=>Li,IsDateTime:()=>Ap,IsDuration:()=>bp,IsEmail:()=>Op,IsHostname:()=>Sp,IsIPv4:()=>kp,IsIPv6:()=>Up,IsIdnEmail:()=>Rp,IsIdnHostname:()=>Pp,IsIri:()=>Np,IsIriReference:()=>Lp,IsJsonPointer:()=>wp,IsJsonPointerUriFragment:()=>Mp,IsRegex:()=>$p,IsRelativeJsonPointer:()=>vp,IsTime:()=>Ni,IsUri:()=>jp,IsUriReference:()=>Gp,IsUriTemplate:()=>Dp,IsUrl:()=>Fp,IsUuid:()=>qp,Reset:()=>DT,Set:()=>gN,Test:()=>EN});var QL=[0,31,28,31,30,31,30,31,31,30,31,30,31],ZL=/^(\d\d\d\d)-(\d\d)-(\d\d)$/;function JL(e){return e%4===0&&(e%100!==0||e%400===0)}function Li(e){let t=ZL.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&JL(r)?29:QL[n])}var XL=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;function Ni(e,t=!0){let r=XL.exec(e);if(!r)return!1;let n=+r[1],i=+r[2],s=+r[3],p=r[4]==="-"?-1:1,c=+(r[5]||0),l=+(r[6]||0);if(c>23||l>59||t&&!r[4]&&e.toLowerCase().indexOf("z")===-1)return!1;if(n<=23&&i<=59&&s<60)return!0;let g=i-l*p,y=n-c*p-(g<0?1:0);return(y===23||y===-1)&&(g===59||g===-1)&&s<61}function Ap(e,t=!0){let r=e.split(/T/i);return r.length===2&&Li(r[0])&&Ni(r[1],t)}var eN=/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/;function bp(e){return eN.test(e)}var tN=/^(?!.*\.\.)[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 Op(e){return tN.test(e)}var rN=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;function Sp(e){return rN.test(e)}var nN=/^(?!.*\.\.)[\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 Rp(e){return nN.test(e)}function Cp(e){let t=e.codePointAt(0);return t===void 0?!1:t>=12352&&t<=12447||t>=12448&&t<=12543&&t!==12539||t>=19968&&t<=40959}function Pp(e){if(e.length===0||e.includes(" "))return!1;let t=/[\u002E\u3002\uFF0E\uFF61]/g,r=e.normalize("NFC").replace(t,".");if(r.length>253)return!1;let n=r.split(".");if(n.some(i=>i.length===0))return!1;for(let i of n){if(i.length>63||i.startsWith("-")||i.endsWith("-"))return!1;if(/^xn--/i.test(i)){let l=i.slice(4);if(l.length<2||l.includes("---"))return!1;continue}if(/[\u302E\u302F\u3031\u3032\u3033\u3034\u3035\u303B\u0640\u07FA]/.test(i))return!1;let s=i.charAt(0);if(/[\u0903\u0300\u0488]/.test(s))return!1;for(let l=0;l<i.length;l++){let g=i.charAt(l);if(g==="\xB7"){if(l===0||l===i.length-1)return!1;let y=i.charAt(l-1),E=i.charAt(l+1);if(!/^[lL]$/.test(y)||!/^[lL]$/.test(E))return!1}if(g==="\u30FB"){if(i.length===1)return!1;if(l===0){let y=i.charAt(l+1);if(!Cp(y))return!1}else{let y=i.charAt(l-1),E=i.charAt(l+1);if(!Cp(y)||!Cp(E))return!1}}if(g==="\u0375"){if(l===i.length-1)return!1;let y=i.charAt(l+1);if(!/[\u0370-\u03FF]/.test(y))return!1}if(g==="\u05F3"||g==="\u05F4"){if(l===0)return!1;let y=i.charAt(l-1);if(!/[\u05D0-\u05EA]/.test(y))return!1}if(g==="\u200D"&&(l===0||i.charAt(l-1)!=="\u094D"))return!1}let p=!1,c=!1;for(let l=0;l<i.length;l++){let g=i.charAt(l);/[\u0660-\u0669]/.test(g)&&(p=!0),/[\u06F0-\u06F9]/.test(g)&&(c=!0)}if(p&&c)return!1}return!0}var oN=/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;function kp(e){return oN.test(e)}var iN=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function Up(e){return iN.test(e)}function vT(e){try{return new URL(e,"http://example.com"),!0}catch{return!1}}function Lp(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))?vT(e):e.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/)&&t===-1?!1:vT(e)}function Np(e){try{return new URL(e),!0}catch{return!1}}var aN=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;function Mp(e){return aN.test(e)}var sN=/^(?:\/(?:[^~/]|~0|~1)*)*$/;function wp(e){return sN.test(e)}function $p(e){if(e.length===0)return!1;try{return new RegExp(e),!0}catch{return!1}}var mN=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function vp(e){return mN.test(e)}var pN=/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i;function Gp(e){return pN.test(e)}var cN=/^(?:(?:[^\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 Dp(e){return cN.test(e)}var uN=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i;function jp(e){return uN.test(e)}var lN=/^(?: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 Fp(e){return lN.test(e)}var dN=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;function qp(e){return dN.test(e)}var se=new Map;function GT(){se.clear()}function fN(){return[...se.entries()]}function gN(e,t){se.set(e,t)}function yN(e){return se.has(e)}function IN(e){return se.get(e)}function EN(e,t){return se.get(e)?.(t)??!0}function DT(){GT(),se.set("date-time",Ap),se.set("date",Li),se.set("duration",bp),se.set("email",Op),se.set("hostname",Sp),se.set("idn-email",Rp),se.set("idn-hostname",Pp),se.set("ipv4",kp),se.set("ipv6",Up),se.set("iri-reference",Lp),se.set("iri",Np),se.set("json-pointer-uri-fragment",Mp),se.set("json-pointer",wp),se.set("regex",$p),se.set("relative-json-pointer",vp),se.set("time",Ni),se.set("uri-reference",Gp),se.set("uri-template",Dp),se.set("uri",jp),se.set("url",Fp),se.set("uuid",qp)}DT();function Bp(e,t,r,n){return ro.Test(r.format,n)}function jT(e,t,r,n,i,s){return Bp(e,t,i,s)||t.AddError({keyword:"format",schemaPath:r,instancePath:n,params:{format:i.format}})}function FT(e,t,r,n){let i=fp(r)?r.then:!0,s=Xm(r)?r.else:!0;return w(e,t,r.if,n)?w(e,t,i,n):w(e,t,s,n)}function qT(e,t,r,n,i,s){let p=fp(i)?i.then:!0,c=Xm(i)?i.else:!0,l=new Le,g=K(e,l,`${r}/if`,n,i.if,s)?K(e,l,`${r}/then`,n,p,s)||t.AddError({keyword:"if",schemaPath:r,instancePath:n,params:{failingKeyword:"then"}}):K(e,t,`${r}/else`,n,c,s)||t.AddError({keyword:"if",schemaPath:r,instancePath:n,params:{failingKeyword:"else"}});return g&&t.Merge([l]),g}function hN(e,t,r,n){return a.Every(r.items,0,(i,s)=>a.IsLessEqualThan(n.length,s)||w(e,t,i,n[s])&&t.AddIndex(s))}function TN(e,t,r,n,i,s){return a.EveryAll(i.items,0,(p,c)=>{let l=`${r}/items/${c}`,g=`${n}/${c}`;return a.IsLessEqualThan(s.length,c)||K(e,t,l,g,p,s[c])&&t.AddIndex(c)})}function xN(e,t,r,n){let i=Xn(r)?r.prefixItems.length:0;return a.Every(n,i,(s,p)=>w(e,t,r.items,s)&&t.AddIndex(p))}function _N(e,t,r,n,i,s){let p=Xn(i)?i.prefixItems.length:0;return a.EveryAll(s,p,(c,l)=>{let g=`${r}/items`,y=`${n}/${l}`;return K(e,t,g,y,i.items,c)&&t.AddIndex(l)})}function BT(e,t,r,n){return np(r)?hN(e,t,r,n):xN(e,t,r,n)}function HT(e,t,r,n,i,s){return np(i)?TN(e,t,r,n,i,s):_N(e,t,r,n,i,s)}function AN(e){return Xr(e)}function Hp(e,t,r,n){if(!AN(r))return!0;let i=n.reduce((s,p)=>w(e,t,r.contains,p)?++s:s,0);return a.IsLessEqualThan(i,r.maxContains)}function KT(e,t,r,n,i,s){let p=tn(i)?i.minContains:1;return Hp(e,t,i,s)||t.AddError({keyword:"contains",schemaPath:r,instancePath:n,params:{minContains:p,maxContains:i.maxContains}})}function Kp(e,t,r,n){return a.IsLessEqualThan(n,r.maximum)}function zT(e,t,r,n,i,s){return Kp(e,t,i,s)||t.AddError({keyword:"maximum",schemaPath:r,instancePath:n,params:{comparison:"<=",limit:i.maximum}})}function zp(e,t,r,n){return a.IsLessEqualThan(n.length,r.maxItems)}function VT(e,t,r,n,i,s){return zp(e,t,i,s)||t.AddError({keyword:"maxItems",schemaPath:r,instancePath:n,params:{limit:i.maxItems}})}function Vp(e,t,r,n){return a.IsMaxLength(n,r.maxLength)}function YT(e,t,r,n,i,s){return Vp(e,t,i,s)||t.AddError({keyword:"maxLength",schemaPath:r,instancePath:n,params:{limit:i.maxLength}})}function Yp(e,t,r,n){return a.IsLessEqualThan(a.Keys(n).length,r.maxProperties)}function WT(e,t,r,n,i,s){return Yp(e,t,i,s)||t.AddError({keyword:"maxProperties",schemaPath:r,instancePath:n,params:{limit:i.maxProperties}})}function bN(e){return Xr(e)}function Wp(e,t,r,n){if(!bN(r))return!0;let i=n.reduce((s,p)=>w(e,t,r.contains,p)?++s:s,0);return a.IsGreaterEqualThan(i,r.minContains)}function QT(e,t,r,n,i,s){return Wp(e,t,i,s)||t.AddError({keyword:"contains",schemaPath:r,instancePath:n,params:{minContains:i.minContains}})}function Qp(e,t,r,n){return a.IsGreaterEqualThan(n,r.minimum)}function ZT(e,t,r,n,i,s){return Qp(e,t,i,s)||t.AddError({keyword:"minimum",schemaPath:r,instancePath:n,params:{comparison:">=",limit:i.minimum}})}function Zp(e,t,r,n){return a.IsGreaterEqualThan(n.length,r.minItems)}function JT(e,t,r,n,i,s){return Zp(e,t,i,s)||t.AddError({keyword:"minItems",schemaPath:r,instancePath:n,params:{limit:i.minItems}})}function Jp(e,t,r,n){return a.IsMinLength(n,r.minLength)}function XT(e,t,r,n,i,s){return Jp(e,t,i,s)||t.AddError({keyword:"minLength",schemaPath:r,instancePath:n,params:{limit:i.minLength}})}function Xp(e,t,r,n){return a.IsGreaterEqualThan(a.Keys(n).length,r.minProperties)}function ex(e,t,r,n,i,s){return Xp(e,t,i,s)||t.AddError({keyword:"minProperties",schemaPath:r,instancePath:n,params:{limit:i.minProperties}})}function ec(e,t,r,n){return a.IsMultipleOf(n,r.multipleOf)}function tx(e,t,r,n,i,s){return ec(e,t,i,s)||t.AddError({keyword:"multipleOf",schemaPath:r,instancePath:n,params:{multipleOf:i.multipleOf}})}function tc(e,t,r,n){let i=new Qe;return!w(e,i,r.not,n)&&t.Merge([i])}function rx(e,t,r,n,i,s){return tc(e,t,i,s)||t.AddError({keyword:"not",schemaPath:r,instancePath:n,params:{}})}function nx(e,t,r,n){let i=r.oneOf.reduce((s,p)=>{let c=new Qe;return w(e,c,p,n)?[...s,c]:s},[]);return a.IsEqual(i.length,1)&&t.Merge(i)}function ox(e,t,r,n,i,s){let p=[],c=[],l=i.oneOf.reduce((y,E,C)=>{let Pe=new Le,ot=`${r}/oneOf/${C}`,ao=K(e,Pe,ot,n,E,s);return ao&&c.push(C),ao||p.push(Pe),ao?[...y,Pe]:y},[]),g=a.IsEqual(l.length,1)&&t.Merge(l);return!g&&a.IsEqual(c.length,0)&&p.forEach(y=>y.GetErrors().forEach(E=>t.AddError(E))),g||t.AddError({keyword:"oneOf",schemaPath:r,instancePath:n,params:{passingSchemas:c}})}function rc(e,t,r,n){return(a.IsString(r.pattern)?new RegExp(r.pattern):r.pattern).test(n)}function ix(e,t,r,n,i,s){return rc(e,t,i,s)||t.AddError({keyword:"pattern",schemaPath:r,instancePath:n,params:{pattern:i.pattern}})}function ax(e,t,r,n){return a.Every(a.Entries(r.patternProperties),0,([i,s])=>{let p=new RegExp(i);return a.Every(a.Entries(n),0,([c,l])=>!p.test(c)||w(e,t,s,l)&&t.AddKey(c))})}function sx(e,t,r,n,i,s){return a.EveryAll(a.Entries(i.patternProperties),0,([p,c])=>{let l=`${r}/patternProperties/${p}`,g=new RegExp(p);return a.EveryAll(a.Entries(s),0,([y,E])=>{let C=`${n}/${y}`;return!g.test(y)||K(e,t,l,C,c,E)&&t.AddKey(y)})})}function mx(e,t,r,n){return a.IsEqual(n.length,0)||a.Every(r.prefixItems,0,(i,s)=>a.IsLessEqualThan(n.length,s)||w(e,t,i,n[s])&&t.AddIndex(s))}function px(e,t,r,n,i,s){return a.IsEqual(s.length,0)||a.EveryAll(i.prefixItems,0,(p,c)=>{let l=`${r}/prefixItems/${c}`,g=`${n}/${c}`;return a.IsLessEqualThan(s.length,c)||K(e,t,l,g,p,s[c])&&t.AddIndex(c)})}function nc(e,t){return e.includes(t)||pt.Get().exactOptionalPropertyTypes}function oc(e,t){return a.IsUndefined(e[t])}function cx(e,t,r,n){let i=rn(r)?r.required:[];return a.Every(a.Entries(r.properties),0,([p,c])=>{let l=!a.HasPropertyKey(n,p)||w(e,t,c,n[p])&&t.AddKey(p);return nc(i,p)?l:oc(n,p)||l})}function ux(e,t,r,n,i,s){let p=rn(i)?i.required:[];return a.EveryAll(a.Entries(i.properties),0,([l,g])=>{let y=`${r}/properties/${l}`,E=`${n}/${l}`,C=()=>!a.HasPropertyKey(s,l)||K(e,t,y,E,g,s[l])&&t.AddKey(l);return nc(p,l)?C():oc(s,l)||C()})}function lx(e,t,r,n){return a.Every(a.Keys(n),0,(i,s)=>w(e,t,r.propertyNames,i))}function dx(e,t,r,n,i,s){let p=[];return a.EveryAll(a.Keys(s),0,(l,g)=>{let y=`${n}/${l}`,E=`${r}/propertyNames`,C=new Le,Pe=K(e,C,E,y,i.propertyNames,l);return Pe||p.push(l),Pe})||t.AddError({keyword:"propertyNames",schemaPath:r,instancePath:n,params:{propertyNames:p}})}function fx(e,t,r,n){let i=e.RecursiveRef(r.$recursiveRef)??!1;return $(i)&&w(e,t,i,n)}function gx(e,t,r,n,i,s){let p=e.RecursiveRef(i.$recursiveRef)??!1;return $(p)&&K(e,t,"#",n,p,s)}function Ex(e,t,r,n){let i=e.Ref(r.$ref)??!1,s=new Qe,p=$(i)&&w(e,s,i,n);return p&&t.Merge([s]),p}function hx(e,t,r,n,i,s){let p=e.Ref(i.$ref)??!1,c=new Le,l=$(p)&&K(e,c,"#",n,p,s);return l&&t.Merge([c]),l||c.GetErrors().forEach(g=>t.AddError(g)),l}function Tx(e,t,r,n){return a.Every(r.required,0,i=>a.HasPropertyKey(n,i))}function xx(e,t,r,n,i,s){let p=[];return a.EveryAll(i.required,0,l=>{let g=a.HasPropertyKey(s,l);return g||p.push(l),g})||t.AddError({keyword:"required",schemaPath:r,instancePath:n,params:{requiredProperties:p}})}function ic(e,t,r,n,i){return a.IsEqual(r,"object")?a.IsObjectNotArray(i):a.IsEqual(r,"array")?a.IsArray(i):a.IsEqual(r,"boolean")?a.IsBoolean(i):a.IsEqual(r,"integer")?a.IsInteger(i):a.IsEqual(r,"number")?a.IsNumber(i):a.IsEqual(r,"null")?a.IsNull(i):a.IsEqual(r,"string")?a.IsString(i):a.IsEqual(r,"asyncIterator")?a.IsAsyncIterator(i):a.IsEqual(r,"bigint")?a.IsBigInt(i):a.IsEqual(r,"constructor")?a.IsConstructor(i):a.IsEqual(r,"function")?a.IsFunction(i):a.IsEqual(r,"iterator")?a.IsIterator(i):a.IsEqual(r,"symbol")?a.IsSymbol(i):a.IsEqual(r,"undefined")?a.IsUndefined(i):a.IsEqual(r,"void")?a.IsUndefined(i):!0}function _x(e,t,r,n,i){return r.some(s=>ic(e,t,s,n,i))}function Ax(e,t,r,n){return a.IsArray(r.type)?_x(e,t,r.type,r,n):ic(e,t,r.type,r,n)}function bx(e,t,r,n,i,s){return(a.IsArray(i.type)?_x(e,t,i.type,i,s):ic(e,t,i.type,i,s))||t.AddError({keyword:"type",schemaPath:r,instancePath:n,params:{type:i.type}})}function Ox(e,t,r,n){let i=t.GetIndices();return a.Every(n,0,(s,p)=>(i.has(p)||w(e,t,r.unevaluatedItems,s))&&t.AddIndex(p))}function Sx(e,t,r,n,i,s){let p=t.GetIndices(),c=[];return a.EveryAll(s,0,(g,y)=>{let E=new Le,C=(p.has(y)||K(e,E,r,n,i.unevaluatedItems,g))&&t.AddIndex(y);return C||c.push(y),C})||t.AddError({keyword:"unevaluatedItems",schemaPath:r,instancePath:n,params:{unevaluatedItems:c}})}function Rx(e,t,r,n){let i=t.GetKeys();return a.Every(a.Entries(n),0,([s,p])=>i.has(s)||w(e,t,r.unevaluatedProperties,p)&&t.AddKey(s))}function Cx(e,t,r,n,i,s){let p=t.GetKeys(),c=[];return a.EveryAll(a.Entries(s),0,([g,y])=>{let E=new Le,C=p.has(g)||K(e,E,r,n,i.unevaluatedProperties,y)&&t.AddKey(g);return C||c.push(g),C})||t.AddError({keyword:"unevaluatedProperties",schemaPath:r,instancePath:n,params:{unevaluatedProperties:c}})}function Px(e){return!a.IsEqual(e.uniqueItems,!1)}function kx(e,t,r,n){if(!Px(r))return!0;let i=new Set(n.map(pr.Hash)).size,s=n.length;return a.IsEqual(i,s)}function Ux(e,t,r,n,i,s){if(!Px(i))return!0;let p=new Set,c=s.reduce((g,y,E)=>{let C=pr.Hash(y);return p.has(C)?[...g,E]:(p.add(C),g)},[]);return a.IsEqual(c.length,0)||t.AddError({keyword:"uniqueItems",schemaPath:r,instancePath:n,params:{duplicateItems:c}})}function w(e,t,r,n){e.Push(r);let i=za(r)?Ip(e,t,r,n):(!gp(r)||Ax(e,t,r,n))&&(!(a.IsObject(n)&&!a.IsArray(n))||(!rn(r)||Tx(e,t,r,n))&&(!Qt(r)||hT(e,t,r,n))&&(!Wm(r)||CT(e,t,r,n))&&(!Qm(r)||kT(e,t,r,n))&&(!Zm(r)||LT(e,t,r,n))&&(!Pi(r)||ax(e,t,r,n))&&(!ki(r)||cx(e,t,r,n))&&(!up(r)||lx(e,t,r,n))&&(!Ri(r)||Xp(e,t,r,n))&&(!sp(r)||Yp(e,t,r,n)))&&(!a.IsArray(n)||(!Km(r)||yT(e,t,r,n))&&(!Xr(r)||hp(e,t,r,n))&&(!Zn(r)||BT(e,t,r,n))&&(!ip(r)||Hp(e,t,r,n))&&(!Va(r)||zp(e,t,r,n))&&(!tn(r)||Wp(e,t,r,n))&&(!Jn(r)||Zp(e,t,r,n))&&(!Xn(r)||mx(e,t,r,n))&&(!eo(r)||kx(e,t,r,n)))&&(!a.IsString(n)||(!Oi(r)||Bp(e,t,r,n))&&(!ap(r)||Vp(e,t,r,n))&&(!Si(r)||Jp(e,t,r,n))&&(!Ci(r)||rc(e,t,r,n)))&&(!(a.IsNumber(n)||a.IsBigInt(n))||(!tp(r)||xp(e,t,r,n))&&(!Zt(r)||_p(e,t,r,n))&&(!op(r)||Kp(e,t,r,n))&&(!Jt(r)||Qp(e,t,r,n))&&(!mp(r)||ec(e,t,r,n)))&&(!lp(r)||fx(e,t,r,n))&&(!dp(r)||Ex(e,t,r,n))&&(!Bm(r)||uT(e,t,r,n))&&(!Ym(r)||Ep(e,t,r,n))&&(!ep(r)||Tp(e,t,r,n))&&(!rp(r)||FT(e,t,r,n))&&(!pp(r)||tc(e,t,r,n))&&(!zm(r)||xT(e,t,r,n))&&(!Vm(r)||AT(e,t,r,n))&&(!cp(r)||nx(e,t,r,n))&&(!Wa(r)||!a.IsArray(n)||Ox(e,t,r,n))&&(!Qa(r)||!a.IsObject(n)||Rx(e,t,r,n))&&(!Hm(r)||dT(e,t,r,n));return e.Pop(r),i}function K(e,t,r,n,i,s){e.Push(i);let p=za(i)?OT(e,t,r,n,i,s):!!(+(!gp(i)||bx(e,t,r,n,i,s))&+(!(a.IsObject(s)&&!a.IsArray(s))||!!(+(!rn(i)||xx(e,t,r,n,i,s))&+(!Qt(i)||TT(e,t,r,n,i,s))&+(!Wm(i)||PT(e,t,r,n,i,s))&+(!Qm(i)||UT(e,t,r,n,i,s))&+(!Zm(i)||NT(e,t,r,n,i,s))&+(!Pi(i)||sx(e,t,r,n,i,s))&+(!ki(i)||ux(e,t,r,n,i,s))&+(!up(i)||dx(e,t,r,n,i,s))&+(!Ri(i)||ex(e,t,r,n,i,s))&+(!sp(i)||WT(e,t,r,n,i,s))))&+(!a.IsArray(s)||!!(+(!Km(i)||IT(e,t,r,n,i,s))&+(!Xr(i)||RT(e,t,r,n,i,s))&+(!Zn(i)||HT(e,t,r,n,i,s))&+(!ip(i)||KT(e,t,r,n,i,s))&+(!Va(i)||VT(e,t,r,n,i,s))&+(!tn(i)||QT(e,t,r,n,i,s))&+(!Jn(i)||JT(e,t,r,n,i,s))&+(!Xn(i)||px(e,t,r,n,i,s))&+(!eo(i)||Ux(e,t,r,n,i,s))))&+(!a.IsString(s)||!!(+(!Oi(i)||jT(e,t,r,n,i,s))&+(!ap(i)||YT(e,t,r,n,i,s))&+(!Si(i)||XT(e,t,r,n,i,s))&+(!Ci(i)||ix(e,t,r,n,i,s))))&+(!(a.IsNumber(s)||a.IsBigInt(s))||!!(+(!tp(i)||wT(e,t,r,n,i,s))&+(!Zt(i)||$T(e,t,r,n,i,s))&+(!op(i)||zT(e,t,r,n,i,s))&+(!Jt(i)||ZT(e,t,r,n,i,s))&+(!mp(i)||tx(e,t,r,n,i,s))))&+(!lp(i)||gx(e,t,r,n,i,s))&+(!dp(i)||hx(e,t,r,n,i,s))&+(!Bm(i)||lT(e,t,r,n,i,s))&+(!Ym(i)||ST(e,t,r,n,i,s))&+(!ep(i)||MT(e,t,r,n,i,s))&+(!rp(i)||qT(e,t,r,n,i,s))&+(!pp(i)||rx(e,t,r,n,i,s))&+(!zm(i)||_T(e,t,r,n,i,s))&+(!Vm(i)||bT(e,t,r,n,i,s))&+(!cp(i)||ox(e,t,r,n,i,s))&+(!Wa(i)||!a.IsArray(s)||Sx(e,t,r,n,i,s))&+(!Qa(i)||!a.IsObject(s)||Cx(e,t,r,n,i,s)))&&(!Hm(i)||fT(e,t,r,n,i,s));return e.Pop(i),p}var on={};ft(on,{Ref:()=>vN});var Xt={};ft(Xt,{Delete:()=>UN,Get:()=>PN,Has:()=>CN,Indices:()=>Mi,Set:()=>kN});function Lx(e){if(e.length===0)throw Error("Cannot set root")}function Nx(e){if(!a.IsObject(e))throw Error("Cannot set value")}function ON(e){return/^(0|[1-9]\d*)$/.test(e)}function Mx(e){return[e.slice(0,e.length-1),e.slice(e.length-1)[0]]}function SN(e,t){return a.IsObject(t)&&a.HasPropertyKey(t,e)}function RN(e,t){return a.IsObject(t)?t[e]:void 0}function ac(e,t){return e.reduce((r,n)=>RN(n,r),t)}function Mi(e){if(a.IsEqual(e.length,0))return[];let t=e.split("/").map(r=>r.replace(/~1/g,"/").replace(/~0/g,"~"));return t.length>0&&t[0]===""?t.slice(1):t}function CN(e,t){let r=e;return Mi(t).every(n=>SN(n,r)?(r=r[n],!0):!1)}function PN(e,t){let r=Mi(t);return ac(r,e)}function kN(e,t,r){let n=Mi(t);Lx(n);let[i,s]=Mx(n),p=ac(i,e);return Nx(p),p[s]=r,e}function UN(e,t){let r=Mi(t);Lx(r);let[n,i]=Mx(r),s=ac(n,e);return Nx(s),a.IsArray(s)&&ON(i)?s.splice(+i,1):delete s[i],e}function LN(e,t,r){if(e.$id===r.hash)return e;let n=new URL(e.$id,t.href),i=new URL(r.href,t.href);if(a.IsEqual(n.pathname,i.pathname))return r.hash.startsWith("#")?wx(e,t,r):e}function NN(e,t,r){let n=new URL(`#${e.$anchor}`,t.href),i=new URL(r.href,t.href);if(a.IsEqual(n.href,i.href))return e}function wx(e,t,r){return r.href.endsWith("#")?e:r.hash.startsWith("#")?Xt.Get(e,decodeURIComponent(r.hash.slice(1))):void 0}function MN(e,t,r){if(en(e)){let n=LN(e,t,r);if(!a.IsUndefined(n))return n}if(bi(e)){let n=NN(e,t,r);if(!a.IsUndefined(n))return n}return wx(e,t,r)}function wN(e,t,r){return e.reduce((n,i)=>{let s=sc(i,t,r);return a.IsUndefined(s)?n:s},void 0)}function $N(e,t,r){return a.Keys(e).reduce((n,i)=>{let s=sc(e[i],t,r);return a.IsUndefined(s)?n:s},void 0)}function sc(e,t,r){if(t=Wt(e)&&en(e)?new URL(e.$id,t.href):t,Wt(e)){let n=MN(e,t,r);if(!a.IsUndefined(n))return n}if(a.IsArray(e))return wN(e,t,r);if(a.IsObject(e))return $N(e,t,r)}function vN(e,t){let r=new URL("http://unknown"),n=en(e)?new URL(e.$id,r.href):r,i=new URL(t,n.href);return sc(e,n,i)}var an=class{constructor(t,r){this.context=t,this.schema=r,this.ids=[],this.anchors=[],this.recursiveAnchors=[],this.dynamicAnchors=[]}BaseURL(){return this.ids.reduce((t,r)=>new URL(r.$id,t),new URL("http://unknown"))}Base(){return this.ids[this.ids.length-1]??this.schema}Push(t){Wt(t)&&(en(t)&&this.ids.push(t),bi(t)&&this.anchors.push(t),Ya(t)&&this.recursiveAnchors.push(t),Jm(t)&&this.dynamicAnchors.push(t))}Pop(t){Wt(t)&&(en(t)&&this.ids.pop(),bi(t)&&this.anchors.pop(),Ya(t)&&this.recursiveAnchors.pop(),Jm(t)&&this.dynamicAnchors.pop())}FromContext(t){return a.HasPropertyKey(this.context,t)?this.context[t]:void 0}FromRef(t){return t.startsWith("#")?on.Ref(this.Base(),t):on.Ref(this.schema,t)}Ref(t){return this.FromContext(t)??this.FromRef(t)}RecursiveRef(t){return Ya(this.Base())?on.Ref(this.recursiveAnchors[0],t):on.Ref(this.Base(),t)}};function $x(...e){let[t,r,n]=X.Match(e,{3:(p,c,l)=>[p,c,l],2:(p,c)=>[{},p,c]}),i=new an(t,r),s=new Qe;return w(i,s,r,n)}function vx(...e){let[t,r,n]=X.Match(e,{3:(y,E,C)=>[y,E,C],2:(y,E)=>[{},y,E]}),i=pt.Get(),s=Lu(),p=[],c=new an(t,r),l=new Ui(y=>{if(!a.IsGreaterEqualThan(p.length,i.maxErrors))return p.push({...y,message:s(y)})});return[K(c,l,"#","",r,n),p]}function ie(...e){let[t,r,n]=X.Match(e,{3:(i,s,p)=>[i,s,p],2:(i,s)=>[{},i,s]});return $x(t,r,n)}function Sr(...e){let[t,r,n]=X.Match(e,{3:(p,c,l)=>[p,c,l],2:(p,c)=>[{},p,c]}),[i,s]=vx(t,r,n);return s}var Rr=class extends Error{constructor(t,r,n){super(t),Object.defineProperty(this,"cause",{value:{source:t,errors:n,value:r},writable:!1,configurable:!1,enumerable:!1})}};function Gx(e,t,r){return a.IsArray(r)?r.map(n=>Me(e,t.items,n)):r}function Dx(e,t,r){return t.Clean(r)}function jx(e,t,r){return Me({...e,...t.$defs},Te(t.$ref),r)}function DN(e){let t=a.HasPropertyKey(e,"unevaluatedProperties")?{additionalProperties:e.unevaluatedProperties}:{},r=At(e);return N(r)?Pa(r,t):r}function Fx(e,t,r){let n=DN(t);return Me(e,n,r)}function Za(e){return a.HasPropertyKey(e,"additionalProperties")?e.additionalProperties:void 0}function qx(e,t,r){if(!a.IsObject(r)||a.IsArray(r))return r;let n=Za(t);for(let i of a.Keys(r)){if(a.HasPropertyKey(t.properties,i)){r[i]=Me(e,t.properties[i],r[i]);continue}if(a.IsBoolean(n)&&a.IsEqual(n,!0)||_(n)&&ie(e,n,r[i])){r[i]=Me(e,n,r[i]);continue}delete r[i]}return r}function Bx(e,t,r){if(!a.IsObject(r))return r;let n=Za(t),[i,s]=[new RegExp(at(t)),Ge(t)];for(let p of a.Keys(r)){if(i.test(p)){r[p]=Me(e,s,r[p]);continue}if(a.IsBoolean(n)&&a.IsEqual(n,!0)||_(n)&&ie(e,n,r[p])){r[p]=Me(e,n,r[p]);continue}delete r[p]}return r}function Hx(e,t,r){return a.HasPropertyKey(e,t.$ref)?Me(e,e[t.$ref],r):r}function Kx(e,t,r){if(!a.IsArray(r))return r;let n=Math.min(r.length,t.items.length);for(let i=0;i<n;i++)r[i]=Me(e,t.items[i],r[i]);return a.IsGreaterThan(r.length,n)?r.slice(0,n):r}function jN(e){let t={};for(let r of Object.getOwnPropertyNames(e))t[r]=ae(e[r]);for(let r of Object.getOwnPropertySymbols(e))t[r]=ae(e[r]);return t}function FN(e){return a.IsClassInstance(e)?e:jN(e)}function qN(e){return e.map(t=>ae(t))}function BN(e){return e.slice()}function HN(e){return new Map(ae([...e.entries()]))}function KN(e){return new Set(ae([...e.values()]))}function ae(e){return Ke.IsTypeArray(e)?BN(e):Ke.IsMap(e)?HN(e):Ke.IsSet(e)?KN(e):a.IsArray(e)?qN(e):a.IsObject(e)?FN(e):e}function zx(e,t,r){for(let n of t.anyOf){let i=Me(e,n,ae(r));if(ie(e,n,i))return i}return r}function Me(e,t,r){return Q(t)?Gx(e,t,r):ct(t)?Dx(e,t,r):ne(t)?jx(e,t,r):P(t)?Fx(e,t,r):N(t)?qx(e,t,r):le(t)?Bx(e,t,r):re(t)?Hx(e,t,r):B(t)?Kx(e,t,r):x(t)?zx(e,t,r):r}function mn(...e){let[t,r,n]=X.Match(e,{3:(i,s,p)=>[i,s,p],2:(i,s)=>[{},i,s]});return Me(t,r,n)}function Vx(e,t,r){return a.IsArray(r)?r.map(n=>Ae(e,t.items,n)):r}function Yx(e,t,r){return t.Convert(r)}var J={};ft(J,{Fail:()=>pn,IsOk:()=>pc,Ok:()=>R,TryBigInt:()=>cc,TryBoolean:()=>cM,TryNull:()=>IM,TryNumber:()=>SM,TryString:()=>NM,TryUndefined:()=>jM});function pc(e){return a.IsObject(e)&&a.HasPropertyKey(e,"value")}function R(e){return{value:e}}function pn(){}function zN(e){return R(e)}function VN(e){return a.IsEqual(e,!0)?R(BigInt(1)):R(BigInt(0))}function YN(e){return R(BigInt(Math.trunc(e)))}function WN(e){return R(BigInt(0))}var QN=/^-?(0|[1-9]\d*)n$/,ZN=/^-?(0|[1-9]\d*)\.\d+$/,JN=/^-?(0|[1-9]\d*)$/;function XN(e){return QN.test(e)}function eM(e){return ZN.test(e)}function tM(e){return JN.test(e)}function rM(e){let t=e.toLowerCase();return XN(e)?R(BigInt(e.slice(0,e.length-1))):eM(e)?R(BigInt(e.split(".")[0])):tM(e)?R(BigInt(e)):a.IsEqual(t,"false")?R(BigInt(0)):a.IsEqual(t,"true")?R(BigInt(1)):void 0}function nM(e){return R(BigInt(0))}function cc(e){return a.IsBigInt(e)?zN(e):a.IsBoolean(e)?VN(e):a.IsNumber(e)?YN(e):a.IsNull(e)?WN(e):a.IsString(e)?rM(e):a.IsUndefined(e)?nM(e):void 0}function oM(e){return a.IsEqual(e,BigInt(0))?R(!1):a.IsEqual(e,BigInt(1))?R(!0):void 0}function iM(e){return R(e)}function aM(e){return a.IsEqual(e,0)?R(!1):a.IsEqual(e,1)?R(!0):void 0}function sM(e){return R(!1)}function mM(e){return a.IsEqual(e.toLowerCase(),"false")?R(!1):a.IsEqual(e.toLowerCase(),"true")?R(!0):a.IsEqual(e,"0")?R(!1):a.IsEqual(e,"1")?R(!0):void 0}function pM(e){return R(!1)}function cM(e){return a.IsBigInt(e)?oM(e):a.IsBoolean(e)?iM(e):a.IsNumber(e)?aM(e):a.IsNull(e)?sM(e):a.IsString(e)?mM(e):a.IsUndefined(e)?pM(e):void 0}function uM(e){return a.IsEqual(e,BigInt(0))?R(null):void 0}function lM(e){return a.IsEqual(e,!1)?R(null):void 0}function dM(e){return a.IsEqual(e,0)?R(null):void 0}function fM(e){return R(null)}function gM(e){let t=e.toLowerCase();return a.IsEqual(t,"undefined")||a.IsEqual(t,"null")||a.IsEqual(e,"")||a.IsEqual(e,"0")?R(null):void 0}function yM(e){return R(null)}function IM(e){return a.IsBigInt(e)?uM(e):a.IsBoolean(e)?lM(e):a.IsNumber(e)?dM(e):a.IsNull(e)?fM(e):a.IsString(e)?gM(e):a.IsUndefined(e)?yM(e):void 0}var EM=BigInt(Number.MAX_SAFE_INTEGER),hM=BigInt(Number.MIN_SAFE_INTEGER);function TM(e){return e<=EM&&e>=hM}function Wx(e){return TM(e)?R(Number(e)):void 0}function xM(e){return e?R(1):R(0)}function _M(e){return R(e)}function AM(e){return R(0)}function bM(e){let t=+e;if(a.IsNumber(t))return R(t);let r=e.toLowerCase();if(a.IsEqual(r,"false"))return R(0);if(a.IsEqual(r,"true"))return R(1);let n=cc(e);return pc(n)?Wx(n.value):void 0}function OM(e){return R(0)}function SM(e){return a.IsBigInt(e)?Wx(e):a.IsBoolean(e)?xM(e):a.IsNumber(e)?_M(e):a.IsNull(e)?AM(e):a.IsString(e)?bM(e):a.IsUndefined(e)?OM(e):void 0}function RM(e){return R(e.toString())}function CM(e){return R(e.toString())}function PM(e){return R(e.toString())}function kM(e){return R("null")}function UM(e){return R(e)}function LM(e){return R("")}function NM(e){return a.IsBigInt(e)?RM(e):a.IsBoolean(e)?CM(e):a.IsNumber(e)?PM(e):a.IsNull(e)?kM(e):a.IsString(e)?UM(e):a.IsUndefined(e)?LM(e):void 0}function MM(e){return a.IsEqual(e,BigInt(0))?R(void 0):void 0}function wM(e){return a.IsEqual(e,!1)?R(void 0):void 0}function $M(e){return a.IsEqual(e,0)?R(void 0):void 0}function vM(e){return R(void 0)}function GM(e){let t=e.toLowerCase();return a.IsEqual(t,"undefined")||a.IsEqual(t,"null")||a.IsEqual(e,"")||a.IsEqual(e,"0")?R(void 0):void 0}function DM(e){return R(void 0)}function jM(e){return a.IsBigInt(e)?MM(e):a.IsBoolean(e)?wM(e):a.IsNumber(e)?$M(e):a.IsNull(e)?vM(e):a.IsString(e)?GM(e):a.IsUndefined(e)?DM(e):void 0}function Qx(e,t,r){if(a.IsBigInt(r))return r;let n=J.TryBigInt(r);return J.IsOk(n)?n.value:r}function Zx(e,t,r){if(a.IsBoolean(r))return r;let n=J.TryBoolean(r);return J.IsOk(n)?n.value:r}function Jx(e,t,r){return Ae({...e,...t.$defs},Te(t.$ref),r)}function Ja(e,t,r){if(t.anyOf.some(p=>ie(e,p,r)))return r;let s=t.anyOf.map(p=>Ae(e,p,ae(r))).find(p=>ie(e,t,p));return a.IsUndefined(s)?r:s}function Xx(e,t,r){let n=qr(t);return Ja(e,n,r)}function e_(e,t,r){if(a.IsInteger(r))return r;let n=J.TryNumber(r);return J.IsOk(n)?Math.trunc(n.value):r}function t_(e,t,r){let n=At(t);return Ae(e,n,r)}function FM(e,t,r){let n=J.TryBigInt(r);return J.IsOk(n)&&a.IsEqual(t.const,n.value)?n.value:r}function qM(e,t,r){let n=J.TryBoolean(r);return J.IsOk(n)&&a.IsEqual(t.const,n.value)?n.value:r}function BM(e,t,r){let n=J.TryNumber(r);return J.IsOk(n)&&a.IsEqual(t.const,n.value)?n.value:r}function HM(e,t,r){let n=J.TryString(r);return J.IsOk(n)&&a.IsEqual(t.const,n.value)?n.value:r}function r_(e,t,r){return a.IsEqual(t.const,r)?r:ju(t)?FM(e,t,r):Fu(t)?qM(e,t,r):In(t)?BM(e,t,r):En(t)?HM(e,t,r):D()}function n_(e,t,r){if(a.IsNull(r))return r;let n=J.TryNull(r);return J.IsOk(n)?n.value:r}function o_(e,t,r){if(a.IsNumber(r))return r;let n=J.TryNumber(r);return J.IsOk(n)?n.value:r}function Xa(e,t,r,n){let i=a.Keys(n);for(let[s,p]of t)for(let c of i)s.test(c)||(n[c]=Ae(e,r,n[c]));return n}function wi(e,t,r){return be(e)&&a.IsUndefined(r[t])}function KM(e,t,r){let n=a.EntriesRegExp(t.properties),i=a.Keys(r);for(let[s,p]of n)for(let c of i)!s.test(c)||wi(p,c,r)||(r[c]=Ae(e,p,r[c]));return a.HasPropertyKey(t,"additionalProperties")&&a.IsObject(t.additionalProperties)?Xa(e,n,t.additionalProperties,r):r}function i_(e,t,r){return a.IsObjectNotArray(r)?KM(e,t,r):r}function zM(e,t,r){let n=a.EntriesRegExp(t.patternProperties),i=a.Keys(r);for(let[s,p]of n)for(let c of i)s.test(c)&&(r[c]=Ae(e,p,r[c]));return a.HasPropertyKey(t,"additionalProperties")&&a.IsObject(t.additionalProperties)?Xa(e,n,t.additionalProperties,r):r}function a_(e,t,r){return a.IsObjectNotArray(r)?zM(e,t,r):r}function s_(e,t,r){return a.HasPropertyKey(e,t.$ref)?Ae(e,e[t.$ref],r):r}function m_(e,t,r){if(a.IsString(r))return r;let n=J.TryString(r);return J.IsOk(n)?n.value:r}function p_(e,t,r){let n=De(t.pattern);return Ae(e,n,r)}function c_(e,t,r){if(!a.IsArray(r))return r;for(let n=0;n<Math.min(t.items.length,r.length);n++)r[n]=Ae(e,t.items[n],r[n]);return r}function u_(e,t,r){if(a.IsUndefined(r))return r;let n=J.TryUndefined(r);return J.IsOk(n)?n.value:r}function l_(e,t,r){if(a.IsUndefined(r))return r;let n=J.TryUndefined(r);return J.IsOk(n)?void 0:r}function Ae(e,t,r){return Q(t)?Vx(e,t,r):ct(t)?Yx(e,t,r):it(t)?Qx(e,t,r):Ye(t)?Zx(e,t,r):ne(t)?Jx(e,t,r):Ie(t)?Xx(e,t,r):ke(t)?e_(e,t,r):P(t)?t_(e,t,r):V(t)?r_(e,t,r):Pt(t)?n_(e,t,r):ue(t)?o_(e,t,r):N(t)?i_(e,t,r):le(t)?a_(e,t,r):re(t)?s_(e,t,r):xe(t)?m_(e,t,r):Ee(t)?p_(e,t,r):B(t)?c_(e,t,r):Nt(t)?u_(e,t,r):x(t)?Ja(e,t,r):st(t)?l_(e,t,r):r}function Cr(...e){let[t,r,n]=X.Match(e,{3:(i,s,p)=>[i,s,p],2:(i,s)=>[{},i,s]});return Ae(t,r,n)}function d_(e,t,r){if(!a.IsArray(r))return r;for(let n=0;n<r.length;n++)r[n]=Ce(e,t.items,r[n]);return r}function f_(e,t,r){return t.Default(r)}function g_(e,t,r){return Ce({...e,...t.$defs},Te(t.$ref),r)}function y_(e,t){return a.IsUndefined(t)?a.IsFunction(e.default)?e.default():ae(e.default):t}function I_(e,t,r){let n=At(t);return Ce(e,n,r)}function E_(e,t,r){if(!a.IsObject(r))return r;let n=a.Keys(t.properties);for(let i of n){let s=Ce(e,t.properties[i],r[i]);a.IsUndefined(s)&&(be(t.properties[i])||!a.HasPropertyKey(t.properties[i],"default"))||(r[i]=Ce(e,t.properties[i],r[i]))}if(!Qt(t)||a.IsBoolean(t.additionalProperties))return r;for(let i of a.Keys(r))n.includes(i)||(r[i]=Ce(e,t.additionalProperties,r[i]));return r}function h_(e,t,r){if(!a.IsObject(r))return r;let[n,i]=[new RegExp(at(t)),Ge(t)];for(let s of a.Keys(r))n.test(s)&&dt(i)&&(r[s]=Ce(e,i,r[s]));if(!Qt(t))return r;for(let s of a.Keys(r))n.test(s)||(r[s]=Ce(e,t.additionalProperties,r[s]));return r}function T_(e,t,r){return a.HasPropertyKey(e,t.$ref)?Ce(e,e[t.$ref],r):r}function x_(e,t,r){if(!a.IsArray(r))return r;let[n,i]=[t.items,Math.max(t.items.length,r.length)];for(let s=0;s<i;s++)s<n.length&&(r[s]=Ce(e,n[s],r[s]));return r}function __(e,t,r){for(let n of t.anyOf){let i=Ce(e,n,ae(r));if(ie(e,n,i))return i}return r}function Ce(e,t,r){let n=dt(t)?y_(t,r):r;return Q(t)?d_(e,t,n):ct(t)?f_(e,t,n):ne(t)?g_(e,t,n):P(t)?I_(e,t,n):N(t)?E_(e,t,n):le(t)?h_(e,t,n):re(t)?T_(e,t,n):B(t)?x_(e,t,n):x(t)?__(e,t,n):n}function cn(...e){let[t,r,n]=X.Match(e,{3:(i,s,p)=>[i,s,p],2:(i,s)=>[{},i,s]});return Ce(t,r,n)}function no(e){return(...t)=>{let[r,n,i]=X.Match(t,{3:(s,p,c)=>[s,p,c],2:(s,p)=>[{},s,p]});return e.reduce((s,p)=>p(r,n,s),i)}}function VM(e,t,r){return t["~codec"].decode(r)}function YM(e,t,r){return t["~codec"].encode(r)}function ge(e,t,r,n){return vr(r)?a.IsEqual(e,"Decode")?VM(t,r,n):YM(t,r,n):n}function WM(e,t,r,n){if(!a.IsArray(n))return D();for(let i=0;i<n.length;i++)n[i]=me(e,t,r.items,n[i]);return ge(e,t,r,n)}function QM(e,t,r,n){let i=ge(e,t,r,n);if(!a.IsArray(i))return i;for(let s=0;s<i.length;s++)i[s]=me(e,t,r.items,i[s]);return i}function A_(e,t,r,n){return a.IsEqual(e,"Decode")?WM(e,t,r,n):QM(e,t,r,n)}function b_(e,t,r,n){return n=me(e,{...t,...r.$defs},Te(r.$ref),n),ge(e,t,r,n)}function ZM(e,t,r,n){for(let i of r.allOf)n=me(e,t,i,n);return ge(e,t,r,n)}function JM(e,t,r,n){let i=ge(e,t,r,n);for(let s of r.allOf)i=me(e,t,s,i);return i}function O_(e,t,r,n){return a.IsEqual(e,"Decode")?ZM(e,t,r,n):JM(e,t,r,n)}function XM(e,t,r,n){if(!a.IsObjectNotArray(n))return D();for(let i of a.Keys(r.properties))!a.HasPropertyKey(n,i)||wi(r.properties[i],i,n)||(n[i]=me(e,t,r.properties[i],n[i]));return ge(e,t,r,n)}function ew(e,t,r,n){let i=ge(e,t,r,n);if(!a.IsObjectNotArray(i))return i;for(let s of a.Keys(r.properties))!a.HasPropertyKey(i,s)||wi(r.properties[s],s,i)||(i[s]=me(e,t,r.properties[s],i[s]));return i}function S_(e,t,r,n){return a.IsEqual(e,"Decode")?XM(e,t,r,n):ew(e,t,r,n)}function tw(e,t,r,n){if(!a.IsObjectNotArray(n))return D();let i=new RegExp(at(r));for(let s of a.Keys(n))i.test(s)||D(),n[s]=me(e,t,Ge(r),n[s]);return ge(e,t,r,n)}function rw(e,t,r,n){let i=ge(e,t,r,n);if(!a.IsObjectNotArray(i))return i;let s=new RegExp(at(r));for(let p of a.Keys(i))s.test(p)&&(i[p]=me(e,t,Ge(r),i[p]));return i}function R_(e,t,r,n){return a.IsEqual(e,"Decode")?tw(e,t,r,n):rw(e,t,r,n)}function C_(e,t,r,n){return n=a.HasPropertyKey(t,r.$ref)?me(e,t,t[r.$ref],n):n,ge(e,t,r,n)}function nw(e,t,r,n){if(!a.IsArray(n))return D();for(let i=0;i<Math.min(r.items.length,n.length);i++)n[i]=me(e,t,r.items[i],n[i]);return ge(e,t,r,n)}function ow(e,t,r,n){let i=ge(e,t,r,n);if(!a.IsArray(i))return n;for(let s=0;s<Math.min(r.items.length,i.length);s++)i[s]=me(e,t,r.items[s],i[s]);return i}function P_(e,t,r,n){return a.IsEqual(e,"Decode")?nw(e,t,r,n):ow(e,t,r,n)}function iw(e,t,r,n){for(let i of r.anyOf){if(!ie(t,i,n))continue;let s=me(e,t,i,n);return ge(e,t,r,s)}return D()}function aw(e,t,r,n){let i=ge(e,t,r,n);for(let s of r.anyOf){let p=me(e,t,s,ae(i));if(ie(t,s,p))return p}return i}function k_(e,t,r,n){return a.IsEqual(e,"Decode")?iw(e,t,r,n):aw(e,t,r,n)}function me(e,t,r,n){return Q(r)?A_(e,t,r,n):ne(r)?b_(e,t,r,n):P(r)?O_(e,t,r,n):N(r)?S_(e,t,r,n):le(r)?R_(e,t,r,n):re(r)?C_(e,t,r,n):B(r)?P_(e,t,r,n):x(r)?k_(e,t,r,n):ge(e,t,r,n)}var uc=class extends Rr{constructor(t,r){super("Decode",t,r)}};function sw(e,t,r){if(!ie(e,t,r))throw new uc(r,Sr(e,t,r));return r}function mw(e,t,r){return me("Decode",e,t,r)}var cCe=no([(e,t,r)=>ae(r),(e,t,r)=>cn(e,t,r),(e,t,r)=>Cr(e,t,r),(e,t,r)=>mn(e,t,r),(e,t,r)=>sw(e,t,r),(e,t,r)=>mw(e,t,r)]);var lc=class extends Rr{constructor(t,r){super("Encode",t,r)}};function pw(e,t,r){if(!ie(e,t,r))throw new lc(r,Sr(e,t,r));return r}function cw(e,t,r){return me("Encode",e,t,r)}var _Ce=no([(e,t,r)=>ae(r),(e,t,r)=>cw(e,t,r),(e,t,r)=>cn(e,t,r),(e,t,r)=>Cr(e,t,r),(e,t,r)=>mn(e,t,r),(e,t,r)=>pw(e,t,r)]);var It=class extends Error{constructor(t,r){super(r),this.type=t}};function U_(e,t){return a.IsFunction(t.default)?t.default(t):a.IsObject(t.default)?ae(t.default):t.default}function L_(e,t){if(eo(t)&&!dt(t))throw new It(t,"Arrays with uniqueItems constraints must specify a default annotation");let r=Jn(t)?t.minItems:0;return Array.from({length:r},()=>pe(e,t.items))}async function*uw(){}function N_(e,t){return uw()}function M_(e,t){return t.Create()}function w_(e,t){return Zt(t)?BigInt(t.exclusiveMinimum)+BigInt(1):Jt(t)?BigInt(t.minimum):BigInt(0)}function $_(e,t){return!1}function v_(e,t){let r=pe(e,t.instanceType);return class{constructor(){Object.assign(this,r)}}}function G_(e,t){return pe({...e,...t.$defs},Te(t.$ref))}function D_(e,t){return pe(e,qr(t))}function j_(e,t){let r=pe(e,t.returnType);return()=>r}function F_(e,t){return Zt(t)&&a.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Jt(t)?t.minimum:0}function q_(e,t){return pe(e,At(t))}function*lw(){}function B_(e,t){return lw()}function H_(e,t){return t.const}function K_(e,t){throw new It(t,"Cannot create TNever types")}function z_(e,t){return null}function V_(e,t){return Zt(t)&&a.IsNumber(t.exclusiveMinimum)?t.exclusiveMinimum+1:Jt(t)?t.minimum:0}function Y_(e,t){return(a.IsUndefined(t.required)?[]:t.required).reduce((n,i)=>({...n,[i]:pe(e,t.properties[i])}),{})}function W_(e,t){return Promise.resolve(pe(e,t.item))}function Q_(e,t){if(Ri(t)&&!dt(t))throw new It(t,"Record with the minProperties constraint must have a default annotation");return{}}function Z_(e,t){return a.HasPropertyKey(e,t.$ref)?pe(e,e[t.$ref]):(()=>{throw new It(t,"Unable to deref Ref")})()}function J_(e,t){if((Ci(t)||Oi(t))&&!dt(t))throw Error("Strings with format or pattern constraints must specify default");let n=Si(t)?t.minLength:0;return"".padEnd(n)}function X_(e,t){return Symbol()}function eA(e,t){let r=De(t.pattern);if(xe(r))throw new It(t,"Unable to create TemplateLiteral due to infinite type expansion");return pe(e,r)}function tA(e,t){return Array.from({length:t.minItems},(r,n)=>pe(e,t.items[n]))}function rA(e,t){if(a.IsEqual(t.anyOf.length,0))throw Error("Unable to create Union with no variants");return pe(e,t.anyOf[0])}function pe(e,t){return dt(t)?U_(e,t):Q(t)?L_(e,t):Be(t)?N_(e,t):ct(t)?M_(e,t):it(t)?w_(e,t):Ye(t)?$_(e,t):Oe(t)?v_(e,t):ne(t)?G_(e,t):Ie(t)?D_(e,t):Se(t)?j_(e,t):ke(t)?F_(e,t):P(t)?q_(e,t):He(t)?B_(e,t):V(t)?H_(e,t):qt(t)?K_(e,t):Pt(t)?z_(e,t):ue(t)?V_(e,t):N(t)?Y_(e,t):ve(t)?W_(e,t):le(t)?Q_(e,t):re(t)?Z_(e,t):xe(t)?J_(e,t):kt(t)?X_(e,t):Ee(t)?eA(e,t):B(t)?tA(e,t):Nt(t)?void 0:x(t)?rA(e,t):st(t)?void 0:void 0}function jt(...e){let[t,r]=X.Match(e,{2:(n,i)=>[n,i],1:n=>[{},n]});return pe(t,r)}var dc=class extends Rr{constructor(t,r){super("Parse",t,r)}};function dw(e,t,r){if(!ie(e,t,r))throw new dc(r,Sr(e,t,r));return r}var R0e=no([(e,t,r)=>ae(r),(e,t,r)=>cn(e,t,r),(e,t,r)=>Cr(e,t,r),(e,t,r)=>mn(e,t,r),(e,t,r)=>dw(e,t,r)]);var gw=k({type:q("insert"),path:et(),value:we()}),yw=Object({type:q("update"),path:et(),value:we()}),Iw=k({type:q("delete"),path:et()}),M0e=v([gw,yw,Iw]);function $i(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]:jt(t)}var iA=Lc(require("node:fs"));function vi(e){if(e.file){let t=iA.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> or -d <json>. Use --generate-skeleton to get a template.")}function qe(e){process.stdout.write(`${JSON.stringify(e,null,2)}
38
+ `)}function xw(e){return e.replace(/-/g," ").replace(/ies$/,"y").replace(/s$/,"")}function gc(e){let t=e.params;if(t?.properties){let r=Object.keys(t.properties);if(r.length===1&&r[0])return r[0]}return"id"}function aA(e,t,r){let n=e.command(t.commandName).description(t.description),i=xw(t.commandName),s=n.command("list").description(`List all ${t.commandName}`);if(t.listOptions)for(let p of t.listOptions)s.option(p.flag,p.description);if(s.action(async p=>{let c={};if(t.listOptions)for(let g of t.listOptions){let y=p[g.queryParam];y!==void 0&&(c[g.queryParam]=y)}let l=await r()(t.endpoints.list,Object.keys(c).length>0?{query:c}:void 0);qe(l)}),t.endpoints.get){let p=t.endpoints.get,c=gc(p);n.command("get <id>").description(`Get a ${i} by ID`).action(async l=>{let g=await r()(p,{params:{[c]:l}});qe(g)})}if(t.endpoints.create){let p=t.endpoints.create;n.command("create").description(`Create a new ${i}`).option("-f, --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 c=>{if(c.generateSkeleton){qe($i(p));return}let l=vi(c),g=await r()(p,{body:l});qe(g)})}if(t.endpoints.update){let p=t.endpoints.update,c=gc(p);n.command("update <id>").description(`Update a ${i} by ID`).option("-f, --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(l,g)=>{if(g.generateSkeleton){qe($i(p));return}let y=vi(g),E=await r()(p,{params:{[c]:l},body:y});qe(E)})}if(t.endpoints.delete){let p=t.endpoints.delete,c=gc(p);n.command("delete <id>").description(`Delete a ${i} by ID`).action(async l=>{let g=await r()(p,{params:{[c]:l}});qe(g)})}}var _w=[{commandName:"dashboards",description:"Manage dashboards",endpoints:{list:LE,get:NE,create:ME,update:wE,delete:$E},listOptions:[{flag:"--owners <ids...>",description:"Filter by owner team IDs",queryParam:"owners"}]},{commandName:"ingestion-api-keys",description:"Manage ingestion API keys",endpoints:{list:FE,create:qE,update:BE,delete:HE}},{commandName:"monitors",description:"Manage monitors",endpoints:{list:QE,get:ZE,create:nh,update:oh,delete:ih}},{commandName:"notification-rules",description:"Manage notification rules",endpoints:{list:dh,get:fh,create:gh,update:yh,delete:Ih}},{commandName:"notification-silences",description:"Manage notification silences",endpoints:{list:hh,get:Th,create:_h,update:Ah,delete:bh}},{commandName:"quality-reports",description:"Manage quality reports",endpoints:{list:Rh}},{commandName:"retention-policies",description:"Manage retention policies",endpoints:{list:kh,get:Uh,create:Lh,update:Nh,delete:Mh}},{commandName:"routes",description:"Manage routes",endpoints:{list:wh,get:$h,create:vh,update:Gh,delete:Dh}},{commandName:"services",description:"Manage services",endpoints:{list:Hh,get:Kh}},{commandName:"tag-policies",description:"Manage tag policies",endpoints:{list:tT,get:rT,create:nT,update:oT,delete:iT}},{commandName:"teams",description:"Manage teams",endpoints:{list:aT,get:sT,create:mT,update:pT,delete:cT}}];function sA(e,t){for(let r of _w)aA(e,r,t)}var mA=`/${"v1"}/aggregation`,pA=o.Object({id:o.String({description:'Query identifier (q1, q2, ...) or "formula" for formula'}),group:o.Record(o.String(),o.Union([o.String(),o.Number()]),{description:"Group-by field values"})}),Aw={results:[{id:"q1",group:{host:"server-1"},value:123.45}]},cA=o.Object({results:o.Array(o.Object({...pA.properties,value:o.Number({description:"Aggregated value"})},{title:"ScalarResult"}),{description:"Aggregated results per query and group"})},{$id:"ScalarAggregationResponse",title:"ScalarAggregationResponse",description:"Scalar aggregation response with single values"});Object.assign(cA,{examples:[Aw]});var bw={series:[{id:"q1",group:{host:"server-1"},points:[{timestamp:16094592e5,value:123.45},{timestamp:160945926e4,value:456.78}]}]},uA=o.Object({series:o.Array(o.Object({...pA.properties,points:o.Array(o.Object({timestamp:o.Integer({description:"Timestamp in milliseconds"}),value:o.Number({description:"Value"})}),{description:"Array of data points"})},{title:"Series"}),{description:"Time series data per query and group"})},{$id:"TimeseriesAggregationResponse",title:"TimeseriesAggregationResponse",description:"Timeseries aggregation response with points over time"});Object.assign(uA,{examples:[bw]});var lA={timeRange:yt,queries:o.Array(o.Omit(Vo.items,["fill"],{title:"AggregationQuery"}),{maxItems:um,description:"Aggregations that may be combined together in the same query"}),groupBy:o.Optional(Wo),dataSource:cm,formula:o.Optional(Yo)},Ow=o.Object(lA),dA=f({description:"Run aggregation queries and return scalar results",operationId:"aggregateScalar",tags:["public","aggregation"],url:`${mA}/multi-query/scalar`,method:"POST",body:Ow,response:cA}),Sw=o.Object({...lA,aggregationWindow:u({description:'Time bucket size for aggregation (e.g. "10s", "1m", "1h")'})}),fA=f({description:"Run aggregation queries and return timeseries results",operationId:"aggregateTimeseries",tags:["public","aggregation"],url:`${mA}/multi-query/timeseries`,method:"POST",body:Sw,response:uA});var es="/v0/logs";var Gi=["CRITICAL","ERROR","WARN","NOTICE","INFO","DEBUG","TRACE"];var Rw=0,Cw=o.Object({__tsuga_metadata__:o.Object({id:o.String(),source:o.Optional(o.String())},{additionalProperties:!0}),context:o.Optional(o.Object({team:o.Optional(o.String()),tag_policy_warnings:o.Optional(o.Record(o.String(),o.String()))},{additionalProperties:!0})),message:o.Optional(o.String()),timestamp:o.Number(),level:o.Enum(Gi)},{additionalProperties:!0});var Pw="log_timestamp",kw=o.Union([o.Literal(Pw)]),un={...zt.properties,query:o.Optional(u({type:"tsuga-query"})),maxResults:o.Optional(o.Integer({minimum:1,maximum:1e3})),shouldRecommendAttributes:o.Optional(o.Boolean()),defaultAttributesToHighlight:o.Optional(o.Array(u(),{maxItems:50})),triggeredBy:o.Optional(o.Literal("refresh")),startOffset:o.Optional(o.Number({minimum:Rw})),clusterId:o.Optional(u({allowEmpty:!1})),sortBy:o.Optional(kw),sortDirection:o.Optional(o.Union([o.Literal("asc"),o.Literal("desc")]))},FNe=f({tags:["logs"],url:`${es}/count`,method:"GET",query:o.Pick(o.Object(un),["from","to","query","clusterId"]),response:o.Object({count:o.Number()})}),yc=o.Object({value:o.String(),priority:o.Number({minimum:0,maximum:1})}),qNe=f({tags:["logs"],url:`${es}/search`,method:"GET",query:o.Object(un),response:o.Object({logs:o.Optional(o.Array(Cw)),attributesToHighlight:o.Optional(o.Array(yc))},{additionalProperties:!0})}),Ic=o.Cyclic({TokenOutput:o.Union([o.Object({type:o.Literal("top"),values:o.Array(o.String())}),o.Object({type:o.Literal("ip"),value:o.String()}),o.Object({type:o.Literal("range"),min:o.Number(),max:o.Number()}),o.Object({type:o.Literal("variable"),value:o.String()}),o.Object({type:o.Literal("text"),value:o.String()}),o.Object({type:o.Literal("date"),value:o.String()}),o.Object({type:o.Literal("url"),value:o.String()}),o.Object({type:o.Literal("structure"),key:o.Array(o.String()),value:o.Array(o.Ref("TokenOutput"))})])},"TokenOutput",{description:"A token identified as part of the pattern"}),Uw=o.Object({id:o.String(),pattern:o.Array(Ic),size:o.Integer({description:"Number of logs that matched the pattern"}),examples:o.Array(o.Object({id:o.Any(),timestampUnix:o.Number()})),timeDistribution:o.Array(o.Number()),staticFeatures:o.Array(o.Object({key:o.String(),value:o.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),BNe=f({tags:["logs"],url:`${es}/patterns`,method:"GET",query:o.Object({...zt.properties,query:u({type:"tsuga-query"}),clusteringThreshold:o.Optional(o.Number()),clusterId:o.Optional(u({allowEmpty:!1}))}),response:o.Object({patterns:o.Array(Uw),sampleSize:o.Number()})}),HNe=f({tags:["logs"],url:`${es}/attributes`,method:"GET",query:o.Object({...zt.properties,clusterId:o.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:o.Object({attributes:o.Array(o.String())})});var ts=`/${"v1"}/logs`,Ec=o.Object({context:o.Optional(o.Object({team:o.Optional(o.String())},{additionalProperties:!0,$id:"LogContext"})),message:o.Optional(o.String()),timestamp:o.Number(),level:o.Enum(Gi)},{additionalProperties:!0,$id:"LogEvent"}),Lw={context:{team:"platform"},message:"Request completed successfully",timestamp:17040672e5,level:"INFO"};Object.assign(Ec,{examples:[Lw]});var Nw={query:"level:ERROR",maxResults:100,from:1704067200,to:1704067200},gA=o.Object({...o.Pick(o.Object(un),["query","maxResults"]).properties,...yt.properties});Object.assign(gA,{examples:[Nw]});var yA=f({description:"Search logs",operationId:"searchLogs",tags:["public","logs"],url:`${ts}/search`,method:"GET",query:gA,response:o.Object({logs:o.Array(Ec)})}),Mw=o.Object({pattern:o.Array(Ic),size:o.Integer({description:"Number of logs that matched the pattern"}),groups:o.Array(o.Object({key:o.String(),value:o.String()},{description:"Fixed groups present in all logs matching the pattern"}))}),IA=o.Object({patterns:o.Array(Mw),sampleSize:o.Number()}),ww={patterns:[{pattern:[{type:"text",value:"Resolved"},{type:"text",value:" "},{type:"text",value:"segment"},{type:"text",value:" "},{type:"text",value:"SegmentId("},{type:"range",min:0,max:1},{type:"text",value:")"},{type:"text",value:" "},{type:"text",value:"from"},{type:"text",value:" "},{type:"text",value:"cache"}],size:37004,groups:[{key:"level",value:"DEBUG"},{key:"context.team",value:"infra"}]}],sampleSize:100};Object.assign(IA,{examples:[ww]});var EA=f({description:"Get log patterns",operationId:"getLogPatterns",tags:["public","logs"],url:`${ts}/patterns`,method:"GET",query:o.Object({...yt.properties,query:u({type:"tsuga-query"})}),response:IA}),$w=o.Object({exampleLog:o.Optional(Ec),team:o.String(),env:o.String(),service:o.String(),firstSeen:o.Number({description:"Timestamp in milliseconds when this pattern was first seen"}),lastSeen:o.Number({description:"Timestamp in milliseconds when this pattern was last seen"})}),hA=o.Object({newErrorPatterns:o.Array($w)}),vw={newErrorPatterns:[{team:"platform",env:"production",service:"api-gateway",firstSeen:17040672e5,lastSeen:17041536e5,exampleLog:{message:"ConnectionError: Failed to connect to database",timestamp:17041536e5,level:"ERROR"}}]};Object.assign(hA,{examples:[vw]});var TA=f({description:"Get new error patterns",operationId:"getNewErrorPatterns",tags:["public","logs"],url:`${ts}/patterns/new`,method:"GET",query:o.Object({...yt.properties,team:o.Optional(u()),env:o.Optional(u()),service:o.Optional(u())}),response:hA}),Gw=o.Object({team:o.String(),env:o.String(),pattern:o.String({description:"The error pattern formatted"}),increaseTimestamps:o.Array(o.Number({description:"Timestamps in milliseconds when there were increases in this pattern"}))}),xA=o.Object({errorPatternIncreases:o.Array(Gw)}),Dw={errorPatternIncreases:[{team:"platform",env:"production",pattern:"Non-resolved segment SegmentId(*) from cache",increaseTimestamps:[17041536e5,17042392e5]}]};Object.assign(xA,{examples:[Dw]});var _A=f({description:"Get error pattern increases for a given team",operationId:"getErrorPatternIncrease",tags:["public","logs"],url:`${ts}/patterns/increase`,method:"GET",query:o.Object({...yt.properties,team:u(),env:o.Optional(u())}),response:xA});var Pr="/v0/metrics",jw=o.Object({__tsuga_metadata__:o.Object({id:o.Optional(o.String())},{additionalProperties:!0}),context:o.Optional(o.Object({},{additionalProperties:!0})),message:o.Optional(o.String()),timestamp:o.Number(),level:o.Enum(Gi)},{additionalProperties:!0}),oMe=f({tags:["metrics"],url:`${Pr}/count`,method:"GET",query:o.Pick(o.Object(un),["from","to","query"]),response:o.Object({count:o.Number()})}),iMe=f({tags:["metrics"],url:`${Pr}/search`,method:"GET",query:o.Object(un),response:o.Object({logs:o.Optional(o.Array(jw)),totalHits:o.Optional(o.Number()),attributesToHighlight:o.Optional(o.Array(yc))},{additionalProperties:!0})}),rs=o.Enum(["counter","gauge","histogram","summary"]),hc=o.Enum(["delta","cumulative","none"]),Fw=o.Object({capabilities:o.Optional(o.Array(o.String())),description:o.Optional(o.String()),tags:o.Optional(o.Array(o.String())),temporality:o.Optional(hc),type:o.Optional(rs),unit:o.Optional(o.String())}),aMe=f({url:`${Pr}/metadata`,method:"GET",query:o.Object({...zt.properties,metricName:u({allowEmpty:!1}),clusterId:o.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:Fw}),sMe=f({tags:["metrics"],url:Pr,method:"GET",query:o.Object({...zt.properties,clusterId:o.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:o.Array(o.String())}),Tc=o.Array(o.Object({name:o.String(),type:rs}),{description:"List of metric names and their types"}),mMe=f({tags:["metrics"],url:`${Pr}/names-and-types`,method:"GET",query:o.Object({...zt.properties,clusterId:o.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:Tc}),xc=o.Array(o.String(),{description:"List of attribute names"}),pMe=f({tags:["metrics"],url:`${Pr}/attributes`,method:"GET",query:o.Object({...zt.properties,metricName:u({allowEmpty:!1}),clusterId:o.Optional(u({allowEmpty:!1,description:"Cluster ID"}))}),response:xc}),_c=o.Object({assets:o.Array(o.Object({type:o.Enum(["dashboard","monitor"]),id:o.String(),name:o.String(),owner:o.String()},{description:"An asset that uses a metric"}),{description:"List of assets (dashboards and monitors) using this metric"})}),cMe=f({tags:["metrics"],url:`${Pr}/assets-usage`,method:"GET",query:o.Object({metricName:u({allowEmpty:!1})}),response:_c}),uMe=f({url:`${Pr}/per-attribute`,method:"GET",query:o.Object({from:o.Optional(o.Number()),to:o.Optional(o.Number()),attribute:u(),clusterId:o.Optional(u({allowEmpty:!1}))}),response:o.Array(o.String())});var Ac=`/${"v1"}/metrics`,qw=[{name:"http.server.request.duration",type:"histogram"},{name:"http.server.active_requests",type:"gauge"},{name:"http.server.request.count",type:"counter"}];Object.assign(Tc,{examples:[qw]});var bc=o.Object({name:o.String({description:"Name of the metric"}),type:rs,description:o.Optional(o.String({description:"Human-readable description of the metric"})),unit:o.Optional(o.String({description:"Unit of the metric"})),temporality:o.Optional(hc),capabilities:o.Optional(o.Array(o.String(),{description:"Supported capabilities, an empty array means all capabilities are supported"})),attributes:o.Optional(o.Array(o.String(),{description:"Metric attributes"}))}),Bw={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(bc,{examples:[Bw]});var AA=f({description:"Get all metrics with their metadata",operationId:"listMetrics",tags:["public","metrics"],url:Ac,method:"GET",query:yt,response:o.Array(bc)}),bA=f({description:"Retrieve a metric by name with its metadata",operationId:"getMetric",tags:["public","metrics"],url:`${Ac}/:name`,method:"GET",params:o.Object({name:u({allowEmpty:!1,description:"The metric name"})}),query:yt,response:bc}),Hw=["service","env","host","method","status_code"];Object.assign(xc,{examples:[Hw]});var OA=o.Pick(_c,["assets"]),Kw={assets:[{type:"dashboard",id:"dash-123-abc",name:"API Performance Overview",owner:"user-456-def"},{type:"monitor",id:"mon-789-ghi",name:"High Latency Alert",owner:"user-456-def"}]};Object.assign(OA,{examples:[Kw]});var hMe=f({description:"Retrieve dashboards and monitors that use a specific metric",operationId:"getMetricAssetsUsage",tags:["private"],url:`${Ac}/assets-usage`,method:"GET",query:o.Object({metricName:u({allowEmpty:!1,description:"The name of the metric to find usage for"})}),response:OA});var zw=`/${"v1"}/traces`,SA=o.Object({context:o.Optional(o.Object({service:o.Optional(o.Object({name:o.Optional(o.String()),version:o.Optional(o.String())},{additionalProperties:!0}))},{additionalProperties:!0})),parentSpanId:o.Optional(o.String()),resourceAttributes:o.Object({},{additionalProperties:!0}),spanAttributes:o.Object({},{additionalProperties:!0}),duration:o.Number({description:"In milliseconds."}),startTime:o.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),endTime:o.String({description:"In nanoseconds. Transmitted as a string to avoid losing precision, as BigInt is not JSON-compatible."}),error:o.Optional(o.Object({message:o.String()})),events:o.Optional(o.Array(o.Object({event_attributes:o.Object({},{additionalProperties:!0}),event_name:o.String(),event_timestamp_nanos:o.String()}))),spanId:o.String(),span:o.Object({kind:o.String(),name:o.String()}),statusCode:o.Optional(o.String()),traceId:o.String()},{additionalProperties:!0,$id:"SpanEvent"}),Vw={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(SA,{examples:[Vw]});var Yw={from:1704067200,to:1704067200,query:"context.service.name:my-service",maxResults:100},RA=o.Object({...yt.properties,query:o.Optional(u({type:"tsuga-query"})),maxResults:o.Optional(o.Integer({minimum:1,maximum:1e4}))});Object.assign(RA,{examples:[Yw]});var CA=f({description:"Search spans",operationId:"searchSpans",tags:["public","traces"],url:`${zw}/search`,method:"GET",query:RA,response:o.Object({spans:o.Array(SA)})});var tr=require("node:fs"),PA=require("node:os"),Oc=require("node:path"),kA=(0,Oc.join)((0,PA.homedir)(),".config","tsuga"),oo=(0,Oc.join)(kA,"config.json"),Ww="https://api.tsuga.com";function ln(){if(!(0,tr.existsSync)(oo))return{};try{return JSON.parse((0,tr.readFileSync)(oo,"utf-8"))}catch{throw new Error(`Config file corrupted: ${oo}
39
39
  Re-run: tsuga auth <token>`)}}function Sc(e){(0,tr.mkdirSync)(kA,{recursive:!0,mode:448}),(0,tr.writeFileSync)(oo,`${JSON.stringify(e,null,2)}
40
- `,{mode:384})}function Rc(e){let t=ln(),r=e.apiToken??process.env.TSUGA_OPERATION_API_KEY??t.operationApiKey;return{apiUrl:Ww,apiToken:r}}function Cc(e){let t={};try{t=ln()}catch{}Sc({...t,...e})}function UA(){return(0,tr.existsSync)(oo)||!!process.env.TSUGA_OPERATION_API_KEY}function Pc(){return oo}var kc={from:"-30m",to:"now",query:"*","max-results":"100"};function LA(){return ln().defaults??{}}function io(e){return(ln().defaults??{})[e]??kc[e]}function NA(e,t){let r={};try{r=ln()}catch{}let n={...r.defaults??{},[e]:t};Sc({...r,defaults:n})}function MA(){let e={};try{e=ln()}catch{}let{defaults:t,...r}=e;Sc(r)}function wA(){return ln().lastUpdateCheck}function $A(e){Cc({lastUpdateCheck:e})}var Qw={s:1,m:60,h:3600,d:86400};function vA(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<48||r>57)return!1}return!0}function GA(){return Math.floor(Date.now()/1e3)}function DA(e){if(e==="now")return GA();if(e.startsWith("-")&&e.length>=3){let r=e.at(-1),n=r?Qw[r]:void 0;if(n){let i=e.slice(1,-1);if(i.length>0&&vA(i))return GA()-parseInt(i,10)*n}}if(vA(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 Et(e,t){let r=t??io(e);if(!r)throw new Error(`--${e} is required`);return DA(r)}function jA(e){let t={from:Et("from",e.from),to:Et("to",e.to)},r=e.query??io("query");r!==void 0&&(t.query=r);let n=e.maxResults??io("max-results");if(n!==void 0){let i=Number(n);if(Number.isNaN(i))throw new Error(`--max-results must be a number (got: ${n})`);t.maxResults=i}return t}function FA(e,t,r,n,i){e.command(t).description(r).option("-f, --file <path>","Read body from file (use - for stdin)").option("-d, --data <json>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async s=>{if(s.generateSkeleton){qe($i(n));return}let p=vi(s),c=await i()(n,{body:p});qe(c)})}function je(e){let t=io(e);return t===void 0?"":` (default: ${t})`}function qA(e,t){let r=e.command("logs").description("Search and analyze logs");r.command("search").description("Search logs").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).option("--query <query>",`Search query${je("query")}`).option("--max-results <n>",`Maximum number of results${je("max-results")}`).action(async p=>{let c=await t()(yA,{query:jA(p)});qe(c)}),r.command("patterns").description("List log patterns").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).option("--query <query>",`Search query${je("query")}`).action(async p=>{let c={from:Et("from",p.from),to:Et("to",p.to)},l=p.query??io("query");l!==void 0&&(c.query=l);let g=await t()(EA,{query:c});qe(g)}),r.command("new-error-patterns").description("List new error patterns").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).option("--team <team>","Filter by team").option("--env <env>","Filter by environment").option("--service <service>","Filter by service").action(async p=>{let c={from:Et("from",p.from),to:Et("to",p.to)};p.team!==void 0&&(c.team=p.team),p.env!==void 0&&(c.env=p.env),p.service!==void 0&&(c.service=p.service);let l=await t()(TA,{query:c});qe(l)}),r.command("error-pattern-increases").description("List error pattern increases").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).option("--team <team>","Filter by team").option("--env <env>","Filter by environment").action(async p=>{let c={from:Et("from",p.from),to:Et("to",p.to)};p.team!==void 0&&(c.team=p.team),p.env!==void 0&&(c.env=p.env);let l=await t()(_A,{query:c});qe(l)});let n=e.command("metrics").description("List and inspect metrics");n.command("list").description("List all metrics with their metadata").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).action(async p=>{let c=await t()(AA,{query:{from:Et("from",p.from),to:Et("to",p.to)}});qe(c)}),n.command("get <name>").description("Retrieve a metric by name with its metadata").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).action(async(p,c)=>{let l=await t()(bA,{params:{name:p},query:{from:Et("from",c.from),to:Et("to",c.to)}});qe(l)}),e.command("traces").description("Search traces").command("search").description("Search spans").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).option("--query <query>",`Search query${je("query")}`).option("--max-results <n>",`Maximum number of results${je("max-results")}`).action(async p=>{let c=await t()(CA,{query:jA(p)});qe(c)});let s=e.command("aggregation").description("Run aggregation queries");FA(s,"scalar","Run aggregation queries and return scalar results",dA,t),FA(s,"timeseries","Run aggregation queries and return timeseries results",fA,t)}var Zw=3e3,Jw="https://registry.npmjs.org/@tsuga/cli/latest";function Xw(e,t){let r=e.split(".").map(Number),n=t.split(".").map(Number);for(let i=0;i<Math.max(r.length,n.length);i++){let s=r[i]??0,p=n[i]??0;if(s>p)return!0;if(s<p)return!1}return!1}async function BA(e){try{let t=wA();if(t&&Date.now()-t<Na)return;let r=await fetch(Jw,{signal:AbortSignal.timeout(Zw)});if(!r.ok)return;let i=(await r.json()).version;Xw(i,e)&&(process.stderr.write(`
40
+ `,{mode:384})}function Rc(e){let t=ln(),r=e.apiToken??process.env.TSUGA_OPERATION_API_KEY??t.operationApiKey;return{apiUrl:Ww,apiToken:r}}function Cc(e){let t={};try{t=ln()}catch{}Sc({...t,...e})}function UA(){return(0,tr.existsSync)(oo)||!!process.env.TSUGA_OPERATION_API_KEY}function Pc(){return oo}var kc={from:"-30m",to:"now",query:"*","max-results":"100"};function LA(){return ln().defaults??{}}function io(e){return(ln().defaults??{})[e]??kc[e]}function NA(e,t){let r={};try{r=ln()}catch{}let n={...r.defaults??{},[e]:t};Sc({...r,defaults:n})}function MA(){let e={};try{e=ln()}catch{}let{defaults:t,...r}=e;Sc(r)}function wA(){return ln().lastUpdateCheck}function $A(e){Cc({lastUpdateCheck:e})}var Qw={s:1,m:60,h:3600,d:86400};function vA(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<48||r>57)return!1}return!0}function GA(){return Math.floor(Date.now()/1e3)}function DA(e){if(e==="now")return GA();if(e.startsWith("-")&&e.length>=3){let r=e.at(-1),n=r?Qw[r]:void 0;if(n){let i=e.slice(1,-1);if(i.length>0&&vA(i))return GA()-parseInt(i,10)*n}}if(vA(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 Et(e,t){let r=t??io(e);if(!r)throw new Error(`--${e} is required`);return DA(r)}function jA(e){let t={from:Et("from",e.from),to:Et("to",e.to)},r=e.query??io("query");r!==void 0&&(t.query=r);let n=e.maxResults??io("max-results");if(n!==void 0){let i=Number(n);if(Number.isNaN(i))throw new Error(`--max-results must be a number (got: ${n})`);t.maxResults=i}return t}function FA(e,t,r,n,i){e.command(t).description(r).option("-f, --file <path>","Read body from file (use - for stdin)").option("-d, --data <json>","Inline JSON body").option("--generate-skeleton","Print a JSON skeleton for the request body and exit").action(async s=>{if(s.generateSkeleton){qe($i(n));return}let p=vi(s),c=await i()(n,{body:p});qe(c)})}function je(e){let t=io(e);return t===void 0?"":` (default: ${t})`}function qA(e,t){let r=e.command("logs").description("Search and analyze logs");r.command("search").description("Search logs").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).option("--query <query>",`Search query${je("query")}`).option("--max-results <n>",`Maximum number of results${je("max-results")}`).action(async p=>{let c=await t()(yA,{query:jA(p)});qe(c)}),r.command("patterns").description("List log patterns").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).option("--query <query>",`Search query${je("query")}`).action(async p=>{let c={from:Et("from",p.from),to:Et("to",p.to)},l=p.query??io("query");l!==void 0&&(c.query=l);let g=await t()(EA,{query:c});qe(g)}),r.command("new-error-patterns").description("List new error patterns").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).option("--team <team>","Filter by team").option("--env <env>","Filter by environment").option("--service <service>","Filter by service").action(async p=>{let c={from:Et("from",p.from),to:Et("to",p.to)};p.team!==void 0&&(c.team=p.team),p.env!==void 0&&(c.env=p.env),p.service!==void 0&&(c.service=p.service);let l=await t()(TA,{query:c});qe(l)}),r.command("error-pattern-increases").description("List error pattern increases for a given team").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).requiredOption("--team <team>","Team to query").option("--env <env>","Filter by environment").action(async p=>{let c={from:Et("from",p.from),to:Et("to",p.to),team:p.team};p.env!==void 0&&(c.env=p.env);let l=await t()(_A,{query:c});qe(l)});let n=e.command("metrics").description("List and inspect metrics");n.command("list").description("List all metrics with their metadata").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).action(async p=>{let c=await t()(AA,{query:{from:Et("from",p.from),to:Et("to",p.to)}});qe(c)}),n.command("get <name>").description("Retrieve a metric by name with its metadata").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).action(async(p,c)=>{let l=await t()(bA,{params:{name:p},query:{from:Et("from",c.from),to:Et("to",c.to)}});qe(l)}),e.command("traces").description("Search traces").command("search").description("Search spans").option("--from <timestamp>",`Start of time range${je("from")}`).option("--to <timestamp>",`End of time range${je("to")}`).option("--query <query>",`Search query${je("query")}`).option("--max-results <n>",`Maximum number of results${je("max-results")}`).action(async p=>{let c=await t()(CA,{query:jA(p)});qe(c)});let s=e.command("aggregation").description("Run aggregation queries");FA(s,"scalar","Run aggregation queries and return scalar results",dA,t),FA(s,"timeseries","Run aggregation queries and return timeseries results",fA,t)}var Zw=3e3,Jw="https://registry.npmjs.org/@tsuga/cli/latest";function Xw(e,t){let r=e.split(".").map(Number),n=t.split(".").map(Number);for(let i=0;i<Math.max(r.length,n.length);i++){let s=r[i]??0,p=n[i]??0;if(s>p)return!0;if(s<p)return!1}return!1}async function BA(e){try{let t=wA();if(t&&Date.now()-t<Na)return;let r=await fetch(Jw,{signal:AbortSignal.timeout(Zw)});if(!r.ok)return;let i=(await r.json()).version;Xw(i,e)&&(process.stderr.write(`
41
41
  Update available: ${e} \u2192 ${i}
42
- `),process.stderr.write("Run `npm install -g @tsuga/cli` to update\n")),$A(Date.now())}catch{}}var kr=new zc().name("tsuga").description("Tsuga CLI - manage resources from the command line").version("1.0.5").option("--operation-api-key <operation-api-key>","Operation API key"),Uc;function HA(){if(!Uc){let e=kr.opts(),t=Rc({apiToken:e.apiToken});t.apiToken||(console.error("Error: API token is required. Set it with one of:"),console.error(" tsuga auth <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)),Uc=AE(t.apiUrl,t.apiToken)}return Uc}kr.command("auth <operation-api-key>").description("Save Operation API key to ~/.config/tsuga/config.json").action(e=>{Cc({operationApiKey:e}),process.stdout.write(`Operation API key saved to ${Pc()}
42
+ `),process.stderr.write("Run `npm install -g @tsuga/cli` to update\n")),$A(Date.now())}catch{}}var kr=new zc().name("tsuga").description("Tsuga CLI - manage resources from the command line").version("1.0.6").option("--operation-api-key <operation-api-key>","Operation API key"),Uc;function HA(){if(!Uc){let e=kr.opts(),t=Rc({apiToken:e.apiToken});t.apiToken||(console.error("Error: API token is required. Set it with one of:"),console.error(" tsuga auth <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)),Uc=AE(t.apiUrl,t.apiToken)}return Uc}kr.command("auth <operation-api-key>").description("Save Operation API key to ~/.config/tsuga/config.json").action(e=>{Cc({operationApiKey:e}),process.stdout.write(`Operation API key saved to ${Pc()}
43
43
  `)});kr.command("config").description("Show current configuration").action(()=>{if(!UA()){process.stdout.write(`No config found. Run: tsuga auth <operation-api-key>
44
44
  `);return}let e=kr.opts(),t=Rc({apiToken:e.apiToken}),r=[`API URL: ${t.apiUrl}`];t.apiToken?r.push(`API Token: ${t.apiToken.slice(0,12)}...${t.apiToken.slice(-4)}`):r.push("API Token: (not set)"),r.push(`Config: ${Pc()}`),process.stdout.write(`${r.join(`
45
45
  `)}
@@ -47,7 +47,7 @@ Update available: ${e} \u2192 ${i}
47
47
  `)}
48
48
  `)});KA.command("set <key> <value>").description("Set a custom default value").action((e,t)=>{NA(e,t),process.stdout.write(`Default set: ${e} = ${t}
49
49
  `)});KA.command("reset").description("Clear all custom defaults").action(()=>{MA(),process.stdout.write(`Custom defaults cleared
50
- `)});sA(kr,HA);qA(kr,HA);kr.parseAsync().then(()=>BA("1.0.5")).catch(e=>{console.error(_E(e)),process.exitCode=1});
50
+ `)});sA(kr,HA);qA(kr,HA);kr.parseAsync().then(()=>BA("1.0.6")).catch(e=>{console.error(_E(e)),process.exitCode=1});
51
51
  /**
52
52
  * The following is a list of HTTP status codes and their meanings.
53
53
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsuga/cli",
3
3
  "description": "Tsuga CLI - manage resources from the command line",
4
- "version": "1.0.5",
4
+ "version": "1.0.6",
5
5
  "bin": {
6
6
  "tsuga": "dist/cli.js"
7
7
  },