@bratislava/ginis-sdk 0.3.3 → 0.3.6

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 (53) hide show
  1. package/dist/index.js +197 -0
  2. package/package.json +7 -1
  3. package/.env.example +0 -2
  4. package/.eslintrc.json +0 -84
  5. package/.github/dependabot.yml +0 -11
  6. package/.github/workflows/publish.yml +0 -18
  7. package/.github/workflows/pull.yml +0 -38
  8. package/.prettierrc +0 -7
  9. package/babel.config.js +0 -6
  10. package/docs/.nojekyll +0 -1
  11. package/docs/assets/26e93147f10415a0ed4a.svg +0 -6
  12. package/docs/assets/75c9471662e97ee24f29.svg +0 -7
  13. package/docs/assets/custom.css +0 -1
  14. package/docs/assets/custom.js +0 -1
  15. package/docs/assets/db90e4df2373980c497d.svg +0 -9
  16. package/docs/assets/highlight.css +0 -92
  17. package/docs/assets/main.js +0 -58
  18. package/docs/assets/search.js +0 -1
  19. package/docs/assets/style.css +0 -1280
  20. package/docs/classes/index.Ginis.html +0 -115
  21. package/docs/functions/api_ssl.pridatSoubor-1.html +0 -73
  22. package/docs/functions/api_ude.seznamDokumentu-1.html +0 -73
  23. package/docs/index.html +0 -110
  24. package/docs/modules/api_ssl.html +0 -75
  25. package/docs/modules/api_ude.html +0 -75
  26. package/docs/modules/index.html +0 -71
  27. package/docs/modules.html +0 -62
  28. package/docs/types/api_ssl.pridatSoubor.html +0 -87
  29. package/docs/types/api_ude.seznamDokumentu.html +0 -171
  30. package/docs/types/index.GinisConfig.html +0 -76
  31. package/docs/variables/api_ssl.default.html +0 -80
  32. package/docs/variables/api_ude.default.html +0 -80
  33. package/jest.config.js +0 -1
  34. package/src/api/json/pod/Detail-el-podani.ts +0 -59
  35. package/src/api/json/pod/__tests__/Detail-el-podani.test.ts +0 -27
  36. package/src/api/json/pod/index.ts +0 -5
  37. package/src/api/json/ssl/Detail-dokumentu.ts +0 -140
  38. package/src/api/json/ssl/Pridat-soubor.ts +0 -54
  39. package/src/api/json/ssl/__tests__/Detail-dokumentu.test.ts +0 -27
  40. package/src/api/json/ssl/__tests__/Pridat-soubor.test.ts +0 -37
  41. package/src/api/json/ssl/__tests__/raw-data.bin +0 -0
  42. package/src/api/json/ssl/index.ts +0 -7
  43. package/src/api/xml/ssl.ts +0 -71
  44. package/src/api/xml/ude.ts +0 -141
  45. package/src/ginis.ts +0 -58
  46. package/src/index.ts +0 -6
  47. package/src/utils/api.ts +0 -78
  48. package/src/utils/errors.ts +0 -7
  49. package/src/utils/types.ts +0 -7
  50. package/tsconfig.json +0 -37
  51. package/tsconfig.spec.json +0 -5
  52. package/typedoc.json +0 -9
  53. package/webpack.config.js +0 -42
