apiuikit 0.3.0 → 1.0.0

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 (149) hide show
  1. package/README.md +66 -7
  2. package/dist/LinkedInExtension-6xekO5bX.cjs +1 -0
  3. package/dist/LinkedInExtension-BL-4T9tt.js +21 -0
  4. package/dist/LogoExtension-BOYrY_RE.cjs +1 -0
  5. package/dist/LogoExtension-HOlSsQf-.js +27 -0
  6. package/dist/XExtension-GyRtdHLL.js +23 -0
  7. package/dist/XExtension-jAiATfg-.cjs +1 -0
  8. package/dist/apiuikit.cjs.js +1 -1
  9. package/dist/apiuikit.css +1 -1
  10. package/dist/apiuikit.es.js +24 -17
  11. package/dist/c-Bz1-FJiA.js +277 -0
  12. package/dist/c-C_Sx7N-F.cjs +1 -0
  13. package/dist/clojure-DWYEZwCD.cjs +1 -0
  14. package/dist/clojure-aY2138WD.js +135 -0
  15. package/dist/components/Authorization.d.ts +28 -17
  16. package/dist/components/ChannelAddress.d.ts +8 -2
  17. package/dist/components/CodeBlock.d.ts +4 -1
  18. package/dist/components/CodeSamples.d.ts +12 -0
  19. package/dist/components/CollapsiblePanel.d.ts +24 -0
  20. package/dist/components/CopyMarkdownButton.d.ts +15 -0
  21. package/dist/components/Examples.d.ts +4 -2
  22. package/dist/components/InfoMetadata.d.ts +21 -2
  23. package/dist/components/Markdown.d.ts +2 -0
  24. package/dist/components/MarkdownExportMenu.d.ts +13 -0
  25. package/dist/components/MethodBadge.d.ts +14 -0
  26. package/dist/components/Navigation/AsyncAPINavigation.d.ts +28 -0
  27. package/dist/components/Navigation/Navigation.d.ts +58 -0
  28. package/dist/components/Navigation/OpenAPINavigation.d.ts +22 -0
  29. package/dist/components/Navigation/SpecNavigation.d.ts +25 -0
  30. package/dist/components/Navigation/index.d.ts +4 -0
  31. package/dist/components/Navigation/sharedSections.d.ts +10 -0
  32. package/dist/components/RenderExtensions.d.ts +28 -0
  33. package/dist/components/Section.d.ts +3 -1
  34. package/dist/components/ServerAddressBanner.d.ts +16 -0
  35. package/dist/components/SidePanel.d.ts +2 -0
  36. package/dist/components/Tabs.d.ts +3 -1
  37. package/dist/components/schema/SchemaTab.d.ts +24 -3
  38. package/dist/components/tests/Authorization.test.d.ts +1 -0
  39. package/dist/components/tests/Bindings.test.d.ts +1 -0
  40. package/dist/components/tests/CodeBlock.test.d.ts +1 -0
  41. package/dist/components/tests/CodeSamples.test.d.ts +1 -0
  42. package/dist/components/tests/CopyMarkdownButton.test.d.ts +1 -0
  43. package/dist/components/tests/MarkdownExportMenu.test.d.ts +1 -0
  44. package/dist/components/tests/RenderExtensions.test.d.ts +1 -0
  45. package/dist/config/config.d.ts +10 -0
  46. package/dist/containers/AsyncAPI/AsyncAPI.d.ts +12 -6
  47. package/dist/containers/AsyncAPI/AsyncAPIRenderer.d.ts +9 -0
  48. package/dist/containers/Information/InformationSection.d.ts +22 -0
  49. package/dist/containers/Information/OpenAPIInformation.d.ts +9 -0
  50. package/dist/containers/OpenAPI/Layout.d.ts +7 -0
  51. package/dist/containers/OpenAPI/OpenAPI.d.ts +18 -0
  52. package/dist/containers/OpenAPI/OpenAPIDocumentProvider.d.ts +13 -0
  53. package/dist/containers/OpenAPI/OpenAPIRenderer.d.ts +17 -0
  54. package/dist/containers/OpenAPI/tests/OpenAPI.test.d.ts +1 -0
  55. package/dist/containers/OpenAPI/tests/OpenAPIRenderer.test.d.ts +1 -0
  56. package/dist/containers/Operation/Operations.d.ts +2 -1
  57. package/dist/containers/Path/OperationCallbacks.d.ts +37 -0
  58. package/dist/containers/Path/PathOperation.d.ts +21 -0
  59. package/dist/containers/Path/Paths.d.ts +16 -0
  60. package/dist/containers/Path/ResponseLinks.d.ts +21 -0
  61. package/dist/containers/Path/tests/PathOperation.test.d.ts +1 -0
  62. package/dist/containers/Server/OpenAPIServer.d.ts +4 -0
  63. package/dist/containers/Server/OpenAPIServers.d.ts +13 -0
  64. package/dist/contants.d.ts +7 -0
  65. package/dist/contexts/useSpec.d.ts +30 -6
  66. package/dist/crystal-BcGgviMR.cjs +1 -0
  67. package/dist/crystal-BtD5fR4q.js +283 -0
  68. package/dist/csharp-AnFv7wyC.js +382 -0
  69. package/dist/csharp-yuAGIuP4.cjs +1 -0
  70. package/dist/go-BpetKc7b.cjs +1 -0
  71. package/dist/go-CkZ9_bn0.js +151 -0
  72. package/dist/helpers/codeSamples.d.ts +92 -0
  73. package/dist/helpers/exampleSchema.d.ts +19 -0
  74. package/dist/helpers/hljsLanguages.d.ts +6 -0
  75. package/dist/helpers/openapiParser.d.ts +10 -0
  76. package/dist/helpers/openapiSearchIndex.d.ts +3 -0
  77. package/dist/helpers/resolveDocument.d.ts +8 -0
  78. package/dist/helpers/runtimeExpression.d.ts +15 -0
  79. package/dist/helpers/schemaExample.d.ts +9 -0
  80. package/dist/helpers/searchIndex.d.ts +5 -2
  81. package/dist/helpers/tests/codeSamples.test.d.ts +1 -0
  82. package/dist/helpers/tests/exampleSchema.test.d.ts +1 -0
  83. package/dist/helpers/tests/openapiSearchIndex.test.d.ts +1 -0
  84. package/dist/helpers/tests/toMarkdown.test.d.ts +1 -0
  85. package/dist/helpers/toMarkdown.d.ts +20 -0
  86. package/dist/hooks/useDocumentProviderValue.d.ts +27 -0
  87. package/dist/hooks/useFuseSearch.d.ts +14 -0
  88. package/dist/hooks/useOpenAPISearch.d.ts +9 -0
  89. package/dist/hooks/useSearchResultFocus.d.ts +18 -0
  90. package/dist/hooks/useSpecLayoutController.d.ts +51 -0
  91. package/dist/hooks/useSpecSearch.d.ts +2 -6
  92. package/dist/http--XH4hLDt.cjs +1 -0
  93. package/dist/http-DKeNlJKS.js +85 -0
  94. package/dist/icons/Copy.d.ts +6 -0
  95. package/dist/icons/Info.d.ts +5 -0
  96. package/dist/icons/Search.d.ts +3 -0
  97. package/dist/{index-D7GelPk0.cjs → index-ArzwV232.cjs} +6 -6
  98. package/dist/index-Bh4OKjMA.js +25412 -0
  99. package/dist/index-C278WDNb.cjs +139 -0
  100. package/dist/index-C4I0xC5G.js +17544 -0
  101. package/dist/index-DuW5iShy.cjs +177 -0
  102. package/dist/index-PtAFPDfk.js +18851 -0
  103. package/dist/index.d.ts +7 -0
  104. package/dist/java-BIk0G-rH.cjs +1 -0
  105. package/dist/java-BicX26Pg.js +240 -0
  106. package/dist/kotlin-BwB8b-YX.js +242 -0
  107. package/dist/kotlin-kGuORR5a.cjs +2 -0
  108. package/dist/objectivec-CnyrJ13Z.js +237 -0
  109. package/dist/objectivec-CoeV81Tz.cjs +1 -0
  110. package/dist/ocaml-0j7KDjso.cjs +1 -0
  111. package/dist/ocaml-T8IqWCjo.js +67 -0
  112. package/dist/php-BL35ZHWM.js +566 -0
  113. package/dist/php-DF4zG2hq.cjs +2 -0
  114. package/dist/powershell-CvydS3ek.cjs +1 -0
  115. package/dist/powershell-DuhUKWoO.js +236 -0
  116. package/dist/protoToJsonSchema-AciPTlBK.cjs +83 -0
  117. package/dist/protoToJsonSchema-D1lojrO3.js +6131 -0
  118. package/dist/{protobufSchemaParser-D_2rEsD4.cjs → protobufSchemaParser-7SgmMhQd.cjs} +1 -1
  119. package/dist/{protobufSchemaParser-Cj2WOp05.js → protobufSchemaParser-BohWo_pY.js} +2 -2
  120. package/dist/public/createSectionRoot.d.ts +30 -0
  121. package/dist/public/openapiSections.d.ts +26 -0
  122. package/dist/public/sections.d.ts +6 -3
  123. package/dist/r-B8fCBydS.js +207 -0
  124. package/dist/r-CYaZnHkA.cjs +1 -0
  125. package/dist/ruby-CvOid-1s.js +388 -0
  126. package/dist/ruby-nPcbuC2a.cjs +1 -0
  127. package/dist/rust-BocnJ3Ns.js +305 -0
  128. package/dist/rust-DKnYCg2f.cjs +1 -0
  129. package/dist/stories/AsyncAPI.stories.d.ts +6 -0
  130. package/dist/stories/AsyncAPIRenderer.stories.d.ts +6 -0
  131. package/dist/stories/Messages.stories.d.ts +1 -0
  132. package/dist/stories/Operations.stories.d.ts +6 -0
  133. package/dist/stories/SchemaTab.stories.d.ts +1 -0
  134. package/dist/stories/SchemaTree.stories.d.ts +1 -0
  135. package/dist/stories/Server.stories.d.ts +1 -0
  136. package/dist/stories/documentContextDecorator.d.ts +2 -2
  137. package/dist/stories/noCanvasDocsPage.d.ts +9 -0
  138. package/dist/swift-C35Eof-I.js +799 -0
  139. package/dist/swift-CAnH__EC.cjs +1 -0
  140. package/dist/types/openapi.d.ts +85 -0
  141. package/package.json +16 -3
  142. package/dist/components/Navigation.d.ts +0 -28
  143. package/dist/icons/SideBar.d.ts +0 -6
  144. package/dist/index-Bad1aEIj.js +0 -11352
  145. package/dist/index-CzcxQGxP.js +0 -25414
  146. package/dist/index-gn5KpvCL.cjs +0 -73
  147. package/dist/protoToJsonSchema-8Mm10CIx.cjs +0 -83
  148. package/dist/protoToJsonSchema-BJpwl2Am.js +0 -6174
  149. package/dist/vite.svg +0 -1
