@kartverket/backstage-plugin-risk-scorecard 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/PluginRoot.esm.js +21 -0
  2. package/dist/PluginRoot.esm.js.map +1 -0
  3. package/dist/components/common/Dropdown.esm.js +79 -0
  4. package/dist/components/common/Dropdown.esm.js.map +1 -0
  5. package/dist/components/common/EditButton.esm.js +16 -0
  6. package/dist/components/common/EditButton.esm.js.map +1 -0
  7. package/dist/components/common/Input.esm.js +33 -0
  8. package/dist/components/common/Input.esm.js.map +1 -0
  9. package/dist/components/common/Select.esm.js +85 -0
  10. package/dist/components/common/Select.esm.js.map +1 -0
  11. package/dist/components/common/Spinner.esm.js +11 -0
  12. package/dist/components/common/Spinner.esm.js.map +1 -0
  13. package/dist/components/common/Textfield.esm.js +64 -0
  14. package/dist/components/common/Textfield.esm.js.map +1 -0
  15. package/dist/components/common/typography.esm.js +47 -0
  16. package/dist/components/common/typography.esm.js.map +1 -0
  17. package/dist/components/riScDialog/RiScDialog.esm.js +116 -0
  18. package/dist/components/riScDialog/RiScDialog.esm.js.map +1 -0
  19. package/dist/components/riScDialog/riScDialogStyle.esm.js +34 -0
  20. package/dist/components/riScDialog/riScDialogStyle.esm.js.map +1 -0
  21. package/dist/components/riScInfo/RiScInfo.esm.js +49 -0
  22. package/dist/components/riScInfo/RiScInfo.esm.js.map +1 -0
  23. package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js +148 -0
  24. package/dist/components/riScInfo/riScStatus/RiScStatusComponent.esm.js.map +1 -0
  25. package/dist/components/riScInfo/riScStatus/riScStatusComponentStyle.esm.js +13 -0
  26. package/dist/components/riScInfo/riScStatus/riScStatusComponentStyle.esm.js.map +1 -0
  27. package/dist/components/riScPlugin/RiScPlugin.esm.js +87 -0
  28. package/dist/components/riScPlugin/RiScPlugin.esm.js.map +1 -0
  29. package/dist/components/riScPlugin/linearProgressStyle.esm.js +12 -0
  30. package/dist/components/riScPlugin/linearProgressStyle.esm.js.map +1 -0
  31. package/dist/components/riskMatrix/AggregatedCost.esm.js +29 -0
  32. package/dist/components/riskMatrix/AggregatedCost.esm.js.map +1 -0
  33. package/dist/components/riskMatrix/EstimatedRiskInfoDialog.esm.js +19 -0
  34. package/dist/components/riskMatrix/EstimatedRiskInfoDialog.esm.js.map +1 -0
  35. package/dist/components/riskMatrix/RiskMatrix.esm.js +67 -0
  36. package/dist/components/riskMatrix/RiskMatrix.esm.js.map +1 -0
  37. package/dist/components/riskMatrix/RiskMatrixScenarioCount.esm.js +86 -0
  38. package/dist/components/riskMatrix/RiskMatrixScenarioCount.esm.js.map +1 -0
  39. package/dist/components/riskMatrix/Tabs.esm.js +40 -0
  40. package/dist/components/riskMatrix/Tabs.esm.js.map +1 -0
  41. package/dist/components/riskMatrix/aggregatedCostStyle.esm.js +16 -0
  42. package/dist/components/riskMatrix/aggregatedCostStyle.esm.js.map +1 -0
  43. package/dist/components/riskMatrix/estimatedRiskInfoDialogStyle.esm.js +17 -0
  44. package/dist/components/riskMatrix/estimatedRiskInfoDialogStyle.esm.js.map +1 -0
  45. package/dist/components/riskMatrix/riskMatrixStyle.esm.js +73 -0
  46. package/dist/components/riskMatrix/riskMatrixStyle.esm.js.map +1 -0
  47. package/dist/components/riskMatrix/tabsStyle.esm.js +15 -0
  48. package/dist/components/riskMatrix/tabsStyle.esm.js.map +1 -0
  49. package/dist/components/scenarioDrawer/ScenarioDrawer.esm.js +145 -0
  50. package/dist/components/scenarioDrawer/ScenarioDrawer.esm.js.map +1 -0
  51. package/dist/components/scenarioDrawer/components/ActionBox.esm.js +77 -0
  52. package/dist/components/scenarioDrawer/components/ActionBox.esm.js.map +1 -0
  53. package/dist/components/scenarioDrawer/components/ActionFormSection.esm.js +127 -0
  54. package/dist/components/scenarioDrawer/components/ActionFormSection.esm.js.map +1 -0
  55. package/dist/components/scenarioDrawer/components/ActionsSection.esm.js +29 -0
  56. package/dist/components/scenarioDrawer/components/ActionsSection.esm.js.map +1 -0
  57. package/dist/components/scenarioDrawer/components/DeleteConfirmation.esm.js +17 -0
  58. package/dist/components/scenarioDrawer/components/DeleteConfirmation.esm.js.map +1 -0
  59. package/dist/components/scenarioDrawer/components/RiskFormSection.esm.js +73 -0
  60. package/dist/components/scenarioDrawer/components/RiskFormSection.esm.js.map +1 -0
  61. package/dist/components/scenarioDrawer/components/RiskSection.esm.js +56 -0
  62. package/dist/components/scenarioDrawer/components/RiskSection.esm.js.map +1 -0
  63. package/dist/components/scenarioDrawer/components/ScopeFormSection.esm.js +72 -0
  64. package/dist/components/scenarioDrawer/components/ScopeFormSection.esm.js.map +1 -0
  65. package/dist/components/scenarioDrawer/components/ScopeSection.esm.js +33 -0
  66. package/dist/components/scenarioDrawer/components/ScopeSection.esm.js.map +1 -0
  67. package/dist/components/scenarioDrawer/scenarioDrawerComponents.esm.js +10 -0
  68. package/dist/components/scenarioDrawer/scenarioDrawerComponents.esm.js.map +1 -0
  69. package/dist/components/scenarioTable/ScenarioTable.esm.js +79 -0
  70. package/dist/components/scenarioTable/ScenarioTable.esm.js.map +1 -0
  71. package/dist/components/scenarioTable/ScenarioTableRow.esm.js +57 -0
  72. package/dist/components/scenarioTable/ScenarioTableRow.esm.js.map +1 -0
  73. package/dist/components/scenarioTable/ScenarioTableStyles.esm.js +71 -0
  74. package/dist/components/scenarioTable/ScenarioTableStyles.esm.js.map +1 -0
  75. package/dist/components/scenarioWizard/ScenarioWizard.esm.js +186 -0
  76. package/dist/components/scenarioWizard/ScenarioWizard.esm.js.map +1 -0
  77. package/dist/components/scenarioWizard/components/ActionEdit.esm.js +101 -0
  78. package/dist/components/scenarioWizard/components/ActionEdit.esm.js.map +1 -0
  79. package/dist/components/scenarioWizard/components/CloseConfirmation.esm.js +16 -0
  80. package/dist/components/scenarioWizard/components/CloseConfirmation.esm.js.map +1 -0
  81. package/dist/components/scenarioWizard/components/ConsequenceTable.esm.js +44 -0
  82. package/dist/components/scenarioWizard/components/ConsequenceTable.esm.js.map +1 -0
  83. package/dist/components/scenarioWizard/components/ProbabilityTable.esm.js +30 -0
  84. package/dist/components/scenarioWizard/components/ProbabilityTable.esm.js.map +1 -0
  85. package/dist/components/scenarioWizard/components/tableStyles.esm.js +43 -0
  86. package/dist/components/scenarioWizard/components/tableStyles.esm.js.map +1 -0
  87. package/dist/components/scenarioWizard/scenarioWizardStyle.esm.js +50 -0
  88. package/dist/components/scenarioWizard/scenarioWizardStyle.esm.js.map +1 -0
  89. package/dist/components/scenarioWizard/steps/ActionsStep.esm.js +39 -0
  90. package/dist/components/scenarioWizard/steps/ActionsStep.esm.js.map +1 -0
  91. package/dist/components/scenarioWizard/steps/RiskStep.esm.js +66 -0
  92. package/dist/components/scenarioWizard/steps/RiskStep.esm.js.map +1 -0
  93. package/dist/components/scenarioWizard/steps/ScenarioStep.esm.js +100 -0
  94. package/dist/components/scenarioWizard/steps/ScenarioStep.esm.js.map +1 -0
  95. package/dist/components/scenarioWizard/steps/riskStepStyles.esm.js +10 -0
  96. package/dist/components/scenarioWizard/steps/riskStepStyles.esm.js.map +1 -0
  97. package/dist/contexts/RiScContext.esm.js +261 -0
  98. package/dist/contexts/RiScContext.esm.js.map +1 -0
  99. package/dist/contexts/ScenarioContext.esm.js +272 -0
  100. package/dist/contexts/ScenarioContext.esm.js.map +1 -0
  101. package/dist/index.esm.js +2 -3
  102. package/dist/index.esm.js.map +1 -1
  103. package/dist/plugin.esm.js +21 -0
  104. package/dist/plugin.esm.js.map +1 -0
  105. package/dist/risc_schema_en_v3_3.json.esm.js +299 -0
  106. package/dist/risc_schema_en_v3_3.json.esm.js.map +1 -0
  107. package/dist/routes.esm.js +18 -0
  108. package/dist/routes.esm.js.map +1 -0
  109. package/dist/utils/DTOs.esm.js +77 -0
  110. package/dist/utils/DTOs.esm.js.map +1 -0
  111. package/dist/utils/constants.esm.js +17 -0
  112. package/dist/utils/constants.esm.js.map +1 -0
  113. package/dist/utils/hooks.esm.js +139 -0
  114. package/dist/utils/hooks.esm.js.map +1 -0
  115. package/dist/utils/style.esm.js +125 -0
  116. package/dist/utils/style.esm.js.map +1 -0
  117. package/dist/{esm/index-c11a7a42.esm.js → utils/translations.esm.js} +22 -41
  118. package/dist/utils/translations.esm.js.map +1 -0
  119. package/dist/utils/types.esm.js +31 -0
  120. package/dist/utils/types.esm.js.map +1 -0
  121. package/dist/utils/utilityfunctions.esm.js +95 -0
  122. package/dist/utils/utilityfunctions.esm.js.map +1 -0
  123. package/package.json +16 -12
  124. package/dist/esm/index-99d0fef8.esm.js +0 -3481
  125. package/dist/esm/index-99d0fef8.esm.js.map +0 -1
  126. package/dist/esm/index-c11a7a42.esm.js.map +0 -1
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { Routes, Route } from 'react-router-dom';
3
+ import { CacheProvider } from '@emotion/react';
4
+ import createCache from '@emotion/cache';
5
+ import { RiScPlugin } from './components/riScPlugin/RiScPlugin.esm.js';
6
+ import { ScenarioProvider } from './contexts/ScenarioContext.esm.js';
7
+ import { riScRouteRef, scenarioRouteRef } from './routes.esm.js';
8
+ import { RiScProvider } from './contexts/RiScContext.esm.js';
9
+
10
+ const emotionInsertionPoint = document.createElement("meta");
11
+ emotionInsertionPoint.setAttribute("name", "emotion-insertion-point");
12
+ document.querySelector("head")?.appendChild(emotionInsertionPoint);
13
+ const cache = createCache({
14
+ key: "css",
15
+ insertionPoint: emotionInsertionPoint
16
+ });
17
+ const ProvidedPlugin = () => /* @__PURE__ */ React.createElement(CacheProvider, { value: cache }, /* @__PURE__ */ React.createElement(RiScProvider, null, /* @__PURE__ */ React.createElement(ScenarioProvider, null, /* @__PURE__ */ React.createElement(RiScPlugin, null))));
18
+ const PluginRoot = () => /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, { path: "/", element: /* @__PURE__ */ React.createElement(ProvidedPlugin, null) }), /* @__PURE__ */ React.createElement(Route, { path: riScRouteRef.path, element: /* @__PURE__ */ React.createElement(ProvidedPlugin, null) }), /* @__PURE__ */ React.createElement(Route, { path: scenarioRouteRef.path, element: /* @__PURE__ */ React.createElement(ProvidedPlugin, null) }));
19
+
20
+ export { PluginRoot };
21
+ //# sourceMappingURL=PluginRoot.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PluginRoot.esm.js","sources":["../src/PluginRoot.tsx"],"sourcesContent":["import React from 'react';\nimport { Route, Routes } from 'react-router-dom';\nimport { CacheProvider } from '@emotion/react';\nimport createCache from '@emotion/cache';\nimport { RiScPlugin } from './components/riScPlugin/RiScPlugin';\nimport { ScenarioProvider } from './contexts/ScenarioContext';\nimport { riScRouteRef, scenarioRouteRef } from './routes';\nimport { RiScProvider } from './contexts/RiScContext';\n\nconst emotionInsertionPoint = document.createElement('meta');\nemotionInsertionPoint.setAttribute('name', 'emotion-insertion-point');\ndocument.querySelector('head')?.appendChild(emotionInsertionPoint);\n\nconst cache = createCache({\n key: 'css',\n insertionPoint: emotionInsertionPoint,\n});\n\nconst ProvidedPlugin = () => (\n <CacheProvider value={cache}>\n <RiScProvider>\n <ScenarioProvider>\n <RiScPlugin />\n </ScenarioProvider>\n </RiScProvider>\n </CacheProvider>\n);\n\nexport const PluginRoot = () => (\n <Routes>\n <Route path=\"/\" element={<ProvidedPlugin />} />\n <Route path={riScRouteRef.path} element={<ProvidedPlugin />} />\n <Route path={scenarioRouteRef.path} element={<ProvidedPlugin />} />\n </Routes>\n);\n"],"names":[],"mappings":";;;;;;;;;AASA,MAAM,qBAAA,GAAwB,QAAS,CAAA,aAAA,CAAc,MAAM,CAAA,CAAA;AAC3D,qBAAsB,CAAA,YAAA,CAAa,QAAQ,yBAAyB,CAAA,CAAA;AACpE,QAAA,CAAS,aAAc,CAAA,MAAM,CAAG,EAAA,WAAA,CAAY,qBAAqB,CAAA,CAAA;AAEjE,MAAM,QAAQ,WAAY,CAAA;AAAA,EACxB,GAAK,EAAA,KAAA;AAAA,EACL,cAAgB,EAAA,qBAAA;AAClB,CAAC,CAAA,CAAA;AAED,MAAM,cAAiB,GAAA,sBACpB,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,EAAc,OAAO,KACpB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,gBACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,IAAA,CACd,CACF,CACF,CAAA,CAAA;AAGK,MAAM,UAAa,GAAA,sBACvB,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,sCACE,KAAM,EAAA,EAAA,IAAA,EAAK,GAAI,EAAA,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAe,CAAI,EAAA,CAAA,sCAC5C,KAAM,EAAA,EAAA,IAAA,EAAM,YAAa,CAAA,IAAA,EAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,IAAA,CAAA,EAAI,mBAC5D,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,IAAM,EAAA,gBAAA,CAAiB,IAAM,EAAA,OAAA,kBAAU,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAe,GAAI,CACnE;;;;"}
@@ -0,0 +1,79 @@
1
+ import Box from '@material-ui/core/Box';
2
+ import Checkbox from '@material-ui/core/Checkbox';
3
+ import Chip from '@material-ui/core/Chip';
4
+ import FormControl from '@material-ui/core/FormControl';
5
+ import FormLabel from '@material-ui/core/FormLabel';
6
+ import ListItemIcon from '@material-ui/core/ListItemIcon';
7
+ import ListItemText from '@material-ui/core/ListItemText';
8
+ import MenuItem from '@material-ui/core/MenuItem';
9
+ import Select from '@material-ui/core/Select';
10
+ import React from 'react';
11
+ import { FormHelperText } from '@material-ui/core';
12
+ import { useInputFieldStyles, menuProps } from '../../utils/style.esm.js';
13
+
14
+ const Dropdown = ({
15
+ label,
16
+ options,
17
+ selectedValues,
18
+ handleChange,
19
+ error,
20
+ required,
21
+ variant = "outlined",
22
+ renderSelectedValue
23
+ }) => {
24
+ const { formLabel, formControl } = useInputFieldStyles();
25
+ const multiple = Array.isArray(selectedValues);
26
+ function getOptionsValue(option) {
27
+ return typeof option === "string" ? option : option.value;
28
+ }
29
+ function getOptionsRenderValue(option) {
30
+ return typeof option === "string" ? option : option.renderedValue;
31
+ }
32
+ function renderSelectedValueHandler(value) {
33
+ if (renderSelectedValue) {
34
+ return renderSelectedValue(value);
35
+ }
36
+ return value;
37
+ }
38
+ const onChange = (event) => handleChange(event.target.value);
39
+ const renderValue = (selected) => multiple ? /* @__PURE__ */ React.createElement(
40
+ Box,
41
+ {
42
+ sx: {
43
+ display: "flex",
44
+ flexWrap: "wrap",
45
+ marginBottom: 0,
46
+ paddingBottom: 0
47
+ }
48
+ },
49
+ selected.map((value) => /* @__PURE__ */ React.createElement(Chip, { key: value, label: renderSelectedValueHandler(value) }))
50
+ ) : selected;
51
+ return /* @__PURE__ */ React.createElement(FormControl, { className: formControl }, label && /* @__PURE__ */ React.createElement(FormLabel, { className: formLabel, required }, label), /* @__PURE__ */ React.createElement(
52
+ Select,
53
+ {
54
+ multiple,
55
+ value: selectedValues,
56
+ onChange,
57
+ variant,
58
+ MenuProps: menuProps,
59
+ renderValue,
60
+ error: !!error,
61
+ SelectDisplayProps: multiple ? {
62
+ style: {
63
+ paddingBottom: 8,
64
+ paddingTop: 16,
65
+ minHeight: 40
66
+ }
67
+ } : {}
68
+ },
69
+ options.map((name) => /* @__PURE__ */ React.createElement(MenuItem, { key: getOptionsValue(name), value: getOptionsValue(name) }, multiple && /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(
70
+ Checkbox,
71
+ {
72
+ checked: selectedValues.indexOf(getOptionsValue(name)) > -1
73
+ }
74
+ )), /* @__PURE__ */ React.createElement(ListItemText, { primary: getOptionsRenderValue(name) })))
75
+ ), error && /* @__PURE__ */ React.createElement(FormHelperText, { error: true }, error));
76
+ };
77
+
78
+ export { Dropdown };
79
+ //# sourceMappingURL=Dropdown.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.esm.js","sources":["../../../src/components/common/Dropdown.tsx"],"sourcesContent":["import Box from '@material-ui/core/Box';\nimport Checkbox from '@material-ui/core/Checkbox';\nimport Chip from '@material-ui/core/Chip';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormLabel from '@material-ui/core/FormLabel';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport React, { ChangeEvent } from 'react';\nimport { FormHelperText } from '@material-ui/core';\nimport { menuProps, useInputFieldStyles } from '../../utils/style';\n\ntype OptionsObject = {\n value: string;\n renderedValue: string;\n};\ninterface DropdownProps<T> {\n options: string[] | OptionsObject[];\n selectedValues: T;\n handleChange: (value: T) => void;\n error?: string | null;\n required?: boolean;\n label?: string;\n variant?: 'standard' | 'outlined' | 'filled';\n renderSelectedValue?: (selectedValue: string) => string;\n}\n\nexport const Dropdown = <T,>({\n label,\n options,\n selectedValues,\n handleChange,\n error,\n required,\n variant = 'outlined',\n renderSelectedValue,\n}: DropdownProps<T>) => {\n const { formLabel, formControl } = useInputFieldStyles();\n\n const multiple = Array.isArray(selectedValues);\n\n function getOptionsValue(option: DropdownProps<T>['options'][0]): string {\n return typeof option === 'string' ? option : option.value;\n }\n\n function getOptionsRenderValue(\n option: DropdownProps<T>['options'][0],\n ): string {\n return typeof option === 'string' ? option : option.renderedValue;\n }\n\n function renderSelectedValueHandler(value: string): string {\n if (renderSelectedValue) {\n return renderSelectedValue(value);\n }\n return value;\n }\n\n const onChange = (event: ChangeEvent<{ value: unknown }>) =>\n handleChange(event.target.value as T);\n\n const renderValue = (selected: any) =>\n multiple ? (\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'wrap',\n marginBottom: 0,\n paddingBottom: 0,\n }}\n >\n {selected.map((value: string) => (\n <Chip key={value} label={renderSelectedValueHandler(value)} />\n ))}\n </Box>\n ) : (\n selected\n );\n\n return (\n <FormControl className={formControl}>\n {label && (\n <FormLabel className={formLabel} required={required}>\n {label}\n </FormLabel>\n )}\n <Select\n multiple={multiple}\n value={selectedValues}\n onChange={onChange}\n variant={variant}\n MenuProps={menuProps}\n renderValue={renderValue}\n error={!!error}\n SelectDisplayProps={\n multiple\n ? {\n style: {\n paddingBottom: 8,\n paddingTop: 16,\n minHeight: 40,\n },\n }\n : {}\n }\n >\n {options.map(name => (\n <MenuItem key={getOptionsValue(name)} value={getOptionsValue(name)}>\n {multiple && (\n <ListItemIcon>\n <Checkbox\n checked={selectedValues.indexOf(getOptionsValue(name)) > -1}\n />\n </ListItemIcon>\n )}\n <ListItemText primary={getOptionsRenderValue(name)} />\n </MenuItem>\n ))}\n </Select>\n {error && <FormHelperText error>{error}</FormHelperText>}\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AA4BO,MAAM,WAAW,CAAK;AAAA,EAC3B,KAAA;AAAA,EACA,OAAA;AAAA,EACA,cAAA;AAAA,EACA,YAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAU,GAAA,UAAA;AAAA,EACV,mBAAA;AACF,CAAwB,KAAA;AACtB,EAAA,MAAM,EAAE,SAAA,EAAW,WAAY,EAAA,GAAI,mBAAoB,EAAA,CAAA;AAEvD,EAAM,MAAA,QAAA,GAAW,KAAM,CAAA,OAAA,CAAQ,cAAc,CAAA,CAAA;AAE7C,EAAA,SAAS,gBAAgB,MAAgD,EAAA;AACvE,IAAA,OAAO,OAAO,MAAA,KAAW,QAAW,GAAA,MAAA,GAAS,MAAO,CAAA,KAAA,CAAA;AAAA,GACtD;AAEA,EAAA,SAAS,sBACP,MACQ,EAAA;AACR,IAAA,OAAO,OAAO,MAAA,KAAW,QAAW,GAAA,MAAA,GAAS,MAAO,CAAA,aAAA,CAAA;AAAA,GACtD;AAEA,EAAA,SA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UACf,UAAY,EAAA,EAAA;AAAA,UACZ,SAAW,EAAA,EAAA;AAAA,SACb;AAAA,UAEF,EAAC;AAAA,KAAA;AAAA,IAGN,OAAQ,CAAA,GAAA,CAAI,CACX,IAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,YAAS,GAAK,EAAA,eAAA,CAAgB,IAAI,CAAA,EAAG,OAAO,eAAgB,CAAA,IAAI,CAC9D,EAAA,EAAA,QAAA,wCACE,YACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,SAAS,cAAe,CAAA,OAAA,CAAQ,eAAgB,CAAA,IAAI,CAAC,CAAI,GAAA,CAAA,CAAA;AAAA,OAAA;AAAA,KAE7D,mBAED,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,SAAS,qBAAsB,CAAA,IAAI,CAAG,EAAA,CACtD,CACD,CAAA;AAAA,KAEF,KAAS,oBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,KAAK,EAAA,IAAA,EAAA,EAAE,KAAM,CACzC,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { makeStyles, IconButton } from '@material-ui/core';
3
+ import EditIcon from '@mui/icons-material/Edit';
4
+
5
+ const useEditButtonStyle = makeStyles((theme) => ({
6
+ icon: {
7
+ color: theme.palette.type === "dark" ? "#fff" : "rgba(0, 0, 0, 0.54)"
8
+ }
9
+ }));
10
+ const EditButton = (props) => {
11
+ const { icon } = useEditButtonStyle();
12
+ return /* @__PURE__ */ React.createElement(IconButton, { size: "small", ...props }, /* @__PURE__ */ React.createElement(EditIcon, { className: icon, "aria-label": "Edit" }));
13
+ };
14
+
15
+ export { EditButton as default };
16
+ //# sourceMappingURL=EditButton.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditButton.esm.js","sources":["../../../src/components/common/EditButton.tsx"],"sourcesContent":["import React from 'react';\nimport {\n IconButton,\n IconButtonProps,\n Theme,\n makeStyles,\n} from '@material-ui/core';\nimport EditIcon from '@mui/icons-material/Edit';\n\nconst useEditButtonStyle = makeStyles((theme: Theme) => ({\n icon: {\n color: theme.palette.type === 'dark' ? '#fff' : 'rgba(0, 0, 0, 0.54)',\n },\n}));\n\nconst EditButton = (props: IconButtonProps) => {\n const { icon } = useEditButtonStyle();\n\n return (\n <IconButton size=\"small\" {...props}>\n <EditIcon className={icon} aria-label=\"Edit\" />\n </IconButton>\n );\n};\n\nexport default EditButton;\n"],"names":[],"mappings":";;;;AASA,MAAM,kBAAA,GAAqB,UAAW,CAAA,CAAC,KAAkB,MAAA;AAAA,EACvD,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,KAAS,SAAS,MAAS,GAAA,qBAAA;AAAA,GAClD;AACF,CAAE,CAAA,CAAA,CAAA;AAEI,MAAA,UAAA,GAAa,CAAC,KAA2B,KAAA;AAC7C,EAAM,MAAA,EAAE,IAAK,EAAA,GAAI,kBAAmB,EAAA,CAAA;AAEpC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,IAAK,EAAA,OAAA,EAAS,GAAG,KAAA,EAAA,kBAC1B,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,SAAW,EAAA,IAAA,EAAM,YAAW,EAAA,MAAA,EAAO,CAC/C,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,33 @@
1
+ import FormControl from '@mui/material/FormControl';
2
+ import FormHelperText from '@mui/material/FormHelperText';
3
+ import FormLabel from '@mui/material/FormLabel';
4
+ import TextField from '@mui/material/TextField';
5
+ import React, { forwardRef } from 'react';
6
+ import { formLabel, labelSubtitle } from './typography.esm.js';
7
+
8
+ const Input = forwardRef(
9
+ ({ label, sublabel, error, helperText, required, ...props }, ref) => {
10
+ return /* @__PURE__ */ React.createElement(FormControl, { sx: { width: "100%" }, error, required }, label && /* @__PURE__ */ React.createElement(FormLabel, { required, sx: formLabel }, label), sublabel && /* @__PURE__ */ React.createElement(FormHelperText, { sx: labelSubtitle }, sublabel), /* @__PURE__ */ React.createElement(
11
+ TextField,
12
+ {
13
+ id: "filled-multiline-static",
14
+ error,
15
+ multiline: true,
16
+ fullWidth: true,
17
+ variant: "outlined",
18
+ inputRef: ref,
19
+ InputProps: {
20
+ sx: (theme) => ({
21
+ "&.Mui-disabled": {
22
+ color: theme.palette.mode === "dark" ? "#FFFFFF80" : "#757575"
23
+ }
24
+ })
25
+ },
26
+ ...props
27
+ }
28
+ ), helperText && /* @__PURE__ */ React.createElement(FormHelperText, null, helperText));
29
+ }
30
+ );
31
+
32
+ export { Input };
33
+ //# sourceMappingURL=Input.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.esm.js","sources":["../../../src/components/common/Input.tsx"],"sourcesContent":["import FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormLabel from '@mui/material/FormLabel';\nimport TextField, { TextFieldProps } from '@mui/material/TextField';\nimport React, { forwardRef } from 'react';\nimport { formLabel, labelSubtitle } from './typography';\n\ntype Props = TextFieldProps & {\n sublabel?: string;\n};\n\nexport const Input = forwardRef<HTMLInputElement, Props>(\n ({ label, sublabel, error, helperText, required, ...props }, ref) => {\n return (\n <FormControl sx={{ width: '100%' }} error={error} required={required}>\n {label && (\n <FormLabel required={required} sx={formLabel}>\n {label}\n </FormLabel>\n )}\n {sublabel && (\n <FormHelperText sx={labelSubtitle}>{sublabel}</FormHelperText>\n )}\n <TextField\n id=\"filled-multiline-static\"\n error={error}\n multiline\n fullWidth\n variant=\"outlined\"\n inputRef={ref}\n InputProps={{\n sx: theme => ({\n '&.Mui-disabled': {\n color: theme.palette.mode === 'dark' ? '#FFFFFF80' : '#757575',\n },\n }),\n }}\n {...props}\n />\n {helperText && <FormHelperText>{helperText}</FormHelperText>}\n </FormControl>\n );\n },\n);\n"],"names":[],"mappings":";;;;;;;AAWO,MAAM,KAAQ,GAAA,UAAA;AAAA,EACnB,CAAC,EAAE,KAAA,EAAO,QAAU,EAAA,KAAA,EAAO,YAAY,QAAU,EAAA,GAAG,KAAM,EAAA,EAAG,GAAQ,KAAA;AACnE,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,eAAY,EAAI,EAAA,EAAE,OAAO,MAAO,EAAA,EAAG,KAAc,EAAA,QAAA,EAAA,EAC/C,KACC,oBAAA,KAAA,CAAA,aAAA,CAAC,aAAU,QAAoB,EAAA,EAAA,EAAI,SAChC,EAAA,EAAA,KACH,CAED,EAAA,QAAA,wCACE,cAAe,EAAA,EAAA,EAAA,EAAI,aAAgB,EAAA,EAAA,QAAS,CAE/C,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,EAAG,EAAA,yBAAA;AAAA,QACH,KAAA;AAAA,QACA,SAAS,EAAA,IAAA;AAAA,QACT,SAAS,EAAA,IAAA;AAAA,QACT,OAAQ,EAAA,UAAA;AAAA,QACR,QAAU,EAAA,GAAA;AAAA,QACV,UAAY,EAAA;AAAA,UACV,IAAI,CAAU,KAAA,MAAA;AAAA,YACZ,gBAAkB,EAAA;AAAA,cAChB,KAAO,EAAA,KAAA,CAAM,OAAQ,CAAA,IAAA,KAAS,SAAS,WAAc,GAAA,SAAA;AAAA,aACvD;AAAA,WACF,CAAA;AAAA,SACF;AAAA,QACC,GAAG,KAAA;AAAA,OAAA;AAAA,KAEL,EAAA,UAAA,oBAAe,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,EAAgB,UAAW,CAC7C,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
@@ -0,0 +1,85 @@
1
+ import React from 'react';
2
+ import { useController } from 'react-hook-form';
3
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
4
+ import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
5
+ import Box from '@mui/material/Box';
6
+ import Chip from '@mui/material/Chip';
7
+ import FormControl from '@mui/material/FormControl';
8
+ import FormHelperText from '@mui/material/FormHelperText';
9
+ import FormLabel from '@mui/material/FormLabel';
10
+ import MUISelect from '@mui/material/Select';
11
+ import Checkbox from '@mui/material/Checkbox';
12
+ import MenuItem from '@mui/material/MenuItem';
13
+ import ListItemText from '@mui/material/ListItemText';
14
+ import { formLabel, labelSubtitle } from './typography.esm.js';
15
+
16
+ const Select = ({
17
+ label,
18
+ sublabel,
19
+ error,
20
+ helperText,
21
+ required,
22
+ control,
23
+ name,
24
+ multiple,
25
+ labelTranslationKey,
26
+ options,
27
+ ...props
28
+ }) => {
29
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
30
+ const { field } = useController({
31
+ name,
32
+ control,
33
+ rules: { required }
34
+ });
35
+ const renderValue = (values) => multiple ? /* @__PURE__ */ React.createElement(
36
+ Box,
37
+ {
38
+ sx: {
39
+ display: "flex",
40
+ flexWrap: "wrap",
41
+ marginBottom: 0,
42
+ paddingBottom: 0
43
+ }
44
+ },
45
+ values.map((value) => /* @__PURE__ */ React.createElement(
46
+ Chip,
47
+ {
48
+ key: value,
49
+ label: (
50
+ /* @ts-ignore Because ts can't typecheck strings against our keys */
51
+ labelTranslationKey ? t(`${labelTranslationKey}.${value}`) : value
52
+ )
53
+ }
54
+ ))
55
+ ) : options.find((option) => option.value === values)?.renderedValue;
56
+ const handleChecked = (fieldValue, optionValue) => {
57
+ if (Array.isArray(fieldValue)) return fieldValue.includes(optionValue);
58
+ return fieldValue === optionValue;
59
+ };
60
+ return /* @__PURE__ */ React.createElement(FormControl, { sx: { width: "100%" } }, label && /* @__PURE__ */ React.createElement(FormLabel, { sx: formLabel, required }, label), sublabel && /* @__PURE__ */ React.createElement(FormHelperText, { sx: labelSubtitle }, sublabel), /* @__PURE__ */ React.createElement(
61
+ MUISelect,
62
+ {
63
+ MenuProps: {
64
+ disablePortal: true
65
+ },
66
+ variant: "outlined",
67
+ renderValue,
68
+ multiple,
69
+ SelectDisplayProps: multiple ? {
70
+ style: {
71
+ paddingBottom: 8,
72
+ paddingTop: 16,
73
+ minHeight: 40
74
+ }
75
+ } : {},
76
+ inputRef: field.ref,
77
+ ...field,
78
+ ...props
79
+ },
80
+ options.map((option) => /* @__PURE__ */ React.createElement(MenuItem, { key: option.value, value: option.value }, multiple && /* @__PURE__ */ React.createElement(Checkbox, { checked: handleChecked(field.value, option.value) }), /* @__PURE__ */ React.createElement(ListItemText, { primary: option.renderedValue })))
81
+ ), error && /* @__PURE__ */ React.createElement(FormHelperText, { error: true }, helperText));
82
+ };
83
+
84
+ export { Select };
85
+ //# sourceMappingURL=Select.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.esm.js","sources":["../../../src/components/common/Select.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Control,\n FieldValues,\n Path,\n PathValue,\n useController,\n} from 'react-hook-form';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport Box from '@mui/material/Box';\nimport Chip from '@mui/material/Chip';\nimport FormControl from '@mui/material/FormControl';\nimport FormHelperText from '@mui/material/FormHelperText';\nimport FormLabel from '@mui/material/FormLabel';\nimport MUISelect, { SelectProps } from '@mui/material/Select';\nimport Checkbox from '@mui/material/Checkbox';\nimport MenuItem from '@mui/material/MenuItem';\nimport ListItemText from '@mui/material/ListItemText';\nimport { formLabel, labelSubtitle } from './typography';\n\ntype Props<T extends FieldValues> = SelectProps & {\n sublabel?: string;\n helperText?: string;\n control?: Control<T, any>;\n name: Path<T>;\n labelTranslationKey?: string;\n options: { value: string | number; renderedValue: string | number }[];\n};\n\nexport const Select = <T extends FieldValues>({\n label,\n sublabel,\n error,\n helperText,\n required,\n control,\n name,\n multiple,\n labelTranslationKey,\n options,\n ...props\n}: Props<T>) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const { field } = useController({\n name,\n control,\n rules: { required },\n });\n\n // values er strengt tatt unknown, men da må vi bruke mye ts-ignore for å komme i mål\n const renderValue = (values: any) =>\n multiple ? (\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'wrap',\n marginBottom: 0,\n paddingBottom: 0,\n }}\n >\n {values.map((value: string) => (\n <Chip\n key={value}\n label={\n /* @ts-ignore Because ts can't typecheck strings against our keys */\n labelTranslationKey ? t(`${labelTranslationKey}.${value}`) : value\n }\n />\n ))}\n </Box>\n ) : (\n options.find(option => option.value === values)?.renderedValue\n );\n\n const handleChecked = (\n fieldValue: PathValue<T, (string | undefined) & Path<T>>,\n optionValue: Props<T>['options'][0]['value'],\n ) => {\n if (Array.isArray(fieldValue)) return fieldValue.includes(optionValue);\n return fieldValue === optionValue;\n };\n\n return (\n <FormControl sx={{ width: '100%' }}>\n {label && (\n <FormLabel sx={formLabel} required={required}>\n {label}\n </FormLabel>\n )}\n {sublabel && (\n <FormHelperText sx={labelSubtitle}>{sublabel}</FormHelperText>\n )}\n\n <MUISelect\n MenuProps={{\n disablePortal: true,\n }}\n variant=\"outlined\"\n renderValue={renderValue}\n multiple={multiple}\n SelectDisplayProps={\n multiple\n ? {\n style: {\n paddingBottom: 8,\n paddingTop: 16,\n minHeight: 40,\n },\n }\n : {}\n }\n inputRef={field.ref}\n {...field}\n {...props}\n >\n {options.map(option => (\n <MenuItem key={option.value} value={option.value}>\n {multiple && (\n <Checkbox checked={handleChecked(field.value, option.value)} />\n )}\n <ListItemText primary={option.renderedValue} />\n </MenuItem>\n ))}\n </MUISelect>\n {error && <FormHelperText error>{helperText}</FormHelperText>}\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA8BO,MAAM,SAAS,CAAwB;AAAA,EAC5C,KAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,mBAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG,KAAA;AACL,CAAgB,KAAA;AACd,EAAA,MAAM,EAAE,CAAA,E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AW,EAAA,QAAA,EAAA,EACvB,KACH,CAED,EAAA,QAAA,wCACE,cAAe,EAAA,EAAA,EAAA,EAAI,aAAgB,EAAA,EAAA,QAAS,CAG/C,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA;AAAA,QACT,aAAe,EAAA,IAAA;AAAA,OACjB;AAAA,MACA,OAAQ,EAAA,UAAA;AAAA,MACR,WAAA;AAAA,MACA,QAAA;AAAA,MACA,oBACE,QACI,GAAA;AAAA,QACE,KAAO,EAAA;AAAA,UACL,aAAe,EAAA,CAAA;AAAA,UACf,UAAY,EAAA,EAAA;AAAA,UACZ,SAAW,EAAA,EAAA;AAAA,SACb;AAAA,UAEF,EAAC;AAAA,MAEP,UAAU,KAAM,CAAA,GAAA;AAAA,MACf,GAAG,KAAA;AAAA,MACH,GAAG,KAAA;AAAA,KAAA;AAAA,IAEH,OAAQ,CAAA,GAAA,CAAI,CACX,MAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,GAAA,EAAK,MAAO,CAAA,KAAA,EAAO,KAAO,EAAA,MAAA,CAAO,KACxC,EAAA,EAAA,QAAA,oBACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,OAAS,EAAA,aAAA,CAAc,KAAM,CAAA,KAAA,EAAO,MAAO,CAAA,KAAK,CAAG,EAAA,CAAA,kBAE9D,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,OAAS,EAAA,MAAA,CAAO,aAAe,EAAA,CAC/C,CACD,CAAA;AAAA,KAEF,KAAS,oBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,KAAK,EAAA,IAAA,EAAA,EAAE,UAAW,CAC9C,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,11 @@
1
+ import { CircularProgress } from '@material-ui/core';
2
+ import React from 'react';
3
+ import { useSpinnerStyles } from '../../utils/style.esm.js';
4
+
5
+ const Spinner = ({ size }) => {
6
+ const { container, spinner } = useSpinnerStyles();
7
+ return /* @__PURE__ */ React.createElement("div", { className: container }, /* @__PURE__ */ React.createElement(CircularProgress, { className: spinner, size }));
8
+ };
9
+
10
+ export { Spinner };
11
+ //# sourceMappingURL=Spinner.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.esm.js","sources":["../../../src/components/common/Spinner.tsx"],"sourcesContent":["import { CircularProgress } from '@material-ui/core';\nimport React from 'react';\nimport { useSpinnerStyles } from '../../utils/style';\n\nexport const Spinner = ({ size }: { size?: string | number }) => {\n const { container, spinner } = useSpinnerStyles();\n return (\n <div className={container}>\n <CircularProgress className={spinner} size={size} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;AAIO,MAAM,OAAU,GAAA,CAAC,EAAE,IAAA,EAAuC,KAAA;AAC/D,EAAA,MAAM,EAAE,SAAA,EAAW,OAAQ,EAAA,GAAI,gBAAiB,EAAA,CAAA;AAChD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,SAAW,EAAA,SAAA,EAAA,sCACb,gBAAiB,EAAA,EAAA,SAAA,EAAW,OAAS,EAAA,IAAA,EAAY,CACpD,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,64 @@
1
+ import { FormControl, FormLabel, FormHelperText, TextField as TextField$1 } from '@material-ui/core';
2
+ import React, { useState } from 'react';
3
+ import { useScenario } from '../../contexts/ScenarioContext.esm.js';
4
+ import { useInputFieldStyles, useFontStyles } from '../../utils/style.esm.js';
5
+
6
+ const TextField = ({
7
+ label,
8
+ subtitle,
9
+ value,
10
+ required,
11
+ minRows = 1,
12
+ handleChange,
13
+ validateInput,
14
+ errorMessage,
15
+ errorKey
16
+ }) => {
17
+ const [hasError, setHasError] = useState(false);
18
+ const { setFormError, removeFormError, formFieldHasErrors } = useScenario();
19
+ const { formLabel, formControl, root } = useInputFieldStyles();
20
+ const { labelSubtitle } = useFontStyles();
21
+ const onChange = (event) => {
22
+ if (handleChange) {
23
+ handleChange(event.target.value);
24
+ }
25
+ };
26
+ const onBlur = (event) => {
27
+ if (!validateInput && !required) {
28
+ return;
29
+ }
30
+ const isValid = validateInput ? validateInput(event.target.value) : true;
31
+ const requiredValid = required ? event.target.value.length > 0 : true;
32
+ const validationResult = isValid && requiredValid;
33
+ setHasError(!validationResult);
34
+ if (!errorKey) {
35
+ return;
36
+ }
37
+ if (validationResult) {
38
+ removeFormError(errorKey);
39
+ } else {
40
+ setFormError(errorKey);
41
+ }
42
+ };
43
+ const fieldError = hasError || (errorKey ? formFieldHasErrors(errorKey) : false);
44
+ return /* @__PURE__ */ React.createElement(FormControl, { className: formControl }, label && /* @__PURE__ */ React.createElement(FormLabel, { className: formLabel, required }, label), subtitle && /* @__PURE__ */ React.createElement(FormHelperText, { className: labelSubtitle }, subtitle), /* @__PURE__ */ React.createElement(
45
+ TextField$1,
46
+ {
47
+ disabled: !handleChange,
48
+ required: true,
49
+ id: "filled-multiline-static",
50
+ value,
51
+ multiline: true,
52
+ fullWidth: true,
53
+ minRows,
54
+ variant: "outlined",
55
+ onChange,
56
+ error: fieldError,
57
+ onBlur,
58
+ InputProps: { className: root }
59
+ }
60
+ ), fieldError && /* @__PURE__ */ React.createElement(FormHelperText, { error: true }, errorMessage));
61
+ };
62
+
63
+ export { TextField };
64
+ //# sourceMappingURL=Textfield.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textfield.esm.js","sources":["../../../src/components/common/Textfield.tsx"],"sourcesContent":["import {\n FormControl,\n FormHelperText,\n FormLabel,\n TextField as MUITextField,\n} from '@material-ui/core';\nimport React, { ChangeEvent, useState } from 'react';\nimport { useScenario } from '../../contexts/ScenarioContext';\nimport { useFontStyles, useInputFieldStyles } from '../../utils/style';\n\ntype ErrorProps = {\n errorKey?: string;\n errorMessage?: string;\n};\n\ntype TextFieldProps = {\n label?: string;\n subtitle?: string;\n value: string | number;\n error?: string | boolean | null;\n minRows?: number;\n handleChange?: (value: string) => void;\n} & (\n | ({\n validateInput: (value: string) => boolean;\n required?: boolean;\n } & ErrorProps)\n | ({\n required?: undefined;\n validateInput?: undefined;\n } & ErrorProps)\n | ({\n required: boolean;\n validateInput?: (value: string) => boolean;\n } & ErrorProps)\n);\n\nexport const TextField = ({\n label,\n subtitle,\n value,\n required,\n minRows = 1,\n handleChange,\n validateInput,\n errorMessage,\n errorKey,\n}: TextFieldProps) => {\n const [hasError, setHasError] = useState(false);\n const { setFormError, removeFormError, formFieldHasErrors } = useScenario();\n const { formLabel, formControl, root } = useInputFieldStyles();\n const { labelSubtitle } = useFontStyles();\n\n const onChange = (event: ChangeEvent<{ value: string }>) => {\n if (handleChange) {\n handleChange(event.target.value);\n }\n };\n\n const onBlur = (event: ChangeEvent<{ value: string }>) => {\n if (!validateInput && !required) {\n return;\n }\n\n const isValid = validateInput ? validateInput(event.target.value) : true;\n const requiredValid = required ? event.target.value.length > 0 : true;\n\n const validationResult = isValid && requiredValid;\n setHasError(!validationResult);\n\n if (!errorKey) {\n return;\n }\n\n if (validationResult) {\n removeFormError(errorKey);\n } else {\n setFormError(errorKey);\n }\n };\n\n const fieldError =\n hasError || (errorKey ? formFieldHasErrors(errorKey) : false);\n\n return (\n <FormControl className={formControl}>\n {label && (\n <FormLabel className={formLabel} required={required}>\n {label}\n </FormLabel>\n )}\n {subtitle && (\n <FormHelperText className={labelSubtitle}>{subtitle}</FormHelperText>\n )}\n <MUITextField\n disabled={!handleChange}\n required\n id=\"filled-multiline-static\"\n value={value}\n multiline\n fullWidth\n minRows={minRows}\n variant=\"outlined\"\n onChange={onChange}\n error={fieldError}\n onBlur={onBlur}\n InputProps={{ className: root }}\n />\n {fieldError && <FormHelperText error>{errorMessage}</FormHelperText>}\n </FormControl>\n );\n};\n"],"names":["MUITextField"],"mappings":";;;;;AAqCO,MAAM,YAAY,CAAC;AAAA,EACxB,KAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAU,GAAA,CAAA;AAAA,EACV,YA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A,MAAM,UACJ,GAAA,QAAA,KAAa,QAAW,GAAA,kBAAA,CAAmB,QAAQ,CAAI,GAAA,KAAA,CAAA,CAAA;AAEzD,EAAA,2CACG,WAAY,EAAA,EAAA,SAAA,EAAW,eACrB,KACC,oBAAA,KAAA,CAAA,aAAA,CAAC,aAAU,SAAW,EAAA,SAAA,EAAW,QAC9B,EAAA,EAAA,KACH,GAED,QACC,oBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,SAAW,EAAA,aAAA,EAAA,EAAgB,QAAS,CAEtD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAACA,WAAA;AAAA,IAAA;AAAA,MACC,UAAU,CAAC,YAAA;AAAA,MACX,QAAQ,EAAA,IAAA;AAAA,MACR,EAAG,EAAA,yBAAA;AAAA,MACH,KAAA;AAAA,MACA,SAAS,EAAA,IAAA;AAAA,MACT,SAAS,EAAA,IAAA;AAAA,MACT,OAAA;AAAA,MACA,OAAQ,EAAA,UAAA;AAAA,MACR,QAAA;AAAA,MACA,KAAO,EAAA,UAAA;AAAA,MACP,MAAA;AAAA,MACA,UAAA,EAAY,EAAE,SAAA,EAAW,IAAK,EAAA;AAAA,KAAA;AAAA,KAE/B,UAAc,oBAAA,KAAA,CAAA,aAAA,CAAC,kBAAe,KAAK,EAAA,IAAA,EAAA,EAAE,YAAa,CACrD,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,47 @@
1
+ const formLabel = {
2
+ fontSize: "0.875rem",
3
+ fontWeight: 700,
4
+ textTransform: "uppercase",
5
+ marginBottom: "8px"
6
+ };
7
+ const heading1 = {
8
+ fontSize: "2rem",
9
+ fontWeight: 700
10
+ };
11
+ const heading3 = {
12
+ fontSize: "1.25rem",
13
+ fontWeight: 500
14
+ };
15
+ const body1 = {
16
+ fontSize: "1rem",
17
+ fontWeight: 500
18
+ };
19
+ const body2 = {
20
+ fontSize: "1rem",
21
+ fontWeight: 400,
22
+ whiteSpace: "pre-line"
23
+ };
24
+ const label = {
25
+ fontSize: "0.875rem",
26
+ fontWeight: 700,
27
+ textTransform: "uppercase",
28
+ paddingBottom: "0.4rem"
29
+ };
30
+ const labelSubtitle = {
31
+ fontSize: "0.875rem",
32
+ fontWeight: 400,
33
+ paddingBottom: "0.4rem",
34
+ marginTop: "-0.2rem"
35
+ };
36
+ const label2 = {
37
+ fontSize: "0.875rem",
38
+ fontWeight: 700,
39
+ textTransform: "uppercase"
40
+ };
41
+ const emptyState = {
42
+ fontSize: "1rem",
43
+ fontStyle: "italic"
44
+ };
45
+
46
+ export { body1, body2, emptyState, formLabel, heading1, heading3, label, label2, labelSubtitle };
47
+ //# sourceMappingURL=typography.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.esm.js","sources":["../../../src/components/common/typography.ts"],"sourcesContent":["import { SxProps, Theme } from '@mui/material/styles';\n\nexport const formLabel: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 700,\n textTransform: 'uppercase',\n marginBottom: '8px',\n};\n\nexport const heading1: SxProps<Theme> = {\n fontSize: '2rem',\n fontWeight: 700,\n};\n\nexport const heading2: SxProps<Theme> = {\n fontSize: '1.75rem',\n fontWeight: 500,\n};\n\nexport const heading3: SxProps<Theme> = {\n fontSize: '1.25rem',\n fontWeight: 500,\n};\n\nexport const body1: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 500,\n};\n\nexport const body2: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 400,\n whiteSpace: 'pre-line',\n};\n\nexport const label: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 700,\n textTransform: 'uppercase',\n paddingBottom: '0.4rem',\n};\n\nexport const labelSubtitle: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 400,\n paddingBottom: '0.4rem',\n marginTop: '-0.2rem',\n};\n\nexport const label2: SxProps<Theme> = {\n fontSize: '0.875rem',\n fontWeight: 700,\n textTransform: 'uppercase',\n};\n\nexport const emptyState: SxProps<Theme> = {\n fontSize: '1rem',\n fontStyle: 'italic',\n};\n\nexport const subtitle1: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 700,\n};\n\nexport const subtitle2: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 400,\n};\n\nexport const headerSubtitle: SxProps<Theme> = {\n fontSize: '1rem',\n fontWeight: 500,\n paddingBottom: '1rem',\n marginTop: '-0.2rem',\n};\n\nexport const risikoLevel: SxProps<Theme> = {\n fontSize: '1.125rem',\n fontWeight: 700,\n paddingTop: 0,\n};\n\nexport const actionSubtitle: SxProps<Theme> = {\n fontSize: '1.125rem',\n fontWeight: 700,\n marginBottom: '16px',\n marginTop: '16px',\n};\n"],"names":[],"mappings":"AAEO,MAAM,SAA4B,GAAA;AAAA,EACvC,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,aAAe,EAAA,WAAA;AAAA,EACf,YAAc,EAAA,KAAA;AAChB,EAAA;AAEO,MAAM,QAA2B,GAAA;AAAA,EACtC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAOO,MAAM,QAA2B,GAAA;AAAA,EACtC,QAAU,EAAA,SAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,KAAwB,GAAA;AAAA,EACnC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AACd,EAAA;AAEO,MAAM,KAAwB,GAAA;AAAA,EACnC,QAAU,EAAA,MAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,UAAY,EAAA,UAAA;AACd,EAAA;AAEO,MAAM,KAAwB,GAAA;AAAA,EACnC,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,aAAe,EAAA,WAAA;AAAA,EACf,aAAe,EAAA,QAAA;AACjB,EAAA;AAEO,MAAM,aAAgC,GAAA;AAAA,EAC3C,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,aAAe,EAAA,QAAA;AAAA,EACf,SAAW,EAAA,SAAA;AACb,EAAA;AAEO,MAAM,MAAyB,GAAA;AAAA,EACpC,QAAU,EAAA,UAAA;AAAA,EACV,UAAY,EAAA,GAAA;AAAA,EACZ,aAAe,EAAA,WAAA;AACjB,EAAA;AAEO,MAAM,UAA6B,GAAA;AAAA,EACxC,QAAU,EAAA,MAAA;AAAA,EACV,SAAW,EAAA,QAAA;AACb;;;;"}
@@ -0,0 +1,116 @@
1
+ import React, { useState } from 'react';
2
+ import { Dialog, DialogContent, Typography, Box, Button } from '@material-ui/core';
3
+ import { TextField } from '../common/Textfield.esm.js';
4
+ import { emptyRiSc } from '../../utils/utilityfunctions.esm.js';
5
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
6
+ import { pluginRiScTranslationRef } from '../../utils/translations.esm.js';
7
+ import { useRiScDialogStyles } from './riScDialogStyle.esm.js';
8
+ import { useFontStyles } from '../../utils/style.esm.js';
9
+ import { useRiScs } from '../../contexts/RiScContext.esm.js';
10
+
11
+ var RiScDialogStates = /* @__PURE__ */ ((RiScDialogStates2) => {
12
+ RiScDialogStates2[RiScDialogStates2["Closed"] = 0] = "Closed";
13
+ RiScDialogStates2[RiScDialogStates2["Edit"] = 1] = "Edit";
14
+ RiScDialogStates2[RiScDialogStates2["Create"] = 2] = "Create";
15
+ return RiScDialogStates2;
16
+ })(RiScDialogStates || {});
17
+ const RiScDialog = ({ onClose, dialogState }) => {
18
+ const { t } = useTranslationRef(pluginRiScTranslationRef);
19
+ const { paper, content, buttons } = useRiScDialogStyles();
20
+ const { h1 } = useFontStyles();
21
+ const { selectedRiSc, createNewRiSc, updateRiSc } = useRiScs();
22
+ const [newRiSc, setNewRiSc] = useState(
23
+ dialogState === 1 /* Edit */ ? selectedRiSc.content : emptyRiSc()
24
+ );
25
+ const [newRiScError, setNewRiScError] = useState({
26
+ title: null,
27
+ scope: null
28
+ });
29
+ const handleCancel = () => {
30
+ onClose();
31
+ setNewRiSc(emptyRiSc());
32
+ setNewRiScError({
33
+ title: null,
34
+ scope: null
35
+ });
36
+ };
37
+ const handleSave = () => {
38
+ setNewRiScError({
39
+ title: newRiSc.title === "" ? t("rosDialog.titleError") : null,
40
+ scope: newRiSc.scope === "" ? t("rosDialog.scopeError") : null
41
+ });
42
+ if (!newRiSc.title || !newRiSc.scope) return;
43
+ if (dialogState === 2 /* Create */) {
44
+ createNewRiSc(newRiSc);
45
+ } else {
46
+ updateRiSc(newRiSc);
47
+ }
48
+ handleCancel();
49
+ };
50
+ const setTitle = (title) => {
51
+ setNewRiScError({
52
+ ...newRiScError,
53
+ title: null
54
+ });
55
+ setNewRiSc({
56
+ ...newRiSc,
57
+ title
58
+ });
59
+ };
60
+ const setScope = (scope) => {
61
+ setNewRiScError({
62
+ ...newRiScError,
63
+ scope: null
64
+ });
65
+ setNewRiSc({
66
+ ...newRiSc,
67
+ scope
68
+ });
69
+ };
70
+ const header = dialogState === 2 /* Create */ ? t("rosDialog.titleNew") : t("rosDialog.titleEdit");
71
+ return /* @__PURE__ */ React.createElement(
72
+ Dialog,
73
+ {
74
+ classes: { paper },
75
+ open: dialogState !== 0 /* Closed */,
76
+ onClose: handleCancel
77
+ },
78
+ /* @__PURE__ */ React.createElement(DialogContent, null, /* @__PURE__ */ React.createElement(Typography, { className: h1 }, header), /* @__PURE__ */ React.createElement(Box, { className: content }, /* @__PURE__ */ React.createElement(
79
+ TextField,
80
+ {
81
+ label: t("dictionary.title"),
82
+ value: newRiSc.title,
83
+ minRows: 1,
84
+ handleChange: setTitle,
85
+ error: newRiScError.title,
86
+ required: true
87
+ }
88
+ )), /* @__PURE__ */ React.createElement(Box, { className: content }, /* @__PURE__ */ React.createElement(
89
+ TextField,
90
+ {
91
+ label: t("dictionary.scope"),
92
+ subtitle: t("rosDialog.scopeDescription"),
93
+ value: newRiSc.scope,
94
+ minRows: 4,
95
+ handleChange: setScope,
96
+ error: newRiScError.scope,
97
+ required: true
98
+ }
99
+ ))),
100
+ /* @__PURE__ */ React.createElement(
101
+ "div",
102
+ {
103
+ style: {
104
+ padding: "20px",
105
+ display: "flex",
106
+ justifyContent: "flex-start",
107
+ alignItems: "center"
108
+ }
109
+ },
110
+ /* @__PURE__ */ React.createElement(Box, { className: buttons }, /* @__PURE__ */ React.createElement(Button, { variant: "contained", color: "primary", onClick: handleSave }, t("dictionary.save")), /* @__PURE__ */ React.createElement(Button, { variant: "outlined", color: "primary", onClick: handleCancel }, t("dictionary.cancel")))
111
+ )
112
+ );
113
+ };
114
+
115
+ export { RiScDialog, RiScDialogStates };
116
+ //# sourceMappingURL=RiScDialog.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RiScDialog.esm.js","sources":["../../../src/components/riScDialog/RiScDialog.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport {\n Box,\n Button,\n Dialog,\n DialogContent,\n Typography,\n} from '@material-ui/core';\nimport { TextField } from '../common/Textfield';\nimport { RiSc } from '../../utils/types';\nimport { emptyRiSc } from '../../utils/utilityfunctions';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { pluginRiScTranslationRef } from '../../utils/translations';\nimport { useRiScDialogStyles } from './riScDialogStyle';\nimport { useFontStyles } from '../../utils/style';\nimport { useRiScs } from '../../contexts/RiScContext';\n\nexport enum RiScDialogStates {\n Closed,\n Edit,\n Create,\n}\n\ninterface RiScDialogProps {\n onClose: () => void;\n dialogState: RiScDialogStates;\n}\n\ninterface RiskError {\n title: string | null;\n scope: string | null;\n}\n\nexport const RiScDialog = ({ onClose, dialogState }: RiScDialogProps) => {\n const { t } = useTranslationRef(pluginRiScTranslationRef);\n const { paper, content, buttons } = useRiScDialogStyles();\n const { h1 } = useFontStyles();\n const { selectedRiSc, createNewRiSc, updateRiSc } = useRiScs();\n\n const [newRiSc, setNewRiSc] = useState<RiSc>(\n dialogState === RiScDialogStates.Edit\n ? selectedRiSc!!.content\n : emptyRiSc(),\n );\n\n const [newRiScError, setNewRiScError] = useState<RiskError>({\n title: null,\n scope: null,\n });\n\n const handleCancel = () => {\n onClose();\n setNewRiSc(emptyRiSc());\n setNewRiScError({\n title: null,\n scope: null,\n });\n };\n\n const handleSave = () => {\n setNewRiScError({\n title: newRiSc.title === '' ? t('rosDialog.titleError') : null,\n scope: newRiSc.scope === '' ? t('rosDialog.scopeError') : null,\n });\n if (!newRiSc.title || !newRiSc.scope) return;\n\n if (dialogState === RiScDialogStates.Create) {\n createNewRiSc(newRiSc);\n } else {\n updateRiSc(newRiSc);\n }\n handleCancel();\n };\n\n const setTitle = (title: string) => {\n setNewRiScError({\n ...newRiScError,\n title: null,\n });\n setNewRiSc({\n ...newRiSc,\n title: title,\n });\n };\n\n const setScope = (scope: string) => {\n setNewRiScError({\n ...newRiScError,\n scope: null,\n });\n setNewRiSc({\n ...newRiSc,\n scope: scope,\n });\n };\n\n const header =\n dialogState === RiScDialogStates.Create\n ? t('rosDialog.titleNew')\n : t('rosDialog.titleEdit');\n\n return (\n <Dialog\n classes={{ paper: paper }}\n open={dialogState !== RiScDialogStates.Closed}\n onClose={handleCancel}\n >\n <DialogContent>\n <Typography className={h1}>{header}</Typography>\n <Box className={content}>\n <TextField\n label={t('dictionary.title')}\n value={newRiSc.title}\n minRows={1}\n handleChange={setTitle}\n error={newRiScError.title}\n required\n />\n </Box>\n <Box className={content}>\n <TextField\n label={t('dictionary.scope')}\n subtitle={t('rosDialog.scopeDescription')}\n value={newRiSc.scope}\n minRows={4}\n handleChange={setScope}\n error={newRiScError.scope}\n required\n />\n </Box>\n </DialogContent>\n <div\n style={{\n padding: '20px',\n display: 'flex',\n justifyContent: 'flex-start',\n alignItems: 'center',\n }}\n >\n <Box className={buttons}>\n <Button variant=\"contained\" color=\"primary\" onClick={handleSave}>\n {t('dictionary.save')}\n </Button>\n <Button variant=\"outlined\" color=\"primary\" onClick={handleCancel}>\n {t('dictionary.cancel')}\n </Button>\n </Box>\n </div>\n </Dialog>\n );\n};\n"],"names":["RiScDialogStates"],"mappings":";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EAAA,YAAA;AAAA,UAChB,UAAY,EAAA,QAAA;AAAA,SACd;AAAA,OAAA;AAAA,sBAEA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,SAAA,EAAW,OACd,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,OAAA,EAAQ,WAAY,EAAA,KAAA,EAAM,SAAU,EAAA,OAAA,EAAS,UAClD,EAAA,EAAA,CAAA,CAAE,iBAAiB,CACtB,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,OAAA,EAAQ,UAAW,EAAA,KAAA,EAAM,SAAU,EAAA,OAAA,EAAS,YACjD,EAAA,EAAA,CAAA,CAAE,mBAAmB,CACxB,CACF,CAAA;AAAA,KACF;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,34 @@
1
+ import { makeStyles } from '@material-ui/core';
2
+
3
+ const useRiScDialogStyles = makeStyles((theme) => ({
4
+ paper: {
5
+ width: "80%",
6
+ padding: theme.spacing(2)
7
+ },
8
+ header: {
9
+ display: "flex",
10
+ flexDirection: "row",
11
+ justifyContent: "space-between"
12
+ },
13
+ content: {
14
+ display: "flex",
15
+ flexDirection: "column",
16
+ paddingTop: theme.spacing(2),
17
+ paddingBottom: theme.spacing(2)
18
+ },
19
+ buttons: {
20
+ display: "flex",
21
+ flexDirection: "row",
22
+ alignItems: "center",
23
+ gap: theme.spacing(2)
24
+ },
25
+ inputBox: {
26
+ paddingTop: theme.spacing(2)
27
+ },
28
+ formLabel: {
29
+ marginBottom: theme.spacing(1)
30
+ }
31
+ }));
32
+
33
+ export { useRiScDialogStyles };
34
+ //# sourceMappingURL=riScDialogStyle.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"riScDialogStyle.esm.js","sources":["../../../src/components/riScDialog/riScDialogStyle.ts"],"sourcesContent":["import { Theme, makeStyles } from '@material-ui/core';\n\nexport const useRiScDialogStyles = makeStyles((theme: Theme) => ({\n paper: {\n width: '80%',\n padding: theme.spacing(2),\n },\n header: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n content: {\n display: 'flex',\n flexDirection: 'column',\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n buttons: {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n gap: theme.spacing(2),\n },\n inputBox: {\n paddingTop: theme.spacing(2),\n },\n formLabel: {\n marginBottom: theme.spacing(1),\n },\n}));\n"],"names":[],"mappings":";;AAEa,MAAA,mBAAA,GAAsB,UAAW,CAAA,CAAC,KAAkB,MAAA;AAAA,EAC/D,KAAO,EAAA;AAAA,IACL,KAAO,EAAA,KAAA;AAAA,IACP,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAC1B;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,OAAS,EAAA,MAAA;AAAA,IACT,aAAe,EAAA,KAAA;AAAA,IACf,cAAgB,EAAA,eAAA;AAAA,GAClB;AAAA,EACA,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,MAAA;AAAA,IACT,aAAe,EAAA,QAAA;AAAA,IACf,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC3B,aAAA,EAAe,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAChC;AAAA,EACA,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,MAAA;AAAA,IACT,aAAe,EAAA,KAAA;AAAA,IACf,UAAY,EAAA,QAAA;AAAA,IACZ,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GACtB;AAAA,EACA,QAAU,EAAA;AAAA,IACR,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAC7B;AAAA,EACA,SAAW,EAAA;AAAA,IACT,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAC/B;AACF,CAAE,CAAA;;;;"}