package/dist/index.js ADDED
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ AxiosError: () => import_axios2.AxiosError,
34
+ Ginis: () => Ginis,
35
+ GinisError: () => GinisError
36
+ });
37
+ module.exports = __toCommonJS(src_exports);
38
+ var import_axios2 = require("axios");
39
+
40
+ // src/utils/api.ts
41
+ var import_axios = __toESM(require("axios"));
42
+ var import_crypto = __toESM(require("crypto"));
43
+ var defaultAxiosConfig = {
44
+ headers: {
45
+ "Content-Type": "application/json"
46
+ }
47
+ };
48
+ var makeAxiosRequest = async (axiosConfig, url, body, debug) => {
49
+ if (!url) {
50
+ throw new Error("Missing GINIS url for the service you are trying to reach.");
51
+ }
52
+ const requestConfig = axiosConfig || defaultAxiosConfig;
53
+ if (debug) {
54
+ console.log("########### GINIS REQUEST ###########");
55
+ console.log("headers: ", requestConfig.headers);
56
+ console.log("body: ", body);
57
+ console.log("########### GINIS REQUEST END ###########");
58
+ }
59
+ let responseAxios;
60
+ try {
61
+ responseAxios = await import_axios.default.post(url, body, requestConfig);
62
+ } catch (error) {
63
+ if (debug) {
64
+ let anyError = error;
65
+ console.error(anyError);
66
+ console.log("########### GINIS ERROR RESPONSE ###########");
67
+ console.log("status: ", anyError?.response?.status);
68
+ console.log("statusText: ", anyError?.response?.statusText);
69
+ console.log("data: ", anyError?.response?.data);
70
+ console.log("########### GINIS RESPONSE END ###########");
71
+ }
72
+ throw error;
73
+ }
74
+ if (debug) {
75
+ console.log("########### GINIS RESPONSE ###########");
76
+ console.log("status: ", responseAxios.status);
77
+ console.log("statusText: ", responseAxios.statusText);
78
+ console.log("data: ", responseAxios.data);
79
+ console.log("########### GINIS RESPONSE END ###########");
80
+ }
81
+ return {
82
+ data: responseAxios.data,
83
+ status: responseAxios.status,
84
+ statusText: responseAxios.statusText
85
+ };
86
+ };
87
+ var getGRestHeader = (config, requestNamespace) => {
88
+ return {
89
+ RequestName: "Xrg",
90
+ RequestNamespace: requestNamespace,
91
+ User: config.username,
92
+ Password: config.password,
93
+ PasswordText: true,
94
+ Nonce: import_crypto.default.randomBytes(10).toString("base64"),
95
+ Created: (/* @__PURE__ */ new Date()).toISOString()
96
+ };
97
+ };
98
+
99
+ // src/utils/errors.ts
100
+ var GinisError = class extends Error {
101
+ constructor(message) {
102
+ super(message);
103
+ }
104
+ };
105
+
106
+ // src/api/json/ssl/Detail-dokumentu.ts
107
+ async function detailDokumentu(bodyObj) {
108
+ const url = this.config.urls.ssl;
109
+ if (!url)
110
+ throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
111
+ const response = await makeAxiosRequest(
112
+ void 0,
113
+ `${url}/json/Detail-dokumentu`,
114
+ {
115
+ GRestHeader: getGRestHeader(
116
+ this.config,
117
+ "http://www.gordic.cz/xrg/ssl/wfl-dokument/detail-dokumentu/request/v_1.0.0.0"
118
+ ),
119
+ Xrg: { "Detail-dokumentu": bodyObj }
120
+ },
121
+ this.config.debug
122
+ );
123
+ return response.data.Xrg;
124
+ }
125
+
126
+ // src/api/json/ssl/Pridat-soubor.ts
127
+ async function pridatSoubor(bodyObj) {
128
+ const url = this.config.urls.ssl;
129
+ if (!url)
130
+ throw new GinisError("GINIS SDK Error: Missing SSL url in GINIS config");
131
+ const response = await makeAxiosRequest(
132
+ void 0,
133
+ `${url}/json/Pridat-soubor`,
134
+ {
135
+ GRestHeader: getGRestHeader(
136
+ this.config,
137
+ "http://www.gordic.cz/xrg/ssl/wfl-dokument/pridat-soubor/request/v_1.0.0.0"
138
+ ),
139
+ Xrg: { "Pridat-soubor": bodyObj }
140
+ },
141
+ this.config.debug
142
+ );
143
+ return response.data.Xrg;
144
+ }
145
+
146
+ // src/api/json/ssl/index.ts
147
+ var ssl_default = {
148
+ detailDokumentu,
149
+ pridatSoubor
150
+ };
151
+
152
+ // src/api/json/pod/Detail-el-podani.ts
153
+ async function detailElPodani(bodyObj) {
154
+ const url = this.config.urls.pod;
155
+ if (!url)
156
+ throw new GinisError("GINIS SDK Error: Missing POD url in GINIS config");
157
+ const response = await makeAxiosRequest(
158
+ void 0,
159
+ `${url}/json/Detail-el-podani`,
160
+ {
161
+ GRestHeader: getGRestHeader(
162
+ this.config,
163
+ "http://www.gordic.cz/xrg/pod/detail-el-podani/request/v_1.0.0.0"
164
+ ),
165
+ Xrg: { "Detail-el-podani": bodyObj }
166
+ },
167
+ this.config.debug
168
+ );
169
+ return response.data.Xrg;
170
+ }
171
+
172
+ // src/api/json/pod/index.ts
173
+ var pod_default = {
174
+ detailElPodani
175
+ };
176
+
177
+ // src/ginis.ts
178
+ var import_lodash = require("lodash");
179
+ var defaultConfig = {};
180
+ var Ginis = class {
181
+ constructor(config) {
182
+ this.config = {
183
+ ...defaultConfig,
184
+ ...config
185
+ };
186
+ this.json = {
187
+ ssl: (0, import_lodash.mapValues)(ssl_default, (v) => (0, import_lodash.bind)(v, this)),
188
+ pod: (0, import_lodash.mapValues)(pod_default, (v) => (0, import_lodash.bind)(v, this))
189
+ };
190
+ }
191
+ };
192
+ // Annotate the CommonJS export names for ESM import in node:
193
+ 0 && (module.exports = {
194
+ AxiosError,
195
+ Ginis,
196
+ GinisError
197
+ });
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@bratislava/ginis-sdk",
3
- "version": "0.3.3",
3
+ "version": "0.3.6",
4
4
  "description": "A small wrapper for most commonly used requests towards the Bratislava GINIS system",
