@datadog/apps-frontend 0.0.4 → 0.0.5

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.
@@ -0,0 +1,46 @@
1
+ /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ * Copyright 2019-Present Datadog, Inc.
4
+ */
5
+
6
+ import { DruidsEnvironment } from '@datadog/druids/layout/DruidsEnvironment';
7
+ import type { ComponentProps, ReactElement } from 'react';
8
+ import type { DatadogAppTheme } from '../../inputs/schemas/index.js';
9
+ type DruidsEnvironmentProps = ComponentProps<typeof DruidsEnvironment>;
10
+ /**
11
+ * Everything {@link DruidsEnvironment} accepts, except the two
12
+ * theme-preference props this component owns: the initial preference arrives
13
+ * as a plain `'light' | 'dark'` and the live one comes from the
14
+ * `datadog.theme` input, so neither can be forwarded by callers.
15
+ */
16
+ export type DruidsEnvironmentWithThemeInputProps = Omit<DruidsEnvironmentProps, 'defaultThemePreference' | 'fallbackThemePreference'> & {
17
+ /**
18
+ * Theme rendered until the `datadog.theme` input claims -- and whenever it
19
+ * cannot (the claim is pending, the host offers no such input, or the
20
+ * claim failed). The host's live theme replaces it the moment it arrives.
21
+ */
22
+ defaultThemePreference: DatadogAppTheme;
23
+ };
24
+ /**
25
+ * `DruidsEnvironment` driven by the host's live `datadog.theme` input.
26
+ *
27
+ * A drop-in for `@datadog/druids/layout/DruidsEnvironment`: every other prop
28
+ * is forwarded unchanged. The first render applies `defaultThemePreference`,
29
+ * and as soon as the `datadog.theme` input claims, the host's actual theme
30
+ * takes over and live-updates whenever the user switches it. Until then --
31
+ * and whenever the input never resolves -- your initial preference stays
32
+ * applied. That keeps the app deterministic instead of falling back to
33
+ * DRUIDS' own cookie and iframe detection, which forces light mode inside the
34
+ * iframe every Datadog App runs in, and means the worst case is a brief
35
+ * initial paint in your default theme.
36
+ *
37
+ * Must be rendered below `DatadogAppProvider`
38
+ * (`@datadog/apps-frontend/embedding/react`), like every Datadog App hook.
39
+ *
40
+ * To opt out of the input -- for example to keep DRUIDS' own cookie-based
41
+ * preference handling -- render `DruidsEnvironment` directly instead. This
42
+ * subpath is the only entry that requires `@datadog/druids` (an optional peer
43
+ * dependency): apps that do not import it do not bundle DRUIDS.
44
+ */
45
+ export declare function DruidsEnvironmentWithThemeInput(props: DruidsEnvironmentWithThemeInputProps): ReactElement;
46
+ export {};
@@ -0,0 +1,7 @@
1
+ /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ * Copyright 2019-Present Datadog, Inc.
4
+ */
5
+
6
+ export { DruidsEnvironmentWithThemeInput } from './druids-environment-with-theme-input.js';
7
+ export type { DruidsEnvironmentWithThemeInputProps } from './druids-environment-with-theme-input.js';
@@ -0,0 +1,7 @@
1
+ /* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0.
2
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
3
+ * Copyright 2019-Present Datadog, Inc.
4
+ */
5
+
6
+ import{a as r}from"../../_chunks/chunk-O6R7PFZZ.js";import"../../_chunks/chunk-2V2HASKF.js";import{a as t}from"../../_chunks/chunk-IM4AWPJX.js";import"../../_chunks/chunk-T34NWJ7R.js";import"../../_chunks/chunk-X34MSTJH.js";import{DruidsEnvironment as i}from"@datadog/druids/layout/DruidsEnvironment";import{createElement as s}from"react";function u(n){let{defaultThemePreference:m,...o}=n,e=r(t),p=e.status==="ready"?e.fields.theme:m;return s(i,{...o,defaultThemePreference:p})}export{u as DruidsEnvironmentWithThemeInput};
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/druids/react/druids-environment-with-theme-input.ts"],
4
+ "sourcesContent": ["import { DruidsEnvironment } from '@datadog/druids/layout/DruidsEnvironment';\nimport { createElement } from 'react';\nimport type { ComponentProps, ReactElement } from 'react';\n\nimport { useDatadogAppInput } from '../../inputs/react/index';\nimport { datadogTheme } from '../../inputs/schemas/index';\nimport type { DatadogAppTheme } from '../../inputs/schemas/index';\n\ntype DruidsEnvironmentProps = ComponentProps<typeof DruidsEnvironment>;\n\n/**\n * `SavedThemes` is the type `DruidsEnvironment` expects for its preference\n * props, but `@datadog/druids` does not export it. Recover it structurally --\n * its runtime values are exactly `'light' | 'dark' | 'system'`, so accepting\n * the cast below is only teaching the compiler that correspondence.\n */\ntype DruidsThemePreference = DruidsEnvironmentProps['defaultThemePreference'];\n\n/**\n * Everything {@link DruidsEnvironment} accepts, except the two\n * theme-preference props this component owns: the initial preference arrives\n * as a plain `'light' | 'dark'` and the live one comes from the\n * `datadog.theme` input, so neither can be forwarded by callers.\n */\nexport type DruidsEnvironmentWithThemeInputProps = Omit<\n DruidsEnvironmentProps,\n 'defaultThemePreference' | 'fallbackThemePreference'\n> & {\n /**\n * Theme rendered until the `datadog.theme` input claims -- and whenever it\n * cannot (the claim is pending, the host offers no such input, or the\n * claim failed). The host's live theme replaces it the moment it arrives.\n */\n defaultThemePreference: DatadogAppTheme;\n};\n\n/**\n * `DruidsEnvironment` driven by the host's live `datadog.theme` input.\n *\n * A drop-in for `@datadog/druids/layout/DruidsEnvironment`: every other prop\n * is forwarded unchanged. The first render applies `defaultThemePreference`,\n * and as soon as the `datadog.theme` input claims, the host's actual theme\n * takes over and live-updates whenever the user switches it. Until then --\n * and whenever the input never resolves -- your initial preference stays\n * applied. That keeps the app deterministic instead of falling back to\n * DRUIDS' own cookie and iframe detection, which forces light mode inside the\n * iframe every Datadog App runs in, and means the worst case is a brief\n * initial paint in your default theme.\n *\n * Must be rendered below `DatadogAppProvider`\n * (`@datadog/apps-frontend/embedding/react`), like every Datadog App hook.\n *\n * To opt out of the input -- for example to keep DRUIDS' own cookie-based\n * preference handling -- render `DruidsEnvironment` directly instead. This\n * subpath is the only entry that requires `@datadog/druids` (an optional peer\n * dependency): apps that do not import it do not bundle DRUIDS.\n */\nexport function DruidsEnvironmentWithThemeInput(\n props: DruidsEnvironmentWithThemeInputProps,\n): ReactElement {\n const { defaultThemePreference, ...druidsEnvironmentProps } = props;\n const themeInput = useDatadogAppInput(datadogTheme);\n const preference: DatadogAppTheme =\n themeInput.status === 'ready'\n ? themeInput.fields.theme\n : defaultThemePreference;\n\n return createElement(DruidsEnvironment, {\n ...druidsEnvironmentProps,\n // `preference` is `'light' | 'dark'`; only the enum wrapper differs.\n defaultThemePreference: preference as DruidsThemePreference,\n });\n}\n"],
5
+ "mappings": "gOAAA,OAAS,qBAAAA,MAAyB,2CAClC,OAAS,iBAAAC,MAAqB,QAwDvB,SAASC,EACZC,EACY,CACZ,GAAM,CAAE,uBAAAC,EAAwB,GAAGC,CAAuB,EAAIF,EACxDG,EAAaC,EAAmBC,CAAY,EAC5CC,EACFH,EAAW,SAAW,QAChBA,EAAW,OAAO,MAClBF,EAEV,OAAOM,EAAcC,EAAmB,CACpC,GAAGN,EAEH,uBAAwBI,CAC5B,CAAC,CACL",
6
+ "names": ["DruidsEnvironment", "createElement", "DruidsEnvironmentWithThemeInput", "props", "defaultThemePreference", "druidsEnvironmentProps", "themeInput", "useDatadogAppInput", "datadogTheme", "preference", "createElement", "DruidsEnvironment"]
7
+ }
@@ -3,5 +3,5 @@
3
3
  * Copyright 2019-Present Datadog, Inc.