@@ -0,0 +1,799 @@
1
+ function W(t) {
2
+ return t ? typeof t == "string" ? t : t.source : null;
3
+ }
4
+ function m(t) {
5
+ return e("(?=", t, ")");
6
+ }
7
+ function e(...t) {
8
+ return t.map((A) => W(A)).join("");
9
+ }
10
+ function fe(t) {
11
+ const o = t[t.length - 1];
12
+ return typeof o == "object" && o.constructor === Object ? (t.splice(t.length - 1, 1), o) : {};
13
+ }
14
+ function s(...t) {
15
+ return "(" + (fe(t).capture ? "" : "?:") + t.map((c) => W(c)).join("|") + ")";
16
+ }
17
+ const g = (t) => e(
18
+ /\b/,
19
+ t,
20
+ /\w$/.test(t) ? /\b/ : /\B/
21
+ ), he = [
22
+ "Protocol",
23
+ // contextual
24
+ "Type"
25
+ // contextual
26
+ ].map(g), K = [
27
+ "init",
28
+ "self"
29
+ ].map(g), Ne = [
30
+ "Any",
31
+ "Self"
32
+ ], C = [
33
+ // strings below will be fed into the regular `keywords` engine while regex
34
+ // will result in additional modes being created to scan for those keywords to
35
+ // avoid conflicts with other rules
36
+ "actor",
37
+ "any",
38
+ // contextual
39
+ "associatedtype",
40
+ "async",
41
+ "await",
42
+ /as\?/,
43
+ // operator
44
+ /as!/,
45
+ // operator
46
+ "as",
47
+ // operator
48
+ "borrowing",
49
+ // contextual
50
+ "break",
51
+ "case",
52
+ "catch",
53
+ "class",
54
+ "consume",
55
+ // contextual
56
+ "consuming",
57
+ // contextual
58
+ "continue",
59
+ "convenience",
60
+ // contextual
61
+ "copy",
62
+ // contextual
63
+ "default",
64
+ "defer",
65
+ "deinit",
66
+ "didSet",
67
+ // contextual
68
+ "distributed",
69
+ "do",
70
+ "dynamic",
71
+ // contextual
72
+ "each",
73
+ "else",
74
+ "enum",
75
+ "extension",
76
+ "fallthrough",
77
+ /fileprivate\(set\)/,
78
+ "fileprivate",
79
+ "final",
80
+ // contextual
81
+ "for",
82
+ "func",
83
+ "get",
84
+ // contextual
85
+ "guard",
86
+ "if",
87
+ "import",
88
+ "indirect",
89
+ // contextual
90
+ "infix",
91
+ // contextual
92
+ /init\?/,
93
+ /init!/,
94
+ "inout",
95
+ /internal\(set\)/,
96
+ "internal",
97
+ "in",
98
+ "is",
99
+ // operator
100
+ "isolated",
101
+ // contextual
102
+ "nonisolated",
103
+ // contextual
104
+ "lazy",
105
+ // contextual
106
+ "let",
107
+ "macro",
108
+ "mutating",
109
+ // contextual
110
+ "nonmutating",
111
+ // contextual
112
+ /open\(set\)/,
113
+ // contextual
114
+ "open",
115
+ // contextual
116
+ "operator",
117
+ "optional",
118
+ // contextual
119
+ "override",
120
+ // contextual
121
+ "package",
122
+ "postfix",
123
+ // contextual
124
+ "precedencegroup",
125
+ "prefix",
126
+ // contextual
127
+ /private\(set\)/,
128
+ "private",
129
+ "protocol",
130
+ /public\(set\)/,
131
+ "public",
132
+ "repeat",
133
+ "required",
134
+ // contextual
135
+ "rethrows",
136
+ "return",
137
+ "set",
138
+ // contextual
139
+ "some",
140
+ // contextual
141
+ "static",
142
+ "struct",
143
+ "subscript",
144
+ "super",
145
+ "switch",
146
+ "throws",
147
+ "throw",
148
+ /try\?/,
149
+ // operator
150
+ /try!/,
151
+ // operator
152
+ "try",
153
+ // operator
154
+ "typealias",
155
+ /unowned\(safe\)/,
156
+ // contextual
157
+ /unowned\(unsafe\)/,
158
+ // contextual
159
+ "unowned",
160
+ // contextual
161
+ "var",
162
+ "weak",
163
+ // contextual
164
+ "where",
165
+ "while",
166
+ "willSet"
167
+ // contextual
168
+ ], x = [
169
+ "false",
170
+ "nil",
171
+ "true"
172
+ ], ye = [
173
+ "assignment",
174
+ "associativity",
175
+ "higherThan",
176
+ "left",
177
+ "lowerThan",
178
+ "none",
179
+ "right"
180
+ ], Te = [
181
+ "#colorLiteral",
182
+ "#column",
183
+ "#dsohandle",
184
+ "#else",
185
+ "#elseif",
186
+ "#endif",
187
+ "#error",
188
+ "#file",
189
+ "#fileID",
190
+ "#fileLiteral",
191
+ "#filePath",
192
+ "#function",
193
+ "#if",
194
+ "#imageLiteral",
195
+ "#keyPath",
196
+ "#line",
197
+ "#selector",
198
+ "#sourceLocation",
199
+ "#warning"
200
+ ], G = [
201
+ "abs",
202
+ "all",
203
+ "any",
204
+ "assert",
205
+ "assertionFailure",
206
+ "debugPrint",
207
+ "dump",
208
+ "fatalError",
209
+ "getVaList",
210
+ "isKnownUniquelyReferenced",
211
+ "max",
212
+ "min",
213
+ "numericCast",
214
+ "pointwiseMax",
215
+ "pointwiseMin",
216
+ "precondition",
217
+ "preconditionFailure",
218
+ "print",
219
+ "readLine",
220
+ "repeatElement",
221
+ "sequence",
222
+ "stride",
223
+ "swap",
224
+ "swift_unboxFromSwiftValueWithType",
225
+ "transcode",
226
+ "type",
227
+ "unsafeBitCast",
228
+ "unsafeDowncast",
229
+ "withExtendedLifetime",
230
+ "withUnsafeMutablePointer",
231
+ "withUnsafePointer",
232
+ "withVaList",
233
+ "withoutActuallyEscaping",
234
+ "zip"
235
+ ], $ = s(
236
+ /[/=\-+!*%<>&|^~?]/,
237
+ /[\u00A1-\u00A7]/,
238
+ /[\u00A9\u00AB]/,
239
+ /[\u00AC\u00AE]/,
240
+ /[\u00B0\u00B1]/,
241
+ /[\u00B6\u00BB\u00BF\u00D7\u00F7]/,
242
+ /[\u2016-\u2017]/,
243
+ /[\u2020-\u2027]/,
244
+ /[\u2030-\u203E]/,
245
+ /[\u2041-\u2053]/,
246
+ /[\u2055-\u205E]/,
247
+ /[\u2190-\u23FF]/,
248
+ /[\u2500-\u2775]/,
249
+ /[\u2794-\u2BFF]/,
250
+ /[\u2E00-\u2E7F]/,
251
+ /[\u3001-\u3003]/,
252
+ /[\u3008-\u3020]/,
253
+ /[\u3030]/
254
+ ), Y = s(
255
+ $,
256
+ /[\u0300-\u036F]/,
257
+ /[\u1DC0-\u1DFF]/,
258
+ /[\u20D0-\u20FF]/,
259
+ /[\uFE00-\uFE0F]/,
260
+ /[\uFE20-\uFE2F]/
261
+ // TODO: The following characters are also allowed, but the regex isn't supported yet.
262
+ // /[\u{E0100}-\u{E01EF}]/u
263
+ ), S = e($, Y, "*"), j = s(
264
+ /[a-zA-Z_]/,
265
+ /[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,
266
+ /[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,
267
+ /[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,
268
+ /[\u1E00-\u1FFF]/,
269
+ /[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,
270
+ /[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,
271
+ /[\u2C00-\u2DFF\u2E80-\u2FFF]/,
272
+ /[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,
273
+ /[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,
274
+ /[\uFE47-\uFEFE\uFF00-\uFFFD]/
275
+ // Should be /[\uFE47-\uFFFD]/, but we have to exclude FEFF.
276
+ // The following characters are also allowed, but the regexes aren't supported yet.
277
+ // /[\u{10000}-\u{1FFFD}\u{20000-\u{2FFFD}\u{30000}-\u{3FFFD}\u{40000}-\u{4FFFD}]/u,
278
+ // /[\u{50000}-\u{5FFFD}\u{60000-\u{6FFFD}\u{70000}-\u{7FFFD}\u{80000}-\u{8FFFD}]/u,
279
+ // /[\u{90000}-\u{9FFFD}\u{A0000-\u{AFFFD}\u{B0000}-\u{BFFFD}\u{C0000}-\u{CFFFD}]/u,
280
+ // /[\u{D0000}-\u{DFFFD}\u{E0000-\u{EFFFD}]/u
281
+ ), T = s(
282
+ j,
283
+ /\d/,
284
+ /[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/
285
+ ), a = e(j, T, "*"), y = e(/[A-Z]/, T, "*"), Re = [
286
+ "attached",
287
+ "autoclosure",
288
+ e(/convention\(/, s("swift", "block", "c"), /\)/),
289
+ "discardableResult",
290
+ "dynamicCallable",
291
+ "dynamicMemberLookup",
292
+ "escaping",
293
+ "freestanding",
294
+ "frozen",
295
+ "GKInspectable",
296
+ "IBAction",
297
+ "IBDesignable",
298
+ "IBInspectable",
299
+ "IBOutlet",
300
+ "IBSegueAction",
301
+ "inlinable",
302
+ "main",
303
+ "nonobjc",
304
+ "NSApplicationMain",
305
+ "NSCopying",
306
+ "NSManaged",
307
+ e(/objc\(/, a, /\)/),
308
+ "objc",
309
+ "objcMembers",
310
+ "propertyWrapper",
311
+ "requires_stored_property_inits",
312
+ "resultBuilder",
313
+ "Sendable",
314
+ "testable",
315
+ "UIApplicationMain",
316
+ "unchecked",
317
+ "unknown",
318
+ "usableFromInline",
319
+ "warn_unqualified_access"
320
+ ], _e = [
321
+ "iOS",
322
+ "iOSApplicationExtension",
323
+ "macOS",
324
+ "macOSApplicationExtension",
325
+ "macCatalyst",
326
+ "macCatalystApplicationExtension",
327
+ "watchOS",
328
+ "watchOSApplicationExtension",
329
+ "tvOS",
330
+ "tvOSApplicationExtension",
331
+ "swift"
332
+ ];
333
+ function we(t) {
334
+ const o = {
335
+ match: /\s+/,
336
+ relevance: 0
337
+ }, A = t.COMMENT(
338
+ "/\\*",
339
+ "\\*/",
340
+ { contains: ["self"] }
341
+ ), c = [
342
+ t.C_LINE_COMMENT_MODE,
343
+ A
344
+ ], X = {
345
+ match: [
346
+ /\./,
347
+ s(...he, ...K)
348
+ ],
349
+ className: { 2: "keyword" }
350
+ }, z = {
351
+ // Consume .keyword to prevent highlighting properties and methods as keywords.
352
+ match: e(/\./, s(...C)),
353
+ relevance: 0
354
+ }, H = C.filter((n) => typeof n == "string").concat(["_|0"]), V = C.filter((n) => typeof n != "string").concat(Ne).map(g), q = { variants: [
355
+ {
356
+ className: "keyword",
357
+ match: s(...V, ...K)
358
+ }
359
+ ] }, i = {
360
+ $pattern: s(
361
+ /\b\w+/,
362
+ // regular keywords
363
+ /#\w+/
364
+ // number keywords
365
+ ),
366
+ keyword: H.concat(Te),
367
+ literal: x
368
+ }, r = [
369
+ X,
370
+ z,
371
+ q
372
+ ], Z = {
373
+ // Consume .built_in to prevent highlighting properties and methods.
374
+ match: e(/\./, s(...G)),
375
+ relevance: 0
376
+ }, J = {
377
+ className: "built_in",
378
+ match: e(/\b/, s(...G), /(?=\()/)
379
+ }, R = [
380
+ Z,
381
+ J
382
+ ], O = {
383
+ // Prevent -> from being highlighting as an operator.
384
+ match: /->/,
385
+ relevance: 0
386
+ }, Q = {
387
+ className: "operator",
388
+ relevance: 0,
389
+ variants: [
390
+ { match: S },
391
+ {
392
+ // dot-operator: only operators that start with a dot are allowed to use dots as
393
+ // characters (..., ...<, .*, etc). So there rule here is: a dot followed by one or more
394
+ // characters that may also include dots.
395
+ match: `\\.(\\.|${Y})+`
396
+ }
397
+ ]
398
+ }, E = [
399
+ O,
400
+ Q
401
+ ], F = "([0-9]_*)+", D = "([0-9a-fA-F]_*)+", d = {
402
+ className: "number",
403
+ relevance: 0,
404
+ variants: [
405
+ // decimal floating-point-literal (subsumes decimal-literal)
406
+ { match: `\\b(${F})(\\.(${F}))?([eE][+-]?(${F}))?\\b` },
407
+ // hexadecimal floating-point-literal (subsumes hexadecimal-literal)
408
+ { match: `\\b0x(${D})(\\.(${D}))?([pP][+-]?(${F}))?\\b` },
409
+ // octal-literal
410
+ { match: /\b0o([0-7]_*)+\b/ },
411
+ // binary-literal
412
+ { match: /\b0b([01]_*)+\b/ }
413
+ ]
414
+ }, v = (n = "") => ({
415
+ className: "subst",
416
+ variants: [
417
+ { match: e(/\\/, n, /[0\\tnr"']/) },
418
+ { match: e(/\\/, n, /u\{[0-9a-fA-F]{1,8}\}/) }
419
+ ]
420
+ }), ee = (n = "") => ({
421
+ className: "subst",
422
+ match: e(/\\/, n, /[\t ]*(?:[\r\n]|\r\n)/)
423
+ }), L = (n = "") => ({
424
+ className: "subst",
425
+ label: "interpol",
426
+ begin: e(/\\/, n, /\(/),
427
+ end: /\)/
428
+ }), b = (n = "") => ({
429
+ begin: e(n, /"""/),
430
+ end: e(/"""/, n),
431
+ contains: [
432
+ v(n),
433
+ ee(n),
434
+ L(n)
435
+ ]
436
+ }), f = (n = "") => ({
437
+ begin: e(n, /"/),
438
+ end: e(/"/, n),
439
+ contains: [
440
+ v(n),
441
+ L(n)
442
+ ]
443
+ }), l = {
444
+ className: "string",
445
+ variants: [
446
+ b(),
447
+ b("#"),
448
+ b("##"),
449
+ b("###"),
450
+ f(),
451
+ f("#"),
452
+ f("##"),
453
+ f("###")
454
+ ]
455
+ }, P = [
456
+ t.BACKSLASH_ESCAPE,
457
+ {
458
+ begin: /\[/,
459
+ end: /\]/,
460
+ relevance: 0,
461
+ contains: [t.BACKSLASH_ESCAPE]
462
+ }
463
+ ], ne = {
464
+ begin: /\/[^\s](?=[^/\n]*\/)/,
465
+ end: /\//,
466
+ contains: P
467
+ }, _ = (n) => {
468
+ const N = e(n, /\//), p = e(/\//, n);
469
+ return {
470
+ begin: N,
471
+ end: p,
472
+ contains: [
473
+ ...P,
474
+ {
475
+ scope: "comment",
476
+ begin: `#(?!.*${p})`,
477
+ end: /$/
478
+ }
479
+ ]
480
+ };
481
+ }, k = {
482
+ scope: "regexp",
483
+ variants: [
484
+ _("###"),
485
+ _("##"),
486
+ _("#"),
487
+ ne
488
+ ]
489
+ }, B = { match: e(/`/, a, /`/) }, te = {
490
+ className: "variable",
491
+ match: /\$\d+/
492
+ }, se = {
493
+ className: "variable",
494
+ match: `\\$${T}+`
495
+ }, w = [
496
+ B,
497
+ te,
498
+ se
499
+ ], ae = {
500
+ match: /(@|#(un)?)available/,
501
+ scope: "keyword",
502
+ starts: { contains: [
503
+ {
504
+ begin: /\(/,
505
+ end: /\)/,
506
+ keywords: _e,
507
+ contains: [
508
+ ...E,
509
+ d,
510
+ l
511
+ ]
512
+ }
513
+ ] }
514
+ }, oe = {
515
+ scope: "keyword",
516
+ match: e(/@/, s(...Re), m(s(/\(/, /\s+/)))
517
+ }, ce = {
518
+ scope: "meta",
519
+ match: e(/@/, a)
520
+ }, h = [
521
+ ae,
522
+ oe,
523
+ ce
524
+ ], u = {
525
+ match: m(/\b[A-Z]/),
526
+ relevance: 0,
527
+ contains: [
528
+ {
529
+ // Common Apple frameworks, for relevance boost
530
+ className: "type",
531
+ match: e(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/, T, "+")
532
+ },
533
+ {
534
+ // Type identifier
535
+ className: "type",
536
+ match: y,
537
+ relevance: 0
538
+ },
539
+ {
540
+ // Optional type
541
+ match: /[?!]+/,
542
+ relevance: 0
543
+ },
544
+ {
545
+ // Variadic parameter
546
+ match: /\.\.\./,
547
+ relevance: 0
548
+ },
549
+ {
550
+ // Protocol composition
551
+ match: e(/\s+&\s+/, m(y)),
552
+ relevance: 0
553
+ }
554
+ ]
555
+ }, ie = {
556
+ begin: /</,
557
+ end: />/,
558
+ keywords: i,
559
+ contains: [
560
+ ...c,
561
+ ...r,
562
+ ...h,
563
+ O,
564
+ u
565
+ ]
566
+ };
567
+ u.contains.push(ie);
568
+ const re = {
569
+ match: e(a, /\s*:/),
570
+ keywords: "_|0",
571
+ relevance: 0
572
+ }, M = {
573
+ begin: /\(/,
574
+ end: /\)/,
575
+ relevance: 0,
576
+ keywords: i,
577
+ contains: [
578
+ "self",
579
+ re,
580
+ ...c,
581
+ k,
582
+ ...r,
583
+ ...R,
584
+ ...E,
585
+ d,
586
+ l,
587
+ ...w,
588
+ ...h,
589
+ u
590
+ ]
591
+ }, I = {
592
+ begin: /</,
593
+ end: />/,
594
+ keywords: "repeat each",
595
+ contains: [
596
+ ...c,
597
+ u
598
+ ]
599
+ }, ue = {
600
+ begin: s(
601
+ m(e(a, /\s*:/)),
602
+ m(e(a, /\s+/, a, /\s*:/))
603
+ ),
604
+ end: /:/,
605
+ relevance: 0,
606
+ contains: [
607
+ {
608
+ className: "keyword",
609
+ match: /\b_\b/
610
+ },
611
+ {
612
+ className: "params",
613
+ match: a
614
+ }
615
+ ]
616
+ }, U = {
617
+ begin: /\(/,
618
+ end: /\)/,
619
+ keywords: i,
620
+ contains: [
621
+ ue,
622
+ ...c,
623
+ ...r,
624
+ ...E,
625
+ d,
626
+ l,
627
+ ...h,
628
+ u,
629
+ M
630
+ ],
631
+ endsParent: !0,
632
+ illegal: /["']/
633
+ }, le = {
634
+ match: [
635
+ /(func|macro)/,
636
+ /\s+/,
637
+ s(B.match, a, S)
638
+ ],
639
+ className: {
640
+ 1: "keyword",
641
+ 3: "title.function"
642
+ },
643
+ contains: [
644
+ I,
645
+ U,
646
+ o
647
+ ],
648
+ illegal: [
649
+ /\[/,
650
+ /%/
651
+ ]
652
+ }, Ee = {
653
+ match: [
654
+ /\b(?:subscript|init[?!]?)/,
655
+ /\s*(?=[<(])/
656
+ ],
657
+ className: { 1: "keyword" },
658
+ contains: [
659
+ I,
660
+ U,
661
+ o
662
+ ],
663
+ illegal: /\[|%/
664
+ }, de = {
665
+ match: [
666
+ /operator/,
667
+ /\s+/,
668
+ S
669
+ ],
670
+ className: {
671
+ 1: "keyword",
672
+ 3: "title"
673
+ }
674
+ }, pe = {
675
+ begin: [
676
+ /precedencegroup/,
677
+ /\s+/,
678
+ y
679
+ ],
680
+ className: {
681
+ 1: "keyword",
682
+ 3: "title"
683
+ },
684
+ contains: [u],
685
+ keywords: [
686
+ ...ye,
687
+ ...x
688
+ ],
689
+ end: /}/
690
+ }, me = {
691
+ match: [
692
+ /class\b/,
693
+ /\s+/,
694
+ /func\b/,
695
+ /\s+/,
696
+ /\b[A-Za-z_][A-Za-z0-9_]*\b/
697
+ ],
698
+ scope: {
699
+ 1: "keyword",
700
+ 3: "keyword",
701
+ 5: "title.function"
702
+ }
703
+ }, Ae = {
704
+ match: [
705
+ /class\b/,
706
+ /\s+/,
707
+ /var\b/
708
+ ],
709
+ scope: {
710
+ 1: "keyword",
711
+ 3: "keyword"
712
+ }
713
+ }, Fe = {
714
+ begin: [
715
+ /(struct|protocol|class|extension|enum|actor)/,
716
+ /\s+/,
717
+ a,
718
+ /\s*/
719
+ ],
720
+ beginScope: {
721
+ 1: "keyword",
722
+ 3: "title.class"
723
+ },
724
+ keywords: i,
725
+ contains: [
726
+ I,
727
+ ...r,
728
+ {
729
+ begin: /:/,
730
+ end: /\{/,
731
+ keywords: i,
732
+ contains: [
733
+ {
734
+ scope: "title.class.inherited",
735
+ match: y
736
+ },
737
+ ...r
738
+ ],
739
+ relevance: 0
740
+ }
741
+ ]
742
+ };
743
+ for (const n of l.variants) {
744
+ const N = n.contains.find((be) => be.label === "interpol");
745
+ N.keywords = i;
746
+ const p = [
747
+ ...r,
748
+ ...R,
749
+ ...E,
750
+ d,
751
+ l,
752
+ ...w
753
+ ];
754
+ N.contains = [
755
+ ...p,
756
+ {
757
+ begin: /\(/,
758
+ end: /\)/,
759
+ contains: [
760
+ "self",
761
+ ...p
762
+ ]
763
+ }
764
+ ];
765
+ }
766
+ return {
767
+ name: "Swift",
768
+ keywords: i,
769
+ contains: [
770
+ ...c,
771
+ le,
772
+ Ee,
773
+ me,
774
+ Ae,
775
+ Fe,
776
+ de,
777
+ pe,
778
+ {
779
+ beginKeywords: "import",
780
+ end: /$/,
781
+ contains: [...c],
782
+ relevance: 0
783
+ },
784
+ k,
785
+ ...r,
786
+ ...R,
787
+ ...E,
788
+ d,
789
+ l,
790
+ ...w,
791
+ ...h,
792
+ u,
793
+ M
794
+ ]
795
+ };
796
+ }
797
+ export {
798
+ we as default
799
+ };