@theia/preferences 1.67.0-next.56 → 1.67.0-next.86

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 (206) hide show
  1. package/lib/browser/folder-preference-provider.d.ts +23 -0
  2. package/lib/browser/folder-preference-provider.d.ts.map +1 -0
  3. package/lib/browser/folder-preference-provider.js +57 -0
  4. package/lib/browser/folder-preference-provider.js.map +1 -0
  5. package/lib/browser/folders-preferences-provider.d.ts +27 -0
  6. package/lib/browser/folders-preferences-provider.d.ts.map +1 -0
  7. package/lib/browser/folders-preferences-provider.js +237 -0
  8. package/lib/browser/folders-preferences-provider.js.map +1 -0
  9. package/lib/browser/frontend-preference-storage.d.ts +20 -0
  10. package/lib/browser/frontend-preference-storage.d.ts.map +1 -0
  11. package/lib/browser/frontend-preference-storage.js +63 -0
  12. package/lib/browser/frontend-preference-storage.js.map +1 -0
  13. package/lib/browser/index.d.ts +5 -0
  14. package/lib/browser/index.d.ts.map +1 -0
  15. package/lib/browser/index.js +23 -0
  16. package/lib/browser/index.js.map +1 -0
  17. package/lib/browser/monaco-jsonc-editor.d.ts +10 -0
  18. package/lib/browser/monaco-jsonc-editor.d.ts.map +1 -0
  19. package/lib/browser/monaco-jsonc-editor.js +73 -0
  20. package/lib/browser/monaco-jsonc-editor.js.map +1 -0
  21. package/lib/browser/package.spec.d.ts +1 -0
  22. package/lib/browser/package.spec.d.ts.map +1 -0
  23. package/lib/browser/package.spec.js +26 -0
  24. package/lib/browser/package.spec.js.map +1 -0
  25. package/lib/browser/preference-bindings.d.ts +4 -0
  26. package/lib/browser/preference-bindings.d.ts.map +1 -0
  27. package/lib/browser/preference-bindings.js +49 -0
  28. package/lib/browser/preference-bindings.js.map +1 -0
  29. package/lib/browser/preference-frontend-contribution.d.ts +9 -0
  30. package/lib/browser/preference-frontend-contribution.d.ts.map +1 -0
  31. package/lib/browser/preference-frontend-contribution.js +45 -0
  32. package/lib/browser/preference-frontend-contribution.js.map +1 -0
  33. package/lib/browser/preference-frontend-module.d.ts +7 -0
  34. package/lib/browser/preference-frontend-module.d.ts.map +1 -0
  35. package/lib/browser/preference-frontend-module.js +67 -0
  36. package/lib/browser/preference-frontend-module.js.map +1 -0
  37. package/lib/browser/preference-open-handler.d.ts +10 -0
  38. package/lib/browser/preference-open-handler.d.ts.map +1 -0
  39. package/lib/browser/preference-open-handler.js +57 -0
  40. package/lib/browser/preference-open-handler.js.map +1 -0
  41. package/lib/browser/preference-transaction-manager.d.ts +98 -0
  42. package/lib/browser/preference-transaction-manager.d.ts.map +1 -0
  43. package/lib/browser/preference-transaction-manager.js +279 -0
  44. package/lib/browser/preference-transaction-manager.js.map +1 -0
  45. package/lib/browser/preference-tree-model.d.ts +60 -0
  46. package/lib/browser/preference-tree-model.d.ts.map +1 -0
  47. package/lib/browser/preference-tree-model.js +247 -0
  48. package/lib/browser/preference-tree-model.js.map +1 -0
  49. package/lib/browser/preferences-contribution.d.ts +35 -0
  50. package/lib/browser/preferences-contribution.d.ts.map +1 -0
  51. package/lib/browser/preferences-contribution.js +263 -0
  52. package/lib/browser/preferences-contribution.js.map +1 -0
  53. package/lib/browser/preferences-json-schema-contribution.d.ts +17 -0
  54. package/lib/browser/preferences-json-schema-contribution.d.ts.map +1 -0
  55. package/lib/browser/preferences-json-schema-contribution.js +84 -0
  56. package/lib/browser/preferences-json-schema-contribution.js.map +1 -0
  57. package/lib/browser/preferences-monaco-contribution.d.ts +2 -0
  58. package/lib/browser/preferences-monaco-contribution.d.ts.map +1 -0
  59. package/lib/browser/preferences-monaco-contribution.js +28 -0
  60. package/lib/browser/preferences-monaco-contribution.js.map +1 -0
  61. package/lib/browser/util/preference-layout.d.ts +23 -0
  62. package/lib/browser/util/preference-layout.d.ts.map +1 -0
  63. package/lib/browser/util/preference-layout.js +441 -0
  64. package/lib/browser/util/preference-layout.js.map +1 -0
  65. package/lib/browser/util/preference-scope-command-manager.d.ts +18 -0
  66. package/lib/browser/util/preference-scope-command-manager.d.ts.map +1 -0
  67. package/lib/browser/util/preference-scope-command-manager.js +80 -0
  68. package/lib/browser/util/preference-scope-command-manager.js.map +1 -0
  69. package/lib/browser/util/preference-tree-generator.d.ts +48 -0
  70. package/lib/browser/util/preference-tree-generator.d.ts.map +1 -0
  71. package/lib/browser/util/preference-tree-generator.js +277 -0
  72. package/lib/browser/util/preference-tree-generator.js.map +1 -0
  73. package/lib/browser/util/preference-tree-label-provider.d.ts +12 -0
  74. package/lib/browser/util/preference-tree-label-provider.d.ts.map +1 -0
  75. package/lib/browser/util/preference-tree-label-provider.js +74 -0
  76. package/lib/browser/util/preference-tree-label-provider.js.map +1 -0
  77. package/lib/browser/util/preference-tree-label-provider.spec.d.ts +2 -0
  78. package/lib/browser/util/preference-tree-label-provider.spec.d.ts.map +1 -0
  79. package/lib/browser/util/preference-tree-label-provider.spec.js +90 -0
  80. package/lib/browser/util/preference-tree-label-provider.spec.js.map +1 -0
  81. package/lib/browser/util/preference-types.d.ts +69 -0
  82. package/lib/browser/util/preference-types.d.ts.map +1 -0
  83. package/lib/browser/util/preference-types.js +133 -0
  84. package/lib/browser/util/preference-types.js.map +1 -0
  85. package/lib/browser/views/components/preference-array-input.d.ts +29 -0
  86. package/lib/browser/views/components/preference-array-input.d.ts.map +1 -0
  87. package/lib/browser/views/components/preference-array-input.js +176 -0
  88. package/lib/browser/views/components/preference-array-input.js.map +1 -0
  89. package/lib/browser/views/components/preference-boolean-input.d.ts +18 -0
  90. package/lib/browser/views/components/preference-boolean-input.d.ts.map +1 -0
  91. package/lib/browser/views/components/preference-boolean-input.js +75 -0
  92. package/lib/browser/views/components/preference-boolean-input.js.map +1 -0
  93. package/lib/browser/views/components/preference-file-input.d.ts +30 -0
  94. package/lib/browser/views/components/preference-file-input.d.ts.map +1 -0
  95. package/lib/browser/views/components/preference-file-input.js +103 -0
  96. package/lib/browser/views/components/preference-file-input.js.map +1 -0
  97. package/lib/browser/views/components/preference-json-input.d.ts +20 -0
  98. package/lib/browser/views/components/preference-json-input.d.ts.map +1 -0
  99. package/lib/browser/views/components/preference-json-input.js +86 -0
  100. package/lib/browser/views/components/preference-json-input.js.map +1 -0
  101. package/lib/browser/views/components/preference-markdown-renderer.d.ts +15 -0
  102. package/lib/browser/views/components/preference-markdown-renderer.d.ts.map +1 -0
  103. package/lib/browser/views/components/preference-markdown-renderer.js +86 -0
  104. package/lib/browser/views/components/preference-markdown-renderer.js.map +1 -0
  105. package/lib/browser/views/components/preference-node-renderer-creator.d.ts +49 -0
  106. package/lib/browser/views/components/preference-node-renderer-creator.d.ts.map +1 -0
  107. package/lib/browser/views/components/preference-node-renderer-creator.js +122 -0
  108. package/lib/browser/views/components/preference-node-renderer-creator.js.map +1 -0
  109. package/lib/browser/views/components/preference-node-renderer.d.ts +118 -0
  110. package/lib/browser/views/components/preference-node-renderer.d.ts.map +1 -0
  111. package/lib/browser/views/components/preference-node-renderer.js +442 -0
  112. package/lib/browser/views/components/preference-node-renderer.js.map +1 -0
  113. package/lib/browser/views/components/preference-null-input.d.ts +16 -0
  114. package/lib/browser/views/components/preference-null-input.d.ts.map +1 -0
  115. package/lib/browser/views/components/preference-null-input.js +59 -0
  116. package/lib/browser/views/components/preference-null-input.js.map +1 -0
  117. package/lib/browser/views/components/preference-number-input.d.ts +35 -0
  118. package/lib/browser/views/components/preference-number-input.d.ts.map +1 -0
  119. package/lib/browser/views/components/preference-number-input.js +174 -0
  120. package/lib/browser/views/components/preference-number-input.js.map +1 -0
  121. package/lib/browser/views/components/preference-select-input.d.ts +29 -0
  122. package/lib/browser/views/components/preference-select-input.d.ts.map +1 -0
  123. package/lib/browser/views/components/preference-select-input.js +131 -0
  124. package/lib/browser/views/components/preference-select-input.js.map +1 -0
  125. package/lib/browser/views/components/preference-string-input.d.ts +18 -0
  126. package/lib/browser/views/components/preference-string-input.d.ts.map +1 -0
  127. package/lib/browser/views/components/preference-string-input.js +85 -0
  128. package/lib/browser/views/components/preference-string-input.js.map +1 -0
  129. package/lib/browser/views/preference-editor-widget.d.ts +75 -0
  130. package/lib/browser/views/preference-editor-widget.d.ts.map +1 -0
  131. package/lib/browser/views/preference-editor-widget.js +391 -0
  132. package/lib/browser/views/preference-editor-widget.js.map +1 -0
  133. package/lib/browser/views/preference-scope-tabbar-widget.d.ts +55 -0
  134. package/lib/browser/views/preference-scope-tabbar-widget.d.ts.map +1 -0
  135. package/lib/browser/views/preference-scope-tabbar-widget.js +337 -0
  136. package/lib/browser/views/preference-scope-tabbar-widget.js.map +1 -0
  137. package/lib/browser/views/preference-searchbar-widget.d.ts +54 -0
  138. package/lib/browser/views/preference-searchbar-widget.d.ts.map +1 -0
  139. package/lib/browser/views/preference-searchbar-widget.js +163 -0
  140. package/lib/browser/views/preference-searchbar-widget.js.map +1 -0
  141. package/lib/browser/views/preference-tree-widget.d.ts +20 -0
  142. package/lib/browser/views/preference-tree-widget.d.ts.map +1 -0
  143. package/lib/browser/views/preference-tree-widget.js +106 -0
  144. package/lib/browser/views/preference-tree-widget.js.map +1 -0
  145. package/lib/browser/views/preference-widget-bindings.d.ts +4 -0
  146. package/lib/browser/views/preference-widget-bindings.d.ts.map +1 -0
  147. package/lib/browser/views/preference-widget-bindings.js +91 -0
  148. package/lib/browser/views/preference-widget-bindings.js.map +1 -0
  149. package/lib/browser/views/preference-widget.d.ts +38 -0
  150. package/lib/browser/views/preference-widget.d.ts.map +1 -0
  151. package/lib/browser/views/preference-widget.js +120 -0
  152. package/lib/browser/views/preference-widget.js.map +1 -0
  153. package/lib/browser/workspace-file-preference-provider.d.ts +24 -0
  154. package/lib/browser/workspace-file-preference-provider.d.ts.map +1 -0
  155. package/lib/browser/workspace-file-preference-provider.js +103 -0
  156. package/lib/browser/workspace-file-preference-provider.js.map +1 -0
  157. package/lib/browser/workspace-preference-provider.d.ts +36 -0
  158. package/lib/browser/workspace-preference-provider.d.ts.map +1 -0
  159. package/lib/browser/workspace-preference-provider.js +147 -0
  160. package/lib/browser/workspace-preference-provider.js.map +1 -0
  161. package/lib/common/abstract-resource-preference-provider.d.ts +69 -0
  162. package/lib/common/abstract-resource-preference-provider.d.ts.map +1 -0
  163. package/lib/common/abstract-resource-preference-provider.js +207 -0
  164. package/lib/common/abstract-resource-preference-provider.js.map +1 -0
  165. package/lib/common/abstract-resource-preference-provider.spec.d.ts +2 -0
  166. package/lib/common/abstract-resource-preference-provider.spec.d.ts.map +1 -0
  167. package/lib/common/abstract-resource-preference-provider.spec.js +84 -0
  168. package/lib/common/abstract-resource-preference-provider.spec.js.map +1 -0
  169. package/lib/common/cli-preferences.d.ts +6 -0
  170. package/lib/common/cli-preferences.d.ts.map +1 -0
  171. package/lib/common/cli-preferences.js +21 -0
  172. package/lib/common/cli-preferences.js.map +1 -0
  173. package/lib/common/jsonc-editor.d.ts +10 -0
  174. package/lib/common/jsonc-editor.d.ts.map +1 -0
  175. package/lib/common/jsonc-editor.js +68 -0
  176. package/lib/common/jsonc-editor.js.map +1 -0
  177. package/lib/common/section-preference-provider.d.ts +20 -0
  178. package/lib/common/section-preference-provider.d.ts.map +1 -0
  179. package/lib/common/section-preference-provider.js +84 -0
  180. package/lib/common/section-preference-provider.js.map +1 -0
  181. package/lib/common/user-configs-preference-provider.d.ts +24 -0
  182. package/lib/common/user-configs-preference-provider.d.ts.map +1 -0
  183. package/lib/common/user-configs-preference-provider.js +134 -0
  184. package/lib/common/user-configs-preference-provider.js.map +1 -0
  185. package/lib/common/user-preference-provider.d.ts +14 -0
  186. package/lib/common/user-preference-provider.d.ts.map +1 -0
  187. package/lib/common/user-preference-provider.js +37 -0
  188. package/lib/common/user-preference-provider.js.map +1 -0
  189. package/lib/node/backend-preference-storage.d.ts +34 -0
  190. package/lib/node/backend-preference-storage.d.ts.map +1 -0
  191. package/lib/node/backend-preference-storage.js +100 -0
  192. package/lib/node/backend-preference-storage.js.map +1 -0
  193. package/lib/node/preference-backend-module.d.ts +4 -0
  194. package/lib/node/preference-backend-module.d.ts.map +1 -0
  195. package/lib/node/preference-backend-module.js +41 -0
  196. package/lib/node/preference-backend-module.js.map +1 -0
  197. package/lib/node/preference-bindings.d.ts +3 -0
  198. package/lib/node/preference-bindings.d.ts.map +1 -0
  199. package/lib/node/preference-bindings.js +33 -0
  200. package/lib/node/preference-bindings.js.map +1 -0
  201. package/lib/node/preference-cli-contribution.d.ts +11 -0
  202. package/lib/node/preference-cli-contribution.d.ts.map +1 -0
  203. package/lib/node/preference-cli-contribution.js +48 -0
  204. package/lib/node/preference-cli-contribution.js.map +1 -0
  205. package/package.json +8 -8
  206. package/src/browser/style/index.css +29 -28
