@flanksource/clicky-ui 0.3.81 → 0.3.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/json-schema-form-connection.cjs +31 -2
- package/dist/components/json-schema-form-connection.cjs.map +1 -1
- package/dist/components/json-schema-form-connection.d.ts.map +1 -1
- package/dist/components/json-schema-form-connection.js +32 -3
- package/dist/components/json-schema-form-connection.js.map +1 -1
- package/dist/components/json-schema-form-date-math.cjs +48 -0
- package/dist/components/json-schema-form-date-math.cjs.map +1 -0
- package/dist/components/json-schema-form-date-math.d.ts +9 -0
- package/dist/components/json-schema-form-date-math.d.ts.map +1 -0
- package/dist/components/json-schema-form-date-math.js +48 -0
- package/dist/components/json-schema-form-date-math.js.map +1 -0
- package/dist/components/json-schema-form-fields.cjs +11 -2
- package/dist/components/json-schema-form-fields.cjs.map +1 -1
- package/dist/components/json-schema-form-fields.d.ts.map +1 -1
- package/dist/components/json-schema-form-fields.js +11 -2
- package/dist/components/json-schema-form-fields.js.map +1 -1
- package/dist/components/json-schema-form-render.cjs +1 -1
- package/dist/components/json-schema-form-render.cjs.map +1 -1
- package/dist/components/json-schema-form-render.d.ts.map +1 -1
- package/dist/components/json-schema-form-render.js +1 -1
- package/dist/components/json-schema-form-render.js.map +1 -1
- package/dist/components/json-schema-form-resolve.cjs +1 -1
- package/dist/components/json-schema-form-resolve.cjs.map +1 -1
- package/dist/components/json-schema-form-resolve.d.ts.map +1 -1
- package/dist/components/json-schema-form-resolve.js +1 -1
- package/dist/components/json-schema-form-resolve.js.map +1 -1
- package/dist/components/json-schema-form-types.d.ts +1 -1
- package/dist/components/json-schema-form-types.d.ts.map +1 -1
- package/dist/data/data-table-filter-values.cjs +28 -7
- package/dist/data/data-table-filter-values.cjs.map +1 -1
- package/dist/data/data-table-filter-values.d.ts.map +1 -1
- package/dist/data/data-table-filter-values.js +29 -8
- package/dist/data/data-table-filter-values.js.map +1 -1
- package/dist/data/traces/otel/OtelTraceDetail.cjs +1 -6
- package/dist/data/traces/otel/OtelTraceDetail.cjs.map +1 -1
- package/dist/data/traces/otel/OtelTraceDetail.js +1 -6
- package/dist/data/traces/otel/OtelTraceDetail.js.map +1 -1
- package/dist/data/traces/otel/OtelTraceTable.cjs +5 -2
- package/dist/data/traces/otel/OtelTraceTable.cjs.map +1 -1
- package/dist/data/traces/otel/OtelTraceTable.d.ts.map +1 -1
- package/dist/data/traces/otel/OtelTraceTable.js +5 -2
- package/dist/data/traces/otel/OtelTraceTable.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/devtools/ExecutionDetail.cjs +5 -2
- package/dist/devtools/ExecutionDetail.cjs.map +1 -1
- package/dist/devtools/ExecutionDetail.js +5 -2
- package/dist/devtools/ExecutionDetail.js.map +1 -1
- package/dist/profiles/editor/profileEditor.cjs +1 -2
- package/dist/profiles/editor/profileEditor.cjs.map +1 -1
- package/dist/profiles/editor/profileEditor.d.ts.map +1 -1
- package/dist/profiles/editor/profileEditor.js +2 -3
- package/dist/profiles/editor/profileEditor.js.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.cjs +21 -5
- package/dist/profiles/editor/profileMappingPreview.cjs.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.d.ts.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.js +22 -6
- package/dist/profiles/editor/profileMappingPreview.js.map +1 -1
- package/dist/profiles/editor/spanColumns.cjs +0 -8
- package/dist/profiles/editor/spanColumns.cjs.map +1 -1
- package/dist/profiles/editor/spanColumns.d.ts +0 -1
- package/dist/profiles/editor/spanColumns.d.ts.map +1 -1
- package/dist/profiles/editor/spanColumns.js +1 -8
- package/dist/profiles/editor/spanColumns.js.map +1 -1
- package/dist/rpc/ExplorerNav.cjs +13 -0
- package/dist/rpc/ExplorerNav.cjs.map +1 -1
- package/dist/rpc/ExplorerNav.d.ts.map +1 -1
- package/dist/rpc/ExplorerNav.js +14 -1
- package/dist/rpc/ExplorerNav.js.map +1 -1
- package/dist/runtime/barrels.json +1567 -1567
- package/dist/runtime/importmap.json +2170 -2169
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileMappingPreview.cjs","names":["useRef","useState","useMemo","serverFiltersToFilterBar","profileApiPath","Clicky","OtelTraceTable","profileSpans","profileTraceListing"],"sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"sourcesContent":["import { useEffect, useMemo, useState, useRef, type Dispatch, type SetStateAction } from \"react\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport type { DataTableFilterSelection } from \"../../data/data-table-filter-values\";\nimport {\n serverFiltersToFilterBar,\n type DataTableFilterLookup,\n type DataTableServerColumn,\n} from \"../../data/data-table-server-filters\";\nimport { OtelTraceTable } from \"../../data/traces/otel/OtelTraceTable\";\nimport { profileSpans } from \"../../data/traces/otel/profile-spans\";\nimport { profileTraceListing } from \"../../data/traces/otel/profile-listing\";\nimport { Clicky, type ClickyNode } from \"../../data/Clicky\";\nimport { profileApiPath } from \"../profileApi\";\nimport type { ProfileWizardDraft } from \"../wizard/profileWizardModel\";\n\n/**\n * The filters a table preview offers. The controls are the ones the service\n * describes for the draft's columns (the result columns of the mapping\n * response), built by the same serverFiltersToFilterBar the profile query\n * results use; applying one is the caller's to do, server-side, by sampling\n * again — the table never filters the rows it was given.\n */\nexport type ProfileMappingFilters = {\n selection: DataTableFilterSelection;\n onChange: Dispatch<SetStateAction<DataTableFilterSelection>>;\n lookupValues?: DataTableFilterLookup;\n};\n\nexport function ProfileMappingPreview({\n profile,\n rows,\n onNormalized,\n filters,\n}: {\n profile: ProfileWizardDraft;\n rows: Record<string, unknown>[];\n onNormalized?: (rows: Record<string, unknown>[], columns: ProfileColumn[]) => void;\n filters?: ProfileMappingFilters;\n}) {\n const normalizedCallback = useRef(onNormalized);\n normalizedCallback.current = onNormalized;\n const [result, setResult] = useState<{\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n }>();\n const filtersRef = useRef(filters);\n filtersRef.current = filters;\n const filterConfig = useMemo(\n () =>\n filters && result?.resultColumns\n ? serverFiltersToFilterBar(\n result.resultColumns,\n filters.selection,\n filters.onChange,\n filters.lookupValues ? { lookupValues: filters.lookupValues } : {},\n )\n : undefined,\n [filters, result],\n );\n // A filtered sample may legitimately be empty, and its filter bar is how the\n // filter is cleared, so a preview that offers filters renders zero rows too.\n const idle = rows.length === 0 && !filters;\n const [error, setError] = useState(\"\");\n const [pending, setPending] = useState(false);\n const [trace, setTrace] = useState<string>();\n const [span, setSpan] = useState<string>();\n const body = JSON.stringify({\n profile: {\n profile: profile.profile,\n provider: profile.provider,\n spans: profile.spans,\n search:profile.search,\n render: profile.render,\n columns: profile.columns,\n aliases: profile.aliases,\n ignore: profile.ignore,\n filters: profile.filters,\n },\n rows,\n });\n useEffect(() => {\n if (idle) return;\n const controller = new AbortController();\n setPending(true);\n setError(\"\");\n const timer = setTimeout(() => {\n void (async () => {\n try {\n const response = await fetch(\n profileApiPath(\"profile/sample/mapping\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body,\n signal: controller.signal,\n },\n );\n if (!response.ok) throw new Error(await response.text());\n const next = (await response.json()) as {\n normalizedRows: Record<string, unknown>[];\n availableColumns: ProfileColumn[];\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n };\n if (!next.document?.node)\n throw new Error(\"the mapping response carried no rendered document\");\n if (filtersRef.current && !Array.isArray(next.resultColumns))\n throw new Error(\"the mapping response carried no resultColumns to build filters from\");\n if (!controller.signal.aborted) {\n setResult(next);\n normalizedCallback.current?.(next.normalizedRows, next.availableColumns);\n }\n } catch (error) {\n if (!controller.signal.aborted)\n setError(error instanceof Error ? error.message : String(error));\n } finally {\n if (!controller.signal.aborted) setPending(false);\n }\n })();\n }, 250);\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [body, idle]);\n if (idle) return <p>Run a sample in Query to preview mappings.</p>;\n if (error) return <p role=\"alert\">Cannot preview mappings: {error}</p>;\n // A table keeps showing the last rendering while an edit is remapped, so the\n // preview updates in place instead of blinking to a status line per keystroke.\n if (!result || (pending && profile.render === \"traces\"))\n return <p role=\"status\">Updating mapping preview…</p>;\n if (profile.render !== \"traces\")\n return (\n <div aria-busy={pending} className=\"flex h-full min-h-0 flex-col\">\n <Clicky\n data={result.document.node}\n className=\"flex min-h-0 flex-1 flex-col\"\n {...(filterConfig?.filters.length ? { externalFilters: filterConfig.filters } : {})}\n {...(filterConfig?.timeRange ? { timeRange: filterConfig.timeRange } : {})}\n />\n </div>\n );\n try {\n return (\n <OtelTraceTable\n spans={profileSpans(result.rows)}\n listing={{\n ...profileTraceListing(result.rows, result.document.node),\n linkRows: false,\n }}\n onSelectTrace={(id) => {\n setTrace(id);\n setSpan(undefined);\n }}\n onSelectSpan={setSpan}\n traceHref={(id) => `#trace=${encodeURIComponent(id)}`}\n {...(trace ? { selectedTraceId: trace } : {})}\n {...(span ? { selectedSpanId: span } : {})}\n />\n );\n } catch (error) {\n return (\n <p role=\"alert\">\n Cannot preview traces:{\" \"}\n {error instanceof Error ? error.message : String(error)}\n </p>\n );\n }\n}\n"],"mappings":";;;;;;;;;AA4BA,SAAgB,sBAAsB,EACpC,SACA,MACA,cACA,WAMC;CACD,MAAM,sBAAA,GAAqBA,MAAAA,OAAAA,CAAO,YAAY;CAC9C,mBAAmB,UAAU;CAC7B,MAAM,CAAC,QAAQ,cAAA,GAAaC,MAAAA,SAAAA,CAIzB;CACH,MAAM,cAAA,GAAaD,MAAAA,OAAAA,CAAO,OAAO;CACjC,WAAW,UAAU;CACrB,MAAM,gBAAA,GAAeE,MAAAA,QAAAA,OAEjB,WAAW,QAAQ,gBACfC,kCAAAA,yBACE,OAAO,eACP,QAAQ,WACR,QAAQ,UACR,QAAQ,eAAe,EAAE,cAAc,QAAQ,aAAa,IAAI,CAAC,CACnE,IACA,KAAA,GAC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ACnB;GACA,cAAc;GACd,YAAY,OAAO,UAAU,mBAAmB,EAAE;GAClD,GAAK,QAAQ,EAAE,iBAAiB,MAAM,IAAI,CAAC;GAC3C,GAAK,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;EACzC,CAAA;CAEL,SAAS,OAAO;EACd,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,KAAD;GAAG,MAAK;GAAR,UAAA;IAAgB;IACS;IACtB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GACrD;;CAEP;AACF"}
|
|
1
|
+
{"version":3,"file":"profileMappingPreview.cjs","names":["useRef","useState","useMemo","serverFiltersToFilterBar","profileApiPath","Callout","Clicky","_Fragment","OtelTraceTable","profileSpans","profileTraceListing"],"sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"sourcesContent":["import {\n useEffect,\n useMemo,\n useState,\n useRef,\n type Dispatch,\n type SetStateAction,\n} from \"react\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport type { DataTableFilterSelection } from \"../../data/data-table-filter-values\";\nimport {\n serverFiltersToFilterBar,\n type DataTableFilterLookup,\n type DataTableServerColumn,\n} from \"../../data/data-table-server-filters\";\nimport { OtelTraceTable } from \"../../data/traces/otel/OtelTraceTable\";\nimport { profileSpans } from \"../../data/traces/otel/profile-spans\";\nimport { profileTraceListing } from \"../../data/traces/otel/profile-listing\";\nimport { Clicky, type ClickyNode } from \"../../data/Clicky\";\nimport { Callout } from \"../../data/Callout\";\nimport { profileApiPath } from \"../profileApi\";\nimport type { ProfileWizardDraft } from \"../wizard/profileWizardModel\";\n\n/**\n * The filters a table preview offers. The controls are the ones the service\n * describes for the draft's columns (the result columns of the mapping\n * response), built by the same serverFiltersToFilterBar the profile query\n * results use; applying one is the caller's to do, server-side, by sampling\n * again — the table never filters the rows it was given.\n */\nexport type ProfileMappingFilters = {\n selection: DataTableFilterSelection;\n onChange: Dispatch<SetStateAction<DataTableFilterSelection>>;\n lookupValues?: DataTableFilterLookup;\n};\n\nexport function ProfileMappingPreview({\n profile,\n rows,\n onNormalized,\n filters,\n}: {\n profile: ProfileWizardDraft;\n rows: Record<string, unknown>[];\n onNormalized?: (\n rows: Record<string, unknown>[],\n columns: ProfileColumn[]\n ) => void;\n filters?: ProfileMappingFilters;\n}) {\n const normalizedCallback = useRef(onNormalized);\n normalizedCallback.current = onNormalized;\n const [result, setResult] = useState<{\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n unresolvedColumns?: string[];\n }>();\n const filtersRef = useRef(filters);\n filtersRef.current = filters;\n const filterConfig = useMemo(\n () =>\n filters && result?.resultColumns\n ? serverFiltersToFilterBar(\n result.resultColumns,\n filters.selection,\n filters.onChange,\n filters.lookupValues ? { lookupValues: filters.lookupValues } : {}\n )\n : undefined,\n [filters, result]\n );\n // A filtered sample may legitimately be empty, and its filter bar is how the\n // filter is cleared, so a preview that offers filters renders zero rows too.\n const idle = rows.length === 0 && !filters;\n const [error, setError] = useState(\"\");\n const [pending, setPending] = useState(false);\n const [trace, setTrace] = useState<string>();\n const [span, setSpan] = useState<string>();\n const body = JSON.stringify({\n profile: {\n profile: profile.profile,\n provider: profile.provider,\n spans: profile.spans,\n search: profile.search,\n render: profile.render,\n columns: profile.columns,\n aliases: profile.aliases,\n ignore: profile.ignore,\n filters: profile.filters,\n },\n rows,\n });\n useEffect(() => {\n if (idle) return;\n const controller = new AbortController();\n setPending(true);\n setError(\"\");\n const timer = setTimeout(() => {\n void (async () => {\n try {\n const response = await fetch(\n profileApiPath(\"profile/sample/mapping\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body,\n signal: controller.signal,\n }\n );\n if (!response.ok) throw new Error(await response.text());\n const next = (await response.json()) as {\n normalizedRows: Record<string, unknown>[];\n availableColumns: ProfileColumn[];\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n unresolvedColumns?: string[];\n };\n if (!next.document?.node)\n throw new Error(\n \"the mapping response carried no rendered document\"\n );\n if (filtersRef.current && !Array.isArray(next.resultColumns))\n throw new Error(\n \"the mapping response carried no resultColumns to build filters from\"\n );\n if (!controller.signal.aborted) {\n setResult(next);\n normalizedCallback.current?.(\n next.normalizedRows,\n next.availableColumns\n );\n }\n } catch (error) {\n if (!controller.signal.aborted)\n setError(error instanceof Error ? error.message : String(error));\n } finally {\n if (!controller.signal.aborted) setPending(false);\n }\n })();\n }, 250);\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [body, idle]);\n if (idle) return <p>Run a sample in Query to preview mappings.</p>;\n if (error) return <p role=\"alert\">Cannot preview mappings: {error}</p>;\n // A table keeps showing the last rendering while an edit is remapped, so the\n // preview updates in place instead of blinking to a status line per keystroke.\n if (!result || (pending && profile.render === \"traces\"))\n return <p role=\"status\">Updating mapping preview…</p>;\n // The service names the declared columns no sampled row has a value for. That\n // is a warning, never a refusal: the data may simply not carry them yet.\n const unresolved = result.unresolvedColumns?.length ? (\n <div role=\"status\" aria-label=\"Unresolved columns\" className=\"shrink-0\">\n <Callout\n variant=\"warning\"\n label=\"No sampled values\"\n className=\"my-0 mb-2\"\n >\n No sampled row has a value for {result.unresolvedColumns.join(\", \")}.\n They fill in once the data carries their source; otherwise check where\n they read from.\n </Callout>\n </div>\n ) : null;\n if (profile.render !== \"traces\")\n return (\n <div aria-busy={pending} className=\"flex h-full min-h-0 flex-col\">\n {unresolved}\n <Clicky\n data={result.document.node}\n className=\"flex min-h-0 flex-1 flex-col\"\n {...(filterConfig?.filters.length\n ? { externalFilters: filterConfig.filters }\n : {})}\n {...(filterConfig?.timeRange\n ? { timeRange: filterConfig.timeRange }\n : {})}\n />\n </div>\n );\n try {\n return (\n <>\n {unresolved}\n <OtelTraceTable\n spans={profileSpans(result.rows)}\n listing={{\n ...profileTraceListing(result.rows, result.document.node),\n linkRows: false,\n }}\n onSelectTrace={(id) => {\n setTrace(id);\n setSpan(undefined);\n }}\n onSelectSpan={setSpan}\n traceHref={(id) => `#trace=${encodeURIComponent(id)}`}\n {...(trace ? { selectedTraceId: trace } : {})}\n {...(span ? { selectedSpanId: span } : {})}\n />\n </>\n );\n } catch (error) {\n return (\n <p role=\"alert\">\n Cannot preview traces:{\" \"}\n {error instanceof Error ? error.message : String(error)}\n </p>\n );\n }\n}\n"],"mappings":";;;;;;;;;;AAoCA,SAAgB,sBAAsB,EACpC,SACA,MACA,cACA,WASC;CACD,MAAM,sBAAA,GAAqBA,MAAAA,OAAAA,CAAO,YAAY;CAC9C,mBAAmB,UAAU;CAC7B,MAAM,CAAC,QAAQ,cAAA,GAAaC,MAAAA,SAAAA,CAKzB;CACH,MAAM,cAAA,GAAaD,MAAAA,OAAAA,CAAO,OAAO;CACjC,WAAW,UAAU;CACrB,MAAM,gBAAA,GAAeE,MAAAA,QAAAA,OAEjB,WAAW,QAAQ,gBACfC,kCAAAA,yBACE,OAAO,eACP,QAAQ,WACR,QAAQ,UACR,QAAQ,eAAe,EAAE,cAAc,QAAQ,aAAa,IAAI,CAAC,CACnE,IACA,KAAA,GACN,CAAC,SAAS,MAAM,CAClB;CAGA,MAAM,OAAO,KAAK,WAAW,KAAK,CAAC;CACnC,MAAM,CAAC,OAAO,aAAA,GAAYF,MAAAA,SAAAA,CAAS,EAAE;CACrC,MAAM,CAAC,SAAS,eAAA,GAAcA,MAAAA,SAAAA,CAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAiB;CAC3C,MAAM,CAAC,MAAM,YAAA,GAAWA,MAAAA,SAAAA,CAAiB;CACzC,MAAM,OAAO,KAAK,UAAU;EAC1B,SAAS;GACP,SAAS,QAAQ;GACjB,UAAU,QAAQ;GAClB,OAAO,QAAQ;GACf,QAAQ,QAAQ;GAChB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;GACjB,SAAS,QAAQ;GACjB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;EACnB;EACA;CACF,CAAC;CACD,CAAA,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AAA,GAAA,kBAAA,KAAA,CAAC,KAAD;GAAG,MAAK;GAAR,UAAA;IAAgB;IACS;IACtB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GACrD;;CAEP;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileMappingPreview.d.ts","sourceRoot":"","sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"profileMappingPreview.d.ts","sourceRoot":"","sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,QAAQ,EACb,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,sCAAsC,CAAC;AAO9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,wBAAwB,CAAC;IACpC,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAC7D,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,OAAO,GACR,EAAE;IACD,OAAO,EAAE,kBAAkB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,CACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAC/B,OAAO,EAAE,aAAa,EAAE,KACrB,IAAI,CAAC;IACV,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC,+BAoKA"}
|
|
@@ -3,9 +3,10 @@ import { OtelTraceTable } from "../../data/traces/otel/OtelTraceTable.js";
|
|
|
3
3
|
import { profileSpans } from "../../data/traces/otel/profile-spans.js";
|
|
4
4
|
import { profileTraceListing } from "../../data/traces/otel/profile-listing.js";
|
|
5
5
|
import { Clicky } from "../../data/Clicky.js";
|
|
6
|
+
import { Callout } from "../../data/Callout.js";
|
|
6
7
|
import { profileApiPath } from "../profileApi.js";
|
|
7
8
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
// src/profiles/editor/profileMappingPreview.tsx
|
|
10
11
|
function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
|
|
11
12
|
const normalizedCallback = useRef(onNormalized);
|
|
@@ -76,18 +77,33 @@ function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
|
|
|
76
77
|
role: "status",
|
|
77
78
|
children: "Updating mapping preview…"
|
|
78
79
|
});
|
|
79
|
-
|
|
80
|
+
const unresolved = result.unresolvedColumns?.length ? /* @__PURE__ */ jsx("div", {
|
|
81
|
+
role: "status",
|
|
82
|
+
"aria-label": "Unresolved columns",
|
|
83
|
+
className: "shrink-0",
|
|
84
|
+
children: /* @__PURE__ */ jsxs(Callout, {
|
|
85
|
+
variant: "warning",
|
|
86
|
+
label: "No sampled values",
|
|
87
|
+
className: "my-0 mb-2",
|
|
88
|
+
children: [
|
|
89
|
+
"No sampled row has a value for ",
|
|
90
|
+
result.unresolvedColumns.join(", "),
|
|
91
|
+
". They fill in once the data carries their source; otherwise check where they read from."
|
|
92
|
+
]
|
|
93
|
+
})
|
|
94
|
+
}) : null;
|
|
95
|
+
if (profile.render !== "traces") return /* @__PURE__ */ jsxs("div", {
|
|
80
96
|
"aria-busy": pending,
|
|
81
97
|
className: "flex h-full min-h-0 flex-col",
|
|
82
|
-
children: /* @__PURE__ */ jsx(Clicky, {
|
|
98
|
+
children: [unresolved, /* @__PURE__ */ jsx(Clicky, {
|
|
83
99
|
data: result.document.node,
|
|
84
100
|
className: "flex min-h-0 flex-1 flex-col",
|
|
85
101
|
...filterConfig?.filters.length ? { externalFilters: filterConfig.filters } : {},
|
|
86
102
|
...filterConfig?.timeRange ? { timeRange: filterConfig.timeRange } : {}
|
|
87
|
-
})
|
|
103
|
+
})]
|
|
88
104
|
});
|
|
89
105
|
try {
|
|
90
|
-
return /* @__PURE__ */ jsx(OtelTraceTable, {
|
|
106
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [unresolved, /* @__PURE__ */ jsx(OtelTraceTable, {
|
|
91
107
|
spans: profileSpans(result.rows),
|
|
92
108
|
listing: {
|
|
93
109
|
...profileTraceListing(result.rows, result.document.node),
|
|
@@ -101,7 +117,7 @@ function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
|
|
|
101
117
|
traceHref: (id) => `#trace=${encodeURIComponent(id)}`,
|
|
102
118
|
...trace ? { selectedTraceId: trace } : {},
|
|
103
119
|
...span ? { selectedSpanId: span } : {}
|
|
104
|
-
});
|
|
120
|
+
})] });
|
|
105
121
|
} catch (error) {
|
|
106
122
|
return /* @__PURE__ */ jsxs("p", {
|
|
107
123
|
role: "alert",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileMappingPreview.js","names":[],"sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"sourcesContent":["import { useEffect, useMemo, useState, useRef, type Dispatch, type SetStateAction } from \"react\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport type { DataTableFilterSelection } from \"../../data/data-table-filter-values\";\nimport {\n serverFiltersToFilterBar,\n type DataTableFilterLookup,\n type DataTableServerColumn,\n} from \"../../data/data-table-server-filters\";\nimport { OtelTraceTable } from \"../../data/traces/otel/OtelTraceTable\";\nimport { profileSpans } from \"../../data/traces/otel/profile-spans\";\nimport { profileTraceListing } from \"../../data/traces/otel/profile-listing\";\nimport { Clicky, type ClickyNode } from \"../../data/Clicky\";\nimport { profileApiPath } from \"../profileApi\";\nimport type { ProfileWizardDraft } from \"../wizard/profileWizardModel\";\n\n/**\n * The filters a table preview offers. The controls are the ones the service\n * describes for the draft's columns (the result columns of the mapping\n * response), built by the same serverFiltersToFilterBar the profile query\n * results use; applying one is the caller's to do, server-side, by sampling\n * again — the table never filters the rows it was given.\n */\nexport type ProfileMappingFilters = {\n selection: DataTableFilterSelection;\n onChange: Dispatch<SetStateAction<DataTableFilterSelection>>;\n lookupValues?: DataTableFilterLookup;\n};\n\nexport function ProfileMappingPreview({\n profile,\n rows,\n onNormalized,\n filters,\n}: {\n profile: ProfileWizardDraft;\n rows: Record<string, unknown>[];\n onNormalized?: (rows: Record<string, unknown>[], columns: ProfileColumn[]) => void;\n filters?: ProfileMappingFilters;\n}) {\n const normalizedCallback = useRef(onNormalized);\n normalizedCallback.current = onNormalized;\n const [result, setResult] = useState<{\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n }>();\n const filtersRef = useRef(filters);\n filtersRef.current = filters;\n const filterConfig = useMemo(\n () =>\n filters && result?.resultColumns\n ? serverFiltersToFilterBar(\n result.resultColumns,\n filters.selection,\n filters.onChange,\n filters.lookupValues ? { lookupValues: filters.lookupValues } : {},\n )\n : undefined,\n [filters, result],\n );\n // A filtered sample may legitimately be empty, and its filter bar is how the\n // filter is cleared, so a preview that offers filters renders zero rows too.\n const idle = rows.length === 0 && !filters;\n const [error, setError] = useState(\"\");\n const [pending, setPending] = useState(false);\n const [trace, setTrace] = useState<string>();\n const [span, setSpan] = useState<string>();\n const body = JSON.stringify({\n profile: {\n profile: profile.profile,\n provider: profile.provider,\n spans: profile.spans,\n search:profile.search,\n render: profile.render,\n columns: profile.columns,\n aliases: profile.aliases,\n ignore: profile.ignore,\n filters: profile.filters,\n },\n rows,\n });\n useEffect(() => {\n if (idle) return;\n const controller = new AbortController();\n setPending(true);\n setError(\"\");\n const timer = setTimeout(() => {\n void (async () => {\n try {\n const response = await fetch(\n profileApiPath(\"profile/sample/mapping\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body,\n signal: controller.signal,\n },\n );\n if (!response.ok) throw new Error(await response.text());\n const next = (await response.json()) as {\n normalizedRows: Record<string, unknown>[];\n availableColumns: ProfileColumn[];\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n };\n if (!next.document?.node)\n throw new Error(\"the mapping response carried no rendered document\");\n if (filtersRef.current && !Array.isArray(next.resultColumns))\n throw new Error(\"the mapping response carried no resultColumns to build filters from\");\n if (!controller.signal.aborted) {\n setResult(next);\n normalizedCallback.current?.(next.normalizedRows, next.availableColumns);\n }\n } catch (error) {\n if (!controller.signal.aborted)\n setError(error instanceof Error ? error.message : String(error));\n } finally {\n if (!controller.signal.aborted) setPending(false);\n }\n })();\n }, 250);\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [body, idle]);\n if (idle) return <p>Run a sample in Query to preview mappings.</p>;\n if (error) return <p role=\"alert\">Cannot preview mappings: {error}</p>;\n // A table keeps showing the last rendering while an edit is remapped, so the\n // preview updates in place instead of blinking to a status line per keystroke.\n if (!result || (pending && profile.render === \"traces\"))\n return <p role=\"status\">Updating mapping preview…</p>;\n if (profile.render !== \"traces\")\n return (\n <div aria-busy={pending} className=\"flex h-full min-h-0 flex-col\">\n <Clicky\n data={result.document.node}\n className=\"flex min-h-0 flex-1 flex-col\"\n {...(filterConfig?.filters.length ? { externalFilters: filterConfig.filters } : {})}\n {...(filterConfig?.timeRange ? { timeRange: filterConfig.timeRange } : {})}\n />\n </div>\n );\n try {\n return (\n <OtelTraceTable\n spans={profileSpans(result.rows)}\n listing={{\n ...profileTraceListing(result.rows, result.document.node),\n linkRows: false,\n }}\n onSelectTrace={(id) => {\n setTrace(id);\n setSpan(undefined);\n }}\n onSelectSpan={setSpan}\n traceHref={(id) => `#trace=${encodeURIComponent(id)}`}\n {...(trace ? { selectedTraceId: trace } : {})}\n {...(span ? { selectedSpanId: span } : {})}\n />\n );\n } catch (error) {\n return (\n <p role=\"alert\">\n Cannot preview traces:{\" \"}\n {error instanceof Error ? error.message : String(error)}\n </p>\n );\n }\n}\n"],"mappings":";;;;;;;;;AA4BA,SAAgB,sBAAsB,EACpC,SACA,MACA,cACA,WAMC;CACD,MAAM,qBAAqB,OAAO,YAAY;CAC9C,mBAAmB,UAAU;CAC7B,MAAM,CAAC,QAAQ,aAAa,SAIzB;CACH,MAAM,aAAa,OAAO,OAAO;CACjC,WAAW,UAAU;CACrB,MAAM,eAAe,cAEjB,WAAW,QAAQ,gBACf,yBACE,OAAO,eACP,QAAQ,WACR,QAAQ,UACR,QAAQ,eAAe,EAAE,cAAc,QAAQ,aAAa,IAAI,CAAC,CACnE,IACA,KAAA,GACN,CAAC,SAAS,MAAM,CAClB;CAGA,MAAM,OAAO,KAAK,WAAW,KAAK,CAAC;CACnC,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CACrC,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,YAAY,SAAiB;CAC3C,MAAM,CAAC,MAAM,WAAW,SAAiB;CACzC,MAAM,OAAO,KAAK,UAAU;EAC1B,SAAS;GACP,SAAS,QAAQ;GACjB,UAAU,QAAQ;GAClB,OAAO,QAAQ;GACf,QAAO,QAAQ;GACf,QAAQ,QAAQ;GAChB,SAAS,QAAQ;GACjB,SAAS,QAAQ;GACjB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;EACnB;EACA;CACF,CAAC;CACD,gBAAgB;EACd,IAAI,MAAM;EACV,MAAM,aAAa,IAAI,gBAAgB;EACvC,WAAW,IAAI;EACf,SAAS,EAAE;EACX,MAAM,QAAQ,iBAAiB;GAC7B,CAAM,YAAY;IAChB,IAAI;KACF,MAAM,WAAW,MAAM,MACrB,eAAe,wBAAwB,GACvC;M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,aAAa,UAAU,IAAI,CAAC;EACzE,CAAA;CACE,CAAA;CAET,IAAI;EACF,OACE,oBAAC,gBAAD;GACE,OAAO,aAAa,OAAO,IAAI;GAC/B,SAAS;IACP,GAAG,oBAAoB,OAAO,MAAM,OAAO,SAAS,IAAI;IACxD,UAAU;GACZ;GACA,gBAAgB,OAAO;IACrB,SAAS,EAAE;IACX,QAAQ,KAAA,CAAS;GACnB;GACA,cAAc;GACd,YAAY,OAAO,UAAU,mBAAmB,EAAE;GAClD,GAAK,QAAQ,EAAE,iBAAiB,MAAM,IAAI,CAAC;GAC3C,GAAK,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;EACzC,CAAA;CAEL,SAAS,OAAO;EACd,OACE,qBAAC,KAAD;GAAG,MAAK;GAAR,UAAA;IAAgB;IACS;IACtB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GACrD;;CAEP;AACF"}
|
|
1
|
+
{"version":3,"file":"profileMappingPreview.js","names":["_Fragment"],"sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"sourcesContent":["import {\n useEffect,\n useMemo,\n useState,\n useRef,\n type Dispatch,\n type SetStateAction,\n} from \"react\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport type { DataTableFilterSelection } from \"../../data/data-table-filter-values\";\nimport {\n serverFiltersToFilterBar,\n type DataTableFilterLookup,\n type DataTableServerColumn,\n} from \"../../data/data-table-server-filters\";\nimport { OtelTraceTable } from \"../../data/traces/otel/OtelTraceTable\";\nimport { profileSpans } from \"../../data/traces/otel/profile-spans\";\nimport { profileTraceListing } from \"../../data/traces/otel/profile-listing\";\nimport { Clicky, type ClickyNode } from \"../../data/Clicky\";\nimport { Callout } from \"../../data/Callout\";\nimport { profileApiPath } from \"../profileApi\";\nimport type { ProfileWizardDraft } from \"../wizard/profileWizardModel\";\n\n/**\n * The filters a table preview offers. The controls are the ones the service\n * describes for the draft's columns (the result columns of the mapping\n * response), built by the same serverFiltersToFilterBar the profile query\n * results use; applying one is the caller's to do, server-side, by sampling\n * again — the table never filters the rows it was given.\n */\nexport type ProfileMappingFilters = {\n selection: DataTableFilterSelection;\n onChange: Dispatch<SetStateAction<DataTableFilterSelection>>;\n lookupValues?: DataTableFilterLookup;\n};\n\nexport function ProfileMappingPreview({\n profile,\n rows,\n onNormalized,\n filters,\n}: {\n profile: ProfileWizardDraft;\n rows: Record<string, unknown>[];\n onNormalized?: (\n rows: Record<string, unknown>[],\n columns: ProfileColumn[]\n ) => void;\n filters?: ProfileMappingFilters;\n}) {\n const normalizedCallback = useRef(onNormalized);\n normalizedCallback.current = onNormalized;\n const [result, setResult] = useState<{\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n unresolvedColumns?: string[];\n }>();\n const filtersRef = useRef(filters);\n filtersRef.current = filters;\n const filterConfig = useMemo(\n () =>\n filters && result?.resultColumns\n ? serverFiltersToFilterBar(\n result.resultColumns,\n filters.selection,\n filters.onChange,\n filters.lookupValues ? { lookupValues: filters.lookupValues } : {}\n )\n : undefined,\n [filters, result]\n );\n // A filtered sample may legitimately be empty, and its filter bar is how the\n // filter is cleared, so a preview that offers filters renders zero rows too.\n const idle = rows.length === 0 && !filters;\n const [error, setError] = useState(\"\");\n const [pending, setPending] = useState(false);\n const [trace, setTrace] = useState<string>();\n const [span, setSpan] = useState<string>();\n const body = JSON.stringify({\n profile: {\n profile: profile.profile,\n provider: profile.provider,\n spans: profile.spans,\n search: profile.search,\n render: profile.render,\n columns: profile.columns,\n aliases: profile.aliases,\n ignore: profile.ignore,\n filters: profile.filters,\n },\n rows,\n });\n useEffect(() => {\n if (idle) return;\n const controller = new AbortController();\n setPending(true);\n setError(\"\");\n const timer = setTimeout(() => {\n void (async () => {\n try {\n const response = await fetch(\n profileApiPath(\"profile/sample/mapping\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body,\n signal: controller.signal,\n }\n );\n if (!response.ok) throw new Error(await response.text());\n const next = (await response.json()) as {\n normalizedRows: Record<string, unknown>[];\n availableColumns: ProfileColumn[];\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n unresolvedColumns?: string[];\n };\n if (!next.document?.node)\n throw new Error(\n \"the mapping response carried no rendered document\"\n );\n if (filtersRef.current && !Array.isArray(next.resultColumns))\n throw new Error(\n \"the mapping response carried no resultColumns to build filters from\"\n );\n if (!controller.signal.aborted) {\n setResult(next);\n normalizedCallback.current?.(\n next.normalizedRows,\n next.availableColumns\n );\n }\n } catch (error) {\n if (!controller.signal.aborted)\n setError(error instanceof Error ? error.message : String(error));\n } finally {\n if (!controller.signal.aborted) setPending(false);\n }\n })();\n }, 250);\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [body, idle]);\n if (idle) return <p>Run a sample in Query to preview mappings.</p>;\n if (error) return <p role=\"alert\">Cannot preview mappings: {error}</p>;\n // A table keeps showing the last rendering while an edit is remapped, so the\n // preview updates in place instead of blinking to a status line per keystroke.\n if (!result || (pending && profile.render === \"traces\"))\n return <p role=\"status\">Updating mapping preview…</p>;\n // The service names the declared columns no sampled row has a value for. That\n // is a warning, never a refusal: the data may simply not carry them yet.\n const unresolved = result.unresolvedColumns?.length ? (\n <div role=\"status\" aria-label=\"Unresolved columns\" className=\"shrink-0\">\n <Callout\n variant=\"warning\"\n label=\"No sampled values\"\n className=\"my-0 mb-2\"\n >\n No sampled row has a value for {result.unresolvedColumns.join(\", \")}.\n They fill in once the data carries their source; otherwise check where\n they read from.\n </Callout>\n </div>\n ) : null;\n if (profile.render !== \"traces\")\n return (\n <div aria-busy={pending} className=\"flex h-full min-h-0 flex-col\">\n {unresolved}\n <Clicky\n data={result.document.node}\n className=\"flex min-h-0 flex-1 flex-col\"\n {...(filterConfig?.filters.length\n ? { externalFilters: filterConfig.filters }\n : {})}\n {...(filterConfig?.timeRange\n ? { timeRange: filterConfig.timeRange }\n : {})}\n />\n </div>\n );\n try {\n return (\n <>\n {unresolved}\n <OtelTraceTable\n spans={profileSpans(result.rows)}\n listing={{\n ...profileTraceListing(result.rows, result.document.node),\n linkRows: false,\n }}\n onSelectTrace={(id) => {\n setTrace(id);\n setSpan(undefined);\n }}\n onSelectSpan={setSpan}\n traceHref={(id) => `#trace=${encodeURIComponent(id)}`}\n {...(trace ? { selectedTraceId: trace } : {})}\n {...(span ? { selectedSpanId: span } : {})}\n />\n </>\n );\n } catch (error) {\n return (\n <p role=\"alert\">\n Cannot preview traces:{\" \"}\n {error instanceof Error ? error.message : String(error)}\n </p>\n );\n }\n}\n"],"mappings":";;;;;;;;;;AAoCA,SAAgB,sBAAsB,EACpC,SACA,MACA,cACA,WASC;CACD,MAAM,qBAAqB,OAAO,YAAY;CAC9C,mBAAmB,UAAU;CAC7B,MAAM,CAAC,QAAQ,aAAa,SAKzB;CACH,MAAM,aAAa,OAAO,OAAO;CACjC,WAAW,UAAU;CACrB,MAAM,eAAe,cAEjB,WAAW,QAAQ,gBACf,yBACE,OAAO,eACP,QAAQ,WACR,QAAQ,UACR,QAAQ,eAAe,EAAE,cAAc,QAAQ,aAAa,IAAI,CAAC,CACnE,IACA,KAAA,GACN,CAAC,SAAS,MAAM,CAClB;CAGA,MAAM,OAAO,KAAK,WAAW,KAAK,CAAC;CACnC,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CACrC,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,YAAY,SAAiB;CAC3C,MAAM,CAAC,MAAM,WAAW,SAAiB;CACzC,MAAM,OAAO,KAAK,UAAU;EAC1B,SAAS;GACP,SAAS,QAAQ;GACjB,UAAU,QAAQ;GAClB,OAAO,QAAQ;GACf,QAAQ,QAAQ;GAChB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;GACjB,SAAS,QAAQ;GACjB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;EACnB;EACA;CACF,CAAC;CACD,gBAAgB;EACd,IAAI,MAAM;EACV,MAAM,aAA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C3D,UAAA,qBAAC,SAAD;GACE,SAAQ;GACR,OAAM;GACN,WAAU;GAHZ,UAAA;IAIC;IACiC,OAAO,kBAAkB,KAAK,IAAI;IAAE;GAG7D;;CACN,CAAA,IACH;CACJ,IAAI,QAAQ,WAAW,UACrB,OACE,qBAAC,OAAD;EAAK,aAAW;EAAS,WAAU;EAAnC,UAAA,CACG,YACD,oBAAC,QAAD;GACE,MAAM,OAAO,SAAS;GACtB,WAAU;GACV,GAAK,cAAc,QAAQ,SACvB,EAAE,iBAAiB,aAAa,QAAQ,IACxC,CAAC;GACL,GAAK,cAAc,YACf,EAAE,WAAW,aAAa,UAAU,IACpC,CAAC;EACN,CAAA,CACE;;CAET,IAAI;EACF,OACE,qBAAAA,YAAA,EAAA,UAAA,CACG,YACD,oBAAC,gBAAD;GACE,OAAO,aAAa,OAAO,IAAI;GAC/B,SAAS;IACP,GAAG,oBAAoB,OAAO,MAAM,OAAO,SAAS,IAAI;IACxD,UAAU;GACZ;GACA,gBAAgB,OAAO;IACrB,SAAS,EAAE;IACX,QAAQ,KAAA,CAAS;GACnB;GACA,cAAc;GACd,YAAY,OAAO,UAAU,mBAAmB,EAAE;GAClD,GAAK,QAAQ,EAAE,iBAAiB,MAAM,IAAI,CAAC;GAC3C,GAAK,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;EACzC,CAAA,CACD,EAAA,CAAA;CAEN,SAAS,OAAO;EACd,OACE,qBAAC,KAAD;GAAG,MAAK;GAAR,UAAA;IAAgB;IACS;IACtB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GACrD;;CAEP;AACF"}
|
|
@@ -5,14 +5,6 @@ function defaultSpanColumns() {
|
|
|
5
5
|
if (!Array.isArray(columns) || !columns.length) throw new Error("Profile schema is missing canonical span defaults");
|
|
6
6
|
return structuredClone(columns);
|
|
7
7
|
}
|
|
8
|
-
var SPAN_ATTRIBUTE_SOURCES = /* @__PURE__ */ new Set(["_span_attributes", "_resource"]);
|
|
9
|
-
function obsoleteSpanColumns(configured, available) {
|
|
10
|
-
return configured.filter((column) => {
|
|
11
|
-
if (column.source && SPAN_ATTRIBUTE_SOURCES.has(column.source) && column.jsonpath) return false;
|
|
12
|
-
return !available.some((field) => field.name === (column.source || column.name) || column.source !== void 0 && field.source === column.source && field.jsonpath === column.jsonpath);
|
|
13
|
-
}).map((column) => column.name);
|
|
14
|
-
}
|
|
15
8
|
exports.defaultSpanColumns = defaultSpanColumns;
|
|
16
|
-
exports.obsoleteSpanColumns = obsoleteSpanColumns;
|
|
17
9
|
|
|
18
10
|
//# sourceMappingURL=spanColumns.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spanColumns.cjs","names":["profileSchema"],"sources":["../../../src/profiles/editor/spanColumns.ts"],"sourcesContent":["import type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport { profileSchema } from \"../profileApi\";\n\nexport function defaultSpanColumns(): ProfileColumn[] {\n const columns = profileSchema().properties?.spans?.[\"x-clicky-default-columns\"];\n if (!Array.isArray(columns) || !columns.length) throw new Error(\"Profile schema is missing canonical span defaults\");\n return structuredClone(columns) as ProfileColumn[];\n}\n
|
|
1
|
+
{"version":3,"file":"spanColumns.cjs","names":["profileSchema"],"sources":["../../../src/profiles/editor/spanColumns.ts"],"sourcesContent":["import type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport { profileSchema } from \"../profileApi\";\n\nexport function defaultSpanColumns(): ProfileColumn[] {\n const columns = profileSchema().properties?.spans?.[\"x-clicky-default-columns\"];\n if (!Array.isArray(columns) || !columns.length) throw new Error(\"Profile schema is missing canonical span defaults\");\n return structuredClone(columns) as ProfileColumn[];\n}\n"],"mappings":";;AAGA,SAAgB,qBAAsC;CACpD,MAAM,UAAUA,mBAAAA,cAAc,CAAC,CAAC,YAAY,QAAQ;CACpD,IAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,CAAC,QAAQ,QAAQ,MAAM,IAAI,MAAM,mDAAmD;CACnH,OAAO,gBAAgB,OAAO;AAChC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { ProfileColumn } from '../wizard/profileWizardModel.js';
|
|
2
2
|
export declare function defaultSpanColumns(): ProfileColumn[];
|
|
3
|
-
export declare function obsoleteSpanColumns(configured: ProfileColumn[], available: ProfileColumn[]): string[];
|
|
4
3
|
//# sourceMappingURL=spanColumns.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spanColumns.d.ts","sourceRoot":"","sources":["../../../src/profiles/editor/spanColumns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,wBAAgB,kBAAkB,IAAI,aAAa,EAAE,CAIpD
|
|
1
|
+
{"version":3,"file":"spanColumns.d.ts","sourceRoot":"","sources":["../../../src/profiles/editor/spanColumns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,wBAAgB,kBAAkB,IAAI,aAAa,EAAE,CAIpD"}
|
|
@@ -5,13 +5,6 @@ function defaultSpanColumns() {
|
|
|
5
5
|
if (!Array.isArray(columns) || !columns.length) throw new Error("Profile schema is missing canonical span defaults");
|
|
6
6
|
return structuredClone(columns);
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
function obsoleteSpanColumns(configured, available) {
|
|
10
|
-
return configured.filter((column) => {
|
|
11
|
-
if (column.source && SPAN_ATTRIBUTE_SOURCES.has(column.source) && column.jsonpath) return false;
|
|
12
|
-
return !available.some((field) => field.name === (column.source || column.name) || column.source !== void 0 && field.source === column.source && field.jsonpath === column.jsonpath);
|
|
13
|
-
}).map((column) => column.name);
|
|
14
|
-
}
|
|
15
|
-
export { defaultSpanColumns, obsoleteSpanColumns };
|
|
8
|
+
export { defaultSpanColumns };
|
|
16
9
|
|
|
17
10
|
//# sourceMappingURL=spanColumns.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spanColumns.js","names":[],"sources":["../../../src/profiles/editor/spanColumns.ts"],"sourcesContent":["import type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport { profileSchema } from \"../profileApi\";\n\nexport function defaultSpanColumns(): ProfileColumn[] {\n const columns = profileSchema().properties?.spans?.[\"x-clicky-default-columns\"];\n if (!Array.isArray(columns) || !columns.length) throw new Error(\"Profile schema is missing canonical span defaults\");\n return structuredClone(columns) as ProfileColumn[];\n}\n
|
|
1
|
+
{"version":3,"file":"spanColumns.js","names":[],"sources":["../../../src/profiles/editor/spanColumns.ts"],"sourcesContent":["import type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport { profileSchema } from \"../profileApi\";\n\nexport function defaultSpanColumns(): ProfileColumn[] {\n const columns = profileSchema().properties?.spans?.[\"x-clicky-default-columns\"];\n if (!Array.isArray(columns) || !columns.length) throw new Error(\"Profile schema is missing canonical span defaults\");\n return structuredClone(columns) as ProfileColumn[];\n}\n"],"mappings":";;AAGA,SAAgB,qBAAsC;CACpD,MAAM,UAAU,cAAc,CAAC,CAAC,YAAY,QAAQ;CACpD,IAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,CAAC,QAAQ,QAAQ,MAAM,IAAI,MAAM,mDAAmD;CACnH,OAAO,gBAAgB,OAAO;AAChC"}
|
package/dist/rpc/ExplorerNav.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_Icon = require("../data/Icon.cjs");
|
|
2
|
+
const require_UiArrowLeft = require("../icons/components/UiArrowLeft.cjs");
|
|
2
3
|
const require_UiChevronRight = require("../icons/components/UiChevronRight.cjs");
|
|
3
4
|
const require_router = require("./router.cjs");
|
|
4
5
|
const require_explorer_nav_context = require("./explorer-nav-context.cjs");
|
|
@@ -22,6 +23,18 @@ function ExplorerNavPortal({ parentHref, children }) {
|
|
|
22
23
|
"aria-label": "Breadcrumb",
|
|
23
24
|
className: "flex min-w-0 flex-1 items-center gap-density-2",
|
|
24
25
|
children: [
|
|
26
|
+
renderLink({
|
|
27
|
+
to: parentHref,
|
|
28
|
+
title: `Back to ${title}`,
|
|
29
|
+
className: "inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground",
|
|
30
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
31
|
+
icon: require_UiArrowLeft.UiArrowLeft,
|
|
32
|
+
className: "size-4"
|
|
33
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
34
|
+
className: "sr-only",
|
|
35
|
+
children: ["Back to ", title]
|
|
36
|
+
})] })
|
|
37
|
+
}),
|
|
25
38
|
renderLink({
|
|
26
39
|
to: parentHref,
|
|
27
40
|
className: "shrink-0 text-base font-semibold tracking-tight text-muted-foreground hover:text-foreground hover:underline",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExplorerNav.cjs","names":["useContext","ExplorerNavContext","useRouter","createPortal","Icon","UiChevronRight"],"sources":["../../src/rpc/ExplorerNav.tsx"],"sourcesContent":["import { useContext, useEffect, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Icon } from \"../data/Icon\";\nimport { UiChevronRight } from \"../icons\";\nimport { useRouter } from \"./router\";\nimport { ExplorerNavContext } from \"./explorer-nav-context\";\n\nexport type ExplorerNavPortalProps = {\n /** Where the surface breadcrumb leads — the surface listing with the host's filters kept. */\n parentHref: string;\n children: ReactNode;\n};\n\n/**\n * Renders a drill-down page's title into EntityExplorerApp's top bar, after a\n * breadcrumb back to the surface it was opened from.\n */\nexport function ExplorerNavPortal({ parentHref, children }: ExplorerNavPortalProps) {\n const slot = useContext(ExplorerNavContext);\n const { renderLink } = useRouter();\n const claim = slot?.claim;\n useEffect(() => claim?.(), [claim]);\n if (!slot) throw new Error(\"ExplorerNavPortal must render inside EntityExplorerApp\");\n const { container, title, titleActions } = slot;\n if (!container) return null;\n return createPortal(\n <nav aria-label=\"Breadcrumb\" className=\"flex min-w-0 flex-1 items-center gap-density-2\">\n {renderLink({\n to: parentHref,\n className: \"shrink-0 text-base font-semibold tracking-tight text-muted-foreground hover:text-foreground hover:underline\",\n children: title,\n })}\n {titleActions ? <div className=\"flex shrink-0 items-center\">{titleActions}</div> : null}\n <Icon icon={UiChevronRight} className=\"shrink-0 text-muted-foreground\" />\n <div aria-current=\"page\" className=\"flex min-w-0 flex-1 items-center gap-density-2\">\n {children}\n </div>\n </nav>,\n container,\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExplorerNav.cjs","names":["useContext","ExplorerNavContext","useRouter","createPortal","_Fragment","Icon","UiArrowLeft","UiChevronRight"],"sources":["../../src/rpc/ExplorerNav.tsx"],"sourcesContent":["import { useContext, useEffect, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Icon } from \"../data/Icon\";\nimport { UiArrowLeft, UiChevronRight } from \"../icons\";\nimport { useRouter } from \"./router\";\nimport { ExplorerNavContext } from \"./explorer-nav-context\";\n\nexport type ExplorerNavPortalProps = {\n /** Where the surface breadcrumb leads — the surface listing with the host's filters kept. */\n parentHref: string;\n children: ReactNode;\n};\n\n/**\n * Renders a drill-down page's title into EntityExplorerApp's top bar, after a\n * breadcrumb back to the surface it was opened from.\n */\nexport function ExplorerNavPortal({ parentHref, children }: ExplorerNavPortalProps) {\n const slot = useContext(ExplorerNavContext);\n const { renderLink } = useRouter();\n const claim = slot?.claim;\n useEffect(() => claim?.(), [claim]);\n if (!slot) throw new Error(\"ExplorerNavPortal must render inside EntityExplorerApp\");\n const { container, title, titleActions } = slot;\n if (!container) return null;\n return createPortal(\n <nav aria-label=\"Breadcrumb\" className=\"flex min-w-0 flex-1 items-center gap-density-2\">\n {renderLink({\n to: parentHref,\n title: `Back to ${title}`,\n className: \"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground\",\n children: (\n <>\n <Icon icon={UiArrowLeft} className=\"size-4\" />\n <span className=\"sr-only\">Back to {title}</span>\n </>\n ),\n })}\n {renderLink({\n to: parentHref,\n className: \"shrink-0 text-base font-semibold tracking-tight text-muted-foreground hover:text-foreground hover:underline\",\n children: title,\n })}\n {titleActions ? <div className=\"flex shrink-0 items-center\">{titleActions}</div> : null}\n <Icon icon={UiChevronRight} className=\"shrink-0 text-muted-foreground\" />\n <div aria-current=\"page\" className=\"flex min-w-0 flex-1 items-center gap-density-2\">\n {children}\n </div>\n </nav>,\n container,\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,SAAgB,kBAAkB,EAAE,YAAY,YAAoC;CAClF,MAAM,QAAA,GAAOA,MAAAA,WAAAA,CAAWC,6BAAAA,kBAAkB;CAC1C,MAAM,EAAE,eAAeC,eAAAA,UAAU;CACjC,MAAM,QAAQ,MAAM;CACpB,CAAA,GAAA,MAAA,UAAA,OAAgB,QAAQ,GAAG,CAAC,KAAK,CAAC;CAClC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,wDAAwD;CACnF,MAAM,EAAE,WAAW,OAAO,iBAAiB;CAC3C,IAAI,CAAC,WAAW,OAAO;CACvB,QAAA,GAAOC,UAAAA,aAAAA,CACL,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,cAAW;EAAa,WAAU;EAAvC,UAAA;GACG,WAAW;IACV,IAAI;IACJ,OAAO,WAAW;IAClB,WAAW;IACX,UACE,iBAAA,GAAA,kBAAA,KAAA,CAAAC,kBAAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,aAAAA,MAAD;KAAM,MAAMC,oBAAAA;KAAa,WAAU;IAAU,CAAA,GAC7C,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;KAAM,WAAU;KAAhB,UAAA,CAA0B,YAAS,KAAY;IAC/C,CAAA,CAAA,EAAA,CAAA;GAEN,CAAC;GACA,WAAW;IACV,IAAI;IACJ,WAAW;IACX,UAAU;GACZ,CAAC;GACA,eAAe,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,WAAU;IAA8B,UAAA;GAAkB,CAAA,IAAI;GACnF,iBAAA,GAAA,kBAAA,IAAA,CAACD,aAAAA,MAAD;IAAM,MAAME,uBAAAA;IAAgB,WAAU;GAAkC,CAAA;GACxE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,gBAAa;IAAO,WAAU;IAChC;GACE,CAAA;EACF;CACL,CAAA,GAAA,SACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExplorerNav.d.ts","sourceRoot":"","sources":["../../src/rpc/ExplorerNav.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO9D,MAAM,MAAM,sBAAsB,GAAG;IACnC,6FAA6F;IAC7F,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"ExplorerNav.d.ts","sourceRoot":"","sources":["../../src/rpc/ExplorerNav.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO9D,MAAM,MAAM,sBAAsB,GAAG;IACnC,6FAA6F;IAC7F,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,sBAAsB,sCAkCjF"}
|
package/dist/rpc/ExplorerNav.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Icon } from "../data/Icon.js";
|
|
2
|
+
import { UiArrowLeft } from "../icons/components/UiArrowLeft.js";
|
|
2
3
|
import { UiChevronRight } from "../icons/components/UiChevronRight.js";
|
|
3
4
|
import { useRouter } from "./router.js";
|
|
4
5
|
import { ExplorerNavContext } from "./explorer-nav-context.js";
|
|
5
6
|
import { useContext, useEffect } from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { createPortal } from "react-dom";
|
|
8
9
|
// src/rpc/ExplorerNav.tsx
|
|
9
10
|
/**
|
|
@@ -22,6 +23,18 @@ function ExplorerNavPortal({ parentHref, children }) {
|
|
|
22
23
|
"aria-label": "Breadcrumb",
|
|
23
24
|
className: "flex min-w-0 flex-1 items-center gap-density-2",
|
|
24
25
|
children: [
|
|
26
|
+
renderLink({
|
|
27
|
+
to: parentHref,
|
|
28
|
+
title: `Back to ${title}`,
|
|
29
|
+
className: "inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground",
|
|
30
|
+
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Icon, {
|
|
31
|
+
icon: UiArrowLeft,
|
|
32
|
+
className: "size-4"
|
|
33
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
34
|
+
className: "sr-only",
|
|
35
|
+
children: ["Back to ", title]
|
|
36
|
+
})] })
|
|
37
|
+
}),
|
|
25
38
|
renderLink({
|
|
26
39
|
to: parentHref,
|
|
27
40
|
className: "shrink-0 text-base font-semibold tracking-tight text-muted-foreground hover:text-foreground hover:underline",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExplorerNav.js","names":[],"sources":["../../src/rpc/ExplorerNav.tsx"],"sourcesContent":["import { useContext, useEffect, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Icon } from \"../data/Icon\";\nimport { UiChevronRight } from \"../icons\";\nimport { useRouter } from \"./router\";\nimport { ExplorerNavContext } from \"./explorer-nav-context\";\n\nexport type ExplorerNavPortalProps = {\n /** Where the surface breadcrumb leads — the surface listing with the host's filters kept. */\n parentHref: string;\n children: ReactNode;\n};\n\n/**\n * Renders a drill-down page's title into EntityExplorerApp's top bar, after a\n * breadcrumb back to the surface it was opened from.\n */\nexport function ExplorerNavPortal({ parentHref, children }: ExplorerNavPortalProps) {\n const slot = useContext(ExplorerNavContext);\n const { renderLink } = useRouter();\n const claim = slot?.claim;\n useEffect(() => claim?.(), [claim]);\n if (!slot) throw new Error(\"ExplorerNavPortal must render inside EntityExplorerApp\");\n const { container, title, titleActions } = slot;\n if (!container) return null;\n return createPortal(\n <nav aria-label=\"Breadcrumb\" className=\"flex min-w-0 flex-1 items-center gap-density-2\">\n {renderLink({\n to: parentHref,\n className: \"shrink-0 text-base font-semibold tracking-tight text-muted-foreground hover:text-foreground hover:underline\",\n children: title,\n })}\n {titleActions ? <div className=\"flex shrink-0 items-center\">{titleActions}</div> : null}\n <Icon icon={UiChevronRight} className=\"shrink-0 text-muted-foreground\" />\n <div aria-current=\"page\" className=\"flex min-w-0 flex-1 items-center gap-density-2\">\n {children}\n </div>\n </nav>,\n container,\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExplorerNav.js","names":["_Fragment"],"sources":["../../src/rpc/ExplorerNav.tsx"],"sourcesContent":["import { useContext, useEffect, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Icon } from \"../data/Icon\";\nimport { UiArrowLeft, UiChevronRight } from \"../icons\";\nimport { useRouter } from \"./router\";\nimport { ExplorerNavContext } from \"./explorer-nav-context\";\n\nexport type ExplorerNavPortalProps = {\n /** Where the surface breadcrumb leads — the surface listing with the host's filters kept. */\n parentHref: string;\n children: ReactNode;\n};\n\n/**\n * Renders a drill-down page's title into EntityExplorerApp's top bar, after a\n * breadcrumb back to the surface it was opened from.\n */\nexport function ExplorerNavPortal({ parentHref, children }: ExplorerNavPortalProps) {\n const slot = useContext(ExplorerNavContext);\n const { renderLink } = useRouter();\n const claim = slot?.claim;\n useEffect(() => claim?.(), [claim]);\n if (!slot) throw new Error(\"ExplorerNavPortal must render inside EntityExplorerApp\");\n const { container, title, titleActions } = slot;\n if (!container) return null;\n return createPortal(\n <nav aria-label=\"Breadcrumb\" className=\"flex min-w-0 flex-1 items-center gap-density-2\">\n {renderLink({\n to: parentHref,\n title: `Back to ${title}`,\n className: \"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground\",\n children: (\n <>\n <Icon icon={UiArrowLeft} className=\"size-4\" />\n <span className=\"sr-only\">Back to {title}</span>\n </>\n ),\n })}\n {renderLink({\n to: parentHref,\n className: \"shrink-0 text-base font-semibold tracking-tight text-muted-foreground hover:text-foreground hover:underline\",\n children: title,\n })}\n {titleActions ? <div className=\"flex shrink-0 items-center\">{titleActions}</div> : null}\n <Icon icon={UiChevronRight} className=\"shrink-0 text-muted-foreground\" />\n <div aria-current=\"page\" className=\"flex min-w-0 flex-1 items-center gap-density-2\">\n {children}\n </div>\n </nav>,\n container,\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,SAAgB,kBAAkB,EAAE,YAAY,YAAoC;CAClF,MAAM,OAAO,WAAW,kBAAkB;CAC1C,MAAM,EAAE,eAAe,UAAU;CACjC,MAAM,QAAQ,MAAM;CACpB,gBAAgB,QAAQ,GAAG,CAAC,KAAK,CAAC;CAClC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,wDAAwD;CACnF,MAAM,EAAE,WAAW,OAAO,iBAAiB;CAC3C,IAAI,CAAC,WAAW,OAAO;CACvB,OAAO,aACL,qBAAC,OAAD;EAAK,cAAW;EAAa,WAAU;EAAvC,UAAA;GACG,WAAW;IACV,IAAI;IACJ,OAAO,WAAW;IAClB,WAAW;IACX,UACE,qBAAAA,YAAA,EAAA,UAAA,CACE,oBAAC,MAAD;KAAM,MAAM;KAAa,WAAU;IAAU,CAAA,GAC7C,qBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA,CAA0B,YAAS,KAAY;IAC/C,CAAA,CAAA,EAAA,CAAA;GAEN,CAAC;GACA,WAAW;IACV,IAAI;IACJ,WAAW;IACX,UAAU;GACZ,CAAC;GACA,eAAe,oBAAC,OAAD;IAAK,WAAU;IAA8B,UAAA;GAAkB,CAAA,IAAI;GACnF,oBAAC,MAAD;IAAM,MAAM;IAAgB,WAAU;GAAkC,CAAA;GACxE,oBAAC,OAAD;IAAK,gBAAa;IAAO,WAAU;IAChC;GACE,CAAA;EACF;CACL,CAAA,GAAA,SACF;AACF"}
|