@limetech/kompendium 1.1.1

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 (348) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +313 -0
  3. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +13 -0
  4. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js.map +1 -0
  5. package/dist/cjs/anchor-scroll-BmplAyR0.js +69 -0
  6. package/dist/cjs/anchor-scroll-BmplAyR0.js.map +1 -0
  7. package/dist/cjs/index-DYiJ6dQL.js +1866 -0
  8. package/dist/cjs/index-DYiJ6dQL.js.map +1 -0
  9. package/dist/cjs/index.cjs.js +3 -0
  10. package/dist/cjs/index.cjs.js.map +1 -0
  11. package/dist/cjs/kompendium-app.kompendium-darkmode-switch.kompendium-navigation.kompendium-search.stencil-route.stencil-route-switch.stencil-router.entry.cjs.js.map +1 -0
  12. package/dist/cjs/kompendium-app_7.cjs.entry.js +2924 -0
  13. package/dist/cjs/kompendium-code.cjs.entry.js +2724 -0
  14. package/dist/cjs/kompendium-code.entry.cjs.js.map +1 -0
  15. package/dist/cjs/kompendium-component.cjs.entry.js +207 -0
  16. package/dist/cjs/kompendium-component.entry.cjs.js.map +1 -0
  17. package/dist/cjs/kompendium-debug.cjs.entry.js +47 -0
  18. package/dist/cjs/kompendium-debug.entry.cjs.js.map +1 -0
  19. package/dist/cjs/kompendium-example-code.cjs.entry.js +20 -0
  20. package/dist/cjs/kompendium-example-code.entry.cjs.js.map +1 -0
  21. package/dist/cjs/kompendium-example-markdown.cjs.entry.js +165 -0
  22. package/dist/cjs/kompendium-example-markdown.entry.cjs.js.map +1 -0
  23. package/dist/cjs/kompendium-guide.cjs.entry.js +33 -0
  24. package/dist/cjs/kompendium-guide.entry.cjs.js.map +1 -0
  25. package/dist/cjs/kompendium-markdown.cjs.entry.js +48923 -0
  26. package/dist/cjs/kompendium-markdown.entry.cjs.js.map +1 -0
  27. package/dist/cjs/kompendium-playground.cjs.entry.js +89 -0
  28. package/dist/cjs/kompendium-playground.entry.cjs.js.map +1 -0
  29. package/dist/cjs/kompendium-proplist.kompendium-taglist.entry.cjs.js.map +1 -0
  30. package/dist/cjs/kompendium-proplist_2.cjs.entry.js +49 -0
  31. package/dist/cjs/kompendium-type.cjs.entry.js +83 -0
  32. package/dist/cjs/kompendium-type.entry.cjs.js.map +1 -0
  33. package/dist/cjs/kompendium.cjs.js +25 -0
  34. package/dist/cjs/kompendium.cjs.js.map +1 -0
  35. package/dist/cjs/loader.cjs.js +13 -0
  36. package/dist/cjs/loader.cjs.js.map +1 -0
  37. package/dist/cjs/markdown-types-B884tLd-.js +15 -0
  38. package/dist/cjs/markdown-types-B884tLd-.js.map +1 -0
  39. package/dist/cjs/methods-DoA78dOH.js +97 -0
  40. package/dist/cjs/methods-DoA78dOH.js.map +1 -0
  41. package/dist/cjs/types-SjA7Kcy_.js +8 -0
  42. package/dist/cjs/types-SjA7Kcy_.js.map +1 -0
  43. package/dist/collection/assets/favicon.svg +65 -0
  44. package/dist/collection/assets/icons/bookmark-fill.svg +1 -0
  45. package/dist/collection/assets/icons/danger.svg +1 -0
  46. package/dist/collection/assets/icons/debug.svg +1 -0
  47. package/dist/collection/assets/icons/important.svg +1 -0
  48. package/dist/collection/assets/icons/info.svg +1 -0
  49. package/dist/collection/assets/icons/logo.svg +1 -0
  50. package/dist/collection/assets/icons/note.svg +1 -0
  51. package/dist/collection/assets/icons/search.svg +1 -0
  52. package/dist/collection/assets/icons/tip.svg +1 -0
  53. package/dist/collection/assets/icons/warning.svg +1 -0
  54. package/dist/collection/assets/logotype.svg +64 -0
  55. package/dist/collection/collection-manifest.json +35 -0
  56. package/dist/collection/components/anchor-scroll.js +61 -0
  57. package/dist/collection/components/anchor-scroll.js.map +1 -0
  58. package/dist/collection/components/app/app.css +125 -0
  59. package/dist/collection/components/app/app.js +149 -0
  60. package/dist/collection/components/app/app.js.map +1 -0
  61. package/dist/collection/components/code/code.css +250 -0
  62. package/dist/collection/components/code/code.js +82 -0
  63. package/dist/collection/components/code/code.js.map +1 -0
  64. package/dist/collection/components/code/examples/code.js +14 -0
  65. package/dist/collection/components/code/examples/code.js.map +1 -0
  66. package/dist/collection/components/component/component.css +383 -0
  67. package/dist/collection/components/component/component.js +191 -0
  68. package/dist/collection/components/component/component.js.map +1 -0
  69. package/dist/collection/components/component/templates/events.js +32 -0
  70. package/dist/collection/components/component/templates/events.js.map +1 -0
  71. package/dist/collection/components/component/templates/examples.js +17 -0
  72. package/dist/collection/components/component/templates/examples.js.map +1 -0
  73. package/dist/collection/components/component/templates/methods.js +54 -0
  74. package/dist/collection/components/component/templates/methods.js.map +1 -0
  75. package/dist/collection/components/component/templates/props.js +36 -0
  76. package/dist/collection/components/component/templates/props.js.map +1 -0
  77. package/dist/collection/components/component/templates/slots.js +14 -0
  78. package/dist/collection/components/component/templates/slots.js.map +1 -0
  79. package/dist/collection/components/component/templates/style.js +14 -0
  80. package/dist/collection/components/component/templates/style.js.map +1 -0
  81. package/dist/collection/components/darkmode-switch/darkmode-switch.css +141 -0
  82. package/dist/collection/components/darkmode-switch/darkmode-switch.js +90 -0
  83. package/dist/collection/components/darkmode-switch/darkmode-switch.js.map +1 -0
  84. package/dist/collection/components/darkmode-switch/types.js +2 -0
  85. package/dist/collection/components/darkmode-switch/types.js.map +1 -0
  86. package/dist/collection/components/debug/debug.js +146 -0
  87. package/dist/collection/components/debug/debug.js.map +1 -0
  88. package/dist/collection/components/guide/guide.js +61 -0
  89. package/dist/collection/components/guide/guide.js.map +1 -0
  90. package/dist/collection/components/markdown/examples/markdown-example.js +150 -0
  91. package/dist/collection/components/markdown/examples/markdown-example.js.map +1 -0
  92. package/dist/collection/components/markdown/examples/markdown.js +14 -0
  93. package/dist/collection/components/markdown/examples/markdown.js.map +1 -0
  94. package/dist/collection/components/markdown/markdown-types.js +8 -0
  95. package/dist/collection/components/markdown/markdown-types.js.map +1 -0
  96. package/dist/collection/components/markdown/markdown.css +660 -0
  97. package/dist/collection/components/markdown/markdown.js +83 -0
  98. package/dist/collection/components/markdown/markdown.js.map +1 -0
  99. package/dist/collection/components/navigation/navigation.css +403 -0
  100. package/dist/collection/components/navigation/navigation.js +184 -0
  101. package/dist/collection/components/navigation/navigation.js.map +1 -0
  102. package/dist/collection/components/playground/playground.css +198 -0
  103. package/dist/collection/components/playground/playground.js +174 -0
  104. package/dist/collection/components/playground/playground.js.map +1 -0
  105. package/dist/collection/components/playground/playground.types.js +2 -0
  106. package/dist/collection/components/playground/playground.types.js.map +1 -0
  107. package/dist/collection/components/proplist/proplist.css +334 -0
  108. package/dist/collection/components/proplist/proplist.js +53 -0
  109. package/dist/collection/components/proplist/proplist.js.map +1 -0
  110. package/dist/collection/components/search/search.css +183 -0
  111. package/dist/collection/components/search/search.js +76 -0
  112. package/dist/collection/components/search/search.js.map +1 -0
  113. package/dist/collection/components/taglist/taglist.css +58 -0
  114. package/dist/collection/components/taglist/taglist.js +82 -0
  115. package/dist/collection/components/taglist/taglist.js.map +1 -0
  116. package/dist/collection/components/type/templates/alias.js +11 -0
  117. package/dist/collection/components/type/templates/alias.js.map +1 -0
  118. package/dist/collection/components/type/templates/enum.js +25 -0
  119. package/dist/collection/components/type/templates/enum.js.map +1 -0
  120. package/dist/collection/components/type/templates/interface.js +13 -0
  121. package/dist/collection/components/type/templates/interface.js.map +1 -0
  122. package/dist/collection/components/type/type.js +97 -0
  123. package/dist/collection/components/type/type.js.map +1 -0
  124. package/dist/collection/index.js +4 -0
  125. package/dist/collection/index.js.map +1 -0
  126. package/dist/collection/kompendium/config.js +7 -0
  127. package/dist/collection/kompendium/config.js.map +1 -0
  128. package/dist/collection/kompendium/filesystem.js +9 -0
  129. package/dist/collection/kompendium/filesystem.js.map +1 -0
  130. package/dist/collection/kompendium/generator.js +217 -0
  131. package/dist/collection/kompendium/generator.js.map +1 -0
  132. package/dist/collection/kompendium/guides.js +30 -0
  133. package/dist/collection/kompendium/guides.js.map +1 -0
  134. package/dist/collection/kompendium/index.js +2 -0
  135. package/dist/collection/kompendium/index.js.map +1 -0
  136. package/dist/collection/kompendium/markdown-admonitions.js +82 -0
  137. package/dist/collection/kompendium/markdown-admonitions.js.map +1 -0
  138. package/dist/collection/kompendium/markdown-code.js +40 -0
  139. package/dist/collection/kompendium/markdown-code.js.map +1 -0
  140. package/dist/collection/kompendium/markdown-frontmatter.js +12 -0
  141. package/dist/collection/kompendium/markdown-frontmatter.js.map +1 -0
  142. package/dist/collection/kompendium/markdown-nodes.js +10 -0
  143. package/dist/collection/kompendium/markdown-nodes.js.map +1 -0
  144. package/dist/collection/kompendium/markdown-typelinks.js +115 -0
  145. package/dist/collection/kompendium/markdown-typelinks.js.map +1 -0
  146. package/dist/collection/kompendium/markdown.js +35 -0
  147. package/dist/collection/kompendium/markdown.js.map +1 -0
  148. package/dist/collection/kompendium/menu.js +149 -0
  149. package/dist/collection/kompendium/menu.js.map +1 -0
  150. package/dist/collection/kompendium/schema.js +167 -0
  151. package/dist/collection/kompendium/schema.js.map +1 -0
  152. package/dist/collection/kompendium/search.js +144 -0
  153. package/dist/collection/kompendium/search.js.map +1 -0
  154. package/dist/collection/kompendium/source.js +81 -0
  155. package/dist/collection/kompendium/source.js.map +1 -0
  156. package/dist/collection/kompendium/test/fixtures/basic.js +48 -0
  157. package/dist/collection/kompendium/test/fixtures/basic.js.map +1 -0
  158. package/dist/collection/kompendium/test/fixtures/filtering/example-type.js +2 -0
  159. package/dist/collection/kompendium/test/fixtures/filtering/example-type.js.map +1 -0
  160. package/dist/collection/kompendium/test/fixtures/filtering/node-modules-type.js +2 -0
  161. package/dist/collection/kompendium/test/fixtures/filtering/node-modules-type.js.map +1 -0
  162. package/dist/collection/kompendium/test/fixtures/filtering/private-types.js +2 -0
  163. package/dist/collection/kompendium/test/fixtures/filtering/private-types.js.map +1 -0
  164. package/dist/collection/kompendium/test/fixtures/filtering/stencil-component-types.js +2 -0
  165. package/dist/collection/kompendium/test/fixtures/filtering/stencil-component-types.js.map +1 -0
  166. package/dist/collection/kompendium/test/fixtures/filtering/test-helper-type.js +2 -0
  167. package/dist/collection/kompendium/test/fixtures/filtering/test-helper-type.js.map +1 -0
  168. package/dist/collection/kompendium/test/fixtures/filtering/valid-types.js +29 -0
  169. package/dist/collection/kompendium/test/fixtures/filtering/valid-types.js.map +1 -0
  170. package/dist/collection/kompendium/typedoc.js +481 -0
  171. package/dist/collection/kompendium/typedoc.js.map +1 -0
  172. package/dist/collection/kompendium/watch.js +9 -0
  173. package/dist/collection/kompendium/watch.js.map +1 -0
  174. package/dist/collection/types.js +2 -0
  175. package/dist/collection/types.js.map +1 -0
  176. package/dist/config.ts +8 -0
  177. package/dist/esm/_commonjsHelpers-BFTU3MAI.js +10 -0
  178. package/dist/esm/_commonjsHelpers-BFTU3MAI.js.map +1 -0
  179. package/dist/esm/anchor-scroll-BAGXN2n6.js +65 -0
  180. package/dist/esm/anchor-scroll-BAGXN2n6.js.map +1 -0
  181. package/dist/esm/index-9UrzenzW.js +1857 -0
  182. package/dist/esm/index-9UrzenzW.js.map +1 -0
  183. package/dist/esm/index.js +2 -0
  184. package/dist/esm/index.js.map +1 -0
  185. package/dist/esm/kompendium-app.kompendium-darkmode-switch.kompendium-navigation.kompendium-search.stencil-route.stencil-route-switch.stencil-router.entry.js.map +1 -0
  186. package/dist/esm/kompendium-app_7.entry.js +2916 -0
  187. package/dist/esm/kompendium-code.entry.js +2722 -0
  188. package/dist/esm/kompendium-code.entry.js.map +1 -0
  189. package/dist/esm/kompendium-component.entry.js +205 -0
  190. package/dist/esm/kompendium-component.entry.js.map +1 -0
  191. package/dist/esm/kompendium-debug.entry.js +45 -0
  192. package/dist/esm/kompendium-debug.entry.js.map +1 -0
  193. package/dist/esm/kompendium-example-code.entry.js +18 -0
  194. package/dist/esm/kompendium-example-code.entry.js.map +1 -0
  195. package/dist/esm/kompendium-example-markdown.entry.js +163 -0
  196. package/dist/esm/kompendium-example-markdown.entry.js.map +1 -0
  197. package/dist/esm/kompendium-guide.entry.js +31 -0
  198. package/dist/esm/kompendium-guide.entry.js.map +1 -0
  199. package/dist/esm/kompendium-markdown.entry.js +48921 -0
  200. package/dist/esm/kompendium-markdown.entry.js.map +1 -0
  201. package/dist/esm/kompendium-playground.entry.js +87 -0
  202. package/dist/esm/kompendium-playground.entry.js.map +1 -0
  203. package/dist/esm/kompendium-proplist.kompendium-taglist.entry.js.map +1 -0
  204. package/dist/esm/kompendium-proplist_2.entry.js +46 -0
  205. package/dist/esm/kompendium-type.entry.js +81 -0
  206. package/dist/esm/kompendium-type.entry.js.map +1 -0
  207. package/dist/esm/kompendium.js +21 -0
  208. package/dist/esm/kompendium.js.map +1 -0
  209. package/dist/esm/loader.js +11 -0
  210. package/dist/esm/loader.js.map +1 -0
  211. package/dist/esm/markdown-types-Ajsawr_9.js +12 -0
  212. package/dist/esm/markdown-types-Ajsawr_9.js.map +1 -0
  213. package/dist/esm/methods-BAjd6f7g.js +94 -0
  214. package/dist/esm/methods-BAjd6f7g.js.map +1 -0
  215. package/dist/esm/types-BIPLEi1G.js +6 -0
  216. package/dist/esm/types-BIPLEi1G.js.map +1 -0
  217. package/dist/filesystem.ts +9 -0
  218. package/dist/generator.ts +302 -0
  219. package/dist/guides.ts +49 -0
  220. package/dist/index.cjs.js +1 -0
  221. package/dist/index.js +1 -0
  222. package/dist/index.ts +1 -0
  223. package/dist/kompendium/index.esm.js +2 -0
  224. package/dist/kompendium/index.esm.js.map +1 -0
  225. package/dist/kompendium/kompendium-app.kompendium-darkmode-switch.kompendium-navigation.kompendium-search.stencil-route.stencil-route-switch.stencil-router.entry.esm.js.map +1 -0
  226. package/dist/kompendium/kompendium-code.entry.esm.js.map +1 -0
  227. package/dist/kompendium/kompendium-component.entry.esm.js.map +1 -0
  228. package/dist/kompendium/kompendium-debug.entry.esm.js.map +1 -0
  229. package/dist/kompendium/kompendium-example-code.entry.esm.js.map +1 -0
  230. package/dist/kompendium/kompendium-example-markdown.entry.esm.js.map +1 -0
  231. package/dist/kompendium/kompendium-guide.entry.esm.js.map +1 -0
  232. package/dist/kompendium/kompendium-markdown.entry.esm.js.map +1 -0
  233. package/dist/kompendium/kompendium-playground.entry.esm.js.map +1 -0
  234. package/dist/kompendium/kompendium-proplist.kompendium-taglist.entry.esm.js.map +1 -0
  235. package/dist/kompendium/kompendium-type.entry.esm.js.map +1 -0
  236. package/dist/kompendium/kompendium.css +47 -0
  237. package/dist/kompendium/kompendium.esm.js +2 -0
  238. package/dist/kompendium/kompendium.esm.js.map +1 -0
  239. package/dist/kompendium/loader.esm.js.map +1 -0
  240. package/dist/kompendium/p-15e4b2c0.entry.js +2 -0
  241. package/dist/kompendium/p-15e4b2c0.entry.js.map +1 -0
  242. package/dist/kompendium/p-1cf0168f.entry.js +2 -0
  243. package/dist/kompendium/p-1cf0168f.entry.js.map +1 -0
  244. package/dist/kompendium/p-29c23c89.entry.js +2 -0
  245. package/dist/kompendium/p-29c23c89.entry.js.map +1 -0
  246. package/dist/kompendium/p-3981d11f.entry.js +2 -0
  247. package/dist/kompendium/p-3981d11f.entry.js.map +1 -0
  248. package/dist/kompendium/p-93f0548d.entry.js +2 -0
  249. package/dist/kompendium/p-93f0548d.entry.js.map +1 -0
  250. package/dist/kompendium/p-97b02575.entry.js +2 -0
  251. package/dist/kompendium/p-97b02575.entry.js.map +1 -0
  252. package/dist/kompendium/p-9UrzenzW.js +3 -0
  253. package/dist/kompendium/p-9UrzenzW.js.map +1 -0
  254. package/dist/kompendium/p-Ajsawr_9.js +2 -0
  255. package/dist/kompendium/p-Ajsawr_9.js.map +1 -0
  256. package/dist/kompendium/p-BAGXN2n6.js +2 -0
  257. package/dist/kompendium/p-BAGXN2n6.js.map +1 -0
  258. package/dist/kompendium/p-BFTU3MAI.js +2 -0
  259. package/dist/kompendium/p-BFTU3MAI.js.map +1 -0
  260. package/dist/kompendium/p-BIPLEi1G.js +2 -0
  261. package/dist/kompendium/p-BIPLEi1G.js.map +1 -0
  262. package/dist/kompendium/p-CnQEA7KO.js +2 -0
  263. package/dist/kompendium/p-CnQEA7KO.js.map +1 -0
  264. package/dist/kompendium/p-b0f95bd6.entry.js +2 -0
  265. package/dist/kompendium/p-b0f95bd6.entry.js.map +1 -0
  266. package/dist/kompendium/p-d9bcc473.entry.js +10 -0
  267. package/dist/kompendium/p-d9bcc473.entry.js.map +1 -0
  268. package/dist/kompendium/p-e36f3f1e.entry.js +2 -0
  269. package/dist/kompendium/p-e36f3f1e.entry.js.map +1 -0
  270. package/dist/kompendium/p-e52a2f57.entry.js +2 -0
  271. package/dist/kompendium/p-e52a2f57.entry.js.map +1 -0
  272. package/dist/kompendium/p-ec5861de.entry.js +2 -0
  273. package/dist/kompendium/p-ec5861de.entry.js.map +1 -0
  274. package/dist/markdown-admonitions.ts +112 -0
  275. package/dist/markdown-code.ts +51 -0
  276. package/dist/markdown-frontmatter.ts +19 -0
  277. package/dist/markdown-nodes.ts +23 -0
  278. package/dist/markdown-typelinks.ts +166 -0
  279. package/dist/markdown.ts +49 -0
  280. package/dist/menu.ts +189 -0
  281. package/dist/schema.ts +233 -0
  282. package/dist/search.ts +197 -0
  283. package/dist/source.ts +129 -0
  284. package/dist/typedoc.ts +665 -0
  285. package/dist/types/components/anchor-scroll.d.ts +36 -0
  286. package/dist/types/components/app/app.d.ts +22 -0
  287. package/dist/types/components/code/code.d.ts +26 -0
  288. package/dist/types/components/code/examples/code.d.ts +3 -0
  289. package/dist/types/components/component/component.d.ts +32 -0
  290. package/dist/types/components/component/templates/events.d.ts +5 -0
  291. package/dist/types/components/component/templates/examples.d.ts +9 -0
  292. package/dist/types/components/component/templates/methods.d.ts +5 -0
  293. package/dist/types/components/component/templates/props.d.ts +5 -0
  294. package/dist/types/components/component/templates/slots.d.ts +5 -0
  295. package/dist/types/components/component/templates/style.d.ts +5 -0
  296. package/dist/types/components/darkmode-switch/darkmode-switch.d.ts +18 -0
  297. package/dist/types/components/darkmode-switch/types.d.ts +2 -0
  298. package/dist/types/components/debug/debug.d.ts +24 -0
  299. package/dist/types/components/guide/guide.d.ts +14 -0
  300. package/dist/types/components/markdown/examples/markdown-example.d.ts +1 -0
  301. package/dist/types/components/markdown/examples/markdown.d.ts +7 -0
  302. package/dist/types/components/markdown/markdown-types.d.ts +2 -0
  303. package/dist/types/components/markdown/markdown.d.ts +20 -0
  304. package/dist/types/components/navigation/navigation.d.ts +35 -0
  305. package/dist/types/components/playground/playground.d.ts +32 -0
  306. package/dist/types/components/playground/playground.types.d.ts +1 -0
  307. package/dist/types/components/proplist/proplist.d.ts +12 -0
  308. package/dist/types/components/search/search.d.ts +15 -0
  309. package/dist/types/components/taglist/taglist.d.ts +16 -0
  310. package/dist/types/components/type/templates/alias.d.ts +4 -0
  311. package/dist/types/components/type/templates/enum.d.ts +4 -0
  312. package/dist/types/components/type/templates/interface.d.ts +4 -0
  313. package/dist/types/components/type/type.d.ts +15 -0
  314. package/dist/types/components.d.ts +517 -0
  315. package/dist/types/index.d.ts +5 -0
  316. package/dist/types/kompendium/config.d.ts +2 -0
  317. package/dist/types/kompendium/filesystem.d.ts +1 -0
  318. package/dist/types/kompendium/generator.d.ts +4 -0
  319. package/dist/types/kompendium/guides.d.ts +9 -0
  320. package/dist/types/kompendium/index.d.ts +1 -0
  321. package/dist/types/kompendium/markdown-admonitions.d.ts +3 -0
  322. package/dist/types/kompendium/markdown-code.d.ts +2 -0
  323. package/dist/types/kompendium/markdown-frontmatter.d.ts +6 -0
  324. package/dist/types/kompendium/markdown-nodes.d.ts +12 -0
  325. package/dist/types/kompendium/markdown-typelinks.d.ts +21 -0
  326. package/dist/types/kompendium/markdown.d.ts +8 -0
  327. package/dist/types/kompendium/menu.d.ts +12 -0
  328. package/dist/types/kompendium/schema.d.ts +9 -0
  329. package/dist/types/kompendium/search.d.ts +3 -0
  330. package/dist/types/kompendium/source.d.ts +10 -0
  331. package/dist/types/kompendium/test/fixtures/basic.d.ts +65 -0
  332. package/dist/types/kompendium/test/fixtures/filtering/example-type.d.ts +8 -0
  333. package/dist/types/kompendium/test/fixtures/filtering/node-modules-type.d.ts +8 -0
  334. package/dist/types/kompendium/test/fixtures/filtering/private-types.d.ts +23 -0
  335. package/dist/types/kompendium/test/fixtures/filtering/stencil-component-types.d.ts +19 -0
  336. package/dist/types/kompendium/test/fixtures/filtering/test-helper-type.d.ts +8 -0
  337. package/dist/types/kompendium/test/fixtures/filtering/valid-types.d.ts +42 -0
  338. package/dist/types/kompendium/typedoc.d.ts +2 -0
  339. package/dist/types/kompendium/watch.d.ts +1 -0
  340. package/dist/types/stencil-public-runtime.d.ts +1746 -0
  341. package/dist/types/types.d.ts +119 -0
  342. package/dist/watch.ts +14 -0
  343. package/loader/cdn.js +1 -0
  344. package/loader/index.cjs.js +1 -0
  345. package/loader/index.d.ts +24 -0
  346. package/loader/index.es2017.js +1 -0
  347. package/loader/index.js +2 -0
  348. package/package.json +116 -0
