@opentripplanner/trip-details 6.0.2-alpha.1 → 6.0.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -0
- package/esm/fare-table.js +13 -26
- package/esm/fare-table.js.map +1 -1
- package/esm/index.js +71 -75
- package/esm/index.js.map +1 -1
- package/esm/styled.js.map +1 -1
- package/esm/trip-detail.js +7 -16
- package/esm/trip-detail.js.map +1 -1
- package/esm/types.js +1 -1
- package/esm/types.js.map +1 -1
- package/esm/utils.js +6 -4
- package/esm/utils.js.map +1 -1
- package/lib/fare-table.js +7 -30
- package/lib/fare-table.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +31 -61
- package/lib/index.js.map +1 -1
- package/lib/styled.js +20 -76
- package/lib/styled.js.map +1 -1
- package/lib/trip-detail.d.ts +1 -1
- package/lib/trip-detail.d.ts.map +1 -1
- package/lib/trip-detail.js +5 -22
- package/lib/trip-detail.js.map +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +4 -0
- package/lib/types.js.map +1 -1
- package/lib/utils.js +5 -8
- package/lib/utils.js.map +1 -1
- package/package.json +7 -7
- package/src/__snapshots__/TripDetails.story.tsx.snap +484 -484
- package/src/index.tsx +2 -2
- package/tsconfig.tsbuildinfo +1 -1
package/lib/trip-detail.js
CHANGED
|
@@ -1,48 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _QuestionCircle = require("@styled-icons/fa-solid/QuestionCircle");
|
|
13
|
-
|
|
14
10
|
var _TimesCircle = require("@styled-icons/fa-solid/TimesCircle");
|
|
15
|
-
|
|
16
11
|
var _reactAnimateHeight = _interopRequireDefault(require("react-animate-height"));
|
|
17
|
-
|
|
18
12
|
var _reactIntl = require("react-intl");
|
|
19
|
-
|
|
20
13
|
var S = _interopRequireWildcard(require("./styled"));
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
16
|
// TODO: Remove these two helper methods by moving to semantically correct HTML
|
|
27
|
-
|
|
28
17
|
/**
|
|
29
18
|
* Copied from https://stackoverflow.com/questions/50940640/how-to-determine-if-jest-is-running-the-code-or-not
|
|
30
19
|
*/
|
|
31
20
|
function isRunningJest() {
|
|
32
21
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
33
22
|
}
|
|
34
|
-
|
|
35
23
|
function uuidv4() {
|
|
36
24
|
if (isRunningJest()) return "mocked-random-id";
|
|
37
25
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
38
26
|
// eslint-disable-next-line no-bitwise
|
|
39
|
-
const r = Math.random() * 16 | 0;
|
|
40
|
-
|
|
27
|
+
const r = Math.random() * 16 | 0;
|
|
28
|
+
// eslint-disable-next-line no-bitwise
|
|
41
29
|
const v = c === "x" ? r : r & 0x3 | 0x8;
|
|
42
30
|
return v.toString(16);
|
|
43
31
|
});
|
|
44
32
|
}
|
|
45
|
-
|
|
46
33
|
const TripDetail = ({
|
|
47
34
|
icon,
|
|
48
35
|
summary,
|
|
@@ -51,11 +38,9 @@ const TripDetail = ({
|
|
|
51
38
|
const intl = (0, _reactIntl.useIntl)();
|
|
52
39
|
const [expanded, setExpanded] = (0, _react.useState)(false);
|
|
53
40
|
const id = uuidv4();
|
|
54
|
-
|
|
55
41
|
const toggle = () => {
|
|
56
42
|
setExpanded(!expanded);
|
|
57
43
|
};
|
|
58
|
-
|
|
59
44
|
return /*#__PURE__*/_react.default.createElement(S.TripDetail, {
|
|
60
45
|
role: "group"
|
|
61
46
|
}, /*#__PURE__*/_react.default.createElement(S.TripDetailIcon, {
|
|
@@ -86,7 +71,5 @@ const TripDetail = ({
|
|
|
86
71
|
size: "0.92em"
|
|
87
72
|
})), description)));
|
|
88
73
|
};
|
|
89
|
-
|
|
90
|
-
var _default = TripDetail;
|
|
91
|
-
exports.default = _default;
|
|
74
|
+
var _default = exports.default = TripDetail;
|
|
92
75
|
//# sourceMappingURL=trip-detail.js.map
|
package/lib/trip-detail.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"trip-detail.js","names":["_react","_interopRequireWildcard","require","_QuestionCircle","_TimesCircle","_reactAnimateHeight","_interopRequireDefault","_reactIntl","S","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","isRunningJest","process","env","JEST_WORKER_ID","undefined","uuidv4","replace","c","Math","random","v","toString","TripDetail","icon","summary","description","intl","useIntl","expanded","setExpanded","useState","id","toggle","createElement","role","TripDetailIcon","TripDetailSummary","ExpandButton","formatMessage","onClick","tabIndex","QuestionCircle","size","duration","height","TripDetailDescription","HideButton","TimesCircle","_default","exports"],"sources":["../src/trip-detail.tsx"],"sourcesContent":["import React, { ReactElement, useState } from \"react\";\nimport { QuestionCircle } from \"@styled-icons/fa-solid/QuestionCircle\";\nimport { TimesCircle } from \"@styled-icons/fa-solid/TimesCircle\";\n\nimport AnimateHeight from \"react-animate-height\";\nimport { useIntl } from \"react-intl\";\nimport * as S from \"./styled\";\n\ntype Props = {\n description?: ReactElement | string;\n icon: ReactElement;\n summary: ReactElement | string;\n};\n\n// TODO: Remove these two helper methods by moving to semantically correct HTML\n/**\n * Copied from https://stackoverflow.com/questions/50940640/how-to-determine-if-jest-is-running-the-code-or-not\n */\nfunction isRunningJest() {\n return process.env.JEST_WORKER_ID !== undefined;\n}\n\nfunction uuidv4(): string {\n if (isRunningJest()) return \"mocked-random-id\";\n\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function(c) {\n // eslint-disable-next-line no-bitwise\n const r = (Math.random() * 16) | 0;\n // eslint-disable-next-line no-bitwise\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\nconst TripDetail = ({ icon, summary, description }: Props): JSX.Element => {\n const intl = useIntl();\n const [expanded, setExpanded] = useState(false);\n\n const id = uuidv4();\n\n const toggle = (): void => {\n setExpanded(!expanded);\n };\n\n return (\n <S.TripDetail role=\"group\">\n <S.TripDetailIcon role=\"presentation\">{icon}</S.TripDetailIcon>\n {/* TODO: Adjust the summary and description to be a `summary`/`details` pair, therefore semantically correct */}\n {/* https://github.com/opentripplanner/otp-ui/pull/530#discussion_r1074006057 */}\n <S.TripDetailSummary>\n {summary}\n {description && (\n <S.ExpandButton\n aria-label={\n expanded\n ? intl.formatMessage({\n id: \"otpUi.TripDetails.hideDetail\"\n })\n : intl.formatMessage({\n id: \"otpUi.TripDetails.showDetail\"\n })\n }\n aria-controls={id}\n aria-expanded={expanded}\n id=\"expand-button\"\n onClick={toggle}\n tabIndex={0}\n >\n <QuestionCircle size=\"0.92em\" />\n </S.ExpandButton>\n )}\n </S.TripDetailSummary>\n <AnimateHeight duration={300} height={expanded ? \"auto\" : 0}>\n <S.TripDetailDescription aria-labelledby=\"expand-button\" id={id}>\n {/** This button isn't needed for screen readers as the main expand-button is\n * more convenient.\n */}\n <S.HideButton role=\"presentation\" onClick={() => setExpanded(false)}>\n <TimesCircle size=\"0.92em\" />\n </S.HideButton>\n {description}\n </S.TripDetailDescription>\n </AnimateHeight>\n </S.TripDetail>\n );\n};\n\nexport default TripDetail;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,CAAA,GAAAP,uBAAA,CAAAC,OAAA;AAA8B,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA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AAA,CAAAyD,cAAc;IAACC,IAAI,EAAC;EAAQ,CAAE,CACjB,CAEC,CAAC,eACtB7D,MAAA,CAAAe,OAAA,CAAAqC,aAAA,CAAC/C,mBAAA,CAAAU,OAAa;IAAC+C,QAAQ,EAAE,GAAI;IAACC,MAAM,EAAEhB,QAAQ,GAAG,MAAM,GAAG;EAAE,gBAC1D/C,MAAA,CAAAe,OAAA,CAAAqC,aAAA,CAAC5C,CAAC,CAACwD,qBAAqB;IAAC,mBAAgB,eAAe;IAACd,EAAE,EAAEA;EAAG,gBAI9DlD,MAAA,CAAAe,OAAA,CAAAqC,aAAA,CAAC5C,CAAC,CAACyD,UAAU;IAACZ,IAAI,EAAC,cAAc;IAACK,OAAO,EAAEA,CAAA,KAAMV,WAAW,CAAC,KAAK;EAAE,gBAClEhD,MAAA,CAAAe,OAAA,CAAAqC,aAAA,CAAChD,YAAA,CAAA8D,WAAW;IAACL,IAAI,EAAC;EAAQ,CAAE,CAChB,CAAC,EACdjB,WACsB,CACZ,CACH,CAAC;AAEnB,CAAC;AAAC,IAAAuB,QAAA,GAAAC,OAAA,CAAArD,OAAA,GAEa0B,UAAU","ignoreList":[]}
|
package/lib/types.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface FareLegTableProps {
|
|
|
31
31
|
layout?: FareTableLayout[];
|
|
32
32
|
legs: Leg[];
|
|
33
33
|
}
|
|
34
|
-
export
|
|
34
|
+
export type FareTotals = (FareProductSelector & {
|
|
35
35
|
price: Money;
|
|
36
36
|
})[];
|
|
37
37
|
export interface FareDetailsProps {
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,SAAS,EACT,GAAG,EACH,cAAc,EACd,KAAK,EACL,MAAM,wBAAwB,CAAC;AAEjC,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,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/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["// Prettier does not recognize the import type syntax.\n// eslint-disable-next-line prettier/prettier\nimport type { \n FareProductSelector, \n Itinerary, \n Leg, \n MassUnitOption,\n Money\n } from \"@opentripplanner/types\";\n\nexport interface TimeActiveDetailsProps {\n bikeMinutes: number;\n minutesActive?: number;\n walkMinutes: number;\n}\n\nexport interface CO2ConfigType {\n carbonIntensity?: Record<string, number>;\n units?: MassUnitOption;\n enabled?: boolean;\n}\n\nexport interface DepartureDetailsProps {\n departureDate: Date;\n}\n\n/**\n * This is the interface used to define the layout for a particular fare table.\n * The table with be rendered with the columns defined here,\n * with each row being an individual transit leg from the itinerary.\n */\nexport interface FareTableLayout {\n cols: (FareProductSelector & {\n columnHeaderKey: string;\n })[]\n headerKey: string;\n}\n/**\n * Interface containing the lgs and the layout of the fare table.\n */\nexport interface FareLegTableProps {\n layout?: FareTableLayout[];\n legs: Leg[];\n}\n\n// Total fare amount corresponding to a fare key\nexport type FareTotals = (FareProductSelector & { price: Money })[]\n\nexport interface FareDetailsProps {\n legs: Leg[];\n maxTNCFare: number;\n minTNCFare: number;\n}\n\n\nexport interface TripDetailsProps {\n /**\n * Used for additional styling with styled components for example.\n */\n className?: string;\n /**\n * Object containing the CO₂ config.\n */\n co2Config?: CO2ConfigType;\n /**\n * Determines which transit fare should be displayed by default, should there be multiple transit fare types.\n */\n defaultFareType?: { headerKey: string } & FareProductSelector;\n /**\n * Slot for a custom component to render the expandable section for departure.\n */\n DepartureDetails?: React.ElementType<DepartureDetailsProps>;\n /**\n * If this is set to true, a row will be added to the trip details displaying how\n * many minutes in total the user will spend walking or biking.\n */\n displayTimeActive?: boolean;\n /**\n * Slot for a custom component to render the expandable section for fares.\n */\n FareDetails?: React.ElementType<FareDetailsProps>;\n /**\n * Column and table configuration for fare details/fare by leg table.\n */\n fareDetailsLayout?: FareTableLayout[];\n /**\n * Mapping between fare keys and human-readable names for them.\n */\n fareKeyNameMap?: {\n [name: string]: string;\n };\n /**\n * Itinerary that the user has selected to view, contains multiple legs.\n */\n itinerary: Itinerary;\n /**\n * show the '~' symbol in the trip details panel\n */\n showApproximateMinutesActive?: boolean;\n /**\n * Slot for a custom component to render the expandable section for time active.\n */\n TimeActiveDetails?: React.ElementType<TimeActiveDetailsProps>;\n}"],"mappings":"","ignoreList":[]}
|
package/lib/utils.js
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.boldText = boldText;
|
|
9
8
|
exports.renderFare = renderFare;
|
|
10
|
-
|
|
11
9
|
var _react = _interopRequireDefault(require("react"));
|
|
12
|
-
|
|
13
10
|
var _reactIntl = require("react-intl");
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* Format text bold (used with FormattedMessage).
|
|
17
13
|
*/
|
|
18
14
|
function boldText(contents) {
|
|
19
15
|
return /*#__PURE__*/_react.default.createElement("strong", null, contents);
|
|
20
16
|
}
|
|
17
|
+
|
|
21
18
|
/**
|
|
22
19
|
* Render formatted fare.
|
|
23
20
|
* @param currencyCode The ISO currency code to use (USD, GBP, EUR).
|
|
24
21
|
* @param fare The fare value, in currency units, to be shown.
|
|
25
22
|
* @returns The formatted fare value according to the selected locale.
|
|
26
23
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
24
|
function renderFare(currencyCode, fare) {
|
|
30
25
|
return /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedNumber, {
|
|
31
|
-
currency: currencyCode
|
|
26
|
+
currency: currencyCode
|
|
27
|
+
// For dollars in locales such as 'fr',
|
|
32
28
|
// this will limit the display to just the dollar sign
|
|
33
29
|
// (otherwise it will render e.g. '2,50 $US' instead of '2,50 $').
|
|
34
30
|
,
|
|
35
31
|
currencyDisplay: "narrowSymbol",
|
|
36
|
-
value: fare
|
|
32
|
+
value: fare
|
|
33
|
+
// eslint-disable-next-line react/style-prop-object
|
|
37
34
|
,
|
|
38
35
|
style: "currency"
|
|
39
36
|
});
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_react","_interopRequireDefault","require","_reactIntl","boldText","contents","default","createElement","renderFare","currencyCode","fare","FormattedNumber","currency","currencyDisplay","value","style"],"sources":["../src/utils.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode } from \"react\";\nimport { FormattedNumber } from \"react-intl\";\n\n/**\n * Format text bold (used with FormattedMessage).\n */\nexport function boldText(contents: ReactNode): ReactElement {\n return <strong>{contents}</strong>;\n}\n\n/**\n * Render formatted fare.\n * @param currencyCode The ISO currency code to use (USD, GBP, EUR).\n * @param fare The fare value, in currency units, to be shown.\n * @returns The formatted fare value according to the selected locale.\n */\nexport function renderFare(currencyCode: string, fare: number): ReactElement {\n return (\n <FormattedNumber\n currency={currencyCode}\n // For dollars in locales such as 'fr',\n // this will limit the display to just the dollar sign\n // (otherwise it will render e.g. '2,50 $US' instead of '2,50 $').\n currencyDisplay=\"narrowSymbol\"\n value={fare}\n // eslint-disable-next-line react/style-prop-object\n style=\"currency\"\n />\n );\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACO,SAASE,QAAQA,CAACC,QAAmB,EAAgB;EAC1D,oBAAOL,MAAA,CAAAM,OAAA,CAAAC,aAAA,iBAASF,QAAiB,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,UAAUA,CAACC,YAAoB,EAAEC,IAAY,EAAgB;EAC3E,oBACEV,MAAA,CAAAM,OAAA,CAAAC,aAAA,CAACJ,UAAA,CAAAQ,eAAe;IACdC,QAAQ,EAAEH;IACV;IACA;IACA;IAAA;IACAI,eAAe,EAAC,cAAc;IAC9BC,KAAK,EAAEJ;IACP;IAAA;IACAK,KAAK,EAAC;EAAU,CACjB,CAAC;AAEN","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentripplanner/trip-details",
|
|
3
|
-
"version": "6.0.2-alpha.
|
|
3
|
+
"version": "6.0.2-alpha.3",
|
|
4
4
|
"description": "A component for displaying details about a trip planning itinerary",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"private": false,
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@opentripplanner/core-utils": "^12.0.0",
|
|
15
14
|
"@styled-icons/fa-solid": "^10.34.0",
|
|
16
15
|
"flat": "^5.0.2",
|
|
17
|
-
"react-animate-height": "^3.0.4"
|
|
16
|
+
"react-animate-height": "^3.0.4",
|
|
17
|
+
"@opentripplanner/core-utils": "13.0.0-alpha.4"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@types
|
|
20
|
+
"@types/flat": "^5.0.2",
|
|
21
|
+
"@opentripplanner/types": "7.0.0-alpha.18"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^18.2.0",
|
|
25
|
-
"react-intl": "^
|
|
25
|
+
"react-intl": "^6.8.4",
|
|
26
26
|
"styled-components": "^5.3.0"
|
|
27
27
|
},
|
|
28
28
|
"bugs": {
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"tsc": "tsc"
|
|
34
34
|
}
|
|
35
|
-
}
|
|
35
|
+
}
|