@@ -0,0 +1,263 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 Ericsson and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.PreferencesContribution = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const core_1 = require("@theia/core");
22
+ const browser_1 = require("@theia/core/lib/browser");
23
+ const os_1 = require("@theia/core/lib/common/os");
24
+ const browser_2 = require("@theia/editor/lib/browser");
25
+ const preference_widget_1 = require("./views/preference-widget");
26
+ const preference_types_1 = require("./util/preference-types");
27
+ const clipboard_service_1 = require("@theia/core/lib/browser/clipboard-service");
28
+ const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
29
+ const browser_3 = require("@theia/workspace/lib/browser");
30
+ let PreferencesContribution = class PreferencesContribution extends browser_1.AbstractViewContribution {
31
+ constructor() {
32
+ super({
33
+ widgetId: preference_widget_1.PreferencesWidget.ID,
34
+ widgetName: preference_widget_1.PreferencesWidget.LABEL,
35
+ defaultWidgetOptions: {
36
+ area: 'main',
37
+ },
38
+ });
39
+ }
40
+ registerCommands(commands) {
41
+ commands.registerCommand(browser_1.CommonCommands.OPEN_PREFERENCES, {
42
+ execute: async (query) => {
43
+ const widget = await this.openView({ activate: true });
44
+ if (typeof query === 'string') {
45
+ widget.setSearchTerm(query);
46
+ }
47
+ },
48
+ });
49
+ commands.registerCommand(preference_types_1.PreferencesCommands.OPEN_PREFERENCES_JSON_TOOLBAR, {
50
+ isEnabled: () => true,
51
+ isVisible: w => this.withWidget(w, () => true),
52
+ execute: (preferenceId) => {
53
+ this.openPreferencesJSON(preferenceId);
54
+ }
55
+ });
56
+ commands.registerCommand(preference_types_1.PreferencesCommands.COPY_JSON_NAME, {
57
+ isEnabled: preference_types_1.Preference.EditorCommandArgs.is,
58
+ isVisible: preference_types_1.Preference.EditorCommandArgs.is,
59
+ execute: ({ id, value }) => {
60
+ this.clipboardService.writeText(id);
61
+ }
62
+ });
63
+ commands.registerCommand(preference_types_1.PreferencesCommands.COPY_JSON_VALUE, {
64
+ isEnabled: preference_types_1.Preference.EditorCommandArgs.is,
65
+ isVisible: preference_types_1.Preference.EditorCommandArgs.is,
66
+ execute: ({ id, value }) => {
67
+ const jsonString = `"${id}": ${JSON.stringify(value)}`;
68
+ this.clipboardService.writeText(jsonString);
69
+ }
70
+ });
71
+ commands.registerCommand(preference_types_1.PreferencesCommands.RESET_PREFERENCE, {
72
+ isEnabled: preference_types_1.Preference.EditorCommandArgs.is,
73
+ isVisible: preference_types_1.Preference.EditorCommandArgs.is,
74
+ execute: ({ id }) => {
75
+ this.preferenceService.set(id, undefined, Number(this.scopeTracker.currentScope.scope), this.scopeTracker.currentScope.uri);
76
+ }
77
+ });
78
+ commands.registerCommand(preference_types_1.PreferencesCommands.OPEN_USER_PREFERENCES, {
79
+ execute: async () => {
80
+ const widget = await this.openView({ activate: true });
81
+ widget.setScope(core_1.PreferenceScope.User);
82
+ }
83
+ });
84
+ commands.registerCommand(preference_types_1.PreferencesCommands.OPEN_WORKSPACE_PREFERENCES, {
85
+ isEnabled: () => !!this.workspaceService.workspace,
86
+ isVisible: () => !!this.workspaceService.workspace,
87
+ execute: async () => {
88
+ const widget = await this.openView({ activate: true });
89
+ widget.setScope(core_1.PreferenceScope.Workspace);
90
+ }
91
+ });
92
+ commands.registerCommand(preference_types_1.PreferencesCommands.OPEN_FOLDER_PREFERENCES, {
93
+ isEnabled: () => !!this.workspaceService.isMultiRootWorkspaceOpened && this.workspaceService.tryGetRoots().length > 0,
94
+ isVisible: () => !!this.workspaceService.isMultiRootWorkspaceOpened && this.workspaceService.tryGetRoots().length > 0,
95
+ execute: () => this.openFolderPreferences(root => {
96
+ this.openView({ activate: true });
97
+ this.scopeTracker.setScope(root.resource);
98
+ })
99
+ });
100
+ commands.registerCommand(preference_types_1.PreferencesCommands.OPEN_USER_PREFERENCES_JSON, {
101
+ execute: async () => this.openJson(core_1.PreferenceScope.User)
102
+ });
103
+ commands.registerCommand(preference_types_1.PreferencesCommands.OPEN_WORKSPACE_PREFERENCES_JSON, {
104
+ isEnabled: () => !!this.workspaceService.workspace,
105
+ isVisible: () => !!this.workspaceService.workspace,
106
+ execute: async () => this.openJson(core_1.PreferenceScope.Workspace)
107
+ });
108
+ commands.registerCommand(preference_types_1.PreferencesCommands.OPEN_FOLDER_PREFERENCES_JSON, {
109
+ isEnabled: () => !!this.workspaceService.isMultiRootWorkspaceOpened && this.workspaceService.tryGetRoots().length > 0,
110
+ isVisible: () => !!this.workspaceService.isMultiRootWorkspaceOpened && this.workspaceService.tryGetRoots().length > 0,
111
+ execute: () => this.openFolderPreferences(root => this.openJson(core_1.PreferenceScope.Folder, root.resource.toString()))
112
+ });
113
+ }
114
+ registerMenus(menus) {
115
+ menus.registerMenuAction(browser_1.CommonMenus.FILE_SETTINGS_SUBMENU_OPEN, {
116
+ commandId: browser_1.CommonCommands.OPEN_PREFERENCES.id,
117
+ label: core_1.nls.localizeByDefault('Settings'),
118
+ order: 'a10',
119
+ });
120
+ menus.registerMenuAction(browser_1.CommonMenus.MANAGE_SETTINGS, {
121
+ commandId: browser_1.CommonCommands.OPEN_PREFERENCES.id,
122
+ label: core_1.nls.localizeByDefault('Settings'),
123
+ order: 'a10',
124
+ });
125
+ menus.registerMenuAction(preference_types_1.PreferenceMenus.PREFERENCE_EDITOR_CONTEXT_MENU, {
126
+ commandId: preference_types_1.PreferencesCommands.RESET_PREFERENCE.id,
127
+ label: preference_types_1.PreferencesCommands.RESET_PREFERENCE.label,
128
+ order: 'a'
129
+ });
130
+ menus.registerMenuAction(preference_types_1.PreferenceMenus.PREFERENCE_EDITOR_COPY_ACTIONS, {
131
+ commandId: preference_types_1.PreferencesCommands.COPY_JSON_VALUE.id,
132
+ label: preference_types_1.PreferencesCommands.COPY_JSON_VALUE.label,
133
+ order: 'b'
134
+ });
135
+ menus.registerMenuAction(preference_types_1.PreferenceMenus.PREFERENCE_EDITOR_COPY_ACTIONS, {
136
+ commandId: preference_types_1.PreferencesCommands.COPY_JSON_NAME.id,
137
+ label: preference_types_1.PreferencesCommands.COPY_JSON_NAME.label,
138
+ order: 'c'
139
+ });
140
+ }
141
+ registerKeybindings(keybindings) {
142
+ keybindings.registerKeybinding({
143
+ command: browser_1.CommonCommands.OPEN_PREFERENCES.id,
144
+ keybinding: (os_1.isOSX && !browser_1.isFirefox) ? 'cmd+,' : 'ctrl+,'
145
+ });
146
+ }
147
+ registerToolbarItems(toolbar) {
148
+ toolbar.registerItem({
149
+ id: preference_types_1.PreferencesCommands.OPEN_PREFERENCES_JSON_TOOLBAR.id,
150
+ command: preference_types_1.PreferencesCommands.OPEN_PREFERENCES_JSON_TOOLBAR.id,
151
+ tooltip: preference_types_1.PreferencesCommands.OPEN_USER_PREFERENCES_JSON.label,
152
+ priority: 0,
153
+ });
154
+ }
155
+ async openPreferencesJSON(opener) {
156
+ var _a;
157
+ const { scope, activeScopeIsFolder, uri } = this.scopeTracker.currentScope;
158
+ const scopeID = Number(scope);
159
+ let preferenceId = '';
160
+ if (typeof opener === 'string') {
161
+ preferenceId = opener;
162
+ const currentPreferenceValue = this.preferenceService.inspect(preferenceId, uri);
163
+ const valueInCurrentScope = (_a = preference_types_1.Preference.getValueInScope(currentPreferenceValue, scopeID)) !== null && _a !== void 0 ? _a : currentPreferenceValue === null || currentPreferenceValue === void 0 ? void 0 : currentPreferenceValue.defaultValue;
164
+ this.preferenceService.set(preferenceId, valueInCurrentScope, scopeID, uri);
165
+ }
166
+ let jsonEditorWidget;
167
+ const jsonUriToOpen = await this.obtainConfigUri(scopeID, activeScopeIsFolder, uri);
168
+ if (jsonUriToOpen) {
169
+ jsonEditorWidget = await this.editorManager.open(jsonUriToOpen);
170
+ if (preferenceId) {
171
+ const text = jsonEditorWidget.editor.document.getText();
172
+ if (preferenceId) {
173
+ const { index } = text.match(preferenceId);
174
+ const numReturns = text.slice(0, index).match(new RegExp('\n', 'g')).length;
175
+ jsonEditorWidget.editor.cursor = { line: numReturns, character: 4 + preferenceId.length + 4 };
176
+ }
177
+ }
178
+ }
179
+ }
180
+ async openJson(scope, resource) {
181
+ const jsonUriToOpen = await this.obtainConfigUri(scope, false, resource);
182
+ if (jsonUriToOpen) {
183
+ await this.editorManager.open(jsonUriToOpen);
184
+ }
185
+ }
186
+ /**
187
+ * Prompts which workspace root folder to open the JSON settings.
188
+ */
189
+ async openFolderPreferences(callback) {
190
+ var _a;
191
+ const roots = this.workspaceService.tryGetRoots();
192
+ if (roots.length === 1) {
193
+ callback(roots[0]);
194
+ }
195
+ else {
196
+ const items = roots.map(root => ({
197
+ label: root.name,
198
+ description: root.resource.path.fsPath(),
199
+ execute: () => callback(root)
200
+ }));
201
+ (_a = this.quickInputService) === null || _a === void 0 ? void 0 : _a.showQuickPick(items, { placeholder: 'Select workspace folder' });
202
+ }
203
+ }
204
+ async obtainConfigUri(serializedScope, activeScopeIsFolder, resource) {
205
+ let scope = serializedScope;
206
+ if (activeScopeIsFolder) {
207
+ scope = core_1.PreferenceScope.Folder;
208
+ }
209
+ const resourceUri = !!resource ? resource : undefined;
210
+ const configUri = this.preferenceService.getConfigUri(scope, resourceUri);
211
+ if (!configUri) {
212
+ return undefined;
213
+ }
214
+ if (configUri && !await this.fileService.exists(configUri)) {
215
+ await this.fileService.create(configUri);
216
+ }
217
+ return configUri;
218
+ }
219
+ /**
220
+ * Determine if the current widget is the PreferencesWidget.
221
+ */
222
+ withWidget(widget = this.tryGetWidget(), fn) {
223
+ if (widget instanceof preference_widget_1.PreferencesWidget && widget.id === preference_widget_1.PreferencesWidget.ID) {
224
+ return fn(widget);
225
+ }
226
+ return false;
227
+ }
228
+ };
229
+ exports.PreferencesContribution = PreferencesContribution;
230
+ tslib_1.__decorate([
231
+ (0, inversify_1.inject)(file_service_1.FileService),
232
+ tslib_1.__metadata("design:type", file_service_1.FileService)
233
+ ], PreferencesContribution.prototype, "fileService", void 0);
234
+ tslib_1.__decorate([
235
+ (0, inversify_1.inject)(browser_2.EditorManager),
236
+ tslib_1.__metadata("design:type", browser_2.EditorManager)
237
+ ], PreferencesContribution.prototype, "editorManager", void 0);
238
+ tslib_1.__decorate([
239
+ (0, inversify_1.inject)(core_1.PreferenceService),
240
+ tslib_1.__metadata("design:type", Object)
241
+ ], PreferencesContribution.prototype, "preferenceService", void 0);
242
+ tslib_1.__decorate([
243
+ (0, inversify_1.inject)(clipboard_service_1.ClipboardService),
244
+ tslib_1.__metadata("design:type", Object)
245
+ ], PreferencesContribution.prototype, "clipboardService", void 0);
246
+ tslib_1.__decorate([
247
+ (0, inversify_1.inject)(preference_widget_1.PreferencesWidget),
248
+ tslib_1.__metadata("design:type", preference_widget_1.PreferencesWidget)
249
+ ], PreferencesContribution.prototype, "scopeTracker", void 0);
250
+ tslib_1.__decorate([
251
+ (0, inversify_1.inject)(browser_3.WorkspaceService),
252
+ tslib_1.__metadata("design:type", browser_3.WorkspaceService)
253
+ ], PreferencesContribution.prototype, "workspaceService", void 0);
254
+ tslib_1.__decorate([
255
+ (0, inversify_1.inject)(browser_1.QuickInputService),
256
+ (0, inversify_1.optional)(),
257
+ tslib_1.__metadata("design:type", Object)
258
+ ], PreferencesContribution.prototype, "quickInputService", void 0);
259
+ exports.PreferencesContribution = PreferencesContribution = tslib_1.__decorate([
260
+ (0, inversify_1.injectable)(),
261
+ tslib_1.__metadata("design:paramtypes", [])
262
+ ], PreferencesContribution);
263
+ //# sourceMappingURL=preferences-contribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences-contribution.js","sourceRoot":"","sources":["../../src/browser/preferences-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAA4E;AAC5E,sCAA0G;AAC1G,qDASiC;AACjC,kDAAkD;AAElD,uDAAwE;AAExE,iEAA8D;AAC9D,8DAA2F;AAC3F,iFAA6E;AAC7E,6EAAyE;AACzE,0DAAgE;AAIzD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,kCAA2C;IAUpF;QACI,KAAK,CAAC;YACF,QAAQ,EAAE,qCAAiB,CAAC,EAAE;YAC9B,UAAU,EAAE,qCAAiB,CAAC,KAAK;YACnC,oBAAoB,EAAE;gBAClB,IAAI,EAAE,MAAM;aACf;SACJ,CAAC,CAAC;IACP,CAAC;IAEQ,gBAAgB,CAAC,QAAyB;QAC/C,QAAQ,CAAC,eAAe,CAAC,wBAAc,CAAC,gBAAgB,EAAE;YACtD,OAAO,EAAE,KAAK,EAAE,KAAc,EAAE,EAAE;gBAC9B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CA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,IAAI,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;OAEG;IACO,UAAU,CAAI,SAA6B,IAAI,CAAC,YAAY,EAAE,EAAE,EAAoC;QAC1G,IAAI,MAAM,YAAY,qCAAiB,IAAI,MAAM,CAAC,EAAE,KAAK,qCAAiB,CAAC,EAAE,EAAE,CAAC;YAC5E,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AAvNY,0DAAuB;AAEQ;IAAvC,IAAA,kBAAM,EAAC,0BAAW,CAAC;sCAAiC,0BAAW;4DAAC;AACvB;IAAzC,IAAA,kBAAM,EAAC,uBAAa,CAAC;sCAAmC,uBAAa;8DAAC;AACzB;IAA7C,IAAA,kBAAM,EAAC,wBAAiB,CAAC;;kEAAyD;AACtC;IAA5C,IAAA,kBAAM,EAAC,oCAAgB,CAAC;;iEAAuD;AAClC;IAA7C,IAAA,kBAAM,EAAC,qCAAiB,CAAC;sCAAkC,qCAAiB;6DAAC;AACjC;IAA5C,IAAA,kBAAM,EAAC,0BAAgB,CAAC;sCAAsC,0BAAgB;iEAAC;AACtB;IAAzD,IAAA,kBAAM,EAAC,2BAAiB,CAAC;IAAE,IAAA,oBAAQ,GAAE;;kEAAyD;kCARtF,uBAAuB;IADnC,IAAA,sBAAU,GAAE;;GACA,uBAAuB,CAuNnC"}
@@ -0,0 +1,17 @@
1
+ /// <reference types="lodash" />
2
+ import URI from '@theia/core/lib/common/uri';
3
+ import { JsonSchemaRegisterContext, JsonSchemaContribution, JsonSchemaDataStore } from '@theia/core/lib/browser/json-schema-store';
4
+ import { WorkspaceService } from '@theia/workspace/lib/browser';
5
+ import { PreferenceSchemaService, PreferenceConfigurations, PreferenceScope } from '@theia/core';
6
+ export declare class PreferencesJsonSchemaContribution implements JsonSchemaContribution {
7
+ protected readonly schemaProvider: PreferenceSchemaService;
8
+ protected readonly preferenceConfigurations: PreferenceConfigurations;
9
+ protected readonly jsonSchemaData: JsonSchemaDataStore;
10
+ protected readonly workspaceService: WorkspaceService;
11
+ protected readonly debouncedUpdateInMemoryResources: import("lodash").DebouncedFunc<() => void>;
12
+ registerSchemas(context: JsonSchemaRegisterContext): void;
13
+ protected registerSchema(scope: PreferenceScope, context: JsonSchemaRegisterContext): void;
14
+ protected updateInMemoryResources(): void;
15
+ protected getSchemaURIForScope(scope: PreferenceScope): URI;
16
+ }
17
+ //# sourceMappingURL=preferences-json-schema-contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences-json-schema-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/preferences-json-schema-contribution.ts"],"names":[],"mappings":";AAiBA,OAAO,GAAG,MAAM,4BAA4B,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACnI,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAOjG,qBACa,iCAAkC,YAAW,sBAAsB;IAG5E,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,uBAAuB,CAAC;IAG3D,SAAS,CAAC,QAAQ,CAAC,wBAAwB,EAAE,wBAAwB,CAAC;IAGtE,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,mBAAmB,CAAC;IAGvD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAEtD,SAAS,CAAC,QAAQ,CAAC,gCAAgC,6CAA0E;IAE7H,eAAe,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAoBzD,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAO1F,SAAS,CAAC,uBAAuB,IAAI,IAAI;IAWzC,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG;CAG9D"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.PreferencesJsonSchemaContribution = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const uri_1 = require("@theia/core/lib/common/uri");
22
+ const json_schema_store_1 = require("@theia/core/lib/browser/json-schema-store");
23
+ const browser_1 = require("@theia/workspace/lib/browser");
24
+ const core_1 = require("@theia/core");
25
+ const browser_2 = require("@theia/userstorage/lib/browser");
26
+ const debounce = require("@theia/core/shared/lodash.debounce");
27
+ const PREFERENCE_URI_PREFIX = 'vscode://schemas/settings/';
28
+ const DEBOUNCED_UPDATE_DELAY = 200;
29
+ let PreferencesJsonSchemaContribution = class PreferencesJsonSchemaContribution {
30
+ constructor() {
31
+ this.debouncedUpdateInMemoryResources = debounce(() => this.updateInMemoryResources(), DEBOUNCED_UPDATE_DELAY);
32
+ }
33
+ registerSchemas(context) {
34
+ this.registerSchema(core_1.PreferenceScope.Default, context);
35
+ this.registerSchema(core_1.PreferenceScope.User, context);
36
+ this.registerSchema(core_1.PreferenceScope.Workspace, context);
37
+ this.registerSchema(core_1.PreferenceScope.Folder, context);
38
+ context.registerSchema({
39
+ fileMatch: `file://**/${this.preferenceConfigurations.getConfigName()}.json`,
40
+ url: this.getSchemaURIForScope(core_1.PreferenceScope.Folder).toString()
41
+ });
42
+ context.registerSchema({
43
+ fileMatch: browser_2.UserStorageUri.resolve(this.preferenceConfigurations.getConfigName() + '.json').toString(),
44
+ url: this.getSchemaURIForScope(core_1.PreferenceScope.User).toString()
45
+ });
46
+ this.workspaceService.updateSchema('settings', { $ref: this.getSchemaURIForScope(core_1.PreferenceScope.Workspace).toString() });
47
+ this.schemaProvider.onDidChangeSchema(() => this.debouncedUpdateInMemoryResources());
48
+ }
49
+ registerSchema(scope, context) {
50
+ const scopeStr = core_1.PreferenceScope[scope].toLowerCase();
51
+ const uri = new uri_1.default(PREFERENCE_URI_PREFIX + scopeStr);
52
+ this.jsonSchemaData.setSchema(uri, (this.schemaProvider.getJSONSchema(scope)));
53
+ }
54
+ updateInMemoryResources() {
55
+ this.jsonSchemaData.setSchema(this.getSchemaURIForScope(core_1.PreferenceScope.Default), (this.schemaProvider.getJSONSchema(core_1.PreferenceScope.Default)));
56
+ this.jsonSchemaData.setSchema(this.getSchemaURIForScope(core_1.PreferenceScope.User), this.schemaProvider.getJSONSchema(core_1.PreferenceScope.User));
57
+ this.jsonSchemaData.setSchema(this.getSchemaURIForScope(core_1.PreferenceScope.Workspace), this.schemaProvider.getJSONSchema(core_1.PreferenceScope.Workspace));
58
+ this.jsonSchemaData.setSchema(this.getSchemaURIForScope(core_1.PreferenceScope.Folder), this.schemaProvider.getJSONSchema(core_1.PreferenceScope.Folder));
59
+ }
60
+ getSchemaURIForScope(scope) {
61
+ return new uri_1.default(PREFERENCE_URI_PREFIX + core_1.PreferenceScope[scope].toLowerCase());
62
+ }
63
+ };
64
+ exports.PreferencesJsonSchemaContribution = PreferencesJsonSchemaContribution;
65
+ tslib_1.__decorate([
66
+ (0, inversify_1.inject)(core_1.PreferenceSchemaService),
67
+ tslib_1.__metadata("design:type", Object)
68
+ ], PreferencesJsonSchemaContribution.prototype, "schemaProvider", void 0);
69
+ tslib_1.__decorate([
70
+ (0, inversify_1.inject)(core_1.PreferenceConfigurations),
71
+ tslib_1.__metadata("design:type", core_1.PreferenceConfigurations)
72
+ ], PreferencesJsonSchemaContribution.prototype, "preferenceConfigurations", void 0);
73
+ tslib_1.__decorate([
74
+ (0, inversify_1.inject)(json_schema_store_1.JsonSchemaDataStore),
75
+ tslib_1.__metadata("design:type", json_schema_store_1.JsonSchemaDataStore)
76
+ ], PreferencesJsonSchemaContribution.prototype, "jsonSchemaData", void 0);
77
+ tslib_1.__decorate([
78
+ (0, inversify_1.inject)(browser_1.WorkspaceService),
79
+ tslib_1.__metadata("design:type", browser_1.WorkspaceService)
80
+ ], PreferencesJsonSchemaContribution.prototype, "workspaceService", void 0);
81
+ exports.PreferencesJsonSchemaContribution = PreferencesJsonSchemaContribution = tslib_1.__decorate([
82
+ (0, inversify_1.injectable)()
83
+ ], PreferencesJsonSchemaContribution);
84
+ //# sourceMappingURL=preferences-json-schema-contribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences-json-schema-contribution.js","sourceRoot":"","sources":["../../src/browser/preferences-json-schema-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAkE;AAClE,oDAA6C;AAC7C,iFAAmI;AACnI,0DAAgE;AAChE,sCAAiG;AACjG,4DAAgE;AAChE,+DAAgE;AAEhE,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAC3D,MAAM,sBAAsB,GAAG,GA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,8EAAiC;AAGvB;IADlB,IAAA,kBAAM,EAAC,8BAAuB,CAAC;;yEAC2B;AAGxC;IADlB,IAAA,kBAAM,EAAC,+BAAwB,CAAC;sCACY,+BAAwB;mFAAC;AAGnD;IADlB,IAAA,kBAAM,EAAC,uCAAmB,CAAC;sCACO,uCAAmB;yEAAC;AAGpC;IADlB,IAAA,kBAAM,EAAC,0BAAgB,CAAC;sCACY,0BAAgB;2EAAC;4CAZ7C,iCAAiC;IAD7C,IAAA,sBAAU,GAAE;GACA,iCAAiC,CAyD7C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=preferences-monaco-contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences-monaco-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/preferences-monaco-contribution.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const monaco = require("@theia/monaco-editor-core");
19
+ monaco.languages.register({
20
+ id: 'jsonc',
21
+ 'aliases': [
22
+ 'JSON with Comments'
23
+ ],
24
+ 'filenames': [
25
+ 'settings.json'
26
+ ]
27
+ });
28
+ //# sourceMappingURL=preferences-monaco-contribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences-monaco-contribution.js","sourceRoot":"","sources":["../../src/browser/preferences-monaco-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,oDAAoD;AAEpD,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;IACtB,EAAE,EAAE,OAAO;IACX,SAAS,EAAE;QACP,oBAAoB;KACvB;IACD,WAAW,EAAE;QACT,eAAe;KAClB;CACJ,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ export interface PreferenceLayout {
2
+ id: string;
3
+ label: string;
4
+ children?: PreferenceLayout[];
5
+ settings?: string[];
6
+ }
7
+ export declare const COMMONLY_USED_SECTION_PREFIX = "commonly-used";
8
+ export declare const COMMONLY_USED_LAYOUT: {
9
+ id: string;
10
+ label: string;
11
+ settings: string[];
12
+ };
13
+ export declare const DEFAULT_LAYOUT: PreferenceLayout[];
14
+ export declare class PreferenceLayoutProvider {
15
+ getLayout(): PreferenceLayout[];
16
+ getCommonlyUsedLayout(): PreferenceLayout;
17
+ hasCategory(id: string): boolean;
18
+ getLayoutForPreference(preferenceId: string): PreferenceLayout | undefined;
19
+ protected findItemInSection(section: PreferenceLayout, preferenceId: string): PreferenceLayout | undefined;
20
+ protected matchesSetting(preferenceId: string, setting: string): boolean;
21
+ protected createRegExp(setting: string): RegExp;
22
+ }
23
+ //# sourceMappingURL=preference-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preference-layout.d.ts","sourceRoot":"","sources":["../../../src/browser/util/preference-layout.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB;;;;CAgBhC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,gBAAgB,EA2V5C,CAAC;AAEF,qBACa,wBAAwB;IAEjC,SAAS,IAAI,gBAAgB,EAAE;IAI/B,qBAAqB,IAAI,gBAAgB;IAIzC,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIhC,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAW1E,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAqB1G,SAAS,CAAC,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAOxE,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAIlD"}