5
5
  "main": "dist/ginis-sdk",
6
+ "files": [
7
+ "dist"
8
+ ],
6
9
  "types": "dist/index.d.ts",
7
10
  "scripts": {
8
11
  "build": "webpack",
@@ -37,6 +40,8 @@
37
40
  "@typescript-eslint/parser": "^5.39.0",
38
41
  "babel-jest": "^29.1.2",
39
42
  "dotenv": "^16.0.3",
43
+ "esbuild": "^0.19.3",
44
+ "esbuild-node-externals": "^1.9.0",
40
45
  "eslint": "^8.24.0",
41
46
  "eslint-config-prettier": "^8.5.0",
42
47
  "eslint-plugin-eslint-comments": "^3.2.0",
@@ -45,6 +50,7 @@
45
50
  "jest": "^29.1.2",
46
51
  "ts-jest": "^29.0.3",
47
52
  "ts-loader": "^9.4.1",
53
+ "tsup": "^7.2.0",
48
54
  "typedoc": "^0.23.16",
49
55
  "typedoc-theme-hierarchy": "^3.0.2",
50
56
  "typescript-strict-plugin": "^2.1.0",
package/.env.example DELETED
@@ -1,2 +0,0 @@
1
- GINIS_USERNAME=
2
- GINIS_PASSWORD=
package/.eslintrc.json DELETED
@@ -1,84 +0,0 @@
1
- {
2
- "root": true,
3
- "env": {
4
- "es2021": true,
5
- "node": true
6
- },
7
- "parser": "@typescript-eslint/parser",
8
- "parserOptions": {
9
- "ecmaVersion": 12,
10
- "project": "tsconfig.json",
11
- "sourceType": "module"
12
- },
13
- "ignorePatterns": [
14
- ".eslintrc.js"
15
- ],
16
- "plugins": [
17
- "@typescript-eslint/eslint-plugin",
18
- "prettier",
19
- "import"
20
- ],
21
- "extends": [
22
- "plugin:@typescript-eslint/recommended",
23
- "prettier"
24
- ],
25
- "rules": {
26
- "prettier/prettier": "off",
27
- "@typescript-eslint/interface-name-prefix": "off",
28
- "@typescript-eslint/explicit-function-return-type": "off",
29
- "@typescript-eslint/explicit-module-boundary-types": "off",
30
- "@typescript-eslint/no-explicit-any": "off",
31
- "import/prefer-default-export": "off",
32
- "class-methods-use-this": "off",
33
- "max-classes-per-file": "off",
34
- "sonarjs/no-duplicate-string": "off",
35
- "no-restricted-syntax": "off",
36
- "new-cap": "off",
37
- "no-underscore-dangle": "off",
38
- "guard-for-in": "off"
39
- },
40
- "overrides": [
41
- {
42
- "files": [
43
- "**/*.spec.ts",
44
- "**/*.e2e-spec.ts",
45
- "**/*.spec.js",
46
- "**/*.e2e-spec.js"
47
- ],
48
- "env": {
49
- "es2021": true,
50
- "node": true
51
- },
52
- "plugins": [
53
- "@typescript-eslint/eslint-plugin",
54
- "sonarjs",
55
- "prettier",
56
- "import"
57
- ],
58
- "extends": [
59
- "plugin:@typescript-eslint/recommended",
60
- "prettier"
61
- ],
62
- "settings": {
63
- "jest": {
64
- "version": 27
65
- }
66
- },
67
- "rules": {
68
- "prettier/prettier": "off",
69
- "@typescript-eslint/interface-name-prefix": "off",
70
- "@typescript-eslint/explicit-function-return-type": "off",
71
- "@typescript-eslint/explicit-module-boundary-types": "off",
72
- "@typescript-eslint/no-explicit-any": "off",
73
- "import/prefer-default-export": "off",
74
- "class-methods-use-this": "off",
75
- "max-classes-per-file": "off",
76
- "sonarjs/no-duplicate-string": "off",
77
- "no-restricted-syntax": "off",
78
- "new-cap": "off",
79
- "no-underscore-dangle": "off",
80
- "guard-for-in": "off"
81
- }
82
- }
83
- ]
84
- }
@@ -1,11 +0,0 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
-
6
- version: 2
7
- updates:
8
- - package-ecosystem: 'npm' # See documentation for possible values
9
- directory: '/' # Location of package manifests
10
- schedule:
11
- interval: 'weekly'
@@ -1,18 +0,0 @@
1
- name: Publish Package to npm
2
- on:
3
- release:
4
- types: [created]
5
- jobs:
6
- publish:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v3
10
- - uses: actions/setup-node@v3
11
- with:
12
- node-version: '16'
13
- registry-url: 'https://registry.npmjs.org'
14
- - run: yarn --frozen-lockfile
15
- - run: yarn build
16
- - run: yarn publish --access public
17
- env:
18
- NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
@@ -1,38 +0,0 @@
1
- name: Validate code
2
-
3
- on:
4
- push:
5
- branches: ['master']
6
- pull_request:
7
- branches: ['master']
8
-
9
- jobs:
10
- build:
11
- name: Typescript check
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@v3
16
- - uses: actions/setup-node@v3
17
- with:
18
- node-version: '16'
19
- - run: yarn --frozen-lockfile
20
- - name: Typescript check
21
- uses: EPMatt/reviewdog-action-tsc@v1
22
- with:
23
- # Change reviewdog reporter if you need
24
- # [github-pr-check,github-check,github-pr-review].
25
- # More about reviewdog reporters at
26
- # https://github.com/reviewdog/reviewdog#reporters
27
- reporter: github-check
28
- # Change reporter level if you need
29
- # [info,warning,error].
30
- # More about reviewdog reporter level at
31
- # https://github.com/reviewdog/reviewdog#reporters
32
- level: warning
33
- - name: Typescript strict plugin check
34
- run: yarn typecheck
35
-
36
- # Tests require internal network - until we have GINIS mocked for ci we're omitting
37
- # - name: Tests
38
- # run: yarn test:ci
package/.prettierrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "trailingComma": "es5",
3
- "tabWidth": 2,
4
- "semi": false,
5
- "singleQuote": true,
6
- "printWidth": 100
7
- }
package/babel.config.js DELETED
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- ['@babel/preset-env', {targets: {node: 'current'}}],
4
- '@babel/preset-typescript',
5
- ],
6
- };
package/docs/.nojekyll DELETED
@@ -1 +0,0 @@
1
- TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg fill="none" version="1.1" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
3
- <title>TypeScript logo</title>
4
- <rect width="512" height="512" rx="50" fill="#3178c6"/>
5
- <path d="m317 407v50c8.1 4.2 18 7.3 29 9.4s23 3.1 35 3.1c12 0 23-1.1 34-3.4 11-2.3 20-6.1 28-11 8.1-5.3 15-12 19-21s7.1-19 7.1-32c0-9.1-1.4-17-4.1-24s-6.6-13-12-18c-5.1-5.3-11-10-18-14s-15-8.2-24-12c-6.6-2.7-12-5.3-18-7.9-5.2-2.6-9.7-5.2-13-7.8-3.7-2.7-6.5-5.5-8.5-8.4-2-3-3-6.3-3-10 0-3.4 0.89-6.5 2.7-9.3s4.3-5.1 7.5-7.1c3.2-2 7.2-3.5 12-4.6 4.7-1.1 9.9-1.6 16-1.6 4.2 0 8.6 0.31 13 0.94 4.6 0.63 9.3 1.6 14 2.9 4.7 1.3 9.3 2.9 14 4.9 4.4 2 8.5 4.3 12 6.9v-47c-7.6-2.9-16-5.1-25-6.5s-19-2.1-31-2.1c-12 0-23 1.3-34 3.8s-20 6.5-28 12c-8.1 5.4-14 12-19 21-4.7 8.4-7 18-7 30 0 15 4.3 28 13 38 8.6 11 22 19 39 27 6.9 2.8 13 5.6 19 8.3s11 5.5 15 8.4c4.3 2.9 7.7 6.1 10 9.5 2.5 3.4 3.8 7.4 3.8 12 0 3.2-0.78 6.2-2.3 9s-3.9 5.2-7.1 7.2-7.1 3.6-12 4.8c-4.7 1.1-10 1.7-17 1.7-11 0-22-1.9-32-5.7-11-3.8-21-9.5-30-17zm-84-123h64v-41h-179v41h64v183h51z" clip-rule="evenodd" fill="#fff" fill-rule="evenodd" style="fill:#fff"/>
6
- </svg>
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" ?>
2
- <svg viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg">
3
- <g id="#007bffff">
4
- <path fill="#007bff" opacity="1.00"
5
- d=" M 9.84 70.86 C 18.37 59.93 32.07 53.35 45.93 53.48 C 99.29 53.43 152.64 53.50 206.00 53.45 C 209.00 53.53 212.11 53.12 215.03 53.98 C 218.18 55.70 220.05 58.98 222.42 61.57 C 234.68 76.00 246.64 90.69 259.08 104.97 C 328.06 105.05 397.05 104.97 466.04 105.01 C 475.98 104.92 485.90 108.15 493.81 114.18 C 504.16 121.79 510.49 133.96 512.00 146.61 L 512.00 403.41 C 510.94 415.48 505.32 427.15 496.01 435.00 C 489.04 441.00 480.20 444.79 471.05 445.68 C 466.04 446.17 461.01 445.97 456.00 446.00 C 323.00 446.00 190.00 446.00 57.00 446.00 C 50.54 445.94 44.03 446.33 37.64 445.23 C 24.25 442.94 12.17 434.24 5.68 422.33 C 2.40 416.54 0.74 410.00 0.00 403.44 L 0.00 95.59 C 1.03 86.67 4.14 77.89 9.84 70.86 Z"/>
6
- </g>
7
- </svg>
@@ -1 +0,0 @@
1
- .tree{background:var(--color-panel);font-family:Roboto Mono,monospace;margin-top:20px}.tree-config{display:flex;gap:8px;justify-content:end;padding:8px}.tree-config__button{align-items:center;background-color:transparent;border:0;color:var(--color-toolbar-text);cursor:pointer;display:flex;height:20px;justify-content:center;opacity:.8;padding:0;width:20px}.tree-config__button:hover{opacity:.9}.tree-content{color:var(--color-text);font-size:.85rem;font-weight:400;line-height:1.5;padding:0 20px 20px;position:relative}.tree-content span{font-size:13px;letter-spacing:.4px}.tree-content ul{list-style:none;margin:0;padding-left:5px}.tree-content ul li{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding-bottom:5px;padding-left:15px;padding-top:5px;position:relative}.tree-content ul li:before{height:1px;margin:auto;top:15px;width:10px}.tree-content ul li:after,.tree-content ul li:before{background-color:#666;content:"";left:0;position:absolute}.tree-content ul li:after{bottom:0;height:100%;top:0;width:1px}.tree-content ul li:last-child:after{height:15px}.tree-content ul a{cursor:pointer}.category:not([data-id=root]){display:none}.category:not([data-id=root])._open{display:block}.category__title{color:var(--color-text-aside);cursor:pointer}.category__link,.category__title{align-items:center;display:flex;flex-shrink:0;text-decoration:none}.category__link:hover,.category__title:hover{text-decoration:underline}.category__title--open .category__folder{background:url(db90e4df2373980c497d.svg)}.category__folder{background:url(75c9471662e97ee24f29.svg);display:inline-block;flex-shrink:0;height:15px;margin-right:6px;width:15px}.category__link._active{color:inherit}.category__link--ts:before{background-image:url(26e93147f10415a0ed4a.svg);content:"";display:inline-block;flex-shrink:0;height:15px;margin:0 7px 2px 0;vertical-align:middle;width:15px}
@@ -1 +0,0 @@
1
- (()=>{"use strict";var t={893:(t,e,s)=>{s.r(e)},555:(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.HierarchyManager=void 0;const o=s(498);e.HierarchyManager=class{constructor(){this.stateManager=new o.StateManager,this.titleSelector=".js-category-title",this.titleOpenedClass="category__title--open",this.listSelector=".js-category-list"}init(){this.addListeners(),this.initSaved(),this.openCurrentPath()}openPathAndSave(t){this.openPath(t),this.stateManager.addOpenedPath(t)}openPath(t){var e,s;const o=document.querySelector(`${this.listSelector}[data-id="${t}"]`);o&&(o.classList.add("_open"),null===(s=null===(e=o.parentNode)||void 0===e?void 0:e.querySelector(this.titleSelector))||void 0===s||s.classList.add(this.titleOpenedClass))}closePath(t){var e,s;const o=document.querySelector(`${this.listSelector}[data-id="${t}"]`);o&&(o.classList.remove("_open"),null===(s=null===(e=o.parentNode)||void 0===e?void 0:e.querySelector(this.titleSelector))||void 0===s||s.classList.remove(this.titleOpenedClass),this.stateManager.removeOpenedPath(t))}closePathWithChildren(t){this.closePath(t);const e=document.querySelector(`${this.listSelector}[data-id="${t}"]`);if(!e)return;const s=e.querySelectorAll(this.listSelector);for(const t of s)this.closePath(t.dataset.id||"")}togglePath(t){const e=document.querySelector(`${this.listSelector}[data-id="${t}"]`);e&&(e.classList.contains("_open")?this.closePathWithChildren(t):this.openPathAndSave(t))}addListeners(){const t=document.querySelectorAll('.js-category-title:not([data-id="root"])');for(const e of t)e.addEventListener("click",(()=>{const t=e.dataset.id||"";this.togglePath(t)}));this.addExpandListener(),this.addCollapseListener(),this.addTargetListener()}addExpandListener(){const t=document.querySelector(".js-tree-expand");null==t||t.addEventListener("click",(()=>{const t=document.querySelectorAll(this.listSelector);for(const e of t){const t=e.dataset.id||"";this.openPathAndSave(t)}}))}addCollapseListener(){const t=document.querySelector(".js-tree-collapse");null==t||t.addEventListener("click",(()=>{const t=document.querySelectorAll(this.listSelector);for(const e of t){const t=e.dataset.id||"";this.closePath(t)}}))}addTargetListener(){const t=document.querySelector(".js-tree-target");null==t||t.addEventListener("click",(()=>{const t=this.openCurrentPath();null==t||t.scrollIntoView()}))}initSaved(){const t=this.stateManager.getOpenedPaths();for(const e of t)this.openPath(e)}openCurrentPath(){const t=window.location.pathname.split("/"),e=`/${t[t.length-2]||""}/${t[t.length-1]||""}`,s=document.querySelector(`.js-category-link[data-id="${e}"]`);if(!s)return null;s.classList.add("_active");let o=s.closest(this.listSelector);for(;o;){const t=o.dataset.id||"";this.openPath(t),o=o.parentNode.closest(this.listSelector)}return s}}},498:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StateManager=void 0;e.StateManager=class{constructor(){this.openedPathLsKey="opened-path-state",this.openedPaths=[];const t=localStorage.getItem("opened-path-state");this.openedPaths=t?JSON.parse(t):[]}addOpenedPath(t){this.openedPaths.push(t),this.updateState()}removeOpenedPath(t){this.openedPaths=this.openedPaths.filter((e=>e!==t)),this.updateState()}getOpenedPaths(){return this.openedPaths}updateState(){localStorage.setItem(this.openedPathLsKey,JSON.stringify(this.openedPaths))}}}},e={};function s(o){var a=e[o];if(void 0!==a)return a.exports;var n=e[o]={exports:{}};return t[o](n,n.exports,s),n.exports}s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};(()=>{s(893);(new(s(555).HierarchyManager)).init()})()})();
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" ?>
2
- <svg viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg">
3
- <g id="#007bffff">
4
- <path fill="#007bff" opacity="1.00"
5
- d=" M 0.00 80.69 C 0.22 64.54 15.05 50.95 30.99 51.04 C 71.66 50.97 112.33 51.00 153.00 51.02 C 163.06 50.98 173.05 55.84 178.96 64.04 C 190.23 79.65 201.34 95.39 212.61 111.00 C 275.09 111.02 337.57 110.96 400.05 111.03 C 415.75 110.89 430.55 124.04 431.08 139.96 C 431.29 154.12 431.11 168.29 431.16 182.46 C 324.50 182.48 217.83 182.44 111.17 182.48 C 95.16 182.41 79.32 191.83 72.51 206.44 C 48.34 257.13 24.13 307.80 0.00 358.51 L 0.00 80.69 Z"/>
6
- <path fill="#007bff" opacity="1.00"
7
- d=" M 91.02 234.95 C 97.86 220.76 113.28 211.54 128.94 211.48 C 241.97 211.45 355.00 211.49 468.03 211.46 C 474.47 211.32 480.96 212.47 486.89 215.04 C 501.07 220.92 511.34 235.20 512.00 250.60 L 512.00 254.16 C 511.61 259.88 510.10 265.50 507.48 270.60 C 482.86 319.94 458.24 369.28 433.63 418.62 C 431.10 423.61 428.85 428.84 425.20 433.15 C 417.67 442.38 405.95 447.99 394.03 447.99 C 274.35 448.02 154.68 447.98 35.01 448.01 C 19.82 449.24 4.46 438.96 0.84 423.98 C 30.92 360.98 60.93 297.95 91.02 234.95 Z"/>
8
- </g>
9
- </svg>
@@ -1,92 +0,0 @@
1
- :root {
2
- --light-hl-0: #0000FF;
3
- --dark-hl-0: #569CD6;
4
- --light-hl-1: #000000;
5
- --dark-hl-1: #D4D4D4;
6
- --light-hl-2: #0070C1;
7
- --dark-hl-2: #4FC1FF;
8
- --light-hl-3: #795E26;
9
- --dark-hl-3: #DCDCAA;
10
- --light-hl-4: #008000;
11
- --dark-hl-4: #6A9955;
12
- --light-hl-5: #001080;
13
- --dark-hl-5: #9CDCFE;
14
- --light-hl-6: #A31515;
15
- --dark-hl-6: #CE9178;
16
- --light-hl-7: #AF00DB;
17
- --dark-hl-7: #C586C0;
18
- --light-hl-8: #267F99;
19
- --dark-hl-8: #4EC9B0;
20
- --light-hl-9: #000000FF;
21
- --dark-hl-9: #D4D4D4;
22
- --light-code-background: #FFFFFF;
23
- --dark-code-background: #1E1E1E;
24
- }
25
-
26
- @media (prefers-color-scheme: light) { :root {
27
- --hl-0: var(--light-hl-0);
28
- --hl-1: var(--light-hl-1);
29
- --hl-2: var(--light-hl-2);
30
- --hl-3: var(--light-hl-3);
31
- --hl-4: var(--light-hl-4);
32
- --hl-5: var(--light-hl-5);
33
- --hl-6: var(--light-hl-6);
34
- --hl-7: var(--light-hl-7);
35
- --hl-8: var(--light-hl-8);
36
- --hl-9: var(--light-hl-9);
37
- --code-background: var(--light-code-background);
38
- } }
39
-
40
- @media (prefers-color-scheme: dark) { :root {
41
- --hl-0: var(--dark-hl-0);
42
- --hl-1: var(--dark-hl-1);
43
- --hl-2: var(--dark-hl-2);
44
- --hl-3: var(--dark-hl-3);
45
- --hl-4: var(--dark-hl-4);
46
- --hl-5: var(--dark-hl-5);
47
- --hl-6: var(--dark-hl-6);
48
- --hl-7: var(--dark-hl-7);
49
- --hl-8: var(--dark-hl-8);
50
- --hl-9: var(--dark-hl-9);
51
- --code-background: var(--dark-code-background);
52
- } }
53
-
54
- :root[data-theme='light'] {
55
- --hl-0: var(--light-hl-0);
56
- --hl-1: var(--light-hl-1);
57
- --hl-2: var(--light-hl-2);
58
- --hl-3: var(--light-hl-3);
59
- --hl-4: var(--light-hl-4);
60
- --hl-5: var(--light-hl-5);
61
- --hl-6: var(--light-hl-6);
62
- --hl-7: var(--light-hl-7);
63
- --hl-8: var(--light-hl-8);
64
- --hl-9: var(--light-hl-9);
65
- --code-background: var(--light-code-background);
66
- }
67
-
68
- :root[data-theme='dark'] {
69
- --hl-0: var(--dark-hl-0);
70
- --hl-1: var(--dark-hl-1);
71
- --hl-2: var(--dark-hl-2);
72
- --hl-3: var(--dark-hl-3);
73
- --hl-4: var(--dark-hl-4);
74
- --hl-5: var(--dark-hl-5);
75
- --hl-6: var(--dark-hl-6);
76
- --hl-7: var(--dark-hl-7);
77
- --hl-8: var(--dark-hl-8);
78
- --hl-9: var(--dark-hl-9);
79
- --code-background: var(--dark-code-background);
80
- }
81
-
82
- .hl-0 { color: var(--hl-0); }
83
- .hl-1 { color: var(--hl-1); }
84
- .hl-2 { color: var(--hl-2); }
85
- .hl-3 { color: var(--hl-3); }
86
- .hl-4 { color: var(--hl-4); }
87
- .hl-5 { color: var(--hl-5); }
88
- .hl-6 { color: var(--hl-6); }
89
- .hl-7 { color: var(--hl-7); }
90
- .hl-8 { color: var(--hl-8); }
91
- .hl-9 { color: var(--hl-9); }
92
- pre, code { background: var(--code-background); }