@perses-dev/flame-chart-plugin 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +23 -0
- package/__mf/css/async/325.f56729ca.css +1 -0
- package/__mf/css/async/341.f56729ca.css +1 -0
- package/__mf/css/async/908.f56729ca.css +1 -0
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/FlameChart.96aae761.js +5 -0
- package/__mf/js/async/109.f7e97e30.js +73 -0
- package/__mf/js/async/109.f7e97e30.js.LICENSE.txt +35 -0
- package/__mf/js/async/173.40a64c5c.js +2 -0
- package/__mf/js/async/173.40a64c5c.js.LICENSE.txt +19 -0
- package/__mf/js/async/214.f491540e.js +1 -0
- package/__mf/js/async/224.511d05b6.js +1 -0
- package/__mf/js/async/238.5fdc556e.js +1 -0
- package/__mf/js/async/29.8b55315e.js +1 -0
- package/__mf/js/async/292.643bbcde.js +1 -0
- package/__mf/js/async/32.a46fc45f.js +110 -0
- package/__mf/js/async/32.a46fc45f.js.LICENSE.txt +49 -0
- package/__mf/js/async/325.80031d25.js +1 -0
- package/__mf/js/async/362.c587718a.js +1 -0
- package/__mf/js/async/409.fd2d437e.js +1 -0
- package/__mf/js/async/464.bb266d9b.js +7 -0
- package/__mf/js/async/464.bb266d9b.js.LICENSE.txt +21 -0
- package/__mf/js/async/488.807096d6.js +1 -0
- package/__mf/js/async/600.fdf527b8.js +38 -0
- package/__mf/js/async/651.9eb6f201.js +1 -0
- package/__mf/js/async/69.a1079bc1.js +2 -0
- package/__mf/js/async/69.a1079bc1.js.LICENSE.txt +24 -0
- package/__mf/js/async/694.15848123.js +1 -0
- package/__mf/js/async/738.0b2ab393.js +1 -0
- package/__mf/js/async/740.65aa69e2.js +1 -0
- package/__mf/js/async/75.3435fe3f.js +1 -0
- package/__mf/js/async/770.bc6ab5a3.js +1 -0
- package/__mf/js/async/863.8b7bdf43.js +2 -0
- package/__mf/js/async/863.8b7bdf43.js.LICENSE.txt +9 -0
- package/__mf/js/async/908.0672909d.js +1 -0
- package/__mf/js/async/960.d56a397e.js +2 -0
- package/__mf/js/async/960.d56a397e.js.LICENSE.txt +8 -0
- package/__mf/js/async/964.86d91e52.js +2 -0
- package/__mf/js/async/964.86d91e52.js.LICENSE.txt +9 -0
- package/__mf/js/async/981.4de2d5c8.js +2 -0
- package/__mf/js/async/981.4de2d5c8.js.LICENSE.txt +8 -0
- package/__mf/js/async/__federation_expose_FlameChart.aaa6df30.js +17 -0
- package/__mf/js/async/lib-router.00804bbc.js +2 -0
- package/__mf/js/async/lib-router.00804bbc.js.LICENSE.txt +32 -0
- package/__mf/js/main.4931a266.js +5 -0
- package/lib/FlameChart.d.ts +8 -0
- package/lib/FlameChart.d.ts.map +1 -0
- package/lib/FlameChart.js +32 -0
- package/lib/FlameChart.js.map +1 -0
- package/lib/bootstrap.d.ts +2 -0
- package/lib/bootstrap.d.ts.map +1 -0
- package/lib/bootstrap.js +19 -0
- package/lib/bootstrap.js.map +1 -0
- package/lib/cjs/FlameChart.js +38 -0
- package/lib/cjs/bootstrap.js +26 -0
- package/lib/cjs/components/CustomBreadcrumb.js +96 -0
- package/lib/cjs/components/FlameChart.js +341 -0
- package/lib/cjs/components/FlameChartOptionsEditorSettings.js +87 -0
- package/lib/cjs/components/FlameChartPanel.js +147 -0
- package/lib/cjs/components/PaletteSelector.js +49 -0
- package/lib/cjs/components/SearchBar.js +59 -0
- package/lib/cjs/components/SeriesChart.js +189 -0
- package/lib/cjs/components/Settings.js +202 -0
- package/lib/cjs/components/SwitchSelector.js +37 -0
- package/lib/cjs/components/TableChart.js +143 -0
- package/lib/cjs/components/index.js +39 -0
- package/lib/cjs/env.d.js +14 -0
- package/lib/cjs/flame-chart-model.js +31 -0
- package/lib/cjs/getPluginModule.js +39 -0
- package/lib/cjs/index-federation.js +55 -0
- package/lib/cjs/index.js +37 -0
- package/lib/cjs/setup-tests.js +19 -0
- package/lib/cjs/utils/data-model.js +18 -0
- package/lib/cjs/utils/data-transform.js +152 -0
- package/lib/cjs/utils/format.js +87 -0
- package/lib/cjs/utils/palette-gen.js +68 -0
- package/lib/cjs/utils/palette.js +62 -0
- package/lib/cjs/utils/series-tooltip.js +51 -0
- package/lib/cjs/utils/tooltip.js +76 -0
- package/lib/cjs/utils/ui-text.js +30 -0
- package/lib/cjs/utils/utils.js +108 -0
- package/lib/components/CustomBreadcrumb.d.ts +9 -0
- package/lib/components/CustomBreadcrumb.d.ts.map +1 -0
- package/lib/components/CustomBreadcrumb.js +83 -0
- package/lib/components/CustomBreadcrumb.js.map +1 -0
- package/lib/components/FlameChart.d.ts +13 -0
- package/lib/components/FlameChart.d.ts.map +1 -0
- package/lib/components/FlameChart.js +328 -0
- package/lib/components/FlameChart.js.map +1 -0
- package/lib/components/FlameChartOptionsEditorSettings.d.ts +4 -0
- package/lib/components/FlameChartOptionsEditorSettings.d.ts.map +1 -0
- package/lib/components/FlameChartOptionsEditorSettings.js +79 -0
- package/lib/components/FlameChartOptionsEditorSettings.js.map +1 -0
- package/lib/components/FlameChartPanel.d.ts +7 -0
- package/lib/components/FlameChartPanel.d.ts.map +1 -0
- package/lib/components/FlameChartPanel.js +139 -0
- package/lib/components/FlameChartPanel.js.map +1 -0
- package/lib/components/PaletteSelector.d.ts +8 -0
- package/lib/components/PaletteSelector.d.ts.map +1 -0
- package/lib/components/PaletteSelector.js +41 -0
- package/lib/components/PaletteSelector.js.map +1 -0
- package/lib/components/SearchBar.d.ts +7 -0
- package/lib/components/SearchBar.d.ts.map +1 -0
- package/lib/components/SearchBar.js +46 -0
- package/lib/components/SearchBar.js.map +1 -0
- package/lib/components/SeriesChart.d.ts +9 -0
- package/lib/components/SeriesChart.d.ts.map +1 -0
- package/lib/components/SeriesChart.js +181 -0
- package/lib/components/SeriesChart.js.map +1 -0
- package/lib/components/Settings.d.ts +11 -0
- package/lib/components/Settings.d.ts.map +1 -0
- package/lib/components/Settings.js +189 -0
- package/lib/components/Settings.js.map +1 -0
- package/lib/components/SwitchSelector.d.ts +8 -0
- package/lib/components/SwitchSelector.d.ts.map +1 -0
- package/lib/components/SwitchSelector.js +29 -0
- package/lib/components/SwitchSelector.js.map +1 -0
- package/lib/components/TableChart.d.ts +12 -0
- package/lib/components/TableChart.d.ts.map +1 -0
- package/lib/components/TableChart.js +135 -0
- package/lib/components/TableChart.js.map +1 -0
- package/lib/components/index.d.ts +11 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +24 -0
- package/lib/components/index.js.map +1 -0
- package/lib/env.d.js +15 -0
- package/lib/env.d.js.map +1 -0
- package/lib/flame-chart-model.d.ts +18 -0
- package/lib/flame-chart-model.d.ts.map +1 -0
- package/lib/flame-chart-model.js +23 -0
- package/lib/flame-chart-model.js.map +1 -0
- package/lib/getPluginModule.d.ts +6 -0
- package/lib/getPluginModule.d.ts.map +1 -0
- package/lib/getPluginModule.js +28 -0
- package/lib/getPluginModule.js.map +1 -0
- package/lib/index-federation.d.ts +1 -0
- package/lib/index-federation.d.ts.map +1 -0
- package/lib/index-federation.js +15 -0
- package/lib/index-federation.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -0
- package/lib/setup-tests.d.ts +2 -0
- package/lib/setup-tests.d.ts.map +1 -0
- package/lib/setup-tests.js +17 -0
- package/lib/setup-tests.js.map +1 -0
- package/lib/utils/data-model.d.ts +37 -0
- package/lib/utils/data-model.d.ts.map +1 -0
- package/lib/utils/data-model.js +19 -0
- package/lib/utils/data-model.js.map +1 -0
- package/lib/utils/data-transform.d.ts +19 -0
- package/lib/utils/data-transform.d.ts.map +1 -0
- package/lib/utils/data-transform.js +138 -0
- package/lib/utils/data-transform.js.map +1 -0
- package/lib/utils/format.d.ts +3 -0
- package/lib/utils/format.d.ts.map +1 -0
- package/lib/utils/format.js +71 -0
- package/lib/utils/format.js.map +1 -0
- package/lib/utils/palette-gen.d.ts +14 -0
- package/lib/utils/palette-gen.d.ts.map +1 -0
- package/lib/utils/palette-gen.js +56 -0
- package/lib/utils/palette-gen.js.map +1 -0
- package/lib/utils/palette.d.ts +5 -0
- package/lib/utils/palette.d.ts.map +1 -0
- package/lib/utils/palette.js +51 -0
- package/lib/utils/palette.js.map +1 -0
- package/lib/utils/series-tooltip.d.ts +3 -0
- package/lib/utils/series-tooltip.d.ts.map +1 -0
- package/lib/utils/series-tooltip.js +43 -0
- package/lib/utils/series-tooltip.js.map +1 -0
- package/lib/utils/tooltip.d.ts +6 -0
- package/lib/utils/tooltip.d.ts.map +1 -0
- package/lib/utils/tooltip.js +29 -0
- package/lib/utils/tooltip.js.map +1 -0
- package/lib/utils/ui-text.d.ts +9 -0
- package/lib/utils/ui-text.d.ts.map +1 -0
- package/lib/utils/ui-text.js +22 -0
- package/lib/utils/ui-text.js.map +1 -0
- package/lib/utils/utils.d.ts +36 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/lib/utils/utils.js +92 -0
- package/lib/utils/utils.js.map +1 -0
- package/mf-manifest.json +274 -0
- package/mf-stats.json +322 -0
- package/package.json +64 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export type PaletteOption = 'package-name' | 'value';
|
|
3
|
+
export interface PaletteSelectorProps {
|
|
4
|
+
onChange: (palette: PaletteOption) => void;
|
|
5
|
+
value?: PaletteOption;
|
|
6
|
+
}
|
|
7
|
+
export declare function PaletteSelector({ onChange, value }: PaletteSelectorProps): ReactElement;
|
|
8
|
+
//# sourceMappingURL=PaletteSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaletteSelector.d.ts","sourceRoot":"","sources":["../../../src/components/PaletteSelector.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAQrC,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,OAAO,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,KAAsB,EAAE,EAAE,oBAAoB,GAAG,YAAY,CAmBxG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License | Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing | software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS |
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';
|
|
15
|
+
const PALETTE_OPTIONS = [
|
|
16
|
+
{
|
|
17
|
+
id: 'package-name',
|
|
18
|
+
label: 'By Package Name'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'value',
|
|
22
|
+
label: 'By Value'
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
export function PaletteSelector({ onChange, value = 'package-name' }) {
|
|
26
|
+
const handlePaletteChange = (_, { id })=>{
|
|
27
|
+
onChange(id);
|
|
28
|
+
};
|
|
29
|
+
return /*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
30
|
+
label: "Palette",
|
|
31
|
+
control: /*#__PURE__*/ _jsx(SettingsAutocomplete, {
|
|
32
|
+
value: PALETTE_OPTIONS.find((o)=>o.id === value),
|
|
33
|
+
options: PALETTE_OPTIONS,
|
|
34
|
+
getOptionLabel: (o)=>o.label,
|
|
35
|
+
onChange: handlePaletteChange,
|
|
36
|
+
disableClearable: true
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=PaletteSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PaletteSelector.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement } from 'react';\nimport { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\n\nconst PALETTE_OPTIONS: Array<{ id: PaletteOption; label: string }> = [\n { id: 'package-name', label: 'By Package Name' },\n { id: 'value', label: 'By Value' },\n];\n\nexport type PaletteOption = 'package-name' | 'value';\n\nexport interface PaletteSelectorProps {\n onChange: (palette: PaletteOption) => void;\n value?: PaletteOption;\n}\n\nexport function PaletteSelector({ onChange, value = 'package-name' }: PaletteSelectorProps): ReactElement {\n const handlePaletteChange = (_: unknown, { id }: { id: PaletteOption }): void => {\n onChange(id);\n };\n\n return (\n <OptionsEditorControl\n label=\"Palette\"\n control={\n <SettingsAutocomplete\n value={PALETTE_OPTIONS.find((o) => o.id === value)}\n options={PALETTE_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handlePaletteChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","PALETTE_OPTIONS","id","label","PaletteSelector","onChange","value","handlePaletteChange","_","control","find","o","options","getOptionLabel","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,oBAAoB,EAAEC,oBAAoB,QAAQ,yBAAyB;AAEpF,MAAMC,kBAA+D;IACnE;QAAEC,IAAI;QAAgBC,OAAO;IAAkB;IAC/C;QAAED,IAAI;QAASC,OAAO;IAAW;CAClC;AASD,OAAO,SAASC,gBAAgB,EAAEC,QAAQ,EAAEC,QAAQ,cAAc,EAAwB;IACxF,MAAMC,sBAAsB,CAACC,GAAY,EAAEN,EAAE,EAAyB;QACpEG,SAASH;IACX;IAEA,qBACE,KAACH;QACCI,OAAM;QACNM,uBACE,KAACT;YACCM,OAAOL,gBAAgBS,IAAI,CAAC,CAACC,IAAMA,EAAET,EAAE,KAAKI;YAC5CM,SAASX;YACTY,gBAAgB,CAACF,IAAMA,EAAER,KAAK;YAC9BE,UAAUE;YACVO,gBAAgB;;;AAK1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../../src/components/SearchBar.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CA2B7D"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License | Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing | software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS |
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { TextField, InputAdornment, Chip } from '@mui/material';
|
|
15
|
+
import Magnify from 'mdi-material-ui/Magnify';
|
|
16
|
+
export function SearchBar(props) {
|
|
17
|
+
const { searchValue, onSearchValueChange } = props;
|
|
18
|
+
return /*#__PURE__*/ _jsx(TextField, {
|
|
19
|
+
size: "small",
|
|
20
|
+
variant: "outlined",
|
|
21
|
+
placeholder: "Search...",
|
|
22
|
+
fullWidth: true,
|
|
23
|
+
value: searchValue,
|
|
24
|
+
onChange: (event)=>onSearchValueChange(event.target.value),
|
|
25
|
+
slotProps: {
|
|
26
|
+
input: {
|
|
27
|
+
startAdornment: /*#__PURE__*/ _jsx(InputAdornment, {
|
|
28
|
+
position: "start",
|
|
29
|
+
children: /*#__PURE__*/ _jsx(Magnify, {
|
|
30
|
+
fontSize: "small"
|
|
31
|
+
})
|
|
32
|
+
}),
|
|
33
|
+
endAdornment: searchValue !== '' && /*#__PURE__*/ _jsx(InputAdornment, {
|
|
34
|
+
position: "end",
|
|
35
|
+
children: /*#__PURE__*/ _jsx(Chip, {
|
|
36
|
+
label: "Clear",
|
|
37
|
+
size: "small",
|
|
38
|
+
onClick: ()=>onSearchValueChange('')
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=SearchBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SearchBar.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement } from 'react';\nimport { TextField, InputAdornment, Chip } from '@mui/material';\nimport Magnify from 'mdi-material-ui/Magnify';\n\nexport interface SearchBarProps {\n searchValue: string;\n onSearchValueChange: (value: string) => void;\n}\n\nexport function SearchBar(props: SearchBarProps): ReactElement {\n const { searchValue, onSearchValueChange } = props;\n\n return (\n <TextField\n size=\"small\"\n variant=\"outlined\"\n placeholder=\"Search...\"\n fullWidth\n value={searchValue}\n onChange={(event) => onSearchValueChange(event.target.value)}\n slotProps={{\n input: {\n startAdornment: (\n <InputAdornment position=\"start\">\n <Magnify fontSize=\"small\" />\n </InputAdornment>\n ),\n endAdornment: searchValue !== '' && (\n <InputAdornment position=\"end\">\n <Chip label=\"Clear\" size=\"small\" onClick={() => onSearchValueChange('')} />\n </InputAdornment>\n ),\n },\n }}\n />\n );\n}\n"],"names":["TextField","InputAdornment","Chip","Magnify","SearchBar","props","searchValue","onSearchValueChange","size","variant","placeholder","fullWidth","value","onChange","event","target","slotProps","input","startAdornment","position","fontSize","endAdornment","label","onClick"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,SAAS,EAAEC,cAAc,EAAEC,IAAI,QAAQ,gBAAgB;AAChE,OAAOC,aAAa,0BAA0B;AAO9C,OAAO,SAASC,UAAUC,KAAqB;IAC7C,MAAM,EAAEC,WAAW,EAAEC,mBAAmB,EAAE,GAAGF;IAE7C,qBACE,KAACL;QACCQ,MAAK;QACLC,SAAQ;QACRC,aAAY;QACZC,SAAS;QACTC,OAAON;QACPO,UAAU,CAACC,QAAUP,oBAAoBO,MAAMC,MAAM,CAACH,KAAK;QAC3DI,WAAW;YACTC,OAAO;gBACLC,8BACE,KAACjB;oBAAekB,UAAS;8BACvB,cAAA,KAAChB;wBAAQiB,UAAS;;;gBAGtBC,cAAcf,gBAAgB,oBAC5B,KAACL;oBAAekB,UAAS;8BACvB,cAAA,KAACjB;wBAAKoB,OAAM;wBAAQd,MAAK;wBAAQe,SAAS,IAAMhB,oBAAoB;;;YAG1E;QACF;;AAGN"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ProfileData } from '@perses-dev/core';
|
|
3
|
+
export interface SeriesChartProps {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
data: ProfileData;
|
|
7
|
+
}
|
|
8
|
+
export declare function SeriesChart(props: SeriesChartProps): ReactElement;
|
|
9
|
+
//# sourceMappingURL=SeriesChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeriesChart.d.ts","sourceRoot":"","sources":["../../../src/components/SeriesChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAmB,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAY,MAAM,kBAAkB,CAAC;AAazD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAgKjE"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License | Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing | software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS |
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { useMemo, useRef } from 'react';
|
|
15
|
+
import { Stack, useTheme } from '@mui/material';
|
|
16
|
+
import { useChartsTheme, EChart, enableDataZoom } from '@perses-dev/components';
|
|
17
|
+
import { useTimeRange } from '@perses-dev/plugin-system';
|
|
18
|
+
import { formatItemValue } from '../utils/format';
|
|
19
|
+
import { getSeriesTooltip } from '../utils/series-tooltip';
|
|
20
|
+
const LINE_WIDTH = 1.25;
|
|
21
|
+
const POINT_SIZE_OFFSET = 2;
|
|
22
|
+
export function SeriesChart(props) {
|
|
23
|
+
const { width, height, data } = props;
|
|
24
|
+
const chartsTheme = useChartsTheme();
|
|
25
|
+
const theme = useTheme();
|
|
26
|
+
const { setTimeRange } = useTimeRange();
|
|
27
|
+
const chartRef = useRef();
|
|
28
|
+
const handleEvents = useMemo(()=>{
|
|
29
|
+
return {
|
|
30
|
+
datazoom: (params)=>{
|
|
31
|
+
if (params.batch[0] === undefined) return;
|
|
32
|
+
const xAxisStartValue = params.batch?.[0]?.startValue;
|
|
33
|
+
const xAxisEndValue = params.batch?.[0]?.endValue;
|
|
34
|
+
if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {
|
|
35
|
+
const zoomEvent = {
|
|
36
|
+
start: xAxisStartValue,
|
|
37
|
+
end: xAxisEndValue
|
|
38
|
+
};
|
|
39
|
+
setTimeRange({
|
|
40
|
+
start: new Date(zoomEvent.start),
|
|
41
|
+
end: new Date(zoomEvent.end)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
finished: ()=>{
|
|
46
|
+
if (chartRef.current !== undefined) {
|
|
47
|
+
enableDataZoom(chartRef.current);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}, [
|
|
52
|
+
setTimeRange
|
|
53
|
+
]);
|
|
54
|
+
const seriesData = useMemo(()=>{
|
|
55
|
+
const timeLine = data.timeline || {};
|
|
56
|
+
const startTime = timeLine.startTime;
|
|
57
|
+
const durationDelta = timeLine.durationDelta;
|
|
58
|
+
return timeLine.samples.map((sample, index)=>({
|
|
59
|
+
id: index,
|
|
60
|
+
value: [
|
|
61
|
+
(startTime + index * durationDelta) * 1000,
|
|
62
|
+
Number(sample)
|
|
63
|
+
]
|
|
64
|
+
}));
|
|
65
|
+
}, [
|
|
66
|
+
data.timeline
|
|
67
|
+
]);
|
|
68
|
+
const option = useMemo(()=>{
|
|
69
|
+
const seriesMapping = {
|
|
70
|
+
type: 'line',
|
|
71
|
+
color: theme.palette.primary.main,
|
|
72
|
+
sampling: 'lttb',
|
|
73
|
+
showSymbol: true,
|
|
74
|
+
showAllSymbol: true,
|
|
75
|
+
symbolSize: LINE_WIDTH + POINT_SIZE_OFFSET,
|
|
76
|
+
lineStyle: {
|
|
77
|
+
width: LINE_WIDTH,
|
|
78
|
+
opacity: 0.95
|
|
79
|
+
},
|
|
80
|
+
areaStyle: {
|
|
81
|
+
opacity: 0
|
|
82
|
+
},
|
|
83
|
+
data: seriesData
|
|
84
|
+
};
|
|
85
|
+
const timeLine = data.timeline || {};
|
|
86
|
+
const option = {
|
|
87
|
+
series: seriesMapping,
|
|
88
|
+
xAxis: {
|
|
89
|
+
type: 'time',
|
|
90
|
+
min: timeLine.startTime * 1000,
|
|
91
|
+
max: (timeLine.startTime + timeLine.samples.length * timeLine.durationDelta) * 1000,
|
|
92
|
+
axisLabel: {
|
|
93
|
+
hideOverlap: true
|
|
94
|
+
},
|
|
95
|
+
axisPointer: {
|
|
96
|
+
snap: false
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
yAxis: {
|
|
100
|
+
type: 'value',
|
|
101
|
+
axisLabel: {
|
|
102
|
+
formatter: (value)=>{
|
|
103
|
+
return formatItemValue(data.metadata?.units, value);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
animation: false,
|
|
108
|
+
tooltip: {
|
|
109
|
+
show: true,
|
|
110
|
+
showContent: true,
|
|
111
|
+
trigger: 'axis',
|
|
112
|
+
appendToBody: true,
|
|
113
|
+
confine: true,
|
|
114
|
+
backgroundColor: theme.palette.background.paper,
|
|
115
|
+
borderColor: theme.palette.background.paper,
|
|
116
|
+
textStyle: {
|
|
117
|
+
color: theme.palette.text.primary
|
|
118
|
+
},
|
|
119
|
+
formatter: (params)=>getSeriesTooltip(params[0]?.data || {}, data.metadata?.units || '', data.metadata?.name || '', theme.palette.primary.main, theme.palette.divider)
|
|
120
|
+
},
|
|
121
|
+
axisPointer: {
|
|
122
|
+
type: 'line',
|
|
123
|
+
z: 0,
|
|
124
|
+
triggerEmphasis: true,
|
|
125
|
+
triggerTooltip: false,
|
|
126
|
+
snap: false
|
|
127
|
+
},
|
|
128
|
+
toolbox: {
|
|
129
|
+
feature: {
|
|
130
|
+
dataZoom: {
|
|
131
|
+
icon: null,
|
|
132
|
+
yAxisIndex: 'none'
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
grid: {
|
|
137
|
+
left: 10,
|
|
138
|
+
right: 10,
|
|
139
|
+
top: 10,
|
|
140
|
+
bottom: 10
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
return option;
|
|
144
|
+
}, [
|
|
145
|
+
data.timeline,
|
|
146
|
+
data.metadata,
|
|
147
|
+
seriesData,
|
|
148
|
+
theme
|
|
149
|
+
]);
|
|
150
|
+
const seriesChart = useMemo(()=>/*#__PURE__*/ _jsx(EChart, {
|
|
151
|
+
style: {
|
|
152
|
+
width: width,
|
|
153
|
+
height: height
|
|
154
|
+
},
|
|
155
|
+
option: option,
|
|
156
|
+
theme: chartsTheme.echartsTheme,
|
|
157
|
+
onEvents: handleEvents,
|
|
158
|
+
_instance: chartRef
|
|
159
|
+
}), [
|
|
160
|
+
chartsTheme.echartsTheme,
|
|
161
|
+
height,
|
|
162
|
+
option,
|
|
163
|
+
width,
|
|
164
|
+
handleEvents
|
|
165
|
+
]);
|
|
166
|
+
return /*#__PURE__*/ _jsx(Stack, {
|
|
167
|
+
width: width,
|
|
168
|
+
height: height,
|
|
169
|
+
alignItems: "center",
|
|
170
|
+
justifyContent: "center",
|
|
171
|
+
onMouseEnter: ()=>{
|
|
172
|
+
// This is necessary to ensure that the data zoom feature is enabled after the theme is changed.
|
|
173
|
+
if (chartRef.current !== undefined) {
|
|
174
|
+
enableDataZoom(chartRef.current);
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
children: seriesChart
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
//# sourceMappingURL=SeriesChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SeriesChart.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo, useRef } from 'react';\nimport { Stack, useTheme } from '@mui/material';\nimport { ProfileData, Timeline } from '@perses-dev/core';\nimport { useChartsTheme, EChart, ZoomEventData, OnEventsType, enableDataZoom } from '@perses-dev/components';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport type { EChartsCoreOption, LineSeriesOption } from 'echarts';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { CallbackDataParams } from 'echarts/types/dist/shared';\nimport { formatItemValue } from '../utils/format';\nimport { getSeriesTooltip } from '../utils/series-tooltip';\nimport { SeriesSample } from '../utils/data-model';\n\nconst LINE_WIDTH = 1.25;\nconst POINT_SIZE_OFFSET = 2;\n\nexport interface SeriesChartProps {\n width: number;\n height: number;\n data: ProfileData;\n}\n\nexport function SeriesChart(props: SeriesChartProps): ReactElement {\n const { width, height, data } = props;\n\n const chartsTheme = useChartsTheme();\n const theme = useTheme();\n const { setTimeRange } = useTimeRange();\n const chartRef = useRef<EChartsInstance>();\n\n const handleEvents: OnEventsType<LineSeriesOption['data'] | unknown> = useMemo(() => {\n return {\n datazoom: (params): void => {\n if (params.batch[0] === undefined) return;\n const xAxisStartValue = params.batch?.[0]?.startValue;\n const xAxisEndValue = params.batch?.[0]?.endValue;\n if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {\n const zoomEvent: ZoomEventData = {\n start: xAxisStartValue,\n end: xAxisEndValue,\n };\n setTimeRange({ start: new Date(zoomEvent.start), end: new Date(zoomEvent.end) });\n }\n },\n finished: (): void => {\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n },\n };\n }, [setTimeRange]);\n\n const seriesData: SeriesSample[] = useMemo(() => {\n const timeLine: Timeline = data.timeline || ({} as Timeline);\n const startTime = timeLine.startTime;\n const durationDelta = timeLine.durationDelta;\n return timeLine.samples.map((sample, index) => ({\n id: index,\n value: [(startTime + index * durationDelta) * 1000, Number(sample)],\n }));\n }, [data.timeline]);\n\n const option: EChartsCoreOption = useMemo(() => {\n const seriesMapping = {\n type: 'line',\n color: theme.palette.primary.main,\n sampling: 'lttb',\n showSymbol: true,\n showAllSymbol: true,\n symbolSize: LINE_WIDTH + POINT_SIZE_OFFSET,\n lineStyle: {\n width: LINE_WIDTH,\n opacity: 0.95,\n },\n areaStyle: {\n opacity: 0,\n },\n data: seriesData,\n };\n\n const timeLine: Timeline = data.timeline || ({} as Timeline);\n\n const option: EChartsCoreOption = {\n series: seriesMapping,\n xAxis: {\n type: 'time',\n min: timeLine.startTime * 1000,\n max: (timeLine.startTime + timeLine.samples.length * timeLine.durationDelta) * 1000,\n axisLabel: {\n hideOverlap: true,\n },\n axisPointer: {\n snap: false, // important so shared crosshair does not lag\n },\n },\n yAxis: {\n type: 'value',\n axisLabel: {\n formatter: (value: number) => {\n return formatItemValue(data.metadata?.units, value);\n },\n },\n },\n animation: false,\n tooltip: {\n show: true,\n showContent: true,\n trigger: 'axis',\n appendToBody: true,\n confine: true,\n backgroundColor: theme.palette.background.paper,\n borderColor: theme.palette.background.paper,\n textStyle: {\n color: theme.palette.text.primary,\n },\n formatter: (params: CallbackDataParams[]) =>\n getSeriesTooltip(\n (params[0]?.data as SeriesSample) || {},\n data.metadata?.units || '',\n data.metadata?.name || '',\n theme.palette.primary.main,\n theme.palette.divider\n ),\n },\n axisPointer: {\n type: 'line',\n z: 0, // ensure point symbol shows on top of dashed line\n triggerEmphasis: true,\n triggerTooltip: false,\n snap: false,\n },\n toolbox: {\n feature: {\n dataZoom: {\n icon: null,\n yAxisIndex: 'none',\n },\n },\n },\n grid: {\n left: 10,\n right: 10,\n top: 10,\n bottom: 10,\n },\n };\n\n return option;\n }, [data.timeline, data.metadata, seriesData, theme]);\n\n const seriesChart = useMemo(\n () => (\n <EChart\n style={{\n width: width,\n height: height,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n onEvents={handleEvents}\n _instance={chartRef}\n />\n ),\n [chartsTheme.echartsTheme, height, option, width, handleEvents]\n );\n\n return (\n <Stack\n width={width}\n height={height}\n alignItems=\"center\"\n justifyContent=\"center\"\n onMouseEnter={() => {\n // This is necessary to ensure that the data zoom feature is enabled after the theme is changed.\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n }}\n >\n {seriesChart}\n </Stack>\n );\n}\n"],"names":["useMemo","useRef","Stack","useTheme","useChartsTheme","EChart","enableDataZoom","useTimeRange","formatItemValue","getSeriesTooltip","LINE_WIDTH","POINT_SIZE_OFFSET","SeriesChart","props","width","height","data","chartsTheme","theme","setTimeRange","chartRef","handleEvents","datazoom","params","batch","undefined","xAxisStartValue","startValue","xAxisEndValue","endValue","zoomEvent","start","end","Date","finished","current","seriesData","timeLine","timeline","startTime","durationDelta","samples","map","sample","index","id","value","Number","option","seriesMapping","type","color","palette","primary","main","sampling","showSymbol","showAllSymbol","symbolSize","lineStyle","opacity","areaStyle","series","xAxis","min","max","length","axisLabel","hideOverlap","axisPointer","snap","yAxis","formatter","metadata","units","animation","tooltip","show","showContent","trigger","appendToBody","confine","backgroundColor","background","paper","borderColor","textStyle","text","name","divider","z","triggerEmphasis","triggerTooltip","toolbox","feature","dataZoom","icon","yAxisIndex","grid","left","right","top","bottom","seriesChart","style","echartsTheme","onEvents","_instance","alignItems","justifyContent","onMouseEnter"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAs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OAAOjC,MAAMkC,OAAO,CAACmC,IAAI,CAAClC,OAAO;gBACnC;gBACAmB,WAAW,CAACjD,SACVd,iBACE,AAACc,MAAM,CAAC,EAAE,EAAEP,QAAyB,CAAC,GACtCA,KAAKyD,QAAQ,EAAEC,SAAS,IACxB1D,KAAKyD,QAAQ,EAAEe,QAAQ,IACvBtE,MAAMkC,OAAO,CAACC,OAAO,CAACC,IAAI,EAC1BpC,MAAMkC,OAAO,CAACqC,OAAO;YAE3B;YACApB,aAAa;gBACXnB,MAAM;gBACNwC,GAAG;gBACHC,iBAAiB;gBACjBC,gBAAgB;gBAChBtB,MAAM;YACR;YACAuB,SAAS;gBACPC,SAAS;oBACPC,UAAU;wBACRC,MAAM;wBACNC,YAAY;oBACd;gBACF;YACF;YACAC,MAAM;gBACJC,MAAM;gBACNC,OAAO;gBACPC,KAAK;gBACLC,QAAQ;YACV;QACF;QAEA,OAAOtD;IACT,GAAG;QAAChC,KAAKsB,QAAQ;QAAEtB,KAAKyD,QAAQ;QAAErC;QAAYlB;KAAM;IAEpD,MAAMqF,cAAcvG,QAClB,kBACE,KAACK;YACCmG,OAAO;gBACL1F,OAAOA;gBACPC,QAAQA;YACV;YACAiC,QAAQA;YACR9B,OAAOD,YAAYwF,YAAY;YAC/BC,UAAUrF;YACVsF,WAAWvF;YAGf;QAACH,YAAYwF,YAAY;QAAE1F;QAAQiC;QAAQlC;QAAOO;KAAa;IAGjE,qBACE,KAACnB;QACCY,OAAOA;QACPC,QAAQA;QACR6F,YAAW;QACXC,gBAAe;QACfC,cAAc;YACZ,gGAAgG;YAChG,IAAI1F,SAASe,OAAO,KAAKV,WAAW;gBAClCnB,eAAec,SAASe,OAAO;YACjC;QACF;kBAECoE;;AAGP"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { FlameChartOptions } from '../flame-chart-model';
|
|
3
|
+
export interface SettingsProps {
|
|
4
|
+
value: FlameChartOptions;
|
|
5
|
+
selectedId: number;
|
|
6
|
+
onChangePalette: (palette: 'package-name' | 'value') => void;
|
|
7
|
+
onSelectedIdChange: (newId: number) => void;
|
|
8
|
+
onDisplayChange: (value: 'table' | 'flame-graph' | 'both') => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function Settings(props: SettingsProps): ReactElement;
|
|
11
|
+
//# sourceMappingURL=Settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../../src/components/Settings.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAqB,MAAM,OAAO,CAAC;AAMxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,iBAAiB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,KAAK,IAAI,CAAC;IAC7D,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,MAAM,KAAK,IAAI,CAAC;CACpE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CA0J3D"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { useState, useMemo } from 'react';
|
|
15
|
+
import RefreshIcon from 'mdi-material-ui/Refresh';
|
|
16
|
+
import PaletteIcon from 'mdi-material-ui/Palette';
|
|
17
|
+
import { Stack, Button, useTheme, MenuItem, Menu, Fade } from '@mui/material';
|
|
18
|
+
import { ToolbarIconButton, InfoTooltip } from '@perses-dev/components';
|
|
19
|
+
import { TOOLTIP_TEXT } from '../utils/ui-text';
|
|
20
|
+
export function Settings(props) {
|
|
21
|
+
const { value, selectedId, onSelectedIdChange, onChangePalette, onDisplayChange } = props;
|
|
22
|
+
const theme = useTheme();
|
|
23
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
24
|
+
const open = Boolean(anchorEl);
|
|
25
|
+
const customButtonStyle = {
|
|
26
|
+
fontSize: '12px',
|
|
27
|
+
padding: '2px 6px',
|
|
28
|
+
minWidth: 'auto'
|
|
29
|
+
};
|
|
30
|
+
const handleChangeColorShemeClick = (event)=>{
|
|
31
|
+
setAnchorEl(event.currentTarget);
|
|
32
|
+
};
|
|
33
|
+
const handleByPackageNameClick = ()=>{
|
|
34
|
+
onChangePalette('package-name');
|
|
35
|
+
handleClose();
|
|
36
|
+
};
|
|
37
|
+
const handleByValueClick = ()=>{
|
|
38
|
+
onChangePalette('value');
|
|
39
|
+
handleClose();
|
|
40
|
+
};
|
|
41
|
+
const handleClose = ()=>{
|
|
42
|
+
setAnchorEl(null);
|
|
43
|
+
};
|
|
44
|
+
const isTableSelected = ()=>selectedView === 'table';
|
|
45
|
+
const isFlameGraphSelected = ()=>selectedView === 'flame-graph';
|
|
46
|
+
const isBothSelected = ()=>selectedView === 'both';
|
|
47
|
+
// Update selected view based on the value of showTable and showFlameGraph
|
|
48
|
+
const selectedView = useMemo(()=>{
|
|
49
|
+
if (!value.showTable && !value.showFlameGraph) {
|
|
50
|
+
return 'none';
|
|
51
|
+
} else if (value.showTable && value.showFlameGraph) {
|
|
52
|
+
return 'both';
|
|
53
|
+
} else if (value.showTable) {
|
|
54
|
+
return 'table';
|
|
55
|
+
} else {
|
|
56
|
+
return 'flame-graph';
|
|
57
|
+
}
|
|
58
|
+
}, [
|
|
59
|
+
value.showTable,
|
|
60
|
+
value.showFlameGraph
|
|
61
|
+
]);
|
|
62
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
63
|
+
spacing: "10px",
|
|
64
|
+
direction: "row",
|
|
65
|
+
justifyContent: "center",
|
|
66
|
+
alignItems: "center",
|
|
67
|
+
children: [
|
|
68
|
+
selectedId !== 0 && /*#__PURE__*/ _jsx(InfoTooltip, {
|
|
69
|
+
description: TOOLTIP_TEXT.resetFlameGraph,
|
|
70
|
+
children: /*#__PURE__*/ _jsx(ToolbarIconButton, {
|
|
71
|
+
"aria-label": TOOLTIP_TEXT.resetFlameGraph,
|
|
72
|
+
onClick: ()=>onSelectedIdChange(0),
|
|
73
|
+
color: "primary",
|
|
74
|
+
children: /*#__PURE__*/ _jsx(RefreshIcon, {
|
|
75
|
+
fontSize: "small"
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
82
|
+
description: TOOLTIP_TEXT.changeColorSheme,
|
|
83
|
+
children: /*#__PURE__*/ _jsx(ToolbarIconButton, {
|
|
84
|
+
id: "change-color-sheme-button",
|
|
85
|
+
"aria-label": TOOLTIP_TEXT.changeColorSheme,
|
|
86
|
+
"aria-controls": open ? 'change-color-sheme-menu' : undefined,
|
|
87
|
+
"aria-haspopup": "true",
|
|
88
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
89
|
+
onClick: handleChangeColorShemeClick,
|
|
90
|
+
color: "primary",
|
|
91
|
+
children: /*#__PURE__*/ _jsx(PaletteIcon, {
|
|
92
|
+
fontSize: "small"
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ _jsxs(Menu, {
|
|
97
|
+
id: "change-color-sheme-menu",
|
|
98
|
+
slotProps: {
|
|
99
|
+
list: {
|
|
100
|
+
'aria-labelledby': 'change-color-sheme-button'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
anchorEl: anchorEl,
|
|
104
|
+
open: open,
|
|
105
|
+
onClose: handleClose,
|
|
106
|
+
slots: {
|
|
107
|
+
transition: Fade
|
|
108
|
+
},
|
|
109
|
+
anchorOrigin: {
|
|
110
|
+
vertical: 'bottom',
|
|
111
|
+
horizontal: 'center'
|
|
112
|
+
},
|
|
113
|
+
transformOrigin: {
|
|
114
|
+
vertical: 'top',
|
|
115
|
+
horizontal: 'center'
|
|
116
|
+
},
|
|
117
|
+
sx: {
|
|
118
|
+
mt: 1,
|
|
119
|
+
'& .MuiPaper-root': {
|
|
120
|
+
backgroundColor: theme.palette.background.paper,
|
|
121
|
+
padding: '0 5px'
|
|
122
|
+
},
|
|
123
|
+
'& .MuiMenuItem-root:hover': {
|
|
124
|
+
backgroundColor: theme.palette.action.hover
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
children: [
|
|
128
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
129
|
+
onClick: handleByPackageNameClick,
|
|
130
|
+
selected: value.palette === 'package-name',
|
|
131
|
+
children: "By package name"
|
|
132
|
+
}),
|
|
133
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
134
|
+
onClick: handleByValueClick,
|
|
135
|
+
selected: value.palette === 'value',
|
|
136
|
+
children: "By value"
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
}),
|
|
142
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
143
|
+
direction: "row",
|
|
144
|
+
sx: {
|
|
145
|
+
border: `1px solid ${theme.palette.primary.main}`,
|
|
146
|
+
borderRadius: `${theme.shape.borderRadius}px`,
|
|
147
|
+
padding: '2px'
|
|
148
|
+
},
|
|
149
|
+
children: [
|
|
150
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
151
|
+
description: TOOLTIP_TEXT.showTable,
|
|
152
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
153
|
+
variant: isTableSelected() ? 'contained' : 'text',
|
|
154
|
+
color: "primary",
|
|
155
|
+
size: "small",
|
|
156
|
+
onClick: ()=>onDisplayChange('table'),
|
|
157
|
+
sx: customButtonStyle,
|
|
158
|
+
children: "Table"
|
|
159
|
+
})
|
|
160
|
+
}),
|
|
161
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
162
|
+
description: TOOLTIP_TEXT.showFlameGraph,
|
|
163
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
164
|
+
variant: isFlameGraphSelected() ? 'contained' : 'text',
|
|
165
|
+
color: "primary",
|
|
166
|
+
size: "small",
|
|
167
|
+
onClick: ()=>onDisplayChange('flame-graph'),
|
|
168
|
+
sx: customButtonStyle,
|
|
169
|
+
children: "Flame Graph"
|
|
170
|
+
})
|
|
171
|
+
}),
|
|
172
|
+
/*#__PURE__*/ _jsx(InfoTooltip, {
|
|
173
|
+
description: TOOLTIP_TEXT.showBoth,
|
|
174
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
175
|
+
variant: isBothSelected() ? 'contained' : 'text',
|
|
176
|
+
color: "primary",
|
|
177
|
+
size: "small",
|
|
178
|
+
onClick: ()=>onDisplayChange('both'),
|
|
179
|
+
sx: customButtonStyle,
|
|
180
|
+
children: "Both"
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
//# sourceMappingURL=Settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Settings.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useState, useMemo } from 'react';\nimport RefreshIcon from 'mdi-material-ui/Refresh';\nimport PaletteIcon from 'mdi-material-ui/Palette';\nimport { Stack, Button, useTheme, MenuItem, Menu, Fade } from '@mui/material';\nimport { ToolbarIconButton, InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../utils/ui-text';\nimport { FlameChartOptions } from '../flame-chart-model';\n\nexport interface SettingsProps {\n value: FlameChartOptions;\n selectedId: number;\n onChangePalette: (palette: 'package-name' | 'value') => void;\n onSelectedIdChange: (newId: number) => void;\n onDisplayChange: (value: 'table' | 'flame-graph' | 'both') => void;\n}\n\nexport function Settings(props: SettingsProps): ReactElement {\n const { value, selectedId, onSelectedIdChange, onChangePalette, onDisplayChange } = props;\n const theme = useTheme();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n const open = Boolean(anchorEl);\n\n const customButtonStyle = {\n fontSize: '12px',\n padding: '2px 6px',\n minWidth: 'auto',\n };\n\n const handleChangeColorShemeClick = (event: React.MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleByPackageNameClick = () => {\n onChangePalette('package-name');\n handleClose();\n };\n\n const handleByValueClick = () => {\n onChangePalette('value');\n handleClose();\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n const isTableSelected = () => selectedView === 'table';\n const isFlameGraphSelected = () => selectedView === 'flame-graph';\n const isBothSelected = () => selectedView === 'both';\n\n // Update selected view based on the value of showTable and showFlameGraph\n const selectedView: 'table' | 'flame-graph' | 'both' | 'none' = useMemo(() => {\n if (!value.showTable && !value.showFlameGraph) {\n return 'none';\n } else if (value.showTable && value.showFlameGraph) {\n return 'both';\n } else if (value.showTable) {\n return 'table';\n } else {\n return 'flame-graph';\n }\n }, [value.showTable, value.showFlameGraph]);\n\n return (\n <Stack spacing=\"10px\" direction=\"row\" justifyContent=\"center\" alignItems=\"center\">\n {selectedId !== 0 && (\n <InfoTooltip description={TOOLTIP_TEXT.resetFlameGraph}>\n <ToolbarIconButton\n aria-label={TOOLTIP_TEXT.resetFlameGraph}\n onClick={() => onSelectedIdChange(0)}\n color=\"primary\"\n >\n <RefreshIcon fontSize=\"small\" />\n </ToolbarIconButton>\n </InfoTooltip>\n )}\n <Stack>\n <InfoTooltip description={TOOLTIP_TEXT.changeColorSheme}>\n <ToolbarIconButton\n id=\"change-color-sheme-button\"\n aria-label={TOOLTIP_TEXT.changeColorSheme}\n aria-controls={open ? 'change-color-sheme-menu' : undefined}\n aria-haspopup=\"true\"\n aria-expanded={open ? 'true' : undefined}\n onClick={handleChangeColorShemeClick}\n color=\"primary\"\n >\n <PaletteIcon fontSize=\"small\" />\n </ToolbarIconButton>\n </InfoTooltip>\n <Menu\n id=\"change-color-sheme-menu\"\n slotProps={{\n list: { 'aria-labelledby': 'change-color-sheme-button' },\n }}\n anchorEl={anchorEl}\n open={open}\n onClose={handleClose}\n slots={{ transition: Fade }}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'center',\n }}\n sx={{\n mt: 1,\n '& .MuiPaper-root': {\n backgroundColor: theme.palette.background.paper,\n padding: '0 5px',\n },\n '& .MuiMenuItem-root:hover': {\n backgroundColor: theme.palette.action.hover,\n },\n }}\n >\n <MenuItem onClick={handleByPackageNameClick} selected={value.palette === 'package-name'}>\n By package name\n </MenuItem>\n <MenuItem onClick={handleByValueClick} selected={value.palette === 'value'}>\n By value\n </MenuItem>\n </Menu>\n </Stack>\n <Stack\n direction=\"row\"\n sx={{\n border: `1px solid ${theme.palette.primary.main}`,\n borderRadius: `${theme.shape.borderRadius}px`,\n padding: '2px',\n }}\n >\n <InfoTooltip description={TOOLTIP_TEXT.showTable}>\n <Button\n variant={isTableSelected() ? 'contained' : 'text'}\n color=\"primary\"\n size=\"small\"\n onClick={() => onDisplayChange('table')}\n sx={customButtonStyle}\n >\n Table\n </Button>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.showFlameGraph}>\n <Button\n variant={isFlameGraphSelected() ? 'contained' : 'text'}\n color=\"primary\"\n size=\"small\"\n onClick={() => onDisplayChange('flame-graph')}\n sx={customButtonStyle}\n >\n Flame Graph\n </Button>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.showBoth}>\n <Button\n variant={isBothSelected() ? 'contained' : 'text'}\n color=\"primary\"\n size=\"small\"\n onClick={() => onDisplayChange('both')}\n sx={customButtonStyle}\n >\n Both\n </Button>\n </InfoTooltip>\n </Stack>\n </Stack>\n );\n}\n"],"names":["useState","useMemo","RefreshIcon","PaletteIcon","Stack","Button","useTheme","MenuItem","Menu","Fade","ToolbarIconButton","InfoTooltip","TOOLTIP_TEXT","Settings","props","value","selectedId","onSelectedIdChange","onChangePalette","onDisplayChange","theme","anchorEl","setAnchorEl","open","Boolean","customButtonStyle","fontSize","padding","minWidth","handleChangeColorShemeClick","event","currentTarget","handleByPackageNameClick","handleClose","handleByValueClick","isTableSelected","selectedView","isFlameGraphSelected","isBothSelected","showTable","showFlameGraph","spacing","direction","justifyContent","alignItems","description","resetFlameGraph","aria-label","onClick","color","changeColorSheme","id","aria-controls","undefined","aria-haspopup","aria-expanded","slotProps","list","onClose","slots","transition","anchorOrigin","vertical","horizontal","transformOrigin","sx","mt","backgroundColor","palette","background","paper","action","hover","selected","border","primary","main","borderRadius","shape","variant","size","showBoth"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;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,SAASd;gCAAoBuC,UAAU1D,MAAMqD,OAAO,KAAK;0CAAS;;;;;;0BAKhF,MAAChE;gBACCsC,WAAU;gBACVuB,IAAI;oBACFS,QAAQ,CAAC,UAAU,EAAEtD,MAAMgD,OAAO,CAACO,OAAO,CAACC,IAAI,EAAE;oBACjDC,cAAc,GAAGzD,MAAM0D,KAAK,CAACD,YAAY,CAAC,EAAE,CAAC;oBAC7ClD,SAAS;gBACX;;kCAEA,KAAChB;wBAAYkC,aAAajC,aAAa2B,SAAS;kCAC9C,cAAA,KAAClC;4BACC0E,SAAS5C,oBAAoB,cAAc;4BAC3Cc,OAAM;4BACN+B,MAAK;4BACLhC,SAAS,IAAM7B,gBAAgB;4BAC/B8C,IAAIxC;sCACL;;;kCAIH,KAACd;wBAAYkC,aAAajC,aAAa4B,cAAc;kCACnD,cAAA,KAACnC;4BACC0E,SAAS1C,yBAAyB,cAAc;4BAChDY,OAAM;4BACN+B,MAAK;4BACLhC,SAAS,IAAM7B,gBAAgB;4BAC/B8C,IAAIxC;sCACL;;;kCAIH,KAACd;wBAAYkC,aAAajC,aAAaqE,QAAQ;kCAC7C,cAAA,KAAC5E;4BACC0E,SAASzC,mBAAmB,cAAc;4BAC1CW,OAAM;4BACN+B,MAAK;4BACLhC,SAAS,IAAM7B,gBAAgB;4BAC/B8C,IAAIxC;sCACL;;;;;;;AAOX"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
export interface SwitchSelectorProps {
|
|
3
|
+
onChange: (newValue: boolean) => void;
|
|
4
|
+
value?: boolean;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function SwitchSelector({ onChange, value, label }: SwitchSelectorProps): ReactElement;
|
|
8
|
+
//# sourceMappingURL=SwitchSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchSelector.d.ts","sourceRoot":"","sources":["../../../src/components/SwitchSelector.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,mBAAmB,GAAG,YAAY,CAM5F"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License | Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing | software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS |
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { OptionsEditorControl } from '@perses-dev/components';
|
|
15
|
+
import { Switch } from '@mui/material';
|
|
16
|
+
export function SwitchSelector({ onChange, value, label }) {
|
|
17
|
+
const handleValuesChange = (_, checked)=>{
|
|
18
|
+
onChange(checked);
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
21
|
+
label: label,
|
|
22
|
+
control: /*#__PURE__*/ _jsx(Switch, {
|
|
23
|
+
checked: value,
|
|
24
|
+
onChange: handleValuesChange
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=SwitchSelector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SwitchSelector.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License | Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing | software\n// distributed under the License is distributed on an \"AS IS\" BASIS |\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement } from 'react';\nimport { OptionsEditorControl } from '@perses-dev/components';\nimport { Switch } from '@mui/material';\n\nexport interface SwitchSelectorProps {\n onChange: (newValue: boolean) => void;\n value?: boolean;\n label: string;\n}\n\nexport function SwitchSelector({ onChange, value, label }: SwitchSelectorProps): ReactElement {\n const handleValuesChange = (_: unknown, checked: boolean): void => {\n onChange(checked);\n };\n\n return <OptionsEditorControl label={label} control={<Switch checked={value} onChange={handleValuesChange} />} />;\n}\n"],"names":["OptionsEditorControl","Switch","SwitchSelector","onChange","value","label","handleValuesChange","_","checked","control"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;AAGjC,SAASA,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,MAAM,QAAQ,gBAAgB;AAQvC,OAAO,SAASC,eAAe,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,EAAuB;IAC5E,MAAMC,qBAAqB,CAACC,GAAYC;QACtCL,SAASK;IACX;IAEA,qBAAO,KAACR;QAAqBK,OAAOA;QAAOI,uBAAS,KAACR;YAAOO,SAASJ;YAAOD,UAAUG;;;AACxF"}
|