@@ -0,0 +1,2724 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-DYiJ6dQL.js');
4
+ var _commonjsHelpers = require('./_commonjsHelpers-BJu3ubxk.js');
5
+
6
+ var prism = {exports: {}};
7
+
8
+ var hasRequiredPrism;
9
+
10
+ function requirePrism () {
11
+ if (hasRequiredPrism) return prism.exports;
12
+ hasRequiredPrism = 1;
13
+ (function (module) {
14
+ /* **********************************************
15
+ Begin prism-core.js
16
+ ********************************************** */
17
+
18
+ /// <reference lib="WebWorker"/>
19
+
20
+ var _self = (typeof window !== 'undefined')
21
+ ? window // if in browser
22
+ : (
23
+ (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
24
+ ? self // if in worker
25
+ : {} // if in node js
26
+ );
27
+
28
+ /**
29
+ * Prism: Lightweight, robust, elegant syntax highlighting
30
+ *
31
+ * @license MIT <https://opensource.org/licenses/MIT>
32
+ * @author Lea Verou <https://lea.verou.me>
33
+ * @namespace
34
+ * @public
35
+ */
36
+ var Prism = (function (_self) {
37
+
38
+ // Private helper vars
39
+ var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
40
+ var uniqueId = 0;
41
+
42
+ // The grammar object for plaintext
43
+ var plainTextGrammar = {};
44
+
45
+
46
+ var _ = {
47
+ /**
48
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
49
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
50
+ * additional languages or plugins yourself.
51
+ *
52
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
53
+ *
54
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
55
+ * empty Prism object into the global scope before loading the Prism script like this:
56
+ *
57
+ * ```js
58
+ * window.Prism = window.Prism || {};
59
+ * Prism.manual = true;
60
+ * // add a new <script> to load Prism's script
61
+ * ```
62
+ *
63
+ * @default false
64
+ * @type {boolean}
65
+ * @memberof Prism
66
+ * @public
67
+ */
68
+ manual: _self.Prism && _self.Prism.manual,
69
+ /**
70
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
71
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
72
+ * own worker, you don't want it to do this.
73
+ *
74
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
75
+ *
76
+ * You obviously have to change this value before Prism executes. To do this, you can add an
77
+ * empty Prism object into the global scope before loading the Prism script like this:
78
+ *
79
+ * ```js
80
+ * window.Prism = window.Prism || {};
81
+ * Prism.disableWorkerMessageHandler = true;
82
+ * // Load Prism's script
83
+ * ```
84
+ *
85
+ * @default false
86
+ * @type {boolean}
87
+ * @memberof Prism
88
+ * @public
89
+ */
90
+ disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
91
+
92
+ /**
93
+ * A namespace for utility methods.
94
+ *
95
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
96
+ * change or disappear at any time.
97
+ *
98
+ * @namespace
99
+ * @memberof Prism
100
+ */
101
+ util: {
102
+ encode: function encode(tokens) {
103
+ if (tokens instanceof Token) {
104
+ return new Token(tokens.type, encode(tokens.content), tokens.alias);
105
+ } else if (Array.isArray(tokens)) {
106
+ return tokens.map(encode);
107
+ } else {
108
+ return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
109
+ }
110
+ },
111
+
112
+ /**
113
+ * Returns the name of the type of the given value.
114
+ *
115
+ * @param {any} o
116
+ * @returns {string}
117
+ * @example
118
+ * type(null) === 'Null'
119
+ * type(undefined) === 'Undefined'
120
+ * type(123) === 'Number'
121
+ * type('foo') === 'String'
122
+ * type(true) === 'Boolean'
123
+ * type([1, 2]) === 'Array'
124
+ * type({}) === 'Object'
125
+ * type(String) === 'Function'
126
+ * type(/abc+/) === 'RegExp'
127
+ */
128
+ type: function (o) {
129
+ return Object.prototype.toString.call(o).slice(8, -1);
130
+ },
131
+
132
+ /**
133
+ * Returns a unique number for the given object. Later calls will still return the same number.
134
+ *
135
+ * @param {Object} obj
136
+ * @returns {number}
137
+ */
138
+ objId: function (obj) {
139
+ if (!obj['__id']) {
140
+ Object.defineProperty(obj, '__id', { value: ++uniqueId });
141
+ }
142
+ return obj['__id'];
143
+ },
144
+
145
+ /**
146
+ * Creates a deep clone of the given object.
147
+ *
148
+ * The main intended use of this function is to clone language definitions.
149
+ *
150
+ * @param {T} o
151
+ * @param {Record<number, any>} [visited]
152
+ * @returns {T}
153
+ * @template T
154
+ */
155
+ clone: function deepClone(o, visited) {
156
+ visited = visited || {};
157
+
158
+ var clone; var id;
159
+ switch (_.util.type(o)) {
160
+ case 'Object':
161
+ id = _.util.objId(o);
162
+ if (visited[id]) {
163
+ return visited[id];
164
+ }
165
+ clone = /** @type {Record<string, any>} */ ({});
166
+ visited[id] = clone;
167
+
168
+ for (var key in o) {
169
+ if (o.hasOwnProperty(key)) {
170
+ clone[key] = deepClone(o[key], visited);
171
+ }
172
+ }
173
+
174
+ return /** @type {any} */ (clone);
175
+
176
+ case 'Array':
177
+ id = _.util.objId(o);
178
+ if (visited[id]) {
179
+ return visited[id];
180
+ }
181
+ clone = [];
182
+ visited[id] = clone;
183
+
184
+ (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
185
+ clone[i] = deepClone(v, visited);
186
+ });
187
+
188
+ return /** @type {any} */ (clone);
189
+
190
+ default:
191
+ return o;
192
+ }
193
+ },
194
+
195
+ /**
196
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
197
+ *
198
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
199
+ *
200
+ * @param {Element} element
201
+ * @returns {string}
202
+ */
203
+ getLanguage: function (element) {
204
+ while (element) {
205
+ var m = lang.exec(element.className);
206
+ if (m) {
207
+ return m[1].toLowerCase();
208
+ }
209
+ element = element.parentElement;
210
+ }
211
+ return 'none';
212
+ },
213
+
214
+ /**
215
+ * Sets the Prism `language-xxxx` class of the given element.
216
+ *
217
+ * @param {Element} element
218
+ * @param {string} language
219
+ * @returns {void}
220
+ */
221
+ setLanguage: function (element, language) {
222
+ // remove all `language-xxxx` classes
223
+ // (this might leave behind a leading space)
224
+ element.className = element.className.replace(RegExp(lang, 'gi'), '');
225
+
226
+ // add the new `language-xxxx` class
227
+ // (using `classList` will automatically clean up spaces for us)
228
+ element.classList.add('language-' + language);
229
+ },
230
+
231
+ /**
232
+ * Returns the script element that is currently executing.
233
+ *
234
+ * This does __not__ work for line script element.
235
+ *
236
+ * @returns {HTMLScriptElement | null}
237
+ */
238
+ currentScript: function () {
239
+ if (typeof document === 'undefined') {
240
+ return null;
241
+ }
242
+ if (document.currentScript && document.currentScript.tagName === 'SCRIPT' && 1 < 2 /* hack to trip TS' flow analysis */) {
243
+ return /** @type {any} */ (document.currentScript);
244
+ }
245
+
246
+ // IE11 workaround
247
+ // we'll get the src of the current script by parsing IE11's error stack trace
248
+ // this will not work for inline scripts
249
+
250
+ try {
251
+ throw new Error();
252
+ } catch (err) {
253
+ // Get file src url from stack. Specifically works with the format of stack traces in IE.
254
+ // A stack will look like this:
255
+ //
256
+ // Error
257
+ // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
258
+ // at Global code (http://localhost/components/prism-core.js:606:1)
259
+
260
+ var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
261
+ if (src) {
262
+ var scripts = document.getElementsByTagName('script');
263
+ for (var i in scripts) {
264
+ if (scripts[i].src == src) {
265
+ return scripts[i];
266
+ }
267
+ }
268
+ }
269
+ return null;
270
+ }
271
+ },
272
+
273
+ /**
274
+ * Returns whether a given class is active for `element`.
275
+ *
276
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
277
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
278
+ * given class is just the given class with a `no-` prefix.
279
+ *
280
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
281
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
282
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
283
+ *
284
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
285
+ * version of it, the class is considered active.
286
+ *
287
+ * @param {Element} element
288
+ * @param {string} className
289
+ * @param {boolean} [defaultActivation=false]
290
+ * @returns {boolean}
291
+ */
292
+ isActive: function (element, className, defaultActivation) {
293
+ var no = 'no-' + className;
294
+
295
+ while (element) {
296
+ var classList = element.classList;
297
+ if (classList.contains(className)) {
298
+ return true;
299
+ }
300
+ if (classList.contains(no)) {
301
+ return false;
302
+ }
303
+ element = element.parentElement;
304
+ }
305
+ return !!defaultActivation;
306
+ }
307
+ },
308
+
309
+ /**
310
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
311
+ *
312
+ * @namespace
313
+ * @memberof Prism
314
+ * @public
315
+ */
316
+ languages: {
317
+ /**
318
+ * The grammar for plain, unformatted text.
319
+ */
320
+ plain: plainTextGrammar,
321
+ plaintext: plainTextGrammar,
322
+ text: plainTextGrammar,
323
+ txt: plainTextGrammar,
324
+
325
+ /**
326
+ * Creates a deep copy of the language with the given id and appends the given tokens.
327
+ *
328
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
329
+ * will be overwritten at its original position.
330
+ *
331
+ * ## Best practices
332
+ *
333
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
334
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
335
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
336
+ *
337
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
338
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
339
+ *
340
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
341
+ * @param {Grammar} redef The new tokens to append.
342
+ * @returns {Grammar} The new language created.
343
+ * @public
344
+ * @example
345
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
346
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
347
+ * // at its original position
348
+ * 'comment': { ... },
349
+ * // CSS doesn't have a 'color' token, so this token will be appended
350
+ * 'color': /\b(?:red|green|blue)\b/
351
+ * });
352
+ */
353
+ extend: function (id, redef) {
354
+ var lang = _.util.clone(_.languages[id]);
355
+
356
+ for (var key in redef) {
357
+ lang[key] = redef[key];
358
+ }
359
+
360
+ return lang;
361
+ },
362
+
363
+ /**
364
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
365
+ *
366
+ * ## Usage
367
+ *
368
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
369
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
370
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
371
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
372
+ * this:
373
+ *
374
+ * ```js
375
+ * Prism.languages.markup.style = {
376
+ * // token
377
+ * };
378
+ * ```
379
+ *
380
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
381
+ * before existing tokens. For the CSS example above, you would use it like this:
382
+ *
383
+ * ```js
384
+ * Prism.languages.insertBefore('markup', 'cdata', {
385
+ * 'style': {
386
+ * // token
387
+ * }
388
+ * });
389
+ * ```
390
+ *
391
+ * ## Special cases
392
+ *
393
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
394
+ * will be ignored.
395
+ *
396
+ * This behavior can be used to insert tokens after `before`:
397
+ *
398
+ * ```js
399
+ * Prism.languages.insertBefore('markup', 'comment', {
400
+ * 'comment': Prism.languages.markup.comment,
401
+ * // tokens after 'comment'
402
+ * });
403
+ * ```
404
+ *
405
+ * ## Limitations
406
+ *
407
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
408
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
409
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
410
+ * deleting properties which is necessary to insert at arbitrary positions.
411
+ *
412
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
413
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
414
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
415
+ *
416
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
417
+ * you hold the target object in a variable, then the value of the variable will not change.
418
+ *
419
+ * ```js
420
+ * var oldMarkup = Prism.languages.markup;
421
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
422
+ *
423
+ * assert(oldMarkup !== Prism.languages.markup);
424
+ * assert(newMarkup === Prism.languages.markup);
425
+ * ```
426
+ *
427
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
428
+ * object to be modified.
429
+ * @param {string} before The key to insert before.
430
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
431
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
432
+ * object to be modified.
433
+ *
434
+ * Defaults to `Prism.languages`.
435
+ * @returns {Grammar} The new grammar object.
436
+ * @public
437
+ */
438
+ insertBefore: function (inside, before, insert, root) {
439
+ root = root || /** @type {any} */ (_.languages);
440
+ var grammar = root[inside];
441
+ /** @type {Grammar} */
442
+ var ret = {};
443
+
444
+ for (var token in grammar) {
445
+ if (grammar.hasOwnProperty(token)) {
446
+
447
+ if (token == before) {
448
+ for (var newToken in insert) {
449
+ if (insert.hasOwnProperty(newToken)) {
450
+ ret[newToken] = insert[newToken];
451
+ }
452
+ }
453
+ }
454
+
455
+ // Do not insert token which also occur in insert. See #1525
456
+ if (!insert.hasOwnProperty(token)) {
457
+ ret[token] = grammar[token];
458
+ }
459
+ }
460
+ }
461
+
462
+ var old = root[inside];
463
+ root[inside] = ret;
464
+
465
+ // Update references in other language definitions
466
+ _.languages.DFS(_.languages, function (key, value) {
467
+ if (value === old && key != inside) {
468
+ this[key] = ret;
469
+ }
470
+ });
471
+
472
+ return ret;
473
+ },
474
+
475
+ // Traverse a language definition with Depth First Search
476
+ DFS: function DFS(o, callback, type, visited) {
477
+ visited = visited || {};
478
+
479
+ var objId = _.util.objId;
480
+
481
+ for (var i in o) {
482
+ if (o.hasOwnProperty(i)) {
483
+ callback.call(o, i, o[i], type || i);
484
+
485
+ var property = o[i];
486
+ var propertyType = _.util.type(property);
487
+
488
+ if (propertyType === 'Object' && !visited[objId(property)]) {
489
+ visited[objId(property)] = true;
490
+ DFS(property, callback, null, visited);
491
+ } else if (propertyType === 'Array' && !visited[objId(property)]) {
492
+ visited[objId(property)] = true;
493
+ DFS(property, callback, i, visited);
494
+ }
495
+ }
496
+ }
497
+ }
498
+ },
499
+
500
+ plugins: {},
501
+
502
+ /**
503
+ * This is the most high-level function in Prism’s API.
504
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
505
+ * each one of them.
506
+ *
507
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
508
+ *
509
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
510
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
511
+ * @memberof Prism
512
+ * @public
513
+ */
514
+ highlightAll: function (async, callback) {
515
+ _.highlightAllUnder(document, async, callback);
516
+ },
517
+
518
+ /**
519
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
520
+ * {@link Prism.highlightElement} on each one of them.
521
+ *
522
+ * The following hooks will be run:
523
+ * 1. `before-highlightall`
524
+ * 2. `before-all-elements-highlight`
525
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
526
+ *
527
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
528
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
529
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
530
+ * @memberof Prism
531
+ * @public
532
+ */
533
+ highlightAllUnder: function (container, async, callback) {
534
+ var env = {
535
+ callback: callback,
536
+ container: container,
537
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
538
+ };
539
+
540
+ _.hooks.run('before-highlightall', env);
541
+
542
+ env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
543
+
544
+ _.hooks.run('before-all-elements-highlight', env);
545
+
546
+ for (var i = 0, element; (element = env.elements[i++]);) {
547
+ _.highlightElement(element, async === true, env.callback);
548
+ }
549
+ },
550
+
551
+ /**
552
+ * Highlights the code inside a single element.
553
+ *
554
+ * The following hooks will be run:
555
+ * 1. `before-sanity-check`
556
+ * 2. `before-highlight`
557
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
558
+ * 4. `before-insert`
559
+ * 5. `after-highlight`
560
+ * 6. `complete`
561
+ *
562
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
563
+ * the element's language.
564
+ *
565
+ * @param {Element} element The element containing the code.
566
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
567
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
568
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
569
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
570
+ *
571
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
572
+ * asynchronous highlighting to work. You can build your own bundle on the
573
+ * [Download page](https://prismjs.com/download.html).
574
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
575
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
576
+ * @memberof Prism
577
+ * @public
578
+ */
579
+ highlightElement: function (element, async, callback) {
580
+ // Find language
581
+ var language = _.util.getLanguage(element);
582
+ var grammar = _.languages[language];
583
+
584
+ // Set language on the element, if not present
585
+ _.util.setLanguage(element, language);
586
+
587
+ // Set language on the parent, for styling
588
+ var parent = element.parentElement;
589
+ if (parent && parent.nodeName.toLowerCase() === 'pre') {
590
+ _.util.setLanguage(parent, language);
591
+ }
592
+
593
+ var code = element.textContent;
594
+
595
+ var env = {
596
+ element: element,
597
+ language: language,
598
+ grammar: grammar,
599
+ code: code
600
+ };
601
+
602
+ function insertHighlightedCode(highlightedCode) {
603
+ env.highlightedCode = highlightedCode;
604
+
605
+ _.hooks.run('before-insert', env);
606
+
607
+ env.element.innerHTML = env.highlightedCode;
608
+
609
+ _.hooks.run('after-highlight', env);
610
+ _.hooks.run('complete', env);
611
+ callback && callback.call(env.element);
612
+ }
613
+
614
+ _.hooks.run('before-sanity-check', env);
615
+
616
+ // plugins may change/add the parent/element
617
+ parent = env.element.parentElement;
618
+ if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
619
+ parent.setAttribute('tabindex', '0');
620
+ }
621
+
622
+ if (!env.code) {
623
+ _.hooks.run('complete', env);
624
+ callback && callback.call(env.element);
625
+ return;
626
+ }
627
+
628
+ _.hooks.run('before-highlight', env);
629
+
630
+ if (!env.grammar) {
631
+ insertHighlightedCode(_.util.encode(env.code));
632
+ return;
633
+ }
634
+
635
+ if (async && _self.Worker) {
636
+ var worker = new Worker(_.filename);
637
+
638
+ worker.onmessage = function (evt) {
639
+ insertHighlightedCode(evt.data);
640
+ };
641
+
642
+ worker.postMessage(JSON.stringify({
643
+ language: env.language,
644
+ code: env.code,
645
+ immediateClose: true
646
+ }));
647
+ } else {
648
+ insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
649
+ }
650
+ },
651
+
652
+ /**
653
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
654
+ * and the language definitions to use, and returns a string with the HTML produced.
655
+ *
656
+ * The following hooks will be run:
657
+ * 1. `before-tokenize`
658
+ * 2. `after-tokenize`
659
+ * 3. `wrap`: On each {@link Token}.
660
+ *
661
+ * @param {string} text A string with the code to be highlighted.
662
+ * @param {Grammar} grammar An object containing the tokens to use.
663
+ *
664
+ * Usually a language definition like `Prism.languages.markup`.
665
+ * @param {string} language The name of the language definition passed to `grammar`.
666
+ * @returns {string} The highlighted HTML.
667
+ * @memberof Prism
668
+ * @public
669
+ * @example
670
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
671
+ */
672
+ highlight: function (text, grammar, language) {
673
+ var env = {
674
+ code: text,
675
+ grammar: grammar,
676
+ language: language
677
+ };
678
+ _.hooks.run('before-tokenize', env);
679
+ if (!env.grammar) {
680
+ throw new Error('The language "' + env.language + '" has no grammar.');
681
+ }
682
+ env.tokens = _.tokenize(env.code, env.grammar);
683
+ _.hooks.run('after-tokenize', env);
684
+ return Token.stringify(_.util.encode(env.tokens), env.language);
685
+ },
686
+
687
+ /**
688
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
689
+ * and the language definitions to use, and returns an array with the tokenized code.
690
+ *
691
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
692
+ *
693
+ * This method could be useful in other contexts as well, as a very crude parser.
694
+ *
695
+ * @param {string} text A string with the code to be highlighted.
696
+ * @param {Grammar} grammar An object containing the tokens to use.
697
+ *
698
+ * Usually a language definition like `Prism.languages.markup`.
699
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
700
+ * @memberof Prism
701
+ * @public
702
+ * @example
703
+ * let code = `var foo = 0;`;
704
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
705
+ * tokens.forEach(token => {
706
+ * if (token instanceof Prism.Token && token.type === 'number') {
707
+ * console.log(`Found numeric literal: ${token.content}`);
708
+ * }
709
+ * });
710
+ */
711
+ tokenize: function (text, grammar) {
712
+ var rest = grammar.rest;
713
+ if (rest) {
714
+ for (var token in rest) {
715
+ grammar[token] = rest[token];
716
+ }
717
+
718
+ delete grammar.rest;
719
+ }
720
+
721
+ var tokenList = new LinkedList();
722
+ addAfter(tokenList, tokenList.head, text);
723
+
724
+ matchGrammar(text, tokenList, grammar, tokenList.head, 0);
725
+
726
+ return toArray(tokenList);
727
+ },
728
+
729
+ /**
730
+ * @namespace
731
+ * @memberof Prism
732
+ * @public
733
+ */
734
+ hooks: {
735
+ all: {},
736
+
737
+ /**
738
+ * Adds the given callback to the list of callbacks for the given hook.
739
+ *
740
+ * The callback will be invoked when the hook it is registered for is run.
741
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
742
+ *
743
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
744
+ *
745
+ * @param {string} name The name of the hook.
746
+ * @param {HookCallback} callback The callback function which is given environment variables.
747
+ * @public
748
+ */
749
+ add: function (name, callback) {
750
+ var hooks = _.hooks.all;
751
+
752
+ hooks[name] = hooks[name] || [];
753
+
754
+ hooks[name].push(callback);
755
+ },
756
+
757
+ /**
758
+ * Runs a hook invoking all registered callbacks with the given environment variables.
759
+ *
760
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
761
+ *
762
+ * @param {string} name The name of the hook.
763
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
764
+ * @public
765
+ */
766
+ run: function (name, env) {
767
+ var callbacks = _.hooks.all[name];
768
+
769
+ if (!callbacks || !callbacks.length) {
770
+ return;
771
+ }
772
+
773
+ for (var i = 0, callback; (callback = callbacks[i++]);) {
774
+ callback(env);
775
+ }
776
+ }
777
+ },
778
+
779
+ Token: Token
780
+ };
781
+ _self.Prism = _;
782
+
783
+
784
+ // Typescript note:
785
+ // The following can be used to import the Token type in JSDoc:
786
+ //
787
+ // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
788
+
789
+ /**
790
+ * Creates a new token.
791
+ *
792
+ * @param {string} type See {@link Token#type type}
793
+ * @param {string | TokenStream} content See {@link Token#content content}
794
+ * @param {string|string[]} [alias] The alias(es) of the token.
795
+ * @param {string} [matchedStr=""] A copy of the full string this token was created from.
796
+ * @class
797
+ * @global
798
+ * @public
799
+ */
800
+ function Token(type, content, alias, matchedStr) {
801
+ /**
802
+ * The type of the token.
803
+ *
804
+ * This is usually the key of a pattern in a {@link Grammar}.
805
+ *
806
+ * @type {string}
807
+ * @see GrammarToken
808
+ * @public
809
+ */
810
+ this.type = type;
811
+ /**
812
+ * The strings or tokens contained by this token.
813
+ *
814
+ * This will be a token stream if the pattern matched also defined an `inside` grammar.
815
+ *
816
+ * @type {string | TokenStream}
817
+ * @public
818
+ */
819
+ this.content = content;
820
+ /**
821
+ * The alias(es) of the token.
822
+ *
823
+ * @type {string|string[]}
824
+ * @see GrammarToken
825
+ * @public
826
+ */
827
+ this.alias = alias;
828
+ // Copy of the full string this token was created from
829
+ this.length = (matchedStr || '').length | 0;
830
+ }
831
+
832
+ /**
833
+ * A token stream is an array of strings and {@link Token Token} objects.
834
+ *
835
+ * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
836
+ * them.
837
+ *
838
+ * 1. No adjacent strings.
839
+ * 2. No empty strings.
840
+ *
841
+ * The only exception here is the token stream that only contains the empty string and nothing else.
842
+ *
843
+ * @typedef {Array<string | Token>} TokenStream
844
+ * @global
845
+ * @public
846
+ */
847
+
848
+ /**
849
+ * Converts the given token or token stream to an HTML representation.
850
+ *
851
+ * The following hooks will be run:
852
+ * 1. `wrap`: On each {@link Token}.
853
+ *
854
+ * @param {string | Token | TokenStream} o The token or token stream to be converted.
855
+ * @param {string} language The name of current language.
856
+ * @returns {string} The HTML representation of the token or token stream.
857
+ * @memberof Token
858
+ * @static
859
+ */
860
+ Token.stringify = function stringify(o, language) {
861
+ if (typeof o == 'string') {
862
+ return o;
863
+ }
864
+ if (Array.isArray(o)) {
865
+ var s = '';
866
+ o.forEach(function (e) {
867
+ s += stringify(e, language);
868
+ });
869
+ return s;
870
+ }
871
+
872
+ var env = {
873
+ type: o.type,
874
+ content: stringify(o.content, language),
875
+ tag: 'span',
876
+ classes: ['token', o.type],
877
+ attributes: {},
878
+ language: language
879
+ };
880
+
881
+ var aliases = o.alias;
882
+ if (aliases) {
883
+ if (Array.isArray(aliases)) {
884
+ Array.prototype.push.apply(env.classes, aliases);
885
+ } else {
886
+ env.classes.push(aliases);
887
+ }
888
+ }
889
+
890
+ _.hooks.run('wrap', env);
891
+
892
+ var attributes = '';
893
+ for (var name in env.attributes) {
894
+ attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
895
+ }
896
+
897
+ return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
898
+ };
899
+
900
+ /**
901
+ * @param {RegExp} pattern
902
+ * @param {number} pos
903
+ * @param {string} text
904
+ * @param {boolean} lookbehind
905
+ * @returns {RegExpExecArray | null}
906
+ */
907
+ function matchPattern(pattern, pos, text, lookbehind) {
908
+ pattern.lastIndex = pos;
909
+ var match = pattern.exec(text);
910
+ if (match && lookbehind && match[1]) {
911
+ // change the match to remove the text matched by the Prism lookbehind group
912
+ var lookbehindLength = match[1].length;
913
+ match.index += lookbehindLength;
914
+ match[0] = match[0].slice(lookbehindLength);
915
+ }
916
+ return match;
917
+ }
918
+
919
+ /**
920
+ * @param {string} text
921
+ * @param {LinkedList<string | Token>} tokenList
922
+ * @param {any} grammar
923
+ * @param {LinkedListNode<string | Token>} startNode
924
+ * @param {number} startPos
925
+ * @param {RematchOptions} [rematch]
926
+ * @returns {void}
927
+ * @private
928
+ *
929
+ * @typedef RematchOptions
930
+ * @property {string} cause
931
+ * @property {number} reach
932
+ */
933
+ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
934
+ for (var token in grammar) {
935
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
936
+ continue;
937
+ }
938
+
939
+ var patterns = grammar[token];
940
+ patterns = Array.isArray(patterns) ? patterns : [patterns];
941
+
942
+ for (var j = 0; j < patterns.length; ++j) {
943
+ if (rematch && rematch.cause == token + ',' + j) {
944
+ return;
945
+ }
946
+
947
+ var patternObj = patterns[j];
948
+ var inside = patternObj.inside;
949
+ var lookbehind = !!patternObj.lookbehind;
950
+ var greedy = !!patternObj.greedy;
951
+ var alias = patternObj.alias;
952
+
953
+ if (greedy && !patternObj.pattern.global) {
954
+ // Without the global flag, lastIndex won't work
955
+ var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
956
+ patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
957
+ }
958
+
959
+ /** @type {RegExp} */
960
+ var pattern = patternObj.pattern || patternObj;
961
+
962
+ for ( // iterate the token list and keep track of the current token/string position
963
+ var currentNode = startNode.next, pos = startPos;
964
+ currentNode !== tokenList.tail;
965
+ pos += currentNode.value.length, currentNode = currentNode.next
966
+ ) {
967
+
968
+ if (rematch && pos >= rematch.reach) {
969
+ break;
970
+ }
971
+
972
+ var str = currentNode.value;
973
+
974
+ if (tokenList.length > text.length) {
975
+ // Something went terribly wrong, ABORT, ABORT!
976
+ return;
977
+ }
978
+
979
+ if (str instanceof Token) {
980
+ continue;
981
+ }
982
+
983
+ var removeCount = 1; // this is the to parameter of removeBetween
984
+ var match;
985
+
986
+ if (greedy) {
987
+ match = matchPattern(pattern, pos, text, lookbehind);
988
+ if (!match || match.index >= text.length) {
989
+ break;
990
+ }
991
+
992
+ var from = match.index;
993
+ var to = match.index + match[0].length;
994
+ var p = pos;
995
+
996
+ // find the node that contains the match
997
+ p += currentNode.value.length;
998
+ while (from >= p) {
999
+ currentNode = currentNode.next;
1000
+ p += currentNode.value.length;
1001
+ }
1002
+ // adjust pos (and p)
1003
+ p -= currentNode.value.length;
1004
+ pos = p;
1005
+
1006
+ // the current node is a Token, then the match starts inside another Token, which is invalid
1007
+ if (currentNode.value instanceof Token) {
1008
+ continue;
1009
+ }
1010
+
1011
+ // find the last node which is affected by this match
1012
+ for (
1013
+ var k = currentNode;
1014
+ k !== tokenList.tail && (p < to || typeof k.value === 'string');
1015
+ k = k.next
1016
+ ) {
1017
+ removeCount++;
1018
+ p += k.value.length;
1019
+ }
1020
+ removeCount--;
1021
+
1022
+ // replace with the new match
1023
+ str = text.slice(pos, p);
1024
+ match.index -= pos;
1025
+ } else {
1026
+ match = matchPattern(pattern, 0, str, lookbehind);
1027
+ if (!match) {
1028
+ continue;
1029
+ }
1030
+ }
1031
+
1032
+ // eslint-disable-next-line no-redeclare
1033
+ var from = match.index;
1034
+ var matchStr = match[0];
1035
+ var before = str.slice(0, from);
1036
+ var after = str.slice(from + matchStr.length);
1037
+
1038
+ var reach = pos + str.length;
1039
+ if (rematch && reach > rematch.reach) {
1040
+ rematch.reach = reach;
1041
+ }
1042
+
1043
+ var removeFrom = currentNode.prev;
1044
+
1045
+ if (before) {
1046
+ removeFrom = addAfter(tokenList, removeFrom, before);
1047
+ pos += before.length;
1048
+ }
1049
+
1050
+ removeRange(tokenList, removeFrom, removeCount);
1051
+
1052
+ var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
1053
+ currentNode = addAfter(tokenList, removeFrom, wrapped);
1054
+
1055
+ if (after) {
1056
+ addAfter(tokenList, currentNode, after);
1057
+ }
1058
+
1059
+ if (removeCount > 1) {
1060
+ // at least one Token object was removed, so we have to do some rematching
1061
+ // this can only happen if the current pattern is greedy
1062
+
1063
+ /** @type {RematchOptions} */
1064
+ var nestedRematch = {
1065
+ cause: token + ',' + j,
1066
+ reach: reach
1067
+ };
1068
+ matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
1069
+
1070
+ // the reach might have been extended because of the rematching
1071
+ if (rematch && nestedRematch.reach > rematch.reach) {
1072
+ rematch.reach = nestedRematch.reach;
1073
+ }
1074
+ }
1075
+ }
1076
+ }
1077
+ }
1078
+ }
1079
+
1080
+ /**
1081
+ * @typedef LinkedListNode
1082
+ * @property {T} value
1083
+ * @property {LinkedListNode<T> | null} prev The previous node.
1084
+ * @property {LinkedListNode<T> | null} next The next node.
1085
+ * @template T
1086
+ * @private
1087
+ */
1088
+
1089
+ /**
1090
+ * @template T
1091
+ * @private
1092
+ */
1093
+ function LinkedList() {
1094
+ /** @type {LinkedListNode<T>} */
1095
+ var head = { value: null, prev: null, next: null };
1096
+ /** @type {LinkedListNode<T>} */
1097
+ var tail = { value: null, prev: head, next: null };
1098
+ head.next = tail;
1099
+
1100
+ /** @type {LinkedListNode<T>} */
1101
+ this.head = head;
1102
+ /** @type {LinkedListNode<T>} */
1103
+ this.tail = tail;
1104
+ this.length = 0;
1105
+ }
1106
+
1107
+ /**
1108
+ * Adds a new node with the given value to the list.
1109
+ *
1110
+ * @param {LinkedList<T>} list
1111
+ * @param {LinkedListNode<T>} node
1112
+ * @param {T} value
1113
+ * @returns {LinkedListNode<T>} The added node.
1114
+ * @template T
1115
+ */
1116
+ function addAfter(list, node, value) {
1117
+ // assumes that node != list.tail && values.length >= 0
1118
+ var next = node.next;
1119
+
1120
+ var newNode = { value: value, prev: node, next: next };
1121
+ node.next = newNode;
1122
+ next.prev = newNode;
1123
+ list.length++;
1124
+
1125
+ return newNode;
1126
+ }
1127
+ /**
1128
+ * Removes `count` nodes after the given node. The given node will not be removed.
1129
+ *
1130
+ * @param {LinkedList<T>} list
1131
+ * @param {LinkedListNode<T>} node
1132
+ * @param {number} count
1133
+ * @template T
1134
+ */
1135
+ function removeRange(list, node, count) {
1136
+ var next = node.next;
1137
+ for (var i = 0; i < count && next !== list.tail; i++) {
1138
+ next = next.next;
1139
+ }
1140
+ node.next = next;
1141
+ next.prev = node;
1142
+ list.length -= i;
1143
+ }
1144
+ /**
1145
+ * @param {LinkedList<T>} list
1146
+ * @returns {T[]}
1147
+ * @template T
1148
+ */
1149
+ function toArray(list) {
1150
+ var array = [];
1151
+ var node = list.head.next;
1152
+ while (node !== list.tail) {
1153
+ array.push(node.value);
1154
+ node = node.next;
1155
+ }
1156
+ return array;
1157
+ }
1158
+
1159
+
1160
+ if (!_self.document) {
1161
+ if (!_self.addEventListener) {
1162
+ // in Node.js
1163
+ return _;
1164
+ }
1165
+
1166
+ if (!_.disableWorkerMessageHandler) {
1167
+ // In worker
1168
+ _self.addEventListener('message', function (evt) {
1169
+ var message = JSON.parse(evt.data);
1170
+ var lang = message.language;
1171
+ var code = message.code;
1172
+ var immediateClose = message.immediateClose;
1173
+
1174
+ _self.postMessage(_.highlight(code, _.languages[lang], lang));
1175
+ if (immediateClose) {
1176
+ _self.close();
1177
+ }
1178
+ }, false);
1179
+ }
1180
+
1181
+ return _;
1182
+ }
1183
+
1184
+ // Get current script and highlight
1185
+ var script = _.util.currentScript();
1186
+
1187
+ if (script) {
1188
+ _.filename = script.src;
1189
+
1190
+ if (script.hasAttribute('data-manual')) {
1191
+ _.manual = true;
1192
+ }
1193
+ }
1194
+
1195
+ function highlightAutomaticallyCallback() {
1196
+ if (!_.manual) {
1197
+ _.highlightAll();
1198
+ }
1199
+ }
1200
+
1201
+ if (!_.manual) {
1202
+ // If the document state is "loading", then we'll use DOMContentLoaded.
1203
+ // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
1204
+ // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
1205
+ // might take longer one animation frame to execute which can create a race condition where only some plugins have
1206
+ // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
1207
+ // See https://github.com/PrismJS/prism/issues/2102
1208
+ var readyState = document.readyState;
1209
+ if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
1210
+ document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
1211
+ } else {
1212
+ if (window.requestAnimationFrame) {
1213
+ window.requestAnimationFrame(highlightAutomaticallyCallback);
1214
+ } else {
1215
+ window.setTimeout(highlightAutomaticallyCallback, 16);
1216
+ }
1217
+ }
1218
+ }
1219
+
1220
+ return _;
1221
+
1222
+ }(_self));
1223
+
1224
+ if (module.exports) {
1225
+ module.exports = Prism;
1226
+ }
1227
+
1228
+ // hack for components to work correctly in node.js
1229
+ if (typeof _commonjsHelpers.commonjsGlobal !== 'undefined') {
1230
+ _commonjsHelpers.commonjsGlobal.Prism = Prism;
1231
+ }
1232
+
1233
+ // some additional documentation/types
1234
+
1235
+ /**
1236
+ * The expansion of a simple `RegExp` literal to support additional properties.
1237
+ *
1238
+ * @typedef GrammarToken
1239
+ * @property {RegExp} pattern The regular expression of the token.
1240
+ * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
1241
+ * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
1242
+ * @property {boolean} [greedy=false] Whether the token is greedy.
1243
+ * @property {string|string[]} [alias] An optional alias or list of aliases.
1244
+ * @property {Grammar} [inside] The nested grammar of this token.
1245
+ *
1246
+ * The `inside` grammar will be used to tokenize the text value of each token of this kind.
1247
+ *
1248
+ * This can be used to make nested and even recursive language definitions.
1249
+ *
1250
+ * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
1251
+ * each another.
1252
+ * @global
1253
+ * @public
1254
+ */
1255
+
1256
+ /**
1257
+ * @typedef Grammar
1258
+ * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
1259
+ * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
1260
+ * @global
1261
+ * @public
1262
+ */
1263
+
1264
+ /**
1265
+ * A function which will invoked after an element was successfully highlighted.
1266
+ *
1267
+ * @callback HighlightCallback
1268
+ * @param {Element} element The element successfully highlighted.
1269
+ * @returns {void}
1270
+ * @global
1271
+ * @public
1272
+ */
1273
+
1274
+ /**
1275
+ * @callback HookCallback
1276
+ * @param {Object<string, any>} env The environment variables of the hook.
1277
+ * @returns {void}
1278
+ * @global
1279
+ * @public
1280
+ */
1281
+
1282
+
1283
+ /* **********************************************
1284
+ Begin prism-markup.js
1285
+ ********************************************** */
1286
+
1287
+ Prism.languages.markup = {
1288
+ 'comment': {
1289
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
1290
+ greedy: true
1291
+ },
1292
+ 'prolog': {
1293
+ pattern: /<\?[\s\S]+?\?>/,
1294
+ greedy: true
1295
+ },
1296
+ 'doctype': {
1297
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
1298
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
1299
+ greedy: true,
1300
+ inside: {
1301
+ 'internal-subset': {
1302
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
1303
+ lookbehind: true,
1304
+ greedy: true,
1305
+ inside: null // see below
1306
+ },
1307
+ 'string': {
1308
+ pattern: /"[^"]*"|'[^']*'/,
1309
+ greedy: true
1310
+ },
1311
+ 'punctuation': /^<!|>$|[[\]]/,
1312
+ 'doctype-tag': /^DOCTYPE/i,
1313
+ 'name': /[^\s<>'"]+/
1314
+ }
1315
+ },
1316
+ 'cdata': {
1317
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1318
+ greedy: true
1319
+ },
1320
+ 'tag': {
1321
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
1322
+ greedy: true,
1323
+ inside: {
1324
+ 'tag': {
1325
+ pattern: /^<\/?[^\s>\/]+/,
1326
+ inside: {
1327
+ 'punctuation': /^<\/?/,
1328
+ 'namespace': /^[^\s>\/:]+:/
1329
+ }
1330
+ },
1331
+ 'special-attr': [],
1332
+ 'attr-value': {
1333
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
1334
+ inside: {
1335
+ 'punctuation': [
1336
+ {
1337
+ pattern: /^=/,
1338
+ alias: 'attr-equals'
1339
+ },
1340
+ {
1341
+ pattern: /^(\s*)["']|["']$/,
1342
+ lookbehind: true
1343
+ }
1344
+ ]
1345
+ }
1346
+ },
1347
+ 'punctuation': /\/?>/,
1348
+ 'attr-name': {
1349
+ pattern: /[^\s>\/]+/,
1350
+ inside: {
1351
+ 'namespace': /^[^\s>\/:]+:/
1352
+ }
1353
+ }
1354
+
1355
+ }
1356
+ },
1357
+ 'entity': [
1358
+ {
1359
+ pattern: /&[\da-z]{1,8};/i,
1360
+ alias: 'named-entity'
1361
+ },
1362
+ /&#x?[\da-f]{1,8};/i
1363
+ ]
1364
+ };
1365
+
1366
+ Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
1367
+ Prism.languages.markup['entity'];
1368
+ Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
1369
+
1370
+ // Plugin to make entity title show the real entity, idea by Roman Komarov
1371
+ Prism.hooks.add('wrap', function (env) {
1372
+
1373
+ if (env.type === 'entity') {
1374
+ env.attributes['title'] = env.content.replace(/&amp;/, '&');
1375
+ }
1376
+ });
1377
+
1378
+ Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
1379
+ /**
1380
+ * Adds an inlined language to markup.
1381
+ *
1382
+ * An example of an inlined language is CSS with `<style>` tags.
1383
+ *
1384
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
1385
+ * case insensitive.
1386
+ * @param {string} lang The language key.
1387
+ * @example
1388
+ * addInlined('style', 'css');
1389
+ */
1390
+ value: function addInlined(tagName, lang) {
1391
+ var includedCdataInside = {};
1392
+ includedCdataInside['language-' + lang] = {
1393
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
1394
+ lookbehind: true,
1395
+ inside: Prism.languages[lang]
1396
+ };
1397
+ includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
1398
+
1399
+ var inside = {
1400
+ 'included-cdata': {
1401
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
1402
+ inside: includedCdataInside
1403
+ }
1404
+ };
1405
+ inside['language-' + lang] = {
1406
+ pattern: /[\s\S]+/,
1407
+ inside: Prism.languages[lang]
1408
+ };
1409
+
1410
+ var def = {};
1411
+ def[tagName] = {
1412
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
1413
+ lookbehind: true,
1414
+ greedy: true,
1415
+ inside: inside
1416
+ };
1417
+
1418
+ Prism.languages.insertBefore('markup', 'cdata', def);
1419
+ }
1420
+ });
1421
+ Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
1422
+ /**
1423
+ * Adds an pattern to highlight languages embedded in HTML attributes.
1424
+ *
1425
+ * An example of an inlined language is CSS with `style` attributes.
1426
+ *
1427
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
1428
+ * case insensitive.
1429
+ * @param {string} lang The language key.
1430
+ * @example
1431
+ * addAttribute('style', 'css');
1432
+ */
1433
+ value: function (attrName, lang) {
1434
+ Prism.languages.markup.tag.inside['special-attr'].push({
1435
+ pattern: RegExp(
1436
+ /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
1437
+ 'i'
1438
+ ),
1439
+ lookbehind: true,
1440
+ inside: {
1441
+ 'attr-name': /^[^\s=]+/,
1442
+ 'attr-value': {
1443
+ pattern: /=[\s\S]+/,
1444
+ inside: {
1445
+ 'value': {
1446
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
1447
+ lookbehind: true,
1448
+ alias: [lang, 'language-' + lang],
1449
+ inside: Prism.languages[lang]
1450
+ },
1451
+ 'punctuation': [
1452
+ {
1453
+ pattern: /^=/,
1454
+ alias: 'attr-equals'
1455
+ },
1456
+ /"|'/
1457
+ ]
1458
+ }
1459
+ }
1460
+ }
1461
+ });
1462
+ }
1463
+ });
1464
+
1465
+ Prism.languages.html = Prism.languages.markup;
1466
+ Prism.languages.mathml = Prism.languages.markup;
1467
+ Prism.languages.svg = Prism.languages.markup;
1468
+
1469
+ Prism.languages.xml = Prism.languages.extend('markup', {});
1470
+ Prism.languages.ssml = Prism.languages.xml;
1471
+ Prism.languages.atom = Prism.languages.xml;
1472
+ Prism.languages.rss = Prism.languages.xml;
1473
+
1474
+
1475
+ /* **********************************************
1476
+ Begin prism-css.js
1477
+ ********************************************** */
1478
+
1479
+ (function (Prism) {
1480
+
1481
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
1482
+
1483
+ Prism.languages.css = {
1484
+ 'comment': /\/\*[\s\S]*?\*\//,
1485
+ 'atrule': {
1486
+ pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
1487
+ inside: {
1488
+ 'rule': /^@[\w-]+/,
1489
+ 'selector-function-argument': {
1490
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
1491
+ lookbehind: true,
1492
+ alias: 'selector'
1493
+ },
1494
+ 'keyword': {
1495
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
1496
+ lookbehind: true
1497
+ }
1498
+ // See rest below
1499
+ }
1500
+ },
1501
+ 'url': {
1502
+ // https://drafts.csswg.org/css-values-3/#urls
1503
+ pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
1504
+ greedy: true,
1505
+ inside: {
1506
+ 'function': /^url/i,
1507
+ 'punctuation': /^\(|\)$/,
1508
+ 'string': {
1509
+ pattern: RegExp('^' + string.source + '$'),
1510
+ alias: 'url'
1511
+ }
1512
+ }
1513
+ },
1514
+ 'selector': {
1515
+ pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
1516
+ lookbehind: true
1517
+ },
1518
+ 'string': {
1519
+ pattern: string,
1520
+ greedy: true
1521
+ },
1522
+ 'property': {
1523
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
1524
+ lookbehind: true
1525
+ },
1526
+ 'important': /!important\b/i,
1527
+ 'function': {
1528
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
1529
+ lookbehind: true
1530
+ },
1531
+ 'punctuation': /[(){};:,]/
1532
+ };
1533
+
1534
+ Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
1535
+
1536
+ var markup = Prism.languages.markup;
1537
+ if (markup) {
1538
+ markup.tag.addInlined('style', 'css');
1539
+ markup.tag.addAttribute('style', 'css');
1540
+ }
1541
+
1542
+ }(Prism));
1543
+
1544
+
1545
+ /* **********************************************
1546
+ Begin prism-clike.js
1547
+ ********************************************** */
1548
+
1549
+ Prism.languages.clike = {
1550
+ 'comment': [
1551
+ {
1552
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1553
+ lookbehind: true,
1554
+ greedy: true
1555
+ },
1556
+ {
1557
+ pattern: /(^|[^\\:])\/\/.*/,
1558
+ lookbehind: true,
1559
+ greedy: true
1560
+ }
1561
+ ],
1562
+ 'string': {
1563
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1564
+ greedy: true
1565
+ },
1566
+ 'class-name': {
1567
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1568
+ lookbehind: true,
1569
+ inside: {
1570
+ 'punctuation': /[.\\]/
1571
+ }
1572
+ },
1573
+ 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1574
+ 'boolean': /\b(?:false|true)\b/,
1575
+ 'function': /\b\w+(?=\()/,
1576
+ 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1577
+ 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1578
+ 'punctuation': /[{}[\];(),.:]/
1579
+ };
1580
+
1581
+
1582
+ /* **********************************************
1583
+ Begin prism-javascript.js
1584
+ ********************************************** */
1585
+
1586
+ Prism.languages.javascript = Prism.languages.extend('clike', {
1587
+ 'class-name': [
1588
+ Prism.languages.clike['class-name'],
1589
+ {
1590
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
1591
+ lookbehind: true
1592
+ }
1593
+ ],
1594
+ 'keyword': [
1595
+ {
1596
+ pattern: /((?:^|\})\s*)catch\b/,
1597
+ lookbehind: true
1598
+ },
1599
+ {
1600
+ pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1601
+ lookbehind: true
1602
+ },
1603
+ ],
1604
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1605
+ 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1606
+ 'number': {
1607
+ pattern: RegExp(
1608
+ /(^|[^\w$])/.source +
1609
+ '(?:' +
1610
+ (
1611
+ // constant
1612
+ /NaN|Infinity/.source +
1613
+ '|' +
1614
+ // binary integer
1615
+ /0[bB][01]+(?:_[01]+)*n?/.source +
1616
+ '|' +
1617
+ // octal integer
1618
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
1619
+ '|' +
1620
+ // hexadecimal integer
1621
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
1622
+ '|' +
1623
+ // decimal bigint
1624
+ /\d+(?:_\d+)*n/.source +
1625
+ '|' +
1626
+ // decimal number (integer or float) but no bigint
1627
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
1628
+ ) +
1629
+ ')' +
1630
+ /(?![\w$])/.source
1631
+ ),
1632
+ lookbehind: true
1633
+ },
1634
+ 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1635
+ });
1636
+
1637
+ Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
1638
+
1639
+ Prism.languages.insertBefore('javascript', 'keyword', {
1640
+ 'regex': {
1641
+ pattern: RegExp(
1642
+ // lookbehind
1643
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
1644
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
1645
+ // Regex pattern:
1646
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
1647
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
1648
+ // with the only syntax, so we have to define 2 different regex patterns.
1649
+ /\//.source +
1650
+ '(?:' +
1651
+ /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
1652
+ '|' +
1653
+ // `v` flag syntax. This supports 3 levels of nested character classes.
1654
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
1655
+ ')' +
1656
+ // lookahead
1657
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
1658
+ ),
1659
+ lookbehind: true,
1660
+ greedy: true,
1661
+ inside: {
1662
+ 'regex-source': {
1663
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1664
+ lookbehind: true,
1665
+ alias: 'language-regex',
1666
+ inside: Prism.languages.regex
1667
+ },
1668
+ 'regex-delimiter': /^\/|\/$/,
1669
+ 'regex-flags': /^[a-z]+$/,
1670
+ }
1671
+ },
1672
+ // This must be declared before keyword because we use "function" inside the look-forward
1673
+ 'function-variable': {
1674
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1675
+ alias: 'function'
1676
+ },
1677
+ 'parameter': [
1678
+ {
1679
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1680
+ lookbehind: true,
1681
+ inside: Prism.languages.javascript
1682
+ },
1683
+ {
1684
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1685
+ lookbehind: true,
1686
+ inside: Prism.languages.javascript
1687
+ },
1688
+ {
1689
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1690
+ lookbehind: true,
1691
+ inside: Prism.languages.javascript
1692
+ },
1693
+ {
1694
+ pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1695
+ lookbehind: true,
1696
+ inside: Prism.languages.javascript
1697
+ }
1698
+ ],
1699
+ 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1700
+ });
1701
+
1702
+ Prism.languages.insertBefore('javascript', 'string', {
1703
+ 'hashbang': {
1704
+ pattern: /^#!.*/,
1705
+ greedy: true,
1706
+ alias: 'comment'
1707
+ },
1708
+ 'template-string': {
1709
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
1710
+ greedy: true,
1711
+ inside: {
1712
+ 'template-punctuation': {
1713
+ pattern: /^`|`$/,
1714
+ alias: 'string'
1715
+ },
1716
+ 'interpolation': {
1717
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
1718
+ lookbehind: true,
1719
+ inside: {
1720
+ 'interpolation-punctuation': {
1721
+ pattern: /^\$\{|\}$/,
1722
+ alias: 'punctuation'
1723
+ },
1724
+ rest: Prism.languages.javascript
1725
+ }
1726
+ },
1727
+ 'string': /[\s\S]+/
1728
+ }
1729
+ },
1730
+ 'string-property': {
1731
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
1732
+ lookbehind: true,
1733
+ greedy: true,
1734
+ alias: 'property'
1735
+ }
1736
+ });
1737
+
1738
+ Prism.languages.insertBefore('javascript', 'operator', {
1739
+ 'literal-property': {
1740
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
1741
+ lookbehind: true,
1742
+ alias: 'property'
1743
+ },
1744
+ });
1745
+
1746
+ if (Prism.languages.markup) {
1747
+ Prism.languages.markup.tag.addInlined('script', 'javascript');
1748
+
1749
+ // add attribute support for all DOM events.
1750
+ // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
1751
+ Prism.languages.markup.tag.addAttribute(
1752
+ /on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
1753
+ 'javascript'
1754
+ );
1755
+ }
1756
+
1757
+ Prism.languages.js = Prism.languages.javascript;
1758
+
1759
+
1760
+ /* **********************************************
1761
+ Begin prism-file-highlight.js
1762
+ ********************************************** */
1763
+
1764
+ (function () {
1765
+
1766
+ if (typeof Prism === 'undefined' || typeof document === 'undefined') {
1767
+ return;
1768
+ }
1769
+
1770
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
1771
+ if (!Element.prototype.matches) {
1772
+ Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1773
+ }
1774
+
1775
+ var LOADING_MESSAGE = 'Loading…';
1776
+ var FAILURE_MESSAGE = function (status, message) {
1777
+ return '✖ Error ' + status + ' while fetching file: ' + message;
1778
+ };
1779
+ var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
1780
+
1781
+ var EXTENSIONS = {
1782
+ 'js': 'javascript',
1783
+ 'py': 'python',
1784
+ 'rb': 'ruby',
1785
+ 'ps1': 'powershell',
1786
+ 'psm1': 'powershell',
1787
+ 'sh': 'bash',
1788
+ 'bat': 'batch',
1789
+ 'h': 'c',
1790
+ 'tex': 'latex'
1791
+ };
1792
+
1793
+ var STATUS_ATTR = 'data-src-status';
1794
+ var STATUS_LOADING = 'loading';
1795
+ var STATUS_LOADED = 'loaded';
1796
+ var STATUS_FAILED = 'failed';
1797
+
1798
+ var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
1799
+ + ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
1800
+
1801
+ /**
1802
+ * Loads the given file.
1803
+ *
1804
+ * @param {string} src The URL or path of the source file to load.
1805
+ * @param {(result: string) => void} success
1806
+ * @param {(reason: string) => void} error
1807
+ */
1808
+ function loadFile(src, success, error) {
1809
+ var xhr = new XMLHttpRequest();
1810
+ xhr.open('GET', src, true);
1811
+ xhr.onreadystatechange = function () {
1812
+ if (xhr.readyState == 4) {
1813
+ if (xhr.status < 400 && xhr.responseText) {
1814
+ success(xhr.responseText);
1815
+ } else {
1816
+ if (xhr.status >= 400) {
1817
+ error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
1818
+ } else {
1819
+ error(FAILURE_EMPTY_MESSAGE);
1820
+ }
1821
+ }
1822
+ }
1823
+ };
1824
+ xhr.send(null);
1825
+ }
1826
+
1827
+ /**
1828
+ * Parses the given range.
1829
+ *
1830
+ * This returns a range with inclusive ends.
1831
+ *
1832
+ * @param {string | null | undefined} range
1833
+ * @returns {[number, number | undefined] | undefined}
1834
+ */
1835
+ function parseRange(range) {
1836
+ var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
1837
+ if (m) {
1838
+ var start = Number(m[1]);
1839
+ var comma = m[2];
1840
+ var end = m[3];
1841
+
1842
+ if (!comma) {
1843
+ return [start, start];
1844
+ }
1845
+ if (!end) {
1846
+ return [start, undefined];
1847
+ }
1848
+ return [start, Number(end)];
1849
+ }
1850
+ return undefined;
1851
+ }
1852
+
1853
+ Prism.hooks.add('before-highlightall', function (env) {
1854
+ env.selector += ', ' + SELECTOR;
1855
+ });
1856
+
1857
+ Prism.hooks.add('before-sanity-check', function (env) {
1858
+ var pre = /** @type {HTMLPreElement} */ (env.element);
1859
+ if (pre.matches(SELECTOR)) {
1860
+ env.code = ''; // fast-path the whole thing and go to complete
1861
+
1862
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
1863
+
1864
+ // add code element with loading message
1865
+ var code = pre.appendChild(document.createElement('CODE'));
1866
+ code.textContent = LOADING_MESSAGE;
1867
+
1868
+ var src = pre.getAttribute('data-src');
1869
+
1870
+ var language = env.language;
1871
+ if (language === 'none') {
1872
+ // the language might be 'none' because there is no language set;
1873
+ // in this case, we want to use the extension as the language
1874
+ var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
1875
+ language = EXTENSIONS[extension] || extension;
1876
+ }
1877
+
1878
+ // set language classes
1879
+ Prism.util.setLanguage(code, language);
1880
+ Prism.util.setLanguage(pre, language);
1881
+
1882
+ // preload the language
1883
+ var autoloader = Prism.plugins.autoloader;
1884
+ if (autoloader) {
1885
+ autoloader.loadLanguages(language);
1886
+ }
1887
+
1888
+ // load file
1889
+ loadFile(
1890
+ src,
1891
+ function (text) {
1892
+ // mark as loaded
1893
+ pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
1894
+
1895
+ // handle data-range
1896
+ var range = parseRange(pre.getAttribute('data-range'));
1897
+ if (range) {
1898
+ var lines = text.split(/\r\n?|\n/g);
1899
+
1900
+ // the range is one-based and inclusive on both ends
1901
+ var start = range[0];
1902
+ var end = range[1] == null ? lines.length : range[1];
1903
+
1904
+ if (start < 0) { start += lines.length; }
1905
+ start = Math.max(0, Math.min(start - 1, lines.length));
1906
+ if (end < 0) { end += lines.length; }
1907
+ end = Math.max(0, Math.min(end, lines.length));
1908
+
1909
+ text = lines.slice(start, end).join('\n');
1910
+
1911
+ // add data-start for line numbers
1912
+ if (!pre.hasAttribute('data-start')) {
1913
+ pre.setAttribute('data-start', String(start + 1));
1914
+ }
1915
+ }
1916
+
1917
+ // highlight code
1918
+ code.textContent = text;
1919
+ Prism.highlightElement(code);
1920
+ },
1921
+ function (error) {
1922
+ // mark as failed
1923
+ pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
1924
+
1925
+ code.textContent = error;
1926
+ }
1927
+ );
1928
+ }
1929
+ });
1930
+
1931
+ Prism.plugins.fileHighlight = {
1932
+ /**
1933
+ * Executes the File Highlight plugin for all matching `pre` elements under the given container.
1934
+ *
1935
+ * Note: Elements which are already loaded or currently loading will not be touched by this method.
1936
+ *
1937
+ * @param {ParentNode} [container=document]
1938
+ */
1939
+ highlight: function highlight(container) {
1940
+ var elements = (container || document).querySelectorAll(SELECTOR);
1941
+
1942
+ for (var i = 0, element; (element = elements[i++]);) {
1943
+ Prism.highlightElement(element);
1944
+ }
1945
+ }
1946
+ };
1947
+
1948
+ var logged = false;
1949
+ /** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
1950
+ Prism.fileHighlight = function () {
1951
+ if (!logged) {
1952
+ console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
1953
+ logged = true;
1954
+ }
1955
+ Prism.plugins.fileHighlight.highlight.apply(this, arguments);
1956
+ };
1957
+
1958
+ }());
1959
+ } (prism));
1960
+ return prism.exports;
1961
+ }
1962
+
1963
+ var prismExports = requirePrism();
1964
+ var Prism$1 = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(prismExports);
1965
+
1966
+ (function (Prism) {
1967
+
1968
+ var javascript = Prism.util.clone(Prism.languages.javascript);
1969
+
1970
+ var space = /(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source;
1971
+ var braces = /(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source;
1972
+ var spread = /(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;
1973
+
1974
+ /**
1975
+ * @param {string} source
1976
+ * @param {string} [flags]
1977
+ */
1978
+ function re(source, flags) {
1979
+ source = source
1980
+ .replace(/<S>/g, function () { return space; })
1981
+ .replace(/<BRACES>/g, function () { return braces; })
1982
+ .replace(/<SPREAD>/g, function () { return spread; });
1983
+ return RegExp(source, flags);
1984
+ }
1985
+
1986
+ spread = re(spread).source;
1987
+
1988
+
1989
+ Prism.languages.jsx = Prism.languages.extend('markup', javascript);
1990
+ Prism.languages.jsx.tag.pattern = re(
1991
+ /<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source
1992
+ );
1993
+
1994
+ Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/;
1995
+ Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/;
1996
+ Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
1997
+ Prism.languages.jsx.tag.inside['comment'] = javascript['comment'];
1998
+
1999
+ Prism.languages.insertBefore('inside', 'attr-name', {
2000
+ 'spread': {
2001
+ pattern: re(/<SPREAD>/.source),
2002
+ inside: Prism.languages.jsx
2003
+ }
2004
+ }, Prism.languages.jsx.tag);
2005
+
2006
+ Prism.languages.insertBefore('inside', 'special-attr', {
2007
+ 'script': {
2008
+ // Allow for two levels of nesting
2009
+ pattern: re(/=<BRACES>/.source),
2010
+ alias: 'language-javascript',
2011
+ inside: {
2012
+ 'script-punctuation': {
2013
+ pattern: /^=(?=\{)/,
2014
+ alias: 'punctuation'
2015
+ },
2016
+ rest: Prism.languages.jsx
2017
+ },
2018
+ }
2019
+ }, Prism.languages.jsx.tag);
2020
+
2021
+ // The following will handle plain text inside tags
2022
+ var stringifyToken = function (token) {
2023
+ if (!token) {
2024
+ return '';
2025
+ }
2026
+ if (typeof token === 'string') {
2027
+ return token;
2028
+ }
2029
+ if (typeof token.content === 'string') {
2030
+ return token.content;
2031
+ }
2032
+ return token.content.map(stringifyToken).join('');
2033
+ };
2034
+
2035
+ var walkTokens = function (tokens) {
2036
+ var openedTags = [];
2037
+ for (var i = 0; i < tokens.length; i++) {
2038
+ var token = tokens[i];
2039
+ var notTagNorBrace = false;
2040
+
2041
+ if (typeof token !== 'string') {
2042
+ if (token.type === 'tag' && token.content[0] && token.content[0].type === 'tag') {
2043
+ // We found a tag, now find its kind
2044
+
2045
+ if (token.content[0].content[0].content === '</') {
2046
+ // Closing tag
2047
+ if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) {
2048
+ // Pop matching opening tag
2049
+ openedTags.pop();
2050
+ }
2051
+ } else {
2052
+ if (token.content[token.content.length - 1].content === '/>') ; else {
2053
+ // Opening tag
2054
+ openedTags.push({
2055
+ tagName: stringifyToken(token.content[0].content[1]),
2056
+ openedBraces: 0
2057
+ });
2058
+ }
2059
+ }
2060
+ } else if (openedTags.length > 0 && token.type === 'punctuation' && token.content === '{') {
2061
+
2062
+ // Here we might have entered a JSX context inside a tag
2063
+ openedTags[openedTags.length - 1].openedBraces++;
2064
+
2065
+ } else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === 'punctuation' && token.content === '}') {
2066
+
2067
+ // Here we might have left a JSX context inside a tag
2068
+ openedTags[openedTags.length - 1].openedBraces--;
2069
+
2070
+ } else {
2071
+ notTagNorBrace = true;
2072
+ }
2073
+ }
2074
+ if (notTagNorBrace || typeof token === 'string') {
2075
+ if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) {
2076
+ // Here we are inside a tag, and not inside a JSX context.
2077
+ // That's plain text: drop any tokens matched.
2078
+ var plainText = stringifyToken(token);
2079
+
2080
+ // And merge text with adjacent text
2081
+ if (i < tokens.length - 1 && (typeof tokens[i + 1] === 'string' || tokens[i + 1].type === 'plain-text')) {
2082
+ plainText += stringifyToken(tokens[i + 1]);
2083
+ tokens.splice(i + 1, 1);
2084
+ }
2085
+ if (i > 0 && (typeof tokens[i - 1] === 'string' || tokens[i - 1].type === 'plain-text')) {
2086
+ plainText = stringifyToken(tokens[i - 1]) + plainText;
2087
+ tokens.splice(i - 1, 1);
2088
+ i--;
2089
+ }
2090
+
2091
+ tokens[i] = new Prism.Token('plain-text', plainText, null, plainText);
2092
+ }
2093
+ }
2094
+
2095
+ if (token.content && typeof token.content !== 'string') {
2096
+ walkTokens(token.content);
2097
+ }
2098
+ }
2099
+ };
2100
+
2101
+ Prism.hooks.add('after-tokenize', function (env) {
2102
+ if (env.language !== 'jsx' && env.language !== 'tsx') {
2103
+ return;
2104
+ }
2105
+ walkTokens(env.tokens);
2106
+ });
2107
+
2108
+ }(Prism));
2109
+
2110
+ var prismScss = {};
2111
+
2112
+ var hasRequiredPrismScss;
2113
+
2114
+ function requirePrismScss () {
2115
+ if (hasRequiredPrismScss) return prismScss;
2116
+ hasRequiredPrismScss = 1;
2117
+ Prism.languages.scss = Prism.languages.extend('css', {
2118
+ 'comment': {
2119
+ pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
2120
+ lookbehind: true
2121
+ },
2122
+ 'atrule': {
2123
+ pattern: /@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,
2124
+ inside: {
2125
+ 'rule': /@[\w-]+/
2126
+ // See rest below
2127
+ }
2128
+ },
2129
+ // url, compassified
2130
+ 'url': /(?:[-a-z]+-)?url(?=\()/i,
2131
+ // CSS selector regex is not appropriate for Sass
2132
+ // since there can be lot more things (var, @ directive, nesting..)
2133
+ // a selector must start at the end of a property or after a brace (end of other rules or nesting)
2134
+ // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
2135
+ // the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var
2136
+ // can "pass" as a selector- e.g: proper#{$erty})
2137
+ // this one was hard to do, so please be careful if you edit this one :)
2138
+ 'selector': {
2139
+ // Initial look-ahead is used to prevent matching of blank selectors
2140
+ pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,
2141
+ inside: {
2142
+ 'parent': {
2143
+ pattern: /&/,
2144
+ alias: 'important'
2145
+ },
2146
+ 'placeholder': /%[-\w]+/,
2147
+ 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2148
+ }
2149
+ },
2150
+ 'property': {
2151
+ pattern: /(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,
2152
+ inside: {
2153
+ 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2154
+ }
2155
+ }
2156
+ });
2157
+
2158
+ Prism.languages.insertBefore('scss', 'atrule', {
2159
+ 'keyword': [
2160
+ /@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,
2161
+ {
2162
+ pattern: /( )(?:from|through)(?= )/,
2163
+ lookbehind: true
2164
+ }
2165
+ ]
2166
+ });
2167
+
2168
+ Prism.languages.insertBefore('scss', 'important', {
2169
+ // var and interpolated vars
2170
+ 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2171
+ });
2172
+
2173
+ Prism.languages.insertBefore('scss', 'function', {
2174
+ 'module-modifier': {
2175
+ pattern: /\b(?:as|hide|show|with)\b/i,
2176
+ alias: 'keyword'
2177
+ },
2178
+ 'placeholder': {
2179
+ pattern: /%[-\w]+/,
2180
+ alias: 'selector'
2181
+ },
2182
+ 'statement': {
2183
+ pattern: /\B!(?:default|optional)\b/i,
2184
+ alias: 'keyword'
2185
+ },
2186
+ 'boolean': /\b(?:false|true)\b/,
2187
+ 'null': {
2188
+ pattern: /\bnull\b/,
2189
+ alias: 'keyword'
2190
+ },
2191
+ 'operator': {
2192
+ pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,
2193
+ lookbehind: true
2194
+ }
2195
+ });
2196
+
2197
+ Prism.languages.scss['atrule'].inside.rest = Prism.languages.scss;
2198
+ return prismScss;
2199
+ }
2200
+
2201
+ requirePrismScss();
2202
+
2203
+ /* FIXME :
2204
+ :extend() is not handled specifically : its highlighting is buggy.
2205
+ Mixin usage must be inside a ruleset to be highlighted.
2206
+ At-rules (e.g. import) containing interpolations are buggy.
2207
+ Detached rulesets are highlighted as at-rules.
2208
+ A comment before a mixin usage prevents the latter to be properly highlighted.
2209
+ */
2210
+
2211
+ Prism.languages.less = Prism.languages.extend('css', {
2212
+ 'comment': [
2213
+ /\/\*[\s\S]*?\*\//,
2214
+ {
2215
+ pattern: /(^|[^\\])\/\/.*/,
2216
+ lookbehind: true
2217
+ }
2218
+ ],
2219
+ 'atrule': {
2220
+ pattern: /@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,
2221
+ inside: {
2222
+ 'punctuation': /[:()]/
2223
+ }
2224
+ },
2225
+ // selectors and mixins are considered the same
2226
+ 'selector': {
2227
+ pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,
2228
+ inside: {
2229
+ // mixin parameters
2230
+ 'variable': /@+[\w-]+/
2231
+ }
2232
+ },
2233
+
2234
+ 'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,
2235
+ 'operator': /[+\-*\/]/
2236
+ });
2237
+
2238
+ Prism.languages.insertBefore('less', 'property', {
2239
+ 'variable': [
2240
+ // Variable declaration (the colon must be consumed!)
2241
+ {
2242
+ pattern: /@[\w-]+\s*:/,
2243
+ inside: {
2244
+ 'punctuation': /:/
2245
+ }
2246
+ },
2247
+
2248
+ // Variable usage
2249
+ /@@?[\w-]+/
2250
+ ],
2251
+ 'mixin-usage': {
2252
+ pattern: /([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,
2253
+ lookbehind: true,
2254
+ alias: 'function'
2255
+ }
2256
+ });
2257
+
2258
+ (function (Prism) {
2259
+ var typescript = Prism.util.clone(Prism.languages.typescript);
2260
+ Prism.languages.tsx = Prism.languages.extend('jsx', typescript);
2261
+
2262
+ // doesn't work with TS because TS is too complex
2263
+ delete Prism.languages.tsx['parameter'];
2264
+ delete Prism.languages.tsx['literal-property'];
2265
+
2266
+ // This will prevent collisions between TSX tags and TS generic types.
2267
+ // Idea by https://github.com/karlhorky
2268
+ // Discussion: https://github.com/PrismJS/prism/issues/2594#issuecomment-710666928
2269
+ var tag = Prism.languages.tsx.tag;
2270
+ tag.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + '(?:' + tag.pattern.source + ')', tag.pattern.flags);
2271
+ tag.lookbehind = true;
2272
+ }(Prism));
2273
+
2274
+ var prismTypescript = {};
2275
+
2276
+ var hasRequiredPrismTypescript;
2277
+
2278
+ function requirePrismTypescript () {
2279
+ if (hasRequiredPrismTypescript) return prismTypescript;
2280
+ hasRequiredPrismTypescript = 1;
2281
+ (function (Prism) {
2282
+
2283
+ Prism.languages.typescript = Prism.languages.extend('javascript', {
2284
+ 'class-name': {
2285
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
2286
+ lookbehind: true,
2287
+ greedy: true,
2288
+ inside: null // see below
2289
+ },
2290
+ 'builtin': /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/,
2291
+ });
2292
+
2293
+ // The keywords TypeScript adds to JavaScript
2294
+ Prism.languages.typescript.keyword.push(
2295
+ /\b(?:abstract|declare|is|keyof|readonly|require)\b/,
2296
+ // keywords that have to be followed by an identifier
2297
+ /\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
2298
+ // This is for `import type *, {}`
2299
+ /\btype\b(?=\s*(?:[\{*]|$))/
2300
+ );
2301
+
2302
+ // doesn't work with TS because TS is too complex
2303
+ delete Prism.languages.typescript['parameter'];
2304
+ delete Prism.languages.typescript['literal-property'];
2305
+
2306
+ // a version of typescript specifically for highlighting types
2307
+ var typeInside = Prism.languages.extend('typescript', {});
2308
+ delete typeInside['class-name'];
2309
+
2310
+ Prism.languages.typescript['class-name'].inside = typeInside;
2311
+
2312
+ Prism.languages.insertBefore('typescript', 'function', {
2313
+ 'decorator': {
2314
+ pattern: /@[$\w\xA0-\uFFFF]+/,
2315
+ inside: {
2316
+ 'at': {
2317
+ pattern: /^@/,
2318
+ alias: 'operator'
2319
+ },
2320
+ 'function': /^[\s\S]+/
2321
+ }
2322
+ },
2323
+ 'generic-function': {
2324
+ // e.g. foo<T extends "bar" | "baz">( ...
2325
+ pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
2326
+ greedy: true,
2327
+ inside: {
2328
+ 'function': /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
2329
+ 'generic': {
2330
+ pattern: /<[\s\S]+/, // everything after the first <
2331
+ alias: 'class-name',
2332
+ inside: typeInside
2333
+ }
2334
+ }
2335
+ }
2336
+ });
2337
+
2338
+ Prism.languages.ts = Prism.languages.typescript;
2339
+
2340
+ }(Prism));
2341
+ return prismTypescript;
2342
+ }
2343
+
2344
+ requirePrismTypescript();
2345
+
2346
+ (function () {
2347
+
2348
+ if (typeof Prism === 'undefined' || typeof document === 'undefined') {
2349
+ return;
2350
+ }
2351
+
2352
+ var callbacks = [];
2353
+ var map = {};
2354
+ var noop = function () {};
2355
+
2356
+ Prism.plugins.toolbar = {};
2357
+
2358
+ /**
2359
+ * @typedef ButtonOptions
2360
+ * @property {string} text The text displayed.
2361
+ * @property {string} [url] The URL of the link which will be created.
2362
+ * @property {Function} [onClick] The event listener for the `click` event of the created button.
2363
+ * @property {string} [className] The class attribute to include with element.
2364
+ */
2365
+
2366
+ /**
2367
+ * Register a button callback with the toolbar.
2368
+ *
2369
+ * @param {string} key
2370
+ * @param {ButtonOptions|Function} opts
2371
+ */
2372
+ var registerButton = Prism.plugins.toolbar.registerButton = function (key, opts) {
2373
+ var callback;
2374
+
2375
+ if (typeof opts === 'function') {
2376
+ callback = opts;
2377
+ } else {
2378
+ callback = function (env) {
2379
+ var element;
2380
+
2381
+ if (typeof opts.onClick === 'function') {
2382
+ element = document.createElement('button');
2383
+ element.type = 'button';
2384
+ element.addEventListener('click', function () {
2385
+ opts.onClick.call(this, env);
2386
+ });
2387
+ } else if (typeof opts.url === 'string') {
2388
+ element = document.createElement('a');
2389
+ element.href = opts.url;
2390
+ } else {
2391
+ element = document.createElement('span');
2392
+ }
2393
+
2394
+ if (opts.className) {
2395
+ element.classList.add(opts.className);
2396
+ }
2397
+
2398
+ element.textContent = opts.text;
2399
+
2400
+ return element;
2401
+ };
2402
+ }
2403
+
2404
+ if (key in map) {
2405
+ console.warn('There is a button with the key "' + key + '" registered already.');
2406
+ return;
2407
+ }
2408
+
2409
+ callbacks.push(map[key] = callback);
2410
+ };
2411
+
2412
+ /**
2413
+ * Returns the callback order of the given element.
2414
+ *
2415
+ * @param {HTMLElement} element
2416
+ * @returns {string[] | undefined}
2417
+ */
2418
+ function getOrder(element) {
2419
+ while (element) {
2420
+ var order = element.getAttribute('data-toolbar-order');
2421
+ if (order != null) {
2422
+ order = order.trim();
2423
+ if (order.length) {
2424
+ return order.split(/\s*,\s*/g);
2425
+ } else {
2426
+ return [];
2427
+ }
2428
+ }
2429
+ element = element.parentElement;
2430
+ }
2431
+ }
2432
+
2433
+ /**
2434
+ * Post-highlight Prism hook callback.
2435
+ *
2436
+ * @param env
2437
+ */
2438
+ var hook = Prism.plugins.toolbar.hook = function (env) {
2439
+ // Check if inline or actual code block (credit to line-numbers plugin)
2440
+ var pre = env.element.parentNode;
2441
+ if (!pre || !/pre/i.test(pre.nodeName)) {
2442
+ return;
2443
+ }
2444
+
2445
+ // Autoloader rehighlights, so only do this once.
2446
+ if (pre.parentNode.classList.contains('code-toolbar')) {
2447
+ return;
2448
+ }
2449
+
2450
+ // Create wrapper for <pre> to prevent scrolling toolbar with content
2451
+ var wrapper = document.createElement('div');
2452
+ wrapper.classList.add('code-toolbar');
2453
+ pre.parentNode.insertBefore(wrapper, pre);
2454
+ wrapper.appendChild(pre);
2455
+
2456
+ // Setup the toolbar
2457
+ var toolbar = document.createElement('div');
2458
+ toolbar.classList.add('toolbar');
2459
+
2460
+ // order callbacks
2461
+ var elementCallbacks = callbacks;
2462
+ var order = getOrder(env.element);
2463
+ if (order) {
2464
+ elementCallbacks = order.map(function (key) {
2465
+ return map[key] || noop;
2466
+ });
2467
+ }
2468
+
2469
+ elementCallbacks.forEach(function (callback) {
2470
+ var element = callback(env);
2471
+
2472
+ if (!element) {
2473
+ return;
2474
+ }
2475
+
2476
+ var item = document.createElement('div');
2477
+ item.classList.add('toolbar-item');
2478
+
2479
+ item.appendChild(element);
2480
+ toolbar.appendChild(item);
2481
+ });
2482
+
2483
+ // Add our toolbar to the currently created wrapper of <pre> tag
2484
+ wrapper.appendChild(toolbar);
2485
+ };
2486
+
2487
+ registerButton('label', function (env) {
2488
+ var pre = env.element.parentNode;
2489
+ if (!pre || !/pre/i.test(pre.nodeName)) {
2490
+ return;
2491
+ }
2492
+
2493
+ if (!pre.hasAttribute('data-label')) {
2494
+ return;
2495
+ }
2496
+
2497
+ var element; var template;
2498
+ var text = pre.getAttribute('data-label');
2499
+ try {
2500
+ // Any normal text will blow up this selector.
2501
+ template = document.querySelector('template#' + text);
2502
+ } catch (e) { /* noop */ }
2503
+
2504
+ if (template) {
2505
+ element = template.content;
2506
+ } else {
2507
+ if (pre.hasAttribute('data-url')) {
2508
+ element = document.createElement('a');
2509
+ element.href = pre.getAttribute('data-url');
2510
+ } else {
2511
+ element = document.createElement('span');
2512
+ }
2513
+
2514
+ element.textContent = text;
2515
+ }
2516
+
2517
+ return element;
2518
+ });
2519
+
2520
+ /**
2521
+ * Register the toolbar with Prism.
2522
+ */
2523
+ Prism.hooks.add('complete', hook);
2524
+ }());
2525
+
2526
+ (function () {
2527
+
2528
+ if (typeof Prism === 'undefined' || typeof document === 'undefined') {
2529
+ return;
2530
+ }
2531
+
2532
+ if (!Prism.plugins.toolbar) {
2533
+ console.warn('Copy to Clipboard plugin loaded before Toolbar plugin.');
2534
+
2535
+ return;
2536
+ }
2537
+
2538
+ /**
2539
+ * When the given elements is clicked by the user, the given text will be copied to clipboard.
2540
+ *
2541
+ * @param {HTMLElement} element
2542
+ * @param {CopyInfo} copyInfo
2543
+ *
2544
+ * @typedef CopyInfo
2545
+ * @property {() => string} getText
2546
+ * @property {() => void} success
2547
+ * @property {(reason: unknown) => void} error
2548
+ */
2549
+ function registerClipboard(element, copyInfo) {
2550
+ element.addEventListener('click', function () {
2551
+ copyTextToClipboard(copyInfo);
2552
+ });
2553
+ }
2554
+
2555
+ // https://stackoverflow.com/a/30810322/7595472
2556
+
2557
+ /** @param {CopyInfo} copyInfo */
2558
+ function fallbackCopyTextToClipboard(copyInfo) {
2559
+ var textArea = document.createElement('textarea');
2560
+ textArea.value = copyInfo.getText();
2561
+
2562
+ // Avoid scrolling to bottom
2563
+ textArea.style.top = '0';
2564
+ textArea.style.left = '0';
2565
+ textArea.style.position = 'fixed';
2566
+
2567
+ document.body.appendChild(textArea);
2568
+ textArea.focus();
2569
+ textArea.select();
2570
+
2571
+ try {
2572
+ var successful = document.execCommand('copy');
2573
+ setTimeout(function () {
2574
+ if (successful) {
2575
+ copyInfo.success();
2576
+ } else {
2577
+ copyInfo.error();
2578
+ }
2579
+ }, 1);
2580
+ } catch (err) {
2581
+ setTimeout(function () {
2582
+ copyInfo.error(err);
2583
+ }, 1);
2584
+ }
2585
+
2586
+ document.body.removeChild(textArea);
2587
+ }
2588
+ /** @param {CopyInfo} copyInfo */
2589
+ function copyTextToClipboard(copyInfo) {
2590
+ if (navigator.clipboard) {
2591
+ navigator.clipboard.writeText(copyInfo.getText()).then(copyInfo.success, function () {
2592
+ // try the fallback in case `writeText` didn't work
2593
+ fallbackCopyTextToClipboard(copyInfo);
2594
+ });
2595
+ } else {
2596
+ fallbackCopyTextToClipboard(copyInfo);
2597
+ }
2598
+ }
2599
+
2600
+ /**
2601
+ * Selects the text content of the given element.
2602
+ *
2603
+ * @param {Element} element
2604
+ */
2605
+ function selectElementText(element) {
2606
+ // https://stackoverflow.com/a/20079910/7595472
2607
+ window.getSelection().selectAllChildren(element);
2608
+ }
2609
+
2610
+ /**
2611
+ * Traverses up the DOM tree to find data attributes that override the default plugin settings.
2612
+ *
2613
+ * @param {Element} startElement An element to start from.
2614
+ * @returns {Settings} The plugin settings.
2615
+ * @typedef {Record<"copy" | "copy-error" | "copy-success" | "copy-timeout", string | number>} Settings
2616
+ */
2617
+ function getSettings(startElement) {
2618
+ /** @type {Settings} */
2619
+ var settings = {
2620
+ 'copy': 'Copy',
2621
+ 'copy-error': 'Press Ctrl+C to copy',
2622
+ 'copy-success': 'Copied!',
2623
+ 'copy-timeout': 5000
2624
+ };
2625
+
2626
+ var prefix = 'data-prismjs-';
2627
+ for (var key in settings) {
2628
+ var attr = prefix + key;
2629
+ var element = startElement;
2630
+ while (element && !element.hasAttribute(attr)) {
2631
+ element = element.parentElement;
2632
+ }
2633
+ if (element) {
2634
+ settings[key] = element.getAttribute(attr);
2635
+ }
2636
+ }
2637
+ return settings;
2638
+ }
2639
+
2640
+ Prism.plugins.toolbar.registerButton('copy-to-clipboard', function (env) {
2641
+ var element = env.element;
2642
+
2643
+ var settings = getSettings(element);
2644
+
2645
+ var linkCopy = document.createElement('button');
2646
+ linkCopy.className = 'copy-to-clipboard-button';
2647
+ linkCopy.setAttribute('type', 'button');
2648
+ var linkSpan = document.createElement('span');
2649
+ linkCopy.appendChild(linkSpan);
2650
+
2651
+ setState('copy');
2652
+
2653
+ registerClipboard(linkCopy, {
2654
+ getText: function () {
2655
+ return element.textContent;
2656
+ },
2657
+ success: function () {
2658
+ setState('copy-success');
2659
+
2660
+ resetText();
2661
+ },
2662
+ error: function () {
2663
+ setState('copy-error');
2664
+
2665
+ setTimeout(function () {
2666
+ selectElementText(element);
2667
+ }, 1);
2668
+
2669
+ resetText();
2670
+ }
2671
+ });
2672
+
2673
+ return linkCopy;
2674
+
2675
+ function resetText() {
2676
+ setTimeout(function () { setState('copy'); }, settings['copy-timeout']);
2677
+ }
2678
+
2679
+ /** @param {"copy" | "copy-error" | "copy-success"} state */
2680
+ function setState(state) {
2681
+ linkSpan.textContent = settings[state];
2682
+ linkCopy.setAttribute('data-copy-state', state);
2683
+ }
2684
+ });
2685
+ }());
2686
+
2687
+ const codeCss = "div.code-toolbar{position:relative}div.code-toolbar>.toolbar{position:absolute;z-index:10;top:.3em;right:.2em;transition:opacity 0.3s ease-in-out;opacity:0}div.code-toolbar:hover>.toolbar{opacity:1}div.code-toolbar:focus-within>.toolbar{opacity:1}div.code-toolbar>.toolbar>.toolbar-item{display:inline-block}div.code-toolbar>.toolbar>.toolbar-item>a{cursor:pointer}div.code-toolbar>.toolbar>.toolbar-item>button{background:none;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}div.code-toolbar>.toolbar>.toolbar-item>a,div.code-toolbar>.toolbar>.toolbar-item>button,div.code-toolbar>.toolbar>.toolbar-item>span{color:#bbb;font-size:.8em;padding:0 .5em;background:#f5f2f0;background:rgba(224, 224, 224, 0.2);box-shadow:0 2px 0 0 rgba(0,0,0,0.2);border-radius:.5em}div.code-toolbar>.toolbar>.toolbar-item>a:hover,div.code-toolbar>.toolbar>.toolbar-item>a:focus,div.code-toolbar>.toolbar>.toolbar-item>button:hover,div.code-toolbar>.toolbar>.toolbar-item>button:focus,div.code-toolbar>.toolbar>.toolbar-item>span:hover,div.code-toolbar>.toolbar>.toolbar-item>span:focus{color:inherit;text-decoration:none}:host{display:flex;font-size:1rem}slot{display:none}.root{width:100%}div.code-toolbar{z-index:1;display:flex;height:100%}div.code-toolbar>.toolbar{padding-right:0.25rem}div.code-toolbar>.toolbar .toolbar-item button,div.code-toolbar>.toolbar .toolbar-item span{all:unset}div.code-toolbar>.toolbar .toolbar-item button{cursor:pointer;transition:background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;box-shadow:var(--kompendium-button-shadow-normal)}div.code-toolbar>.toolbar .toolbar-item button:hover{box-shadow:var(--kompendium-button-shadow-hovered)}div.code-toolbar>.toolbar .toolbar-item button:active{box-shadow:var(--kompendium-button-shadow-pressed);transform:translate3d(0, 0.08rem, 0)}div.code-toolbar>.toolbar .toolbar-item button:focus{outline:none}div.code-toolbar>.toolbar .toolbar-item button:focus-visible{outline:none;box-shadow:var(--kompendium-shadow-depth-8-focused)}div.code-toolbar>.toolbar .toolbar-item button{background-color:rgb(var(--kompendium-contrast-100));color:rgb(var(--kompendium-contrast-1100));padding:0.125rem 0.5rem;border-radius:0.375rem;font-size:0.75rem}code,pre{font-family:var(--kompendium-font-code);font-size:0.8125rem}code[class*=language-],pre[class*=language-]{color:rgb(var(--kompendium-color-code-gray-lighter));background:none;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1.5rem 1rem 2rem 1rem;position:relative;margin:0;overflow:auto;flex-grow:1;border-radius:0.5625rem}:not(pre)>code[class*=language-],pre[class*=language-]{background:rgb(var(--kompendium-color-code-background))}:not(pre)>code[class*=language-]{white-space:normal}.token.comment{color:var(--kompendium-color-code-gray-light)}.token.block-comment,.token.prolog,.token.doctype,.token.cdata{color:var(--kompendium-color-code-gray-lighter)}.token.punctuation{color:var(--kompendium-color-code-gray-dark)}.token.tag,.token.attr-name,.token.namespace,.token.deleted{color:rgb(var(--kompendium-color-code-pink))}.token.function-name{color:rgb(var(--kompendium-color-code-blue))}.token.boolean,.token.number,.token.function{color:rgb(var(--kompendium-color-code-orange))}.token.property,.token.class-name,.token.constant,.token.symbol{color:rgb(var(--kompendium-color-code-yellow))}.token.selector,.token.important,.token.atrule,.token.keyword,.token.builtin{color:rgb(var(--kompendium-color-code-purple))}.token.string,.token.char,.token.attr-value,.token.regex,.token.variable{color:rgb(var(--kompendium-color-code-green-light))}.token.operator{color:rgb(var(--kompendium-color-code-purple))}.token.entity,.token.url{color:rgb(var(--kompendium-color-code-turquoise))}.token.important,.token.bold{font-weight:bold}.token.italic{font-style:italic}.token.entity{cursor:help}.token.inserted{color:rgb(var(--kompendium-color-code-green-dark))}";
2688
+
2689
+ const Code = class {
2690
+ constructor(hostRef) {
2691
+ index.registerInstance(this, hostRef);
2692
+ }
2693
+ componentDidLoad() {
2694
+ setTimeout(() => {
2695
+ this.code = this.findCode();
2696
+ });
2697
+ }
2698
+ componentWillRender() {
2699
+ this.code = this.findCode();
2700
+ }
2701
+ componentDidRender() {
2702
+ const container = this.host.shadowRoot.querySelector('.root pre code');
2703
+ Prism$1.highlightElement(container);
2704
+ }
2705
+ render() {
2706
+ const classList = {};
2707
+ classList[`language-${this.language}`] = true;
2708
+ return (index.h("div", { key: '95723df383f836be24b3190b74dc5ee555da29d7', class: "root" }, index.h("slot", { key: '5fd9fc3b9d1499fd4f81d2ffda23e42318e33e66' }), index.h("pre", { key: 'a5e18f68729a29bc9b1d154e2d15b9a14ed4c7ef', class: classList }, index.h("code", { key: 'bc2cb099497051902f8a616e7a5a70330c5c9579' }, this.code))));
2709
+ }
2710
+ findCode() {
2711
+ const slot = this.host.shadowRoot.querySelector('slot');
2712
+ if (!slot) {
2713
+ return;
2714
+ }
2715
+ return [...slot.assignedNodes()]
2716
+ .map((node) => node.textContent)
2717
+ .join('');
2718
+ }
2719
+ get host() { return index.getElement(this); }
2720
+ };
2721
+ Code.style = codeCss;
2722
+
2723
+ exports.kompendium_code = Code;
2724
+ //# sourceMappingURL=kompendium-code.entry.cjs.js.map