@oanda/labs-currency-strength-widget 1.0.162 → 1.0.164
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/CHANGELOG.md +1316 -0
- package/dist/main/CurrencyStrengthWidget/ChartsWithData.js +11 -15
- package/dist/main/CurrencyStrengthWidget/ChartsWithData.js.map +1 -1
- package/dist/main/CurrencyStrengthWidget/Main.js +2 -2
- package/dist/main/CurrencyStrengthWidget/Main.js.map +1 -1
- package/dist/main/CurrencyStrengthWidget/components/Chart/formatters.js +5 -1
- package/dist/main/CurrencyStrengthWidget/components/Chart/formatters.js.map +1 -1
- package/dist/main/CurrencyStrengthWidget/components/Chart/getOption.js +3 -3
- package/dist/main/CurrencyStrengthWidget/components/Chart/getOption.js.map +1 -1
- package/dist/main/gql/getCurrencyStrength.js +12 -3
- package/dist/main/gql/getCurrencyStrength.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js +2 -3
- package/dist/main/gql/types/fragment-masking.js.map +1 -1
- package/dist/main/gql/types/gql.js +1 -2
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/ChartsWithData.js +11 -15
- package/dist/module/CurrencyStrengthWidget/ChartsWithData.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/Main.js +2 -2
- package/dist/module/CurrencyStrengthWidget/Main.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/formatters.js +5 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/formatters.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/getOption.js +3 -3
- package/dist/module/CurrencyStrengthWidget/components/Chart/getOption.js.map +1 -1
- package/dist/module/gql/getCurrencyStrength.js +12 -3
- package/dist/module/gql/getCurrencyStrength.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +2 -3
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +1 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/package.json +3 -3
|
@@ -14,7 +14,6 @@ var _Chart = require("./components/Chart");
|
|
|
14
14
|
var _formatters = require("./components/Chart/formatters");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
const ChartWithData = _ref => {
|
|
17
|
-
var _data$currencyStrengt, _data$currencyStrengt2, _data$currencyStrengt3, _data$currencyStrengt4, _;
|
|
18
17
|
let {
|
|
19
18
|
currency
|
|
20
19
|
} = _ref;
|
|
@@ -32,9 +31,9 @@ const ChartWithData = _ref => {
|
|
|
32
31
|
} = (0, _client.useQuery)(_getCurrencyStrength.getCurrencyStrength, {
|
|
33
32
|
fetchPolicy: 'cache-and-network'
|
|
34
33
|
});
|
|
35
|
-
const showChart =
|
|
36
|
-
const showError =
|
|
37
|
-
const currencyData = currency ? data
|
|
34
|
+
const showChart = data?.currencyStrength && data?.currencyStrength?.length > 0;
|
|
35
|
+
const showError = data?.currencyStrength?.length === 0 || error;
|
|
36
|
+
const currencyData = currency ? data?.currencyStrength?.filter(item => item.currency === currency) : data?.currencyStrength?.slice().sort(_formatters.sortCurrencies);
|
|
38
37
|
return _react.default.createElement(_react.default.Fragment, null, loading && _react.default.createElement("div", {
|
|
39
38
|
className: (0, _classnames.default)('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {
|
|
40
39
|
'lw-h-[461px]': !currency,
|
|
@@ -48,16 +47,13 @@ const ChartWithData = _ref => {
|
|
|
48
47
|
'lw-grid-cols-1': !isDesktop || currency
|
|
49
48
|
}),
|
|
50
49
|
"data-testid": "currency-strength-chart-wrapper"
|
|
51
|
-
}, currencyData && currencyData.map(item => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
values: (_item$strengthRelatio = item.strengthRelation) === null || _item$strengthRelatio === void 0 ? void 0 : _item$strengthRelatio.slice().sort(_formatters.sortCurrencies)
|
|
59
|
-
}));
|
|
60
|
-
})), !loading && showError && _react.default.createElement("div", {
|
|
50
|
+
}, currencyData && currencyData.map(item => _react.default.createElement("div", {
|
|
51
|
+
key: item.currency,
|
|
52
|
+
className: "lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center"
|
|
53
|
+
}, _react.default.createElement(_Chart.Chart, {
|
|
54
|
+
currency: item.currency,
|
|
55
|
+
values: item.strengthRelation?.slice().sort(_formatters.sortCurrencies)
|
|
56
|
+
})))), !loading && showError && _react.default.createElement("div", {
|
|
61
57
|
className: (0, _classnames.default)('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {
|
|
62
58
|
'lw-h-[425px]': !currency,
|
|
63
59
|
'lw-h-[135px]': currency
|
|
@@ -66,7 +62,7 @@ const ChartWithData = _ref => {
|
|
|
66
62
|
className: "lw-mt-2 lw-h-8"
|
|
67
63
|
}, _react.default.createElement(_labsWidgetCommon.LastUpdated, {
|
|
68
64
|
labelCallback: lang,
|
|
69
|
-
timestamp: data
|
|
65
|
+
timestamp: data?.currencyStrength[0]?.updatedAt
|
|
70
66
|
})));
|
|
71
67
|
};
|
|
72
68
|
exports.ChartWithData = ChartWithData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartsWithData.js","names":["_client","require","_labsWidgetCommon","_monoI18n","_classnames","_interopRequireDefault","_react","_getCurrencyStrength","_Chart","_formatters","e","__esModule","default","ChartWithData","_ref","
|
|
1
|
+
{"version":3,"file":"ChartsWithData.js","names":["_client","require","_labsWidgetCommon","_monoI18n","_classnames","_interopRequireDefault","_react","_getCurrencyStrength","_Chart","_formatters","e","__esModule","default","ChartWithData","_ref","currency","size","useLayoutProvider","isDesktop","Size","DESKTOP","lang","useLocale","loading","data","error","useQuery","getCurrencyStrength","fetchPolicy","showChart","currencyStrength","length","showError","currencyData","filter","item","slice","sort","sortCurrencies","createElement","Fragment","className","classnames","Spinner","SpinnerSize","lg","map","key","Chart","values","strengthRelation","ChartError","LastUpdated","labelCallback","timestamp","updatedAt","exports"],"sources":["../../../src/CurrencyStrengthWidget/ChartsWithData.tsx"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport classnames from 'classnames';\nimport React from 'react';\n\nimport { getCurrencyStrength } from '../gql/getCurrencyStrength';\nimport type { GetCurrencyStrengthQuery } from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { sortCurrencies } from './components/Chart/formatters';\nimport type { WidgetProps } from './types';\n\nconst ChartWithData = ({ currency }: WidgetProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<GetCurrencyStrengthQuery>(\n getCurrencyStrength,\n {\n fetchPolicy: 'cache-and-network',\n }\n );\n\n const showChart =\n data?.currencyStrength && data?.currencyStrength?.length > 0;\n const showError = data?.currencyStrength?.length === 0 || error;\n\n const currencyData = currency\n ? data?.currencyStrength?.filter((item) => item.currency === currency)\n : data?.currencyStrength?.slice().sort(sortCurrencies);\n\n return (\n <>\n {loading && (\n <div\n className={classnames(\n 'lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary',\n {\n 'lw-h-[461px]': !currency,\n 'lw-h-[135px]': currency,\n }\n )}\n >\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <div\n className={classnames('lw-grid lw-place-content-center lw-gap-7', {\n 'lw-grid-cols-3 ': isDesktop && !currency,\n 'lw-grid-cols-1': !isDesktop || currency,\n })}\n data-testid=\"currency-strength-chart-wrapper\"\n >\n {currencyData &&\n currencyData.map((item) => (\n <div\n key={item.currency}\n className=\"lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center\"\n >\n <Chart\n currency={item.currency}\n values={item.strengthRelation?.slice().sort(sortCurrencies)!}\n />\n </div>\n ))}\n </div>\n )}\n {!loading && showError && (\n <div\n className={classnames(\n 'lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary',\n {\n 'lw-h-[425px]': !currency,\n 'lw-h-[135px]': currency,\n }\n )}\n >\n <ChartError />\n </div>\n )}\n {!loading && !showError && (\n <div className=\"lw-mt-2 lw-h-8\">\n <LastUpdated\n labelCallback={lang}\n timestamp={data?.currencyStrength![0]?.updatedAt}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAQA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAEA,IAAAM,oBAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAA+D,SAAAI,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG/D,MAAMG,aAAa,GAAGC,IAAA,IAA+B;EAAA,IAA9B;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EAC9C,MAAM;IAAEE;EAAK,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EACpC,MAAMC,SAAS,GAAGF,IAAI,KAAKG,sBAAI,CAACC,OAAO;EACvC,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAC5B,MAAM;IAAEC,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAG,IAAAC,gBAAQ,EACvCC,wCAAmB,EACnB;IACEC,WAAW,EAAE;EACf,CACF,CAAC;EAED,MAAMC,SAAS,GACbL,IAAI,EAAEM,gBAAgB,IAAIN,IAAI,EAAEM,gBAAgB,EAAEC,M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IAAI,CAACpB,QAAS;IACxBkC,MAAM,EAAEd,IAAI,CAACe,gBAAgB,EAAEd,KAAK,CAAC,CAAC,CAACC,IAAI,CAACC,0BAAc;EAAG,CAC9D,CACE,CACN,CACA,CACN,EACA,CAACf,OAAO,IAAIS,SAAS,IACpB1B,MAAA,CAAAM,OAAA,CAAA2B,aAAA;IACEE,SAAS,EAAE,IAAAC,mBAAU,EACnB,sFAAsF,EACtF;MACE,cAAc,EAAE,CAAC3B,QAAQ;MACzB,cAAc,EAAEA;IAClB,CACF;EAAE,GAEFT,MAAA,CAAAM,OAAA,CAAA2B,aAAA,CAACrC,iBAAA,CAAAiD,UAAU,MAAE,CACV,CACN,EACA,CAAC5B,OAAO,IAAI,CAACS,SAAS,IACrB1B,MAAA,CAAAM,OAAA,CAAA2B,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC7BnC,MAAA,CAAAM,OAAA,CAAA2B,aAAA,CAACrC,iBAAA,CAAAkD,WAAW;IACVC,aAAa,EAAEhC,IAAK;IACpBiC,SAAS,EAAE9B,IAAI,EAAEM,gBAAgB,CAAE,CAAC,CAAC,EAAEyB;EAAU,CAClD,CACE,CAEP,CAAC;AAEP,CAAC;AAACC,OAAA,CAAA3C,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -23,9 +23,9 @@ const Main = _ref => {
|
|
|
23
23
|
"data-testid": "currency-strength-wrapper"
|
|
24
24
|
}, _react.default.createElement("div", {
|
|
25
25
|
className: "lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold"
|
|
26
|
-
}, _react.default.createElement("span", null,
|
|
26
|
+
}, _react.default.createElement("span", null, `${lang('daily')} (${lang('minute', {
|
|
27
27
|
count: 5
|
|
28
|
-
})
|
|
28
|
+
})})`)), _react.default.createElement(_ChartsWithData.ChartWithData, {
|
|
29
29
|
currency: currency
|
|
30
30
|
})));
|
|
31
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireDefault","_ChartsWithData","e","__esModule","default","Main","_ref","currency","lang","useLocale","size","useLayoutProvider","createElement","Fragment","className","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireDefault","_ChartsWithData","e","__esModule","default","Main","_ref","currency","lang","useLocale","size","useLayoutProvider","createElement","Fragment","className","count","ChartWithData","exports"],"sources":["../../../src/CurrencyStrengthWidget/Main.tsx"],"sourcesContent":["import { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { ChartWithData } from './ChartsWithData';\nimport type { WidgetProps } from './types';\n\nconst Main = ({ currency }: WidgetProps) => {\n const { lang } = useLocale();\n const { size } = useLayoutProvider();\n\n return (\n <>\n {size && (\n <div data-testid=\"currency-strength-wrapper\">\n <div className=\"lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\">\n <span>{`${lang('daily')} (${lang('minute', { count: 5 })})`}</span>\n </div>\n <ChartWithData currency={currency} />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AAAiD,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGjD,MAAMG,IAAI,GAAGC,IAAA,IAA+B;EAAA,IAA9B;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EACrC,MAAM;IAAEE;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAC5B,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EAEpC,OACEZ,MAAA,CAAAK,OAAA,CAAAQ,aAAA,CAAAb,MAAA,CAAAK,OAAA,CAAAS,QAAA,QACGH,IAAI,IACHX,MAAA,CAAAK,OAAA,CAAAQ,aAAA;IAAK,eAAY;EAA2B,GAC1Cb,MAAA,CAAAK,OAAA,CAAAQ,aAAA;IAAKE,SAAS,EAAC;EAAwE,GACrFf,MAAA,CAAAK,OAAA,CAAAQ,aAAA,eAAO,GAAGJ,IAAI,CAAC,OAAO,CAAC,KAAKA,IAAI,CAAC,QAAQ,EAAE;IAAEO,KAAK,EAAE;EAAE,CAAC,CAAC,GAAU,CAC/D,CAAC,EACNhB,MAAA,CAAAK,OAAA,CAAAQ,aAAA,CAACX,eAAA,CAAAe,aAAa;IAACT,QAAQ,EAAEA;EAAS,CAAE,CACjC,CAEP,CAAC;AAEP,CAAC;AAACU,OAAA,CAAAZ,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -13,7 +13,11 @@ const tooltipFormatter = _ref => {
|
|
|
13
13
|
currency,
|
|
14
14
|
lang
|
|
15
15
|
} = _ref;
|
|
16
|
-
return
|
|
16
|
+
return `
|
|
17
|
+
<div>
|
|
18
|
+
<div style="margin-bottom:5px;">${currency} ${lang('vs')} ${name}</div>
|
|
19
|
+
<div style="display:flex;align-items:center;">${marker} ${value}%</div>
|
|
20
|
+
</div>`;
|
|
17
21
|
};
|
|
18
22
|
exports.tooltipFormatter = tooltipFormatter;
|
|
19
23
|
const sortCurrencies = (a, b) => _constants.instrumentsConfig.indexOf(a.currency) - _constants.instrumentsConfig.indexOf(b.currency);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["_constants","require","tooltipFormatter","_ref","marker","name","value","currency","lang","
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["_constants","require","tooltipFormatter","_ref","marker","name","value","currency","lang","exports","sortCurrencies","a","b","instrumentsConfig","indexOf"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/formatters.ts"],"sourcesContent":["import { instrumentsConfig } from './constants';\nimport type { SortingParams, TooltipFormatterParams } from './types';\n\nconst tooltipFormatter = ({\n marker,\n name,\n value,\n currency,\n lang,\n}: TooltipFormatterParams) => `\n<div>\n <div style=\"margin-bottom:5px;\">${currency} ${lang('vs')} ${name}</div>\n <div style=\"display:flex;align-items:center;\">${marker} ${value}%</div>\n</div>`;\n\nconst sortCurrencies = (a: SortingParams, b: SortingParams) =>\n instrumentsConfig.indexOf(a.currency) - instrumentsConfig.indexOf(b.currency);\n\nexport { sortCurrencies, tooltipFormatter };\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAGA,MAAMC,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IACxBC,MAAM;IACNC,IAAI;IACJC,KAAK;IACLC,QAAQ;IACRC;EACsB,CAAC,GAAAL,IAAA;EAAA,OAAK;AAC9B;AACA,oCAAoCI,QAAQ,IAAIC,IAAI,CAAC,IAAI,CAAC,IAAIH,IAAI;AAClE,kDAAkDD,MAAM,IAAIE,KAAK;AACjE,OAAO;AAAA;AAACG,OAAA,CAAAP,gBAAA,GAAAA,gBAAA;AAER,MAAMQ,cAAc,GAAGA,CAACC,CAAgB,EAAEC,CAAgB,KACxDC,4BAAiB,CAACC,OAAO,CAACH,CAAC,CAACJ,QAAQ,CAAC,GAAGM,4BAAiB,CAACC,OAAO,CAACF,CAAC,CAACL,QAAQ,CAAC;AAACE,OAAA,CAAAC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -29,7 +29,7 @@ const getOption = _ref => {
|
|
|
29
29
|
title: {
|
|
30
30
|
top: '0px',
|
|
31
31
|
left: 'center',
|
|
32
|
-
text:
|
|
32
|
+
text: `${currency} vs`,
|
|
33
33
|
textStyle: {
|
|
34
34
|
fontSize: 12,
|
|
35
35
|
lineHeight: 20,
|
|
@@ -40,8 +40,8 @@ const getOption = _ref => {
|
|
|
40
40
|
name: 'main-grid',
|
|
41
41
|
top: '30px',
|
|
42
42
|
right: '0px',
|
|
43
|
-
left:
|
|
44
|
-
bottom:
|
|
43
|
+
left: `${_constants.Y_LABEL_SIZE}px`,
|
|
44
|
+
bottom: `${_constants.X_LABEL_SIZE}px`
|
|
45
45
|
}],
|
|
46
46
|
graphic: [...gridLines],
|
|
47
47
|
tooltip: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOption.js","names":["_labsWidgetCommon","require","_constants","_formatters","getOption","_ref","values","currency","isDark","lang","currencies","map","item","percentages","percentage","barColors","darkBarColors","lightBarColors","gridLines","getGridLines","chartWidth","CHART_WIDTH","chartHeight","CHART_HEIGHT","xLabelsSize","yLabelSize","animation","title","top","left","text","
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["_labsWidgetCommon","require","_constants","_formatters","getOption","_ref","values","currency","isDark","lang","currencies","map","item","percentages","percentage","barColors","darkBarColors","lightBarColors","gridLines","getGridLines","chartWidth","CHART_WIDTH","chartHeight","CHART_HEIGHT","xLabelsSize","yLabelSize","animation","title","top","left","text","textStyle","fontSize","lineHeight","fontWeight","grid","name","right","Y_LABEL_SIZE","bottom","X_LABEL_SIZE","graphic","tooltip","trigger","formatter","_ref2","marker","value","tooltipFormatter","axisPointer","axis","extraCssText","xAxis","type","data","axisTick","show","axisLine","splitLine","axisLabel","yAxis","position","min","Math","floor","max","ceil","interval","series","emphasis","disabled","itemStyle","opacity","color","_ref3","positive","negative","zero","exports"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/getOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\n\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n darkBarColors,\n lightBarColors,\n X_LABEL_SIZE,\n Y_LABEL_SIZE,\n} from './constants';\nimport { tooltipFormatter } from './formatters';\nimport type { GetOptionProps } from './types';\n\nexport const getOption = ({\n values,\n currency,\n isDark,\n lang,\n}: GetOptionProps) => {\n const currencies = values.map((item) => item.currency);\n const percentages = values.map((item) => item.percentage);\n const barColors = isDark ? darkBarColors : lightBarColors;\n\n const gridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: CHART_HEIGHT,\n xLabelsSize: -2,\n yLabelSize: -3,\n });\n\n return {\n animation: false,\n title: {\n top: '0px',\n left: 'center',\n text: `${currency} vs`,\n textStyle: {\n fontSize: 12,\n lineHeight: 20,\n fontWeight: 400,\n },\n },\n grid: [\n {\n name: 'main-grid',\n top: '30px',\n right: '0px',\n left: `${Y_LABEL_SIZE}px`,\n bottom: `${X_LABEL_SIZE}px`,\n },\n ],\n graphic: [...gridLines],\n tooltip: {\n trigger: 'axis',\n formatter: ([{ marker, name, value }]: {\n marker: string;\n name: string;\n value: number;\n }[]) =>\n tooltipFormatter({\n lang,\n currency,\n marker,\n name,\n value,\n }),\n axisPointer: {\n axis: 'x',\n },\n extraCssText: 'z-index: 1',\n },\n xAxis: {\n type: 'category',\n data: currencies,\n axisTick: { show: false },\n axisLine: { show: false },\n splitLine: { show: false },\n axisLabel: {\n fontSize: 10,\n },\n },\n yAxis: {\n type: 'value',\n position: 'left',\n min: Math.floor(Math.min(...percentages)),\n max: Math.ceil(Math.max(...percentages)),\n interval: 1,\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n formatter: '{value}%',\n fontSize: 10,\n },\n },\n series: [\n {\n data: percentages,\n type: 'bar',\n emphasis: {\n disabled: true,\n },\n itemStyle: {\n opacity: 1,\n color: ({ data }: { data: number }) => {\n if (data > 0) {\n return barColors.positive;\n }\n if (data < 0) {\n return barColors.negative;\n }\n return barColors.zero;\n },\n },\n },\n ],\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAQA,IAAAE,WAAA,GAAAF,OAAA;AAGO,MAAMG,SAAS,GAAGC,IAAA,IAKH;EAAA,IALI;IACxBC,MAAM;IACNC,QAAQ;IACRC,MAAM;IACNC;EACc,CAAC,GAAAJ,IAAA;EACf,MAAMK,UAAU,GAAGJ,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H,CAAC;AAACC,OAAA,CAAA1E,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -5,7 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getCurrencyStrength = void 0;
|
|
7
7
|
var _client = require("@apollo/client");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const getCurrencyStrength = exports.getCurrencyStrength = (0, _client.gql)`
|
|
9
|
+
query GetCurrencyStrength {
|
|
10
|
+
currencyStrength {
|
|
11
|
+
currency
|
|
12
|
+
strengthRelation {
|
|
13
|
+
currency
|
|
14
|
+
percentage
|
|
15
|
+
}
|
|
16
|
+
updatedAt
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
11
20
|
//# sourceMappingURL=getCurrencyStrength.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCurrencyStrength.js","names":["_client","require","
|
|
1
|
+
{"version":3,"file":"getCurrencyStrength.js","names":["_client","require","getCurrencyStrength","exports","gql"],"sources":["../../../src/gql/getCurrencyStrength.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst getCurrencyStrength = gql`\n query GetCurrencyStrength {\n currencyStrength {\n currency\n strengthRelation {\n currency\n percentage\n }\n updatedAt\n }\n }\n`;\n\nexport { getCurrencyStrength };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,IAAAE,WAAG;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -13,11 +13,10 @@ function makeFragmentData(data, _fragment) {
|
|
|
13
13
|
return data;
|
|
14
14
|
}
|
|
15
15
|
function isFragmentReady(queryNode, fragmentNode, data) {
|
|
16
|
-
|
|
17
|
-
const deferredFields = (_meta__ = queryNode.__meta__) === null || _meta__ === void 0 ? void 0 : _meta__.deferredFields;
|
|
16
|
+
const deferredFields = queryNode.__meta__?.deferredFields;
|
|
18
17
|
if (!deferredFields) return true;
|
|
19
18
|
const fragDef = fragmentNode.definitions[0];
|
|
20
|
-
const fragName = fragDef
|
|
19
|
+
const fragName = fragDef?.name?.value;
|
|
21
20
|
const fields = fragName && deferredFields[fragName] || [];
|
|
22
21
|
return fields.length > 0 && fields.every(field => data && field in data);
|
|
23
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import {\n ResultOf,\n DocumentTypeDecoration,\n TypedDocumentNode,\n} from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\nexport type FragmentType<\n TDocumentType extends DocumentTypeDecoration<any, any>,\n> =\n TDocumentType extends DocumentTypeDecoration<infer TType, any>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | null\n | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>,\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data:\n | FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>\n | null\n | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (\n queryNode as {\n __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };\n }\n ).__meta__?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as\n | FragmentDefinitionNode\n | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every((field) => data && field in data);\n}\n"],"mappings":";;;;;;;;AA6CO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAIa,EACoC;EACjD,OAAOA,YAAY;AACrB;AAEO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAGa,EAC8B;EAC3C,MAAMK,cAAc,GAClBF,SAAS,CAGTG,QAAQ,EAAED,cAAc;EAE1B,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAE7B;EACb,MAAMC,QAAQ,GAAGF,OAAO,EAAEG,IAAI,EAAEC,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAAEC,KAAK,IAAKf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC5E","ignoreList":[]}
|
|
@@ -10,7 +10,6 @@ const documents = {
|
|
|
10
10
|
'\n query GetCurrencyStrength {\n currencyStrength {\n currency\n strengthRelation {\n currency\n percentage\n }\n updatedAt\n }\n }\n': types.GetCurrencyStrengthDocument
|
|
11
11
|
};
|
|
12
12
|
function graphql(source) {
|
|
13
|
-
|
|
14
|
-
return (_source = documents[source]) !== null && _source !== void 0 ? _source : {};
|
|
13
|
+
return documents[source] ?? {};
|
|
15
14
|
}
|
|
16
15
|
//# sourceMappingURL=gql.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","documents","GetCurrencyStrengthDocument","graphql","source"
|
|
1
|
+
{"version":3,"file":"gql.js","names":["types","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","documents","GetCurrencyStrengthDocument","graphql","source"],"sources":["../../../../src/gql/types/gql.ts"],"sourcesContent":["/* eslint-disable */\nimport * as types from './graphql';\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\n\n/**\n * Map of all GraphQL operations in the project.\n *\n * This map has several performance disadvantages:\n * 1. It is not tree-shakeable, so it will include all operations in the project.\n * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.\n * 3. It does not support dead code elimination, so it will add unused operations.\n *\n * Therefore it is highly recommended to use the babel or swc plugin for production.\n */\nconst documents = {\n '\\n query GetCurrencyStrength {\\n currencyStrength {\\n currency\\n strengthRelation {\\n currency\\n percentage\\n }\\n updatedAt\\n }\\n }\\n':\n types.GetCurrencyStrengthDocument,\n};\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n *\n *\n * @example\n * ```ts\n * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);\n * ```\n *\n * The query argument is unknown!\n * Please regenerate the types.\n */\nexport function graphql(source: string): unknown;\n\n/**\n * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.\n */\nexport function graphql(\n source: '\\n query GetCurrencyStrength {\\n currencyStrength {\\n currency\\n strengthRelation {\\n currency\\n percentage\\n }\\n updatedAt\\n }\\n }\\n'\n): (typeof documents)['\\n query GetCurrencyStrength {\\n currencyStrength {\\n currency\\n strengthRelation {\\n currency\\n percentage\\n }\\n updatedAt\\n }\\n }\\n'];\n\nexport function graphql(source: string) {\n return (documents as any)[source] ?? {};\n}\n\nexport type DocumentType<TDocumentNode extends DocumentNode<any, any>> =\n TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAanC,MAAMkB,SAAS,GAAG;EAChB,iLAAiL,EAC/KtB,KAAK,CAACuB;AACV,CAAC;AAuBM,SAASC,OAAOA,CAACC,MAAc,EAAE;EACtC,OAAQH,SAAS,CAASG,MAAM,CAAC,IAAI,CAAC,CAAC;AACzC","ignoreList":[]}
|
|
@@ -7,7 +7,6 @@ import { getCurrencyStrength } from '../gql/getCurrencyStrength';
|
|
|
7
7
|
import { Chart } from './components/Chart';
|
|
8
8
|
import { sortCurrencies } from './components/Chart/formatters';
|
|
9
9
|
const ChartWithData = _ref => {
|
|
10
|
-
var _data$currencyStrengt, _data$currencyStrengt2, _data$currencyStrengt3, _data$currencyStrengt4, _;
|
|
11
10
|
let {
|
|
12
11
|
currency
|
|
13
12
|
} = _ref;
|
|
@@ -25,9 +24,9 @@ const ChartWithData = _ref => {
|
|
|
25
24
|
} = useQuery(getCurrencyStrength, {
|
|
26
25
|
fetchPolicy: 'cache-and-network'
|
|
27
26
|
});
|
|
28
|
-
const showChart =
|
|
29
|
-
const showError =
|
|
30
|
-
const currencyData = currency ? data
|
|
27
|
+
const showChart = data?.currencyStrength && data?.currencyStrength?.length > 0;
|
|
28
|
+
const showError = data?.currencyStrength?.length === 0 || error;
|
|
29
|
+
const currencyData = currency ? data?.currencyStrength?.filter(item => item.currency === currency) : data?.currencyStrength?.slice().sort(sortCurrencies);
|
|
31
30
|
return React.createElement(React.Fragment, null, loading && React.createElement("div", {
|
|
32
31
|
className: classnames('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {
|
|
33
32
|
'lw-h-[461px]': !currency,
|
|
@@ -41,16 +40,13 @@ const ChartWithData = _ref => {
|
|
|
41
40
|
'lw-grid-cols-1': !isDesktop || currency
|
|
42
41
|
}),
|
|
43
42
|
"data-testid": "currency-strength-chart-wrapper"
|
|
44
|
-
}, currencyData && currencyData.map(item => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
values: (_item$strengthRelatio = item.strengthRelation) === null || _item$strengthRelatio === void 0 ? void 0 : _item$strengthRelatio.slice().sort(sortCurrencies)
|
|
52
|
-
}));
|
|
53
|
-
})), !loading && showError && React.createElement("div", {
|
|
43
|
+
}, currencyData && currencyData.map(item => React.createElement("div", {
|
|
44
|
+
key: item.currency,
|
|
45
|
+
className: "lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center"
|
|
46
|
+
}, React.createElement(Chart, {
|
|
47
|
+
currency: item.currency,
|
|
48
|
+
values: item.strengthRelation?.slice().sort(sortCurrencies)
|
|
49
|
+
})))), !loading && showError && React.createElement("div", {
|
|
54
50
|
className: classnames('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {
|
|
55
51
|
'lw-h-[425px]': !currency,
|
|
56
52
|
'lw-h-[135px]': currency
|
|
@@ -59,7 +55,7 @@ const ChartWithData = _ref => {
|
|
|
59
55
|
className: "lw-mt-2 lw-h-8"
|
|
60
56
|
}, React.createElement(LastUpdated, {
|
|
61
57
|
labelCallback: lang,
|
|
62
|
-
timestamp: data
|
|
58
|
+
timestamp: data?.currencyStrength[0]?.updatedAt
|
|
63
59
|
})));
|
|
64
60
|
};
|
|
65
61
|
export { ChartWithData };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartsWithData.js","names":["useQuery","ChartError","LastUpdated","Size","Spinner","SpinnerSize","useLayoutProvider","useLocale","classnames","React","getCurrencyStrength","Chart","sortCurrencies","ChartWithData","_ref","
|
|
1
|
+
{"version":3,"file":"ChartsWithData.js","names":["useQuery","ChartError","LastUpdated","Size","Spinner","SpinnerSize","useLayoutProvider","useLocale","classnames","React","getCurrencyStrength","Chart","sortCurrencies","ChartWithData","_ref","currency","size","isDesktop","DESKTOP","lang","loading","data","error","fetchPolicy","showChart","currencyStrength","length","showError","currencyData","filter","item","slice","sort","createElement","Fragment","className","lg","map","key","values","strengthRelation","labelCallback","timestamp","updatedAt"],"sources":["../../../src/CurrencyStrengthWidget/ChartsWithData.tsx"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport classnames from 'classnames';\nimport React from 'react';\n\nimport { getCurrencyStrength } from '../gql/getCurrencyStrength';\nimport type { GetCurrencyStrengthQuery } from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { sortCurrencies } from './components/Chart/formatters';\nimport type { WidgetProps } from './types';\n\nconst ChartWithData = ({ currency }: WidgetProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<GetCurrencyStrengthQuery>(\n getCurrencyStrength,\n {\n fetchPolicy: 'cache-and-network',\n }\n );\n\n const showChart =\n data?.currencyStrength && data?.currencyStrength?.length > 0;\n const showError = data?.currencyStrength?.length === 0 || error;\n\n const currencyData = currency\n ? data?.currencyStrength?.filter((item) => item.currency === currency)\n : data?.currencyStrength?.slice().sort(sortCurrencies);\n\n return (\n <>\n {loading && (\n <div\n className={classnames(\n 'lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary',\n {\n 'lw-h-[461px]': !currency,\n 'lw-h-[135px]': currency,\n }\n )}\n >\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <div\n className={classnames('lw-grid lw-place-content-center lw-gap-7', {\n 'lw-grid-cols-3 ': isDesktop && !currency,\n 'lw-grid-cols-1': !isDesktop || currency,\n })}\n data-testid=\"currency-strength-chart-wrapper\"\n >\n {currencyData &&\n currencyData.map((item) => (\n <div\n key={item.currency}\n className=\"lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center\"\n >\n <Chart\n currency={item.currency}\n values={item.strengthRelation?.slice().sort(sortCurrencies)!}\n />\n </div>\n ))}\n </div>\n )}\n {!loading && showError && (\n <div\n className={classnames(\n 'lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary',\n {\n 'lw-h-[425px]': !currency,\n 'lw-h-[135px]': currency,\n }\n )}\n >\n <ChartError />\n </div>\n )}\n {!loading && !showError && (\n <div className=\"lw-mt-2 lw-h-8\">\n <LastUpdated\n labelCallback={lang}\n timestamp={data?.currencyStrength![0]?.updatedAt}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SACEC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,OAAO,EACPC,WAAW,EACXC,iBAAiB,QACZ,2BAA2B;AAClC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,mBAAmB,QAAQ,4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,KAAA,CAAAwB,aAAA;IACEE,SAAS,EAAE3B,UAAU,CAAC,0CAA0C,EAAE;MAChE,iBAAiB,EAAES,SAAS,IAAI,CAACF,QAAQ;MACzC,gBAAgB,EAAE,CAACE,SAAS,IAAIF;IAClC,CAAC,CAAE;IACH,eAAY;EAAiC,GAE5Ca,YAAY,IACXA,YAAY,CAACS,GAAG,CAAEP,IAAI,IACpBrB,KAAA,CAAAwB,aAAA;IACEK,GAAG,EAAER,IAAI,CAACf,QAAS;IACnBoB,SAAS,EAAC;EAAkE,GAE5E1B,KAAA,CAAAwB,aAAA,CAACtB,KAAK;IACJI,QAAQ,EAAEe,IAAI,CAACf,QAAS;IACxBwB,MAAM,EAAET,IAAI,CAACU,gBAAgB,EAAET,KAAK,CAAC,CAAC,CAACC,IAAI,CAACpB,cAAc;EAAG,CAC9D,CACE,CACN,CACA,CACN,EACA,CAACQ,OAAO,IAAIO,SAAS,IACpBlB,KAAA,CAAAwB,aAAA;IACEE,SAAS,EAAE3B,UAAU,CACnB,sFAAsF,EACtF;MACE,cAAc,EAAE,CAACO,QAAQ;MACzB,cAAc,EAAEA;IAClB,CACF;EAAE,GAEFN,KAAA,CAAAwB,aAAA,CAAChC,UAAU,MAAE,CACV,CACN,EACA,CAACmB,OAAO,IAAI,CAACO,SAAS,IACrBlB,KAAA,CAAAwB,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC7B1B,KAAA,CAAAwB,aAAA,CAAC/B,WAAW;IACVuC,aAAa,EAAEtB,IAAK;IACpBuB,SAAS,EAAErB,IAAI,EAAEI,gBAAgB,CAAE,CAAC,CAAC,EAAEkB;EAAU,CAClD,CACE,CAEP,CAAC;AAEP,CAAC;AAED,SAAS9B,aAAa","ignoreList":[]}
|
|
@@ -16,9 +16,9 @@ const Main = _ref => {
|
|
|
16
16
|
"data-testid": "currency-strength-wrapper"
|
|
17
17
|
}, React.createElement("div", {
|
|
18
18
|
className: "lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold"
|
|
19
|
-
}, React.createElement("span", null,
|
|
19
|
+
}, React.createElement("span", null, `${lang('daily')} (${lang('minute', {
|
|
20
20
|
count: 5
|
|
21
|
-
})
|
|
21
|
+
})})`)), React.createElement(ChartWithData, {
|
|
22
22
|
currency: currency
|
|
23
23
|
})));
|
|
24
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["useLayoutProvider","useLocale","React","ChartWithData","Main","_ref","currency","lang","size","createElement","Fragment","className","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["useLayoutProvider","useLocale","React","ChartWithData","Main","_ref","currency","lang","size","createElement","Fragment","className","count"],"sources":["../../../src/CurrencyStrengthWidget/Main.tsx"],"sourcesContent":["import { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { ChartWithData } from './ChartsWithData';\nimport type { WidgetProps } from './types';\n\nconst Main = ({ currency }: WidgetProps) => {\n const { lang } = useLocale();\n const { size } = useLayoutProvider();\n\n return (\n <>\n {size && (\n <div data-testid=\"currency-strength-wrapper\">\n <div className=\"lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\">\n <span>{`${lang('daily')} (${lang('minute', { count: 5 })})`}</span>\n </div>\n <ChartWithData currency={currency} />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,2BAA2B;AAC7D,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,aAAa,QAAQ,kBAAkB;AAGhD,MAAMC,IAAI,GAAGC,IAAA,IAA+B;EAAA,IAA9B;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EACrC,MAAM;IAAEE;EAAK,CAAC,GAAGN,SAAS,CAAC,CAAC;EAC5B,MAAM;IAAEO;EAAK,CAAC,GAAGR,iBAAiB,CAAC,CAAC;EAEpC,OACEE,KAAA,CAAAO,aAAA,CAAAP,KAAA,CAAAQ,QAAA,QACGF,IAAI,IACHN,KAAA,CAAAO,aAAA;IAAK,eAAY;EAA2B,GAC1CP,KAAA,CAAAO,aAAA;IAAKE,SAAS,EAAC;EAAwE,GACrFT,KAAA,CAAAO,aAAA,eAAO,GAAGF,IAAI,CAAC,OAAO,CAAC,KAAKA,IAAI,CAAC,QAAQ,EAAE;IAAEK,KAAK,EAAE;EAAE,CAAC,CAAC,GAAU,CAC/D,CAAC,EACNV,KAAA,CAAAO,aAAA,CAACN,aAAa;IAACG,QAAQ,EAAEA;EAAS,CAAE,CACjC,CAEP,CAAC;AAEP,CAAC;AAED,SAASF,IAAI","ignoreList":[]}
|
|
@@ -7,7 +7,11 @@ const tooltipFormatter = _ref => {
|
|
|
7
7
|
currency,
|
|
8
8
|
lang
|
|
9
9
|
} = _ref;
|
|
10
|
-
return
|
|
10
|
+
return `
|
|
11
|
+
<div>
|
|
12
|
+
<div style="margin-bottom:5px;">${currency} ${lang('vs')} ${name}</div>
|
|
13
|
+
<div style="display:flex;align-items:center;">${marker} ${value}%</div>
|
|
14
|
+
</div>`;
|
|
11
15
|
};
|
|
12
16
|
const sortCurrencies = (a, b) => instrumentsConfig.indexOf(a.currency) - instrumentsConfig.indexOf(b.currency);
|
|
13
17
|
export { sortCurrencies, tooltipFormatter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["instrumentsConfig","tooltipFormatter","_ref","marker","name","value","currency","lang","
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["instrumentsConfig","tooltipFormatter","_ref","marker","name","value","currency","lang","sortCurrencies","a","b","indexOf"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/formatters.ts"],"sourcesContent":["import { instrumentsConfig } from './constants';\nimport type { SortingParams, TooltipFormatterParams } from './types';\n\nconst tooltipFormatter = ({\n marker,\n name,\n value,\n currency,\n lang,\n}: TooltipFormatterParams) => `\n<div>\n <div style=\"margin-bottom:5px;\">${currency} ${lang('vs')} ${name}</div>\n <div style=\"display:flex;align-items:center;\">${marker} ${value}%</div>\n</div>`;\n\nconst sortCurrencies = (a: SortingParams, b: SortingParams) =>\n instrumentsConfig.indexOf(a.currency) - instrumentsConfig.indexOf(b.currency);\n\nexport { sortCurrencies, tooltipFormatter };\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,aAAa;AAG/C,MAAMC,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IACxBC,MAAM;IACNC,IAAI;IACJC,KAAK;IACLC,QAAQ;IACRC;EACsB,CAAC,GAAAL,IAAA;EAAA,OAAK;AAC9B;AACA,oCAAoCI,QAAQ,IAAIC,IAAI,CAAC,IAAI,CAAC,IAAIH,IAAI;AAClE,kDAAkDD,MAAM,IAAIE,KAAK;AACjE,OAAO;AAAA;AAEP,MAAMG,cAAc,GAAGA,CAACC,CAAgB,EAAEC,CAAgB,KACxDV,iBAAiB,CAACW,OAAO,CAACF,CAAC,CAACH,QAAQ,CAAC,GAAGN,iBAAiB,CAACW,OAAO,CAACD,CAAC,CAACJ,QAAQ,CAAC;AAE/E,SAASE,cAAc,EAAEP,gBAAgB","ignoreList":[]}
|
|
@@ -23,7 +23,7 @@ export const getOption = _ref => {
|
|
|
23
23
|
title: {
|
|
24
24
|
top: '0px',
|
|
25
25
|
left: 'center',
|
|
26
|
-
text:
|
|
26
|
+
text: `${currency} vs`,
|
|
27
27
|
textStyle: {
|
|
28
28
|
fontSize: 12,
|
|
29
29
|
lineHeight: 20,
|
|
@@ -34,8 +34,8 @@ export const getOption = _ref => {
|
|
|
34
34
|
name: 'main-grid',
|
|
35
35
|
top: '30px',
|
|
36
36
|
right: '0px',
|
|
37
|
-
left:
|
|
38
|
-
bottom:
|
|
37
|
+
left: `${Y_LABEL_SIZE}px`,
|
|
38
|
+
bottom: `${X_LABEL_SIZE}px`
|
|
39
39
|
}],
|
|
40
40
|
graphic: [...gridLines],
|
|
41
41
|
tooltip: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOption.js","names":["getGridLines","CHART_HEIGHT","CHART_WIDTH","darkBarColors","lightBarColors","X_LABEL_SIZE","Y_LABEL_SIZE","tooltipFormatter","getOption","_ref","values","currency","isDark","lang","currencies","map","item","percentages","percentage","barColors","gridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","animation","title","top","left","text","
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["getGridLines","CHART_HEIGHT","CHART_WIDTH","darkBarColors","lightBarColors","X_LABEL_SIZE","Y_LABEL_SIZE","tooltipFormatter","getOption","_ref","values","currency","isDark","lang","currencies","map","item","percentages","percentage","barColors","gridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","animation","title","top","left","text","textStyle","fontSize","lineHeight","fontWeight","grid","name","right","bottom","graphic","tooltip","trigger","formatter","_ref2","marker","value","axisPointer","axis","extraCssText","xAxis","type","data","axisTick","show","axisLine","splitLine","axisLabel","yAxis","position","min","Math","floor","max","ceil","interval","series","emphasis","disabled","itemStyle","opacity","color","_ref3","positive","negative","zero"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/getOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\n\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n darkBarColors,\n lightBarColors,\n X_LABEL_SIZE,\n Y_LABEL_SIZE,\n} from './constants';\nimport { tooltipFormatter } from './formatters';\nimport type { GetOptionProps } from './types';\n\nexport const getOption = ({\n values,\n currency,\n isDark,\n lang,\n}: GetOptionProps) => {\n const currencies = values.map((item) => item.currency);\n const percentages = values.map((item) => item.percentage);\n const barColors = isDark ? darkBarColors : lightBarColors;\n\n const gridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: CHART_HEIGHT,\n xLabelsSize: -2,\n yLabelSize: -3,\n });\n\n return {\n animation: false,\n title: {\n top: '0px',\n left: 'center',\n text: `${currency} vs`,\n textStyle: {\n fontSize: 12,\n lineHeight: 20,\n fontWeight: 400,\n },\n },\n grid: [\n {\n name: 'main-grid',\n top: '30px',\n right: '0px',\n left: `${Y_LABEL_SIZE}px`,\n bottom: `${X_LABEL_SIZE}px`,\n },\n ],\n graphic: [...gridLines],\n tooltip: {\n trigger: 'axis',\n formatter: ([{ marker, name, value }]: {\n marker: string;\n name: string;\n value: number;\n }[]) =>\n tooltipFormatter({\n lang,\n currency,\n marker,\n name,\n value,\n }),\n axisPointer: {\n axis: 'x',\n },\n extraCssText: 'z-index: 1',\n },\n xAxis: {\n type: 'category',\n data: currencies,\n axisTick: { show: false },\n axisLine: { show: false },\n splitLine: { show: false },\n axisLabel: {\n fontSize: 10,\n },\n },\n yAxis: {\n type: 'value',\n position: 'left',\n min: Math.floor(Math.min(...percentages)),\n max: Math.ceil(Math.max(...percentages)),\n interval: 1,\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n formatter: '{value}%',\n fontSize: 10,\n },\n },\n series: [\n {\n data: percentages,\n type: 'bar',\n emphasis: {\n disabled: true,\n },\n itemStyle: {\n opacity: 1,\n color: ({ data }: { data: number }) => {\n if (data > 0) {\n return barColors.positive;\n }\n if (data < 0) {\n return barColors.negative;\n }\n return barColors.zero;\n },\n },\n },\n ],\n };\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAExD,SACEC,YAAY,EACZC,WAAW,EACXC,aAAa,EACbC,cAAc,EACdC,YAAY,EACZC,YAAY,QACP,aAAa;AACpB,SAASC,gBAAgB,QAAQ,cAAc;AAG/C,OAAO,MAAMC,SAAS,GAAGC,IAAA,IAKH;EAAA,IALI;IACxBC,MAAM;IACNC,QAAQ;IACRC,MAAM;IACNC;EACc,CAAC,GAAAJ,IAAA;EACf,MAAMK,UAAU,GAAGJ,MAAM,CAACK,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACL,QAAQ,CAAC;EACtD,MAAMM,WAAW,GAAGP,MAAM,CAACK,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACE,UAA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AM,CAAC;MACzBE,SAAS,EAAE;QAAEF,IAAI,EAAE;MAAM,CAAC;MAC1BG,SAAS,EAAE;QACTxB,QAAQ,EAAE;MACZ;IACF,CAAC;IACDyB,KAAK,EAAE;MACLP,IAAI,EAAE,OAAO;MACbQ,QAAQ,EAAE,MAAM;MAChBC,GAAG,EAAEC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACD,GAAG,CAAC,GAAGzC,WAAW,CAAC,CAAC;MACzC4C,GAAG,EAAEF,IAAI,CAACG,IAAI,CAACH,IAAI,CAACE,GAAG,CAAC,GAAG5C,WAAW,CAAC,CAAC;MACxC8C,QAAQ,EAAE,CAAC;MACXV,QAAQ,EAAE;QAAED,IAAI,EAAE;MAAM,CAAC;MACzBD,QAAQ,EAAE;QAAEC,IAAI,EAAE;MAAM,CAAC;MACzBG,SAAS,EAAE;QACTd,SAAS,EAAE,UAAU;QACrBV,QAAQ,EAAE;MACZ;IACF,CAAC;IACDiC,MAAM,EAAE,CACN;MACEd,IAAI,EAAEjC,WAAW;MACjBgC,IAAI,EAAE,KAAK;MACXgB,QAAQ,EAAE;QACRC,QAAQ,EAAE;MACZ,CAAC;MACDC,SAAS,EAAE;QACTC,OAAO,EAAE,CAAC;QACVC,KAAK,EAAEC,KAAA,IAAgC;UAAA,IAA/B;YAAEpB;UAAuB,CAAC,GAAAoB,KAAA;UAChC,IAAIpB,IAAI,GAAG,CAAC,EAAE;YACZ,OAAO/B,SAAS,CAACoD,QAAQ;UAC3B;UACA,IAAIrB,IAAI,GAAG,CAAC,EAAE;YACZ,OAAO/B,SAAS,CAACqD,QAAQ;UAC3B;UACA,OAAOrD,SAAS,CAACsD,IAAI;QACvB;MACF;IACF,CAAC;EAEL,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
var _templateObject;
|
|
2
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
3
1
|
import { gql } from '@apollo/client';
|
|
4
|
-
const getCurrencyStrength = gql
|
|
2
|
+
const getCurrencyStrength = gql`
|
|
3
|
+
query GetCurrencyStrength {
|
|
4
|
+
currencyStrength {
|
|
5
|
+
currency
|
|
6
|
+
strengthRelation {
|
|
7
|
+
currency
|
|
8
|
+
percentage
|
|
9
|
+
}
|
|
10
|
+
updatedAt
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
5
14
|
export { getCurrencyStrength };
|
|
6
15
|
//# sourceMappingURL=getCurrencyStrength.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCurrencyStrength.js","names":["gql","getCurrencyStrength"
|
|
1
|
+
{"version":3,"file":"getCurrencyStrength.js","names":["gql","getCurrencyStrength"],"sources":["../../../src/gql/getCurrencyStrength.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst getCurrencyStrength = gql`\n query GetCurrencyStrength {\n currencyStrength {\n currency\n strengthRelation {\n currency\n percentage\n }\n updatedAt\n }\n }\n`;\n\nexport { getCurrencyStrength };\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,MAAMC,mBAAmB,GAAGD,GAAG;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,SAASC,mBAAmB","ignoreList":[]}
|
|
@@ -5,11 +5,10 @@ export function makeFragmentData(data, _fragment) {
|
|
|
5
5
|
return data;
|
|
6
6
|
}
|
|
7
7
|
export function isFragmentReady(queryNode, fragmentNode, data) {
|
|
8
|
-
|
|
9
|
-
const deferredFields = (_meta__ = queryNode.__meta__) === null || _meta__ === void 0 ? void 0 : _meta__.deferredFields;
|
|
8
|
+
const deferredFields = queryNode.__meta__?.deferredFields;
|
|
10
9
|
if (!deferredFields) return true;
|
|
11
10
|
const fragDef = fragmentNode.definitions[0];
|
|
12
|
-
const fragName = fragDef
|
|
11
|
+
const fragName = fragDef?.name?.value;
|
|
13
12
|
const fields = fragName && deferredFields[fragName] || [];
|
|
14
13
|
return fields.length > 0 && fields.every(field => data && field in data);
|
|
15
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","
|
|
1
|
+
{"version":3,"file":"fragment-masking.js","names":["useFragment","_documentNode","fragmentType","makeFragmentData","data","_fragment","isFragmentReady","queryNode","fragmentNode","deferredFields","__meta__","fragDef","definitions","fragName","name","value","fields","length","every","field"],"sources":["../../../../src/gql/types/fragment-masking.ts"],"sourcesContent":["import {\n ResultOf,\n DocumentTypeDecoration,\n TypedDocumentNode,\n} from '@graphql-typed-document-node/core';\nimport { FragmentDefinitionNode } from 'graphql';\nimport { Incremental } from './graphql';\n\nexport type FragmentType<\n TDocumentType extends DocumentTypeDecoration<any, any>,\n> =\n TDocumentType extends DocumentTypeDecoration<infer TType, any>\n ? [TType] extends [{ ' $fragmentName'?: infer TKey }]\n ? TKey extends string\n ? { ' $fragmentRefs'?: { [key in TKey]: TType } }\n : never\n : never\n : never;\n\n// return non-nullable if `fragmentType` is non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>\n): TType;\n// return nullable if `fragmentType` is nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | null\n | undefined\n): TType | null | undefined;\n// return array of non-nullable if `fragmentType` is array of non-nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n): ReadonlyArray<TType>;\n// return array of nullable if `fragmentType` is array of nullable\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): ReadonlyArray<TType> | null | undefined;\nexport function useFragment<TType>(\n _documentNode: DocumentTypeDecoration<TType, any>,\n fragmentType:\n | FragmentType<DocumentTypeDecoration<TType, any>>\n | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>\n | null\n | undefined\n): TType | ReadonlyArray<TType> | null | undefined {\n return fragmentType as any;\n}\n\nexport function makeFragmentData<\n F extends DocumentTypeDecoration<any, any>,\n FT extends ResultOf<F>,\n>(data: FT, _fragment: F): FragmentType<F> {\n return data as FragmentType<F>;\n}\nexport function isFragmentReady<TQuery, TFrag>(\n queryNode: DocumentTypeDecoration<TQuery, any>,\n fragmentNode: TypedDocumentNode<TFrag>,\n data:\n | FragmentType<TypedDocumentNode<Incremental<TFrag>, any>>\n | null\n | undefined\n): data is FragmentType<typeof fragmentNode> {\n const deferredFields = (\n queryNode as {\n __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> };\n }\n ).__meta__?.deferredFields;\n\n if (!deferredFields) return true;\n\n const fragDef = fragmentNode.definitions[0] as\n | FragmentDefinitionNode\n | undefined;\n const fragName = fragDef?.name?.value;\n\n const fields = (fragName && deferredFields[fragName]) || [];\n return fields.length > 0 && fields.every((field) => data && field in data);\n}\n"],"mappings":"AA6CA,OAAO,SAASA,WAAWA,CACzBC,aAAiD,EACjDC,YAIa,EACoC;EACjD,OAAOA,YAAY;AACrB;AAEA,OAAO,SAASC,gBAAgBA,CAG9BC,IAAQ,EAAEC,SAAY,EAAmB;EACzC,OAAOD,IAAI;AACb;AACA,OAAO,SAASE,eAAeA,CAC7BC,SAA8C,EAC9CC,YAAsC,EACtCJ,IAGa,EAC8B;EAC3C,MAAMK,cAAc,GAClBF,SAAS,CAGTG,QAAQ,EAAED,cAAc;EAE1B,IAAI,CAACA,cAAc,EAAE,OAAO,IAAI;EAEhC,MAAME,OAAO,GAAGH,YAAY,CAACI,WAAW,CAAC,CAAC,CAE7B;EACb,MAAMC,QAAQ,GAAGF,OAAO,EAAEG,IAAI,EAAEC,KAAK;EAErC,MAAMC,MAAM,GAAIH,QAAQ,IAAIJ,cAAc,CAACI,QAAQ,CAAC,IAAK,EAAE;EAC3D,OAAOG,MAAM,CAACC,MAAM,GAAG,CAAC,IAAID,MAAM,CAACE,KAAK,CAAEC,KAAK,IAAKf,IAAI,IAAIe,KAAK,IAAIf,IAAI,CAAC;AAC5E","ignoreList":[]}
|