4
4
  */
5
5
 
6
- import{d as i}from"../../_chunks/chunk-2V2HASKF.js";import{c as n}from"../../_chunks/chunk-T34NWJ7R.js";import"../../_chunks/chunk-X34MSTJH.js";import{useSyncExternalStore as p}from"react";function a(e){let o=i();n(e);let t=o.getClaim(e.latest);return p(t.subscribe,t.getSnapshot,t.getSnapshot)}export{a as useDatadogAppInput};
6
+ import{a}from"../../_chunks/chunk-O6R7PFZZ.js";import"../../_chunks/chunk-2V2HASKF.js";import"../../_chunks/chunk-T34NWJ7R.js";import"../../_chunks/chunk-X34MSTJH.js";export{a as useDatadogAppInput};
7
7
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../src/inputs/react/use-datadog-app-input.ts"],
4
- "sourcesContent": ["import { useSyncExternalStore } from 'react';\n\nimport { useAppEmbedding } from '../../embedding/react/context';\nimport type { ClaimState } from '../../embedding/types';\nimport { assertPublishedDatadogAppInputsDefinition } from '../published-definition';\nimport type { DatadogAppInputDefinition } from '../schemas/index';\n\n/**\n * What {@link useDatadogAppInput} gives back for one input: `pending` while the\n * connection or claim is in flight, `ready` with validated `fields`, `unavailable`\n * when this host does not provide the input, or `failed` with an actionable\n * `error`. `fields` exists only on `ready`, so stale values can never be read as\n * live.\n *\n * Named in terms of the input rather than the contract behind it -- which\n * version is being served is not a caller's concern.\n */\nexport type DatadogAppInputState<\n TDefinition extends DatadogAppInputDefinition,\n> = ClaimState<TDefinition['latest']>;\n\n/**\n * A type that refuses to match while saying why.\n *\n * A compiler error is the one piece of documentation a caller cannot skip, so\n * rejections here resolve to a sentence rather than to a bare `never` -- the\n * message becomes the error text, at the call site, in the editor.\n */\ntype Rejected<TMessage extends string> = Readonly<{\n __datadogAppInputsError: TMessage;\n}>;\n\ntype PublishedDefinitionFor<TDefinition extends DatadogAppInputDefinition> =\n Extract<\n DatadogAppInputDefinition,\n Readonly<{ identifier: TDefinition['identifier'] }>\n >;\n\ntype NoExtraFields<TDefinition extends DatadogAppInputDefinition> =\n Exclude<\n keyof TDefinition['latest']['fields'],\n keyof PublishedDefinitionFor<TDefinition>['latest']['fields']\n > extends never\n ? unknown\n : Rejected<'This definition has fields the published one does not. Pass a definition exported from @datadog/apps-frontend/inputs/schema, unmodified.'>;\n\n/**\n * Claims one Datadog App input and tracks its state across renders. Call it\n * below {@link DatadogAppProvider}.\n *\n * Pass a definition exported from `@datadog/apps-frontend/inputs/schema` --\n * {@link datadogTheme} is one. Hovering a definition shows the surfaces it is\n * offered on; the returned {@link ClaimState} says whether its values are usable\n * yet, and carries `fields` only while they are.\n *\n * Versions are not a caller's concern: this claims whichever version the\n * installed copy of the package treats as latest. An older copy asks for an\n * older version and keeps working for as long as the host still converts to it.\n * Past that the claim fails with `APP_MAJOR_TOO_OLD` -- update this package and\n * re-upload the app -- rather than silently degrading.\n *\n * @param definition An input definition from `@datadog/apps-frontend/inputs/schema`.\n * @returns The claim's current state: `pending`, `ready` (with `fields`),\n * `unavailable` when this host does not provide the input, or `failed` with an\n * actionable `error`.\n */\nexport function useDatadogAppInput<\n const TDefinition extends DatadogAppInputDefinition,\n>(\n definition: TDefinition & NoExtraFields<TDefinition>,\n): DatadogAppInputState<TDefinition> {\n const embedding = useAppEmbedding();\n assertPublishedDatadogAppInputsDefinition(definition);\n const store = embedding.getClaim<TDefinition['latest']>(definition.latest);\n return useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getSnapshot,\n );\n}\n"],
5
- "mappings": "gJAAA,OAAS,wBAAAA,MAA4B,QAkE9B,SAASC,EAGZC,EACiC,CACjC,IAAMC,EAAYC,EAAgB,EAClCC,EAA0CH,CAAU,EACpD,IAAMI,EAAQH,EAAU,SAAgCD,EAAW,MAAM,EACzE,OAAOK,EACHD,EAAM,UACNA,EAAM,YACNA,EAAM,WACV,CACJ",
6
- "names": ["useSyncExternalStore", "useDatadogAppInput", "definition", "embedding", "useAppEmbedding", "assertPublishedDatadogAppInputsDefinition", "store", "useSyncExternalStore"]
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
7
  }
@@ -3,5 +3,5 @@
3
3
  * Copyright 2019-Present Datadog, Inc.
4
4
  */
5
5
 
6
- import{a as O,b as T}from"../../_chunks/chunk-T34NWJ7R.js";import"../../_chunks/chunk-X34MSTJH.js";var Me=Object.freeze({status:"aborted"});function g(e,t,r){function n(u,m){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:m,constr:o,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,m);let p=o.prototype,f=Object.keys(p);for(let v=0;v<f.length;v++){let $=f[v];$ in u||(u[$]=p[$].bind(u))}}let i=r?.Parent??Object;class d extends i{}Object.defineProperty(d,"name",{value:e});function o(u){var m;let p=r?.Parent?new d:this;n(p,u),(m=p._zod).deferred??(m.deferred=[]);for(let f of p._zod.deferred)f();return p}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:u=>r?.Parent&&u instanceof r.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};var K={};function b(e){return e&&Object.assign(K,e),K}function B(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function ie(e,t){return typeof t=="bigint"?t.toString():t}function X(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function oe(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var ne=Symbol("evaluating");function z(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ne)return n===void 0&&(n=ne,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var q="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ae(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Le=X(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});var ue=new Set(["string","number","symbol"]);function E(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function A(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function y(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Re={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function j(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function M(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function N(e){return typeof e=="string"?e:e?.message}function I(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=N(e.inst?._zod.def?.error?.(e))??N(t?.error?.(e))??N(r.customError?.(e))??N(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}var le=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ie,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},se=g("$ZodError",le),U=g("$ZodError",le,{Parent:Error});var Fe=e=>(t,r,n,i)=>{let d=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},d);if(o instanceof Promise)throw new _;if(o.issues.length){let u=new(i?.Err??e)(o.issues.map(m=>I(m,d,b())));throw q(u,i?.callee),u}return o.value},L=Fe(U),Ve=e=>async(t,r,n,i)=>{let d=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},d);if(o instanceof Promise&&(o=await o),o.issues.length){let u=new(i?.Err??e)(o.issues.map(m=>I(m,d,b())));throw q(u,i?.callee),u}return o.value},R=Ve(U),Je=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},d=t._zod.run({value:r,issues:[]},i);if(d instanceof Promise)throw new _;return d.issues.length?{success:!1,error:new(e??se)(d.issues.map(o=>I(o,i,b())))}:{success:!0,data:d.value}},Z=Je(U),Ge=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},d=t._zod.run({value:r,issues:[]},i);return d instanceof Promise&&(d=await d),d.issues.length?{success:!1,error:new e(d.issues.map(o=>I(o,i,b())))}:{success:!0,data:d.value}},P=Ge(U);var Ke="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",We=new RegExp(`^${Ke}$`);var de=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var me=/^-?\d+(?:\.\d+)?$/,pe=/^(?:true|false)$/i;var ge={major:4,minor:3,patch:6};var h=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ge;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let d of i._zod.onattach)d(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(o,u,m)=>{let p=j(o),f;for(let v of u){if(v._zod.def.when){if(!v._zod.def.when(o))continue}else if(p)continue;let $=o.issues.length,x=v._zod.check(o);if(x instanceof Promise&&m?.async===!1)throw new _;if(f||x instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await x,o.issues.length!==$&&(p||(p=j(o,$)))});else{if(o.issues.length===$)continue;p||(p=j(o,$))}}return f?f.then(()=>o):o},d=(o,u,m)=>{if(j(o))return o.aborted=!0,o;let p=i(u,n,m);if(p instanceof Promise){if(m.async===!1)throw new _;return p.then(f=>e._zod.parse(f,m))}return e._zod.parse(p,m)};e._zod.run=(o,u)=>{if(u.skipChecks)return e._zod.parse(o,u);if(u.direction==="backward"){let p=e._zod.parse({value:o.value,issues:[]},{...u,skipChecks:!0});return p instanceof Promise?p.then(f=>d(f,o,u)):d(p,o,u)}let m=e._zod.parse(o,u);if(m instanceof Promise){if(u.async===!1)throw new _;return m.then(p=>i(p,n,u))}return i(m,n,u)}}z(e,"~standard",()=>({validate:i=>{try{let d=Z(e,i);return d.success?{value:d.data}:{issues:d.error?.issues}}catch{return P(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),Y=g("$ZodString",(e,t)=>{h.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??de(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});var _e=g("$ZodNumber",(e,t)=>{h.init(e,t),e._zod.pattern=e._zod.bag.pattern??me,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let d=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...d?{received:d}:{}}),r}});var H=g("$ZodBoolean",(e,t)=>{h.init(e,t),e._zod.pattern=pe,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}});function ve(e,t,r){e.issues.length&&t.issues.push(...M(r,e.issues)),t.value[r]=e.value}var xe=g("$ZodArray",(e,t)=>{h.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let d=[];for(let o=0;o<i.length;o++){let u=i[o],m=t.element._zod.run({value:u,issues:[]},n);m instanceof Promise?d.push(m.then(p=>ve(p,r,o))):ve(m,r,o)}return d.length?Promise.all(d).then(()=>r):r}});function C(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...M(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Xe(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=ce(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function qe(e,t,r,n,i,d){let o=[],u=i.keySet,m=i.catchall._zod,p=m.def.type,f=m.optout==="optional";for(let v in t){if(u.has(v))continue;if(p==="never"){o.push(v);continue}let $=m.run({value:t[v],issues:[]},n);$ instanceof Promise?e.push($.then(x=>C(x,r,v,t,f))):C($,r,v,t,f)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:d}),e.length?Promise.all(e).then(()=>r):r}var ye=g("$ZodObject",(e,t)=>{if(h.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let u=t.shape;Object.defineProperty(t,"shape",{get:()=>{let m={...u};return Object.defineProperty(t,"shape",{value:m}),m}})}let n=X(()=>Xe(t));z(e._zod,"propValues",()=>{let u=t.shape,m={};for(let p in u){let f=u[p]._zod;if(f.values){m[p]??(m[p]=new Set);for(let v of f.values)m[p].add(v)}}return m});let i=ae,d=t.catchall,o;e._zod.parse=(u,m)=>{o??(o=n.value);let p=u.value;if(!i(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value={};let f=[],v=o.shape;for(let $ of o.keys){let x=v[$],w=x._zod.optout==="optional",G=x._zod.run({value:p[$],issues:[]},m);G instanceof Promise?f.push(G.then(Ae=>C(Ae,u,$,p,w))):C(G,u,$,p,w)}return d?qe(f,p,u,m,n.value,e):f.length?Promise.all(f).then(()=>u):u}});var be=g("$ZodEnum",(e,t)=>{h.init(e,t);let r=B(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>ue.has(typeof i)).map(i=>typeof i=="string"?E(i):i.toString()).join("|")})$`),e._zod.parse=(i,d)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:r,input:o,inst:e}),i}});function $e(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var ze=g("$ZodOptional",(e,t)=>{h.init(e,t),e._zod.optin="optional",e._zod.optout="optional",z(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),z(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${oe(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(d=>$e(d,r.value)):$e(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}});var Ie;var Q=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Se(){return new Q}(Ie=globalThis).__zod_globalRegistry??(Ie.__zod_globalRegistry=Se());var ee=globalThis.__zod_globalRegistry;function we(e,t){return new e({type:"string",...y(t)})}function je(e,t){return new e({type:"number",checks:[],...y(t)})}function Ue(e,t){return new e({type:"boolean",...y(t)})}var k=g("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");h.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>L(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Z(e,r,n),e.parseAsync=async(r,n)=>R(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>P(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>A(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Ze=g("ZodMiniString",(e,t)=>{Y.init(e,t),k.init(e,t)});function S(e){return we(Ze,e)}var Pe=g("ZodMiniNumber",(e,t)=>{_e.init(e,t),k.init(e,t)});function te(e){return je(Pe,e)}var De=g("ZodMiniBoolean",(e,t)=>{H.init(e,t),k.init(e,t)});function Oe(e){return Ue(De,e)}var lt=g("ZodMiniArray",(e,t)=>{xe.init(e,t),k.init(e,t)});function re(e,t){return new lt({type:"array",element:e,...y(t)})}var st=g("ZodMiniObject",(e,t)=>{ye.init(e,t),k.init(e,t),z(e,"shape",()=>t.shape)});function V(e,t){let r={type:"object",shape:e??{},...y(t)};return new st(r)}var dt=g("ZodMiniEnum",(e,t)=>{be.init(e,t),k.init(e,t),e.options=Object.values(t.entries)});function Te(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new dt({type:"enum",entries:r,...y(t)})}var mt=g("ZodMiniOptional",(e,t)=>{ze.init(e,t),k.init(e,t)});function J(e){return new mt({type:"optional",innerType:e})}var ht=T({identifier:"datadog.theme",version:1,fields:{theme:O.readOnly(Te(["light","dark"]))}});var _t=V({name:S(),value:S(),values:J(re(S())),prefix:J(S()),default:J(S())}),xt=V({start:te(),end:te(),isLive:Oe()}),yt=V({timeframe:xt,templateVariables:re(_t)}),bt=T({identifier:"datadog.dashboard",version:1,surfaces:["datadog.dashboard"],fields:{dashboard:O.readOnly(yt)}});export{bt as datadogDashboard,ht as datadogTheme};
6
+ import{a,b}from"../../_chunks/chunk-IM4AWPJX.js";import"../../_chunks/chunk-T34NWJ7R.js";import"../../_chunks/chunk-X34MSTJH.js";export{b as datadogDashboard,a as datadogTheme};
7
7
  //# sourceMappingURL=index.js.map