create-nextjs-cms 0.5.19 → 0.5.20

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 (272) hide show
  1. package/dist/index.js +7 -0
  2. package/package.json +4 -4
  3. package/templates/default/.uploads/.photos/categories/000e56fada378de1a84a4 +0 -0
  4. package/templates/default/.uploads/.photos/categories/121e7d13ee3b5fa03795b +0 -0
  5. package/templates/default/.uploads/.photos/categories/17a55c5a53eb62293c69e +0 -0
  6. package/templates/default/.uploads/.photos/categories/4c86ad8c1f51f1e3a953b +0 -0
  7. package/templates/default/.uploads/.photos/categories/4d360813741a45744327c +0 -0
  8. package/templates/default/.uploads/.photos/categories/5238fefaa3cbebf388178 +0 -0
  9. package/templates/default/.uploads/.photos/categories/541d7cf8c69895bcb15cd +0 -0
  10. package/templates/default/.uploads/.photos/categories/57a2f689a910a378247ea +0 -0
  11. package/templates/default/.uploads/.photos/categories/6de4bdb341a3e1f70ddc3 +0 -0
  12. package/templates/default/.uploads/.photos/categories/6f52739eaa686441a28f4 +0 -0
  13. package/templates/default/.uploads/.photos/categories/8a21b9fa8ecd88f460a15 +0 -0
  14. package/templates/default/.uploads/.photos/categories/91948abcb073c9445fdec +0 -0
  15. package/templates/default/.uploads/.photos/categories/9ae700d1abfd6b85780e8 +0 -0
  16. package/templates/default/.uploads/.photos/categories/9edee86e932985fc589b5 +0 -0
  17. package/templates/default/.uploads/.photos/categories/a520e77b082f35b575dba +0 -0
  18. package/templates/default/.uploads/.photos/categories/b19c449029330f0a74b20 +0 -0
  19. package/templates/default/.uploads/.photos/categories/b9802010f68afd4edb0e8 +0 -0
  20. package/templates/default/.uploads/.photos/categories/c1d7c3b986739bf496730 +0 -0
  21. package/templates/default/.uploads/.photos/categories/c25dc38567384513ffe93 +0 -0
  22. package/templates/default/.uploads/.photos/categories/cbe3874a3d13afba388df +0 -0
  23. package/templates/default/.uploads/.photos/categories/d450fdeb04f0d070442d6 +0 -0
  24. package/templates/default/.uploads/.photos/categories/f80bf3a4515680ead5a5c +0 -0
  25. package/templates/default/.uploads/.photos/categories/f8639c2d5b0d24cb76fb1 +0 -0
  26. package/templates/default/.uploads/.photos/categories/f8d997149d10aab046e40 +0 -0
  27. package/templates/default/.uploads/.photos/categories/fa2c55690ff96e33a16fe +0 -0
  28. package/templates/default/.uploads/.photos/featured_slider/d00be4edb4c38ca34b5a5 +0 -0
  29. package/templates/default/.uploads/.thumbs/categories/000e56fada378de1a84a4 +0 -0
  30. package/templates/default/.uploads/.thumbs/categories/121e7d13ee3b5fa03795b +0 -0
  31. package/templates/default/.uploads/.thumbs/categories/17a55c5a53eb62293c69e +0 -0
  32. package/templates/default/.uploads/.thumbs/categories/4c86ad8c1f51f1e3a953b +0 -0
  33. package/templates/default/.uploads/.thumbs/categories/4d360813741a45744327c +0 -0
  34. package/templates/default/.uploads/.thumbs/categories/5238fefaa3cbebf388178 +0 -0
  35. package/templates/default/.uploads/.thumbs/categories/541d7cf8c69895bcb15cd +0 -0
  36. package/templates/default/.uploads/.thumbs/categories/57a2f689a910a378247ea +0 -0
  37. package/templates/default/.uploads/.thumbs/categories/6de4bdb341a3e1f70ddc3 +0 -0
  38. package/templates/default/.uploads/.thumbs/categories/6f52739eaa686441a28f4 +0 -0
  39. package/templates/default/.uploads/.thumbs/categories/8a21b9fa8ecd88f460a15 +0 -0
  40. package/templates/default/.uploads/.thumbs/categories/91948abcb073c9445fdec +0 -0
  41. package/templates/default/.uploads/.thumbs/categories/9ae700d1abfd6b85780e8 +0 -0
  42. package/templates/default/.uploads/.thumbs/categories/9edee86e932985fc589b5 +0 -0
  43. package/templates/default/.uploads/.thumbs/categories/a520e77b082f35b575dba +0 -0
  44. package/templates/default/.uploads/.thumbs/categories/b19c449029330f0a74b20 +0 -0
  45. package/templates/default/.uploads/.thumbs/categories/b9802010f68afd4edb0e8 +0 -0
  46. package/templates/default/.uploads/.thumbs/categories/c1d7c3b986739bf496730 +0 -0
  47. package/templates/default/.uploads/.thumbs/categories/c25dc38567384513ffe93 +0 -0
  48. package/templates/default/.uploads/.thumbs/categories/cbe3874a3d13afba388df +0 -0
  49. package/templates/default/.uploads/.thumbs/categories/d450fdeb04f0d070442d6 +0 -0
  50. package/templates/default/.uploads/.thumbs/categories/f80bf3a4515680ead5a5c +0 -0
  51. package/templates/default/.uploads/.thumbs/categories/f8639c2d5b0d24cb76fb1 +0 -0
  52. package/templates/default/.uploads/.thumbs/categories/f8d997149d10aab046e40 +0 -0
  53. package/templates/default/.uploads/.thumbs/categories/fa2c55690ff96e33a16fe +0 -0
  54. package/templates/default/_gitignore +57 -0
  55. package/templates/default/components/form/helpers/_section-hot-reload.ts +11 -0
  56. package/templates/default/next-env.d.ts +6 -0
  57. package/templates/default/package.json +2 -2
  58. package/templates/default/public/tinymce/CHANGELOG.md +3785 -0
  59. package/templates/default/public/tinymce/README.md +77 -0
  60. package/templates/default/public/tinymce/bower.json +27 -0
  61. package/templates/default/public/tinymce/composer.json +52 -0
  62. package/templates/default/public/tinymce/icons/default/icons.js +231 -0
  63. package/templates/default/public/tinymce/icons/default/icons.min.js +1 -0
  64. package/templates/default/public/tinymce/icons/default/index.js +7 -0
  65. package/templates/default/public/tinymce/license.md +6 -0
  66. package/templates/default/public/tinymce/models/dom/index.js +7 -0
  67. package/templates/default/public/tinymce/models/dom/model.js +8994 -0
  68. package/templates/default/public/tinymce/models/dom/model.min.js +1 -0
  69. package/templates/default/public/tinymce/notices.txt +21 -0
  70. package/templates/default/public/tinymce/package.json +32 -0
  71. package/templates/default/public/tinymce/plugins/accordion/index.js +7 -0
  72. package/templates/default/public/tinymce/plugins/accordion/plugin.js +1349 -0
  73. package/templates/default/public/tinymce/plugins/accordion/plugin.min.js +1 -0
  74. package/templates/default/public/tinymce/plugins/advlist/index.js +7 -0
  75. package/templates/default/public/tinymce/plugins/advlist/plugin.js +471 -0
  76. package/templates/default/public/tinymce/plugins/advlist/plugin.min.js +1 -0
  77. package/templates/default/public/tinymce/plugins/anchor/index.js +7 -0
  78. package/templates/default/public/tinymce/plugins/anchor/plugin.js +237 -0
  79. package/templates/default/public/tinymce/plugins/anchor/plugin.min.js +1 -0
  80. package/templates/default/public/tinymce/plugins/autolink/index.js +7 -0
  81. package/templates/default/public/tinymce/plugins/autolink/plugin.js +318 -0
  82. package/templates/default/public/tinymce/plugins/autolink/plugin.min.js +1 -0
  83. package/templates/default/public/tinymce/plugins/autoresize/index.js +7 -0
  84. package/templates/default/public/tinymce/plugins/autoresize/plugin.js +223 -0
  85. package/templates/default/public/tinymce/plugins/autoresize/plugin.min.js +1 -0
  86. package/templates/default/public/tinymce/plugins/autosave/index.js +7 -0
  87. package/templates/default/public/tinymce/plugins/autosave/plugin.js +252 -0
  88. package/templates/default/public/tinymce/plugins/autosave/plugin.min.js +1 -0
  89. package/templates/default/public/tinymce/plugins/charmap/index.js +7 -0
  90. package/templates/default/public/tinymce/plugins/charmap/plugin.js +997 -0
  91. package/templates/default/public/tinymce/plugins/charmap/plugin.min.js +1 -0
  92. package/templates/default/public/tinymce/plugins/code/index.js +7 -0
  93. package/templates/default/public/tinymce/plugins/code/plugin.js +97 -0
  94. package/templates/default/public/tinymce/plugins/code/plugin.min.js +1 -0
  95. package/templates/default/public/tinymce/plugins/codesample/index.js +7 -0
  96. package/templates/default/public/tinymce/plugins/codesample/plugin.js +3654 -0
  97. package/templates/default/public/tinymce/plugins/codesample/plugin.min.js +9 -0
  98. package/templates/default/public/tinymce/plugins/directionality/index.js +7 -0
  99. package/templates/default/public/tinymce/plugins/directionality/plugin.js +636 -0
  100. package/templates/default/public/tinymce/plugins/directionality/plugin.min.js +1 -0
  101. package/templates/default/public/tinymce/plugins/emoticons/index.js +7 -0
  102. package/templates/default/public/tinymce/plugins/emoticons/js/emojiimages.js +1 -0
  103. package/templates/default/public/tinymce/plugins/emoticons/js/emojiimages.min.js +1 -0
  104. package/templates/default/public/tinymce/plugins/emoticons/js/emojis.js +1 -0
  105. package/templates/default/public/tinymce/plugins/emoticons/js/emojis.min.js +1 -0
  106. package/templates/default/public/tinymce/plugins/emoticons/plugin.js +809 -0
  107. package/templates/default/public/tinymce/plugins/emoticons/plugin.min.js +1 -0
  108. package/templates/default/public/tinymce/plugins/fullscreen/index.js +7 -0
  109. package/templates/default/public/tinymce/plugins/fullscreen/plugin.js +1609 -0
  110. package/templates/default/public/tinymce/plugins/fullscreen/plugin.min.js +1 -0
  111. package/templates/default/public/tinymce/plugins/help/index.js +7 -0
  112. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ar.js +93 -0
  113. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +93 -0
  114. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ca.js +93 -0
  115. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/cs.js +93 -0
  116. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/da.js +93 -0
  117. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/de.js +93 -0
  118. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/el.js +93 -0
  119. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/en.js +93 -0
  120. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/es.js +93 -0
  121. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/eu.js +93 -0
  122. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fa.js +93 -0
  123. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fi.js +93 -0
  124. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +93 -0
  125. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/he_IL.js +93 -0
  126. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hi.js +93 -0
  127. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hr.js +93 -0
  128. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +93 -0
  129. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/id.js +93 -0
  130. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/it.js +93 -0
  131. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ja.js +93 -0
  132. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/kk.js +93 -0
  133. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +93 -0
  134. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ms.js +93 -0
  135. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +93 -0
  136. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/nl.js +93 -0
  137. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pl.js +93 -0
  138. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +93 -0
  139. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +93 -0
  140. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ro.js +93 -0
  141. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/ru.js +93 -0
  142. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sk.js +93 -0
  143. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +93 -0
  144. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +93 -0
  145. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/th_TH.js +93 -0
  146. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/tr.js +93 -0
  147. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/uk.js +93 -0
  148. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/vi.js +93 -0
  149. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +87 -0
  150. package/templates/default/public/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +93 -0
  151. package/templates/default/public/tinymce/plugins/help/plugin.js +828 -0
  152. package/templates/default/public/tinymce/plugins/help/plugin.min.js +1 -0
  153. package/templates/default/public/tinymce/plugins/image/index.js +7 -0
  154. package/templates/default/public/tinymce/plugins/image/plugin.js +1689 -0
  155. package/templates/default/public/tinymce/plugins/image/plugin.min.js +1 -0
  156. package/templates/default/public/tinymce/plugins/importcss/index.js +7 -0
  157. package/templates/default/public/tinymce/plugins/importcss/plugin.js +403 -0
  158. package/templates/default/public/tinymce/plugins/importcss/plugin.min.js +1 -0
  159. package/templates/default/public/tinymce/plugins/insertdatetime/index.js +7 -0
  160. package/templates/default/public/tinymce/plugins/insertdatetime/plugin.js +186 -0
  161. package/templates/default/public/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
  162. package/templates/default/public/tinymce/plugins/link/index.js +7 -0
  163. package/templates/default/public/tinymce/plugins/link/plugin.js +1577 -0
  164. package/templates/default/public/tinymce/plugins/link/plugin.min.js +1 -0
  165. package/templates/default/public/tinymce/plugins/lists/index.js +7 -0
  166. package/templates/default/public/tinymce/plugins/lists/plugin.js +2544 -0
  167. package/templates/default/public/tinymce/plugins/lists/plugin.min.js +1 -0
  168. package/templates/default/public/tinymce/plugins/media/index.js +7 -0
  169. package/templates/default/public/tinymce/plugins/media/plugin.js +1450 -0
  170. package/templates/default/public/tinymce/plugins/media/plugin.min.js +1 -0
  171. package/templates/default/public/tinymce/plugins/nonbreaking/index.js +7 -0
  172. package/templates/default/public/tinymce/plugins/nonbreaking/plugin.js +128 -0
  173. package/templates/default/public/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
  174. package/templates/default/public/tinymce/plugins/pagebreak/index.js +7 -0
  175. package/templates/default/public/tinymce/plugins/pagebreak/plugin.js +123 -0
  176. package/templates/default/public/tinymce/plugins/pagebreak/plugin.min.js +1 -0
  177. package/templates/default/public/tinymce/plugins/preview/index.js +7 -0
  178. package/templates/default/public/tinymce/plugins/preview/plugin.js +765 -0
  179. package/templates/default/public/tinymce/plugins/preview/plugin.min.js +1 -0
  180. package/templates/default/public/tinymce/plugins/quickbars/index.js +7 -0
  181. package/templates/default/public/tinymce/plugins/quickbars/plugin.js +654 -0
  182. package/templates/default/public/tinymce/plugins/quickbars/plugin.min.js +1 -0
  183. package/templates/default/public/tinymce/plugins/save/index.js +7 -0
  184. package/templates/default/public/tinymce/plugins/save/plugin.js +136 -0
  185. package/templates/default/public/tinymce/plugins/save/plugin.min.js +1 -0
  186. package/templates/default/public/tinymce/plugins/searchreplace/index.js +7 -0
  187. package/templates/default/public/tinymce/plugins/searchreplace/plugin.js +1370 -0
  188. package/templates/default/public/tinymce/plugins/searchreplace/plugin.min.js +1 -0
  189. package/templates/default/public/tinymce/plugins/table/index.js +7 -0
  190. package/templates/default/public/tinymce/plugins/table/plugin.js +4019 -0
  191. package/templates/default/public/tinymce/plugins/table/plugin.min.js +1 -0
  192. package/templates/default/public/tinymce/plugins/visualblocks/index.js +7 -0
  193. package/templates/default/public/tinymce/plugins/visualblocks/plugin.js +106 -0
  194. package/templates/default/public/tinymce/plugins/visualblocks/plugin.min.js +1 -0
  195. package/templates/default/public/tinymce/plugins/visualchars/index.js +7 -0
  196. package/templates/default/public/tinymce/plugins/visualchars/plugin.js +809 -0
  197. package/templates/default/public/tinymce/plugins/visualchars/plugin.min.js +1 -0
  198. package/templates/default/public/tinymce/plugins/wordcount/index.js +7 -0
  199. package/templates/default/public/tinymce/plugins/wordcount/plugin.js +480 -0
  200. package/templates/default/public/tinymce/plugins/wordcount/plugin.min.js +1 -0
  201. package/templates/default/public/tinymce/skins/content/dark/content.css +75 -0
  202. package/templates/default/public/tinymce/skins/content/dark/content.js +10 -0
  203. package/templates/default/public/tinymce/skins/content/dark/content.min.css +10 -0
  204. package/templates/default/public/tinymce/skins/content/default/content.css +70 -0
  205. package/templates/default/public/tinymce/skins/content/default/content.js +10 -0
  206. package/templates/default/public/tinymce/skins/content/default/content.min.css +10 -0
  207. package/templates/default/public/tinymce/skins/content/document/content.css +75 -0
  208. package/templates/default/public/tinymce/skins/content/document/content.js +10 -0
  209. package/templates/default/public/tinymce/skins/content/document/content.min.css +10 -0
  210. package/templates/default/public/tinymce/skins/content/tinymce-5/content.css +70 -0
  211. package/templates/default/public/tinymce/skins/content/tinymce-5/content.js +10 -0
  212. package/templates/default/public/tinymce/skins/content/tinymce-5/content.min.css +10 -0
  213. package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.css +75 -0
  214. package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.js +10 -0
  215. package/templates/default/public/tinymce/skins/content/tinymce-5-dark/content.min.css +10 -0
  216. package/templates/default/public/tinymce/skins/content/writer/content.css +71 -0
  217. package/templates/default/public/tinymce/skins/content/writer/content.js +10 -0
  218. package/templates/default/public/tinymce/skins/content/writer/content.min.css +10 -0
  219. package/templates/default/public/tinymce/skins/ui/oxide/content.css +893 -0
  220. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.css +887 -0
  221. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.js +10 -0
  222. package/templates/default/public/tinymce/skins/ui/oxide/content.inline.min.css +10 -0
  223. package/templates/default/public/tinymce/skins/ui/oxide/content.js +10 -0
  224. package/templates/default/public/tinymce/skins/ui/oxide/content.min.css +10 -0
  225. package/templates/default/public/tinymce/skins/ui/oxide/skin.css +5141 -0
  226. package/templates/default/public/tinymce/skins/ui/oxide/skin.js +1 -0
  227. package/templates/default/public/tinymce/skins/ui/oxide/skin.min.css +1 -0
  228. package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.css +30 -0
  229. package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.js +1 -0
  230. package/templates/default/public/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -0
  231. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.css +881 -0
  232. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.css +887 -0
  233. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.js +10 -0
  234. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.inline.min.css +10 -0
  235. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.js +10 -0
  236. package/templates/default/public/tinymce/skins/ui/oxide-dark/content.min.css +10 -0
  237. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.css +5144 -0
  238. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.js +1 -0
  239. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.min.css +1 -0
  240. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +30 -0
  241. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +1 -0
  242. package/templates/default/public/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
  243. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.css +893 -0
  244. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.css +887 -0
  245. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.js +10 -0
  246. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.inline.min.css +10 -0
  247. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.js +10 -0
  248. package/templates/default/public/tinymce/skins/ui/tinymce-5/content.min.css +10 -0
  249. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.css +5260 -0
  250. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.js +1 -0
  251. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.min.css +1 -0
  252. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.css +30 -0
  253. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +1 -0
  254. package/templates/default/public/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
  255. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.css +881 -0
  256. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.css +887 -0
  257. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.js +10 -0
  258. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +10 -0
  259. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.js +10 -0
  260. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/content.min.css +10 -0
  261. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.css +5260 -0
  262. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -0
  263. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -0
  264. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.css +30 -0
  265. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +1 -0
  266. package/templates/default/public/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
  267. package/templates/default/public/tinymce/themes/silver/index.js +7 -0
  268. package/templates/default/public/tinymce/themes/silver/theme.js +34798 -0
  269. package/templates/default/public/tinymce/themes/silver/theme.min.js +1 -0
  270. package/templates/default/public/tinymce/tinymce.d.ts +3350 -0
  271. package/templates/default/public/tinymce/tinymce.js +38694 -0
  272. package/templates/default/public/tinymce/tinymce.min.js +11 -0
@@ -0,0 +1,3654 @@
1
+ /**
2
+ * TinyMCE version 7.9.1 (2025-05-29)
3
+ */
4
+
5
+ (function () {
6
+ 'use strict';
7
+
8
+ var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager');
9
+
10
+ /* eslint-disable @typescript-eslint/no-wrapper-object-types */
11
+ const isNullable = (a) => a === null || a === undefined;
12
+ const isNonNullable = (a) => !isNullable(a);
13
+
14
+ const noop = () => { };
15
+ const constant = (value) => {
16
+ return () => {
17
+ return value;
18
+ };
19
+ };
20
+
21
+ /**
22
+ * The `Optional` type represents a value (of any type) that potentially does
23
+ * not exist. Any `Optional<T>` can either be a `Some<T>` (in which case the
24
+ * value does exist) or a `None` (in which case the value does not exist). This
25
+ * module defines a whole lot of FP-inspired utility functions for dealing with
26
+ * `Optional` objects.
27
+ *
28
+ * Comparison with null or undefined:
29
+ * - We don't get fancy null coalescing operators with `Optional`
30
+ * - We do get fancy helper functions with `Optional`
31
+ * - `Optional` support nesting, and allow for the type to still be nullable (or
32
+ * another `Optional`)
33
+ * - There is no option to turn off strict-optional-checks like there is for
34
+ * strict-null-checks
35
+ */
36
+ class Optional {
37
+ // The internal representation has a `tag` and a `value`, but both are
38
+ // private: able to be console.logged, but not able to be accessed by code
39
+ constructor(tag, value) {
40
+ this.tag = tag;
41
+ this.value = value;
42
+ }
43
+ // --- Identities ---
44
+ /**
45
+ * Creates a new `Optional<T>` that **does** contain a value.
46
+ */
47
+ static some(value) {
48
+ return new Optional(true, value);
49
+ }
50
+ /**
51
+ * Create a new `Optional<T>` that **does not** contain a value. `T` can be
52
+ * any type because we don't actually have a `T`.
53
+ */
54
+ static none() {
55
+ return Optional.singletonNone;
56
+ }
57
+ /**
58
+ * Perform a transform on an `Optional` type. Regardless of whether this
59
+ * `Optional` contains a value or not, `fold` will return a value of type `U`.
60
+ * If this `Optional` does not contain a value, the `U` will be created by
61
+ * calling `onNone`. If this `Optional` does contain a value, the `U` will be
62
+ * created by calling `onSome`.
63
+ *
64
+ * For the FP enthusiasts in the room, this function:
65
+ * 1. Could be used to implement all of the functions below
66
+ * 2. Forms a catamorphism
67
+ */
68
+ fold(onNone, onSome) {
69
+ if (this.tag) {
70
+ return onSome(this.value);
71
+ }
72
+ else {
73
+ return onNone();
74
+ }
75
+ }
76
+ /**
77
+ * Determine if this `Optional` object contains a value.
78
+ */
79
+ isSome() {
80
+ return this.tag;
81
+ }
82
+ /**
83
+ * Determine if this `Optional` object **does not** contain a value.
84
+ */
85
+ isNone() {
86
+ return !this.tag;
87
+ }
88
+ // --- Functor (name stolen from Haskell / maths) ---
89
+ /**
90
+ * Perform a transform on an `Optional` object, **if** there is a value. If
91
+ * you provide a function to turn a T into a U, this is the function you use
92
+ * to turn an `Optional<T>` into an `Optional<U>`. If this **does** contain
93
+ * a value then the output will also contain a value (that value being the
94
+ * output of `mapper(this.value)`), and if this **does not** contain a value
95
+ * then neither will the output.
96
+ */
97
+ map(mapper) {
98
+ if (this.tag) {
99
+ return Optional.some(mapper(this.value));
100
+ }
101
+ else {
102
+ return Optional.none();
103
+ }
104
+ }
105
+ // --- Monad (name stolen from Haskell / maths) ---
106
+ /**
107
+ * Perform a transform on an `Optional` object, **if** there is a value.
108
+ * Unlike `map`, here the transform itself also returns an `Optional`.
109
+ */
110
+ bind(binder) {
111
+ if (this.tag) {
112
+ return binder(this.value);
113
+ }
114
+ else {
115
+ return Optional.none();
116
+ }
117
+ }
118
+ // --- Traversable (name stolen from Haskell / maths) ---
119
+ /**
120
+ * For a given predicate, this function finds out if there **exists** a value
121
+ * inside this `Optional` object that meets the predicate. In practice, this
122
+ * means that for `Optional`s that do not contain a value it returns false (as
123
+ * no predicate-meeting value exists).
124
+ */
125
+ exists(predicate) {
126
+ return this.tag && predicate(this.value);
127
+ }
128
+ /**
129
+ * For a given predicate, this function finds out if **all** the values inside
130
+ * this `Optional` object meet the predicate. In practice, this means that
131
+ * for `Optional`s that do not contain a value it returns true (as all 0
132
+ * objects do meet the predicate).
133
+ */
134
+ forall(predicate) {
135
+ return !this.tag || predicate(this.value);
136
+ }
137
+ filter(predicate) {
138
+ if (!this.tag || predicate(this.value)) {
139
+ return this;
140
+ }
141
+ else {
142
+ return Optional.none();
143
+ }
144
+ }
145
+ // --- Getters ---
146
+ /**
147
+ * Get the value out of the inside of the `Optional` object, using a default
148
+ * `replacement` value if the provided `Optional` object does not contain a
149
+ * value.
150
+ */
151
+ getOr(replacement) {
152
+ return this.tag ? this.value : replacement;
153
+ }
154
+ /**
155
+ * Get the value out of the inside of the `Optional` object, using a default
156
+ * `replacement` value if the provided `Optional` object does not contain a
157
+ * value. Unlike `getOr`, in this method the `replacement` object is also
158
+ * `Optional` - meaning that this method will always return an `Optional`.
159
+ */
160
+ or(replacement) {
161
+ return this.tag ? this : replacement;
162
+ }
163
+ /**
164
+ * Get the value out of the inside of the `Optional` object, using a default
165
+ * `replacement` value if the provided `Optional` object does not contain a
166
+ * value. Unlike `getOr`, in this method the `replacement` value is
167
+ * "thunked" - that is to say that you don't pass a value to `getOrThunk`, you
168
+ * pass a function which (if called) will **return** the `value` you want to
169
+ * use.
170
+ */
171
+ getOrThunk(thunk) {
172
+ return this.tag ? this.value : thunk();
173
+ }
174
+ /**
175
+ * Get the value out of the inside of the `Optional` object, using a default
176
+ * `replacement` value if the provided Optional object does not contain a
177
+ * value.
178
+ *
179
+ * Unlike `or`, in this method the `replacement` value is "thunked" - that is
180
+ * to say that you don't pass a value to `orThunk`, you pass a function which
181
+ * (if called) will **return** the `value` you want to use.
182
+ *
183
+ * Unlike `getOrThunk`, in this method the `replacement` value is also
184
+ * `Optional`, meaning that this method will always return an `Optional`.
185
+ */
186
+ orThunk(thunk) {
187
+ return this.tag ? this : thunk();
188
+ }
189
+ /**
190
+ * Get the value out of the inside of the `Optional` object, throwing an
191
+ * exception if the provided `Optional` object does not contain a value.
192
+ *
193
+ * WARNING:
194
+ * You should only be using this function if you know that the `Optional`
195
+ * object **is not** empty (otherwise you're throwing exceptions in production
196
+ * code, which is bad).
197
+ *
198
+ * In tests this is more acceptable.
199
+ *
200
+ * Prefer other methods to this, such as `.each`.
201
+ */
202
+ getOrDie(message) {
203
+ if (!this.tag) {
204
+ throw new Error(message !== null && message !== void 0 ? message : 'Called getOrDie on None');
205
+ }
206
+ else {
207
+ return this.value;
208
+ }
209
+ }
210
+ // --- Interop with null and undefined ---
211
+ /**
212
+ * Creates an `Optional` value from a nullable (or undefined-able) input.
213
+ * Null, or undefined, is converted to `None`, and anything else is converted
214
+ * to `Some`.
215
+ */
216
+ static from(value) {
217
+ return isNonNullable(value) ? Optional.some(value) : Optional.none();
218
+ }
219
+ /**
220
+ * Converts an `Optional` to a nullable type, by getting the value if it
221
+ * exists, or returning `null` if it does not.
222
+ */
223
+ getOrNull() {
224
+ return this.tag ? this.value : null;
225
+ }
226
+ /**
227
+ * Converts an `Optional` to an undefined-able type, by getting the value if
228
+ * it exists, or returning `undefined` if it does not.
229
+ */
230
+ getOrUndefined() {
231
+ return this.value;
232
+ }
233
+ // --- Utilities ---
234
+ /**
235
+ * If the `Optional` contains a value, perform an action on that value.
236
+ * Unlike the rest of the methods on this type, `.each` has side-effects. If
237
+ * you want to transform an `Optional<T>` **into** something, then this is not
238
+ * the method for you. If you want to use an `Optional<T>` to **do**
239
+ * something, then this is the method for you - provided you're okay with not
240
+ * doing anything in the case where the `Optional` doesn't have a value inside
241
+ * it. If you're not sure whether your use-case fits into transforming
242
+ * **into** something or **doing** something, check whether it has a return
243
+ * value. If it does, you should be performing a transform.
244
+ */
245
+ each(worker) {
246
+ if (this.tag) {
247
+ worker(this.value);
248
+ }
249
+ }
250
+ /**
251
+ * Turn the `Optional` object into an array that contains all of the values
252
+ * stored inside the `Optional`. In practice, this means the output will have
253
+ * either 0 or 1 elements.
254
+ */
255
+ toArray() {
256
+ return this.tag ? [this.value] : [];
257
+ }
258
+ /**
259
+ * Turn the `Optional` object into a string for debugging or printing. Not
260
+ * recommended for production code, but good for debugging. Also note that
261
+ * these days an `Optional` object can be logged to the console directly, and
262
+ * its inner value (if it exists) will be visible.
263
+ */
264
+ toString() {
265
+ return this.tag ? `some(${this.value})` : 'none()';
266
+ }
267
+ }
268
+ // Sneaky optimisation: every instance of Optional.none is identical, so just
269
+ // reuse the same object
270
+ Optional.singletonNone = new Optional(false);
271
+
272
+ const get$1 = (xs, i) => i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
273
+ const head = (xs) => get$1(xs, 0);
274
+
275
+ // Use window object as the global if it's available since CSP will block script evals
276
+ // eslint-disable-next-line @typescript-eslint/no-implied-eval
277
+ const Global = typeof window !== 'undefined' ? window : Function('return this;')();
278
+
279
+ const blank = (r) => (s) => s.replace(r, '');
280
+ /** removes all leading and trailing spaces */
281
+ const trim = blank(/^\s+|\s+$/g);
282
+
283
+ var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
284
+
285
+ const prismjs = function(global, module, exports) {
286
+ // preserve the global if it has already been loaded
287
+ const oldprism = window.Prism;
288
+ window.Prism = { manual: true };
289
+ /// <reference lib="WebWorker"/>
290
+
291
+ var _self = (typeof window !== 'undefined')
292
+ ? window // if in browser
293
+ : (
294
+ (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
295
+ ? self // if in worker
296
+ : {} // if in node js
297
+ );
298
+
299
+ /**
300
+ * Prism: Lightweight, robust, elegant syntax highlighting
301
+ *
302
+ * @license MIT <https://opensource.org/licenses/MIT>
303
+ * @author Lea Verou <https://lea.verou.me>
304
+ * @namespace
305
+ * @public
306
+ */
307
+ var Prism = (function (_self) {
308
+
309
+ // Private helper vars
310
+ var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
311
+ var uniqueId = 0;
312
+
313
+ // The grammar object for plaintext
314
+ var plainTextGrammar = {};
315
+
316
+
317
+ var _ = {
318
+ /**
319
+ * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
320
+ * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
321
+ * additional languages or plugins yourself.
322
+ *
323
+ * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
324
+ *
325
+ * You obviously have to change this value before the automatic highlighting started. To do this, you can add an
326
+ * empty Prism object into the global scope before loading the Prism script like this:
327
+ *
328
+ * ```js
329
+ * window.Prism = window.Prism || {};
330
+ * Prism.manual = true;
331
+ * // add a new <script> to load Prism's script
332
+ * ```
333
+ *
334
+ * @default false
335
+ * @type {boolean}
336
+ * @memberof Prism
337
+ * @public
338
+ */
339
+ manual: _self.Prism && _self.Prism.manual,
340
+ /**
341
+ * By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
342
+ * `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
343
+ * own worker, you don't want it to do this.
344
+ *
345
+ * By setting this value to `true`, Prism will not add its own listeners to the worker.
346
+ *
347
+ * You obviously have to change this value before Prism executes. To do this, you can add an
348
+ * empty Prism object into the global scope before loading the Prism script like this:
349
+ *
350
+ * ```js
351
+ * window.Prism = window.Prism || {};
352
+ * Prism.disableWorkerMessageHandler = true;
353
+ * // Load Prism's script
354
+ * ```
355
+ *
356
+ * @default false
357
+ * @type {boolean}
358
+ * @memberof Prism
359
+ * @public
360
+ */
361
+ disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
362
+
363
+ /**
364
+ * A namespace for utility methods.
365
+ *
366
+ * All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
367
+ * change or disappear at any time.
368
+ *
369
+ * @namespace
370
+ * @memberof Prism
371
+ */
372
+ util: {
373
+ encode: function encode(tokens) {
374
+ if (tokens instanceof Token) {
375
+ return new Token(tokens.type, encode(tokens.content), tokens.alias);
376
+ } else if (Array.isArray(tokens)) {
377
+ return tokens.map(encode);
378
+ } else {
379
+ return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\u00a0/g, ' ');
380
+ }
381
+ },
382
+
383
+ /**
384
+ * Returns the name of the type of the given value.
385
+ *
386
+ * @param {any} o
387
+ * @returns {string}
388
+ * @example
389
+ * type(null) === 'Null'
390
+ * type(undefined) === 'Undefined'
391
+ * type(123) === 'Number'
392
+ * type('foo') === 'String'
393
+ * type(true) === 'Boolean'
394
+ * type([1, 2]) === 'Array'
395
+ * type({}) === 'Object'
396
+ * type(String) === 'Function'
397
+ * type(/abc+/) === 'RegExp'
398
+ */
399
+ type: function (o) {
400
+ return Object.prototype.toString.call(o).slice(8, -1);
401
+ },
402
+
403
+ /**
404
+ * Returns a unique number for the given object. Later calls will still return the same number.
405
+ *
406
+ * @param {Object} obj
407
+ * @returns {number}
408
+ */
409
+ objId: function (obj) {
410
+ if (!obj['__id']) {
411
+ Object.defineProperty(obj, '__id', { value: ++uniqueId });
412
+ }
413
+ return obj['__id'];
414
+ },
415
+
416
+ /**
417
+ * Creates a deep clone of the given object.
418
+ *
419
+ * The main intended use of this function is to clone language definitions.
420
+ *
421
+ * @param {T} o
422
+ * @param {Record<number, any>} [visited]
423
+ * @returns {T}
424
+ * @template T
425
+ */
426
+ clone: function deepClone(o, visited) {
427
+ visited = visited || {};
428
+
429
+ var clone; var id;
430
+ switch (_.util.type(o)) {
431
+ case 'Object':
432
+ id = _.util.objId(o);
433
+ if (visited[id]) {
434
+ return visited[id];
435
+ }
436
+ clone = /** @type {Record<string, any>} */ ({});
437
+ visited[id] = clone;
438
+
439
+ for (var key in o) {
440
+ if (o.hasOwnProperty(key)) {
441
+ clone[key] = deepClone(o[key], visited);
442
+ }
443
+ }
444
+
445
+ return /** @type {any} */ (clone);
446
+
447
+ case 'Array':
448
+ id = _.util.objId(o);
449
+ if (visited[id]) {
450
+ return visited[id];
451
+ }
452
+ clone = [];
453
+ visited[id] = clone;
454
+
455
+ (/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
456
+ clone[i] = deepClone(v, visited);
457
+ });
458
+
459
+ return /** @type {any} */ (clone);
460
+
461
+ default:
462
+ return o;
463
+ }
464
+ },
465
+
466
+ /**
467
+ * Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
468
+ *
469
+ * If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
470
+ *
471
+ * @param {Element} element
472
+ * @returns {string}
473
+ */
474
+ getLanguage: function (element) {
475
+ while (element) {
476
+ var m = lang.exec(element.className);
477
+ if (m) {
478
+ return m[1].toLowerCase();
479
+ }
480
+ element = element.parentElement;
481
+ }
482
+ return 'none';
483
+ },
484
+
485
+ /**
486
+ * Sets the Prism `language-xxxx` class of the given element.
487
+ *
488
+ * @param {Element} element
489
+ * @param {string} language
490
+ * @returns {void}
491
+ */
492
+ setLanguage: function (element, language) {
493
+ // remove all `language-xxxx` classes
494
+ // (this might leave behind a leading space)
495
+ element.className = element.className.replace(RegExp(lang, 'gi'), '');
496
+
497
+ // add the new `language-xxxx` class
498
+ // (using `classList` will automatically clean up spaces for us)
499
+ element.classList.add('language-' + language);
500
+ },
501
+
502
+ /**
503
+ * Returns the script element that is currently executing.
504
+ *
505
+ * This does __not__ work for line script element.
506
+ *
507
+ * @returns {HTMLScriptElement | null}
508
+ */
509
+ currentScript: function () {
510
+ if (typeof document === 'undefined') {
511
+ return null;
512
+ }
513
+ if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
514
+ return /** @type {any} */ (document.currentScript);
515
+ }
516
+
517
+ // IE11 workaround
518
+ // we'll get the src of the current script by parsing IE11's error stack trace
519
+ // this will not work for inline scripts
520
+
521
+ try {
522
+ throw new Error();
523
+ } catch (err) {
524
+ // Get file src url from stack. Specifically works with the format of stack traces in IE.
525
+ // A stack will look like this:
526
+ //
527
+ // Error
528
+ // at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
529
+ // at Global code (http://localhost/components/prism-core.js:606:1)
530
+
531
+ var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
532
+ if (src) {
533
+ var scripts = document.getElementsByTagName('script');
534
+ for (var i in scripts) {
535
+ if (scripts[i].src == src) {
536
+ return scripts[i];
537
+ }
538
+ }
539
+ }
540
+ return null;
541
+ }
542
+ },
543
+
544
+ /**
545
+ * Returns whether a given class is active for `element`.
546
+ *
547
+ * The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
548
+ * if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
549
+ * given class is just the given class with a `no-` prefix.
550
+ *
551
+ * Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
552
+ * closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
553
+ * ancestors have the given class or the negated version of it, then the default activation will be returned.
554
+ *
555
+ * In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
556
+ * version of it, the class is considered active.
557
+ *
558
+ * @param {Element} element
559
+ * @param {string} className
560
+ * @param {boolean} [defaultActivation=false]
561
+ * @returns {boolean}
562
+ */
563
+ isActive: function (element, className, defaultActivation) {
564
+ var no = 'no-' + className;
565
+
566
+ while (element) {
567
+ var classList = element.classList;
568
+ if (classList.contains(className)) {
569
+ return true;
570
+ }
571
+ if (classList.contains(no)) {
572
+ return false;
573
+ }
574
+ element = element.parentElement;
575
+ }
576
+ return !!defaultActivation;
577
+ }
578
+ },
579
+
580
+ /**
581
+ * This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
582
+ *
583
+ * @namespace
584
+ * @memberof Prism
585
+ * @public
586
+ */
587
+ languages: {
588
+ /**
589
+ * The grammar for plain, unformatted text.
590
+ */
591
+ plain: plainTextGrammar,
592
+ plaintext: plainTextGrammar,
593
+ text: plainTextGrammar,
594
+ txt: plainTextGrammar,
595
+
596
+ /**
597
+ * Creates a deep copy of the language with the given id and appends the given tokens.
598
+ *
599
+ * If a token in `redef` also appears in the copied language, then the existing token in the copied language
600
+ * will be overwritten at its original position.
601
+ *
602
+ * ## Best practices
603
+ *
604
+ * Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
605
+ * doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
606
+ * understand the language definition because, normally, the order of tokens matters in Prism grammars.
607
+ *
608
+ * Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
609
+ * Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
610
+ *
611
+ * @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
612
+ * @param {Grammar} redef The new tokens to append.
613
+ * @returns {Grammar} The new language created.
614
+ * @public
615
+ * @example
616
+ * Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
617
+ * // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
618
+ * // at its original position
619
+ * 'comment': { ... },
620
+ * // CSS doesn't have a 'color' token, so this token will be appended
621
+ * 'color': /\b(?:red|green|blue)\b/
622
+ * });
623
+ */
624
+ extend: function (id, redef) {
625
+ var lang = _.util.clone(_.languages[id]);
626
+
627
+ for (var key in redef) {
628
+ lang[key] = redef[key];
629
+ }
630
+
631
+ return lang;
632
+ },
633
+
634
+ /**
635
+ * Inserts tokens _before_ another token in a language definition or any other grammar.
636
+ *
637
+ * ## Usage
638
+ *
639
+ * This helper method makes it easy to modify existing languages. For example, the CSS language definition
640
+ * not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
641
+ * in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
642
+ * appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
643
+ * this:
644
+ *
645
+ * ```js
646
+ * Prism.languages.markup.style = {
647
+ * // token
648
+ * };
649
+ * ```
650
+ *
651
+ * then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
652
+ * before existing tokens. For the CSS example above, you would use it like this:
653
+ *
654
+ * ```js
655
+ * Prism.languages.insertBefore('markup', 'cdata', {
656
+ * 'style': {
657
+ * // token
658
+ * }
659
+ * });
660
+ * ```
661
+ *
662
+ * ## Special cases
663
+ *
664
+ * If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
665
+ * will be ignored.
666
+ *
667
+ * This behavior can be used to insert tokens after `before`:
668
+ *
669
+ * ```js
670
+ * Prism.languages.insertBefore('markup', 'comment', {
671
+ * 'comment': Prism.languages.markup.comment,
672
+ * // tokens after 'comment'
673
+ * });
674
+ * ```
675
+ *
676
+ * ## Limitations
677
+ *
678
+ * The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
679
+ * properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
680
+ * differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
681
+ * deleting properties which is necessary to insert at arbitrary positions.
682
+ *
683
+ * To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
684
+ * Instead, it will create a new object and replace all references to the target object with the new one. This
685
+ * can be done without temporarily deleting properties, so the iteration order is well-defined.
686
+ *
687
+ * However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
688
+ * you hold the target object in a variable, then the value of the variable will not change.
689
+ *
690
+ * ```js
691
+ * var oldMarkup = Prism.languages.markup;
692
+ * var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
693
+ *
694
+ * assert(oldMarkup !== Prism.languages.markup);
695
+ * assert(newMarkup === Prism.languages.markup);
696
+ * ```
697
+ *
698
+ * @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
699
+ * object to be modified.
700
+ * @param {string} before The key to insert before.
701
+ * @param {Grammar} insert An object containing the key-value pairs to be inserted.
702
+ * @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
703
+ * object to be modified.
704
+ *
705
+ * Defaults to `Prism.languages`.
706
+ * @returns {Grammar} The new grammar object.
707
+ * @public
708
+ */
709
+ insertBefore: function (inside, before, insert, root) {
710
+ root = root || /** @type {any} */ (_.languages);
711
+ var grammar = root[inside];
712
+ /** @type {Grammar} */
713
+ var ret = {};
714
+
715
+ for (var token in grammar) {
716
+ if (grammar.hasOwnProperty(token)) {
717
+
718
+ if (token == before) {
719
+ for (var newToken in insert) {
720
+ if (insert.hasOwnProperty(newToken)) {
721
+ ret[newToken] = insert[newToken];
722
+ }
723
+ }
724
+ }
725
+
726
+ // Do not insert token which also occur in insert. See #1525
727
+ if (!insert.hasOwnProperty(token)) {
728
+ ret[token] = grammar[token];
729
+ }
730
+ }
731
+ }
732
+
733
+ var old = root[inside];
734
+ root[inside] = ret;
735
+
736
+ // Update references in other language definitions
737
+ _.languages.DFS(_.languages, function (key, value) {
738
+ if (value === old && key != inside) {
739
+ this[key] = ret;
740
+ }
741
+ });
742
+
743
+ return ret;
744
+ },
745
+
746
+ // Traverse a language definition with Depth First Search
747
+ DFS: function DFS(o, callback, type, visited) {
748
+ visited = visited || {};
749
+
750
+ var objId = _.util.objId;
751
+
752
+ for (var i in o) {
753
+ if (o.hasOwnProperty(i)) {
754
+ callback.call(o, i, o[i], type || i);
755
+
756
+ var property = o[i];
757
+ var propertyType = _.util.type(property);
758
+
759
+ if (propertyType === 'Object' && !visited[objId(property)]) {
760
+ visited[objId(property)] = true;
761
+ DFS(property, callback, null, visited);
762
+ } else if (propertyType === 'Array' && !visited[objId(property)]) {
763
+ visited[objId(property)] = true;
764
+ DFS(property, callback, i, visited);
765
+ }
766
+ }
767
+ }
768
+ }
769
+ },
770
+
771
+ plugins: {},
772
+
773
+ /**
774
+ * This is the most high-level function in Prism’s API.
775
+ * It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
776
+ * each one of them.
777
+ *
778
+ * This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
779
+ *
780
+ * @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
781
+ * @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
782
+ * @memberof Prism
783
+ * @public
784
+ */
785
+ highlightAll: function (async, callback) {
786
+ _.highlightAllUnder(document, async, callback);
787
+ },
788
+
789
+ /**
790
+ * Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
791
+ * {@link Prism.highlightElement} on each one of them.
792
+ *
793
+ * The following hooks will be run:
794
+ * 1. `before-highlightall`
795
+ * 2. `before-all-elements-highlight`
796
+ * 3. All hooks of {@link Prism.highlightElement} for each element.
797
+ *
798
+ * @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
799
+ * @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
800
+ * @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
801
+ * @memberof Prism
802
+ * @public
803
+ */
804
+ highlightAllUnder: function (container, async, callback) {
805
+ var env = {
806
+ callback: callback,
807
+ container: container,
808
+ selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
809
+ };
810
+
811
+ _.hooks.run('before-highlightall', env);
812
+
813
+ env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
814
+
815
+ _.hooks.run('before-all-elements-highlight', env);
816
+
817
+ for (var i = 0, element; (element = env.elements[i++]);) {
818
+ _.highlightElement(element, async === true, env.callback);
819
+ }
820
+ },
821
+
822
+ /**
823
+ * Highlights the code inside a single element.
824
+ *
825
+ * The following hooks will be run:
826
+ * 1. `before-sanity-check`
827
+ * 2. `before-highlight`
828
+ * 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
829
+ * 4. `before-insert`
830
+ * 5. `after-highlight`
831
+ * 6. `complete`
832
+ *
833
+ * Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
834
+ * the element's language.
835
+ *
836
+ * @param {Element} element The element containing the code.
837
+ * It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
838
+ * @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
839
+ * to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
840
+ * [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
841
+ *
842
+ * Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
843
+ * asynchronous highlighting to work. You can build your own bundle on the
844
+ * [Download page](https://prismjs.com/download.html).
845
+ * @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
846
+ * Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
847
+ * @memberof Prism
848
+ * @public
849
+ */
850
+ highlightElement: function (element, async, callback) {
851
+ // Find language
852
+ var language = _.util.getLanguage(element);
853
+ var grammar = _.languages[language];
854
+
855
+ // Set language on the element, if not present
856
+ _.util.setLanguage(element, language);
857
+
858
+ // Set language on the parent, for styling
859
+ var parent = element.parentElement;
860
+ if (parent && parent.nodeName.toLowerCase() === 'pre') {
861
+ _.util.setLanguage(parent, language);
862
+ }
863
+
864
+ var code = element.textContent;
865
+
866
+ var env = {
867
+ element: element,
868
+ language: language,
869
+ grammar: grammar,
870
+ code: code
871
+ };
872
+
873
+ function insertHighlightedCode(highlightedCode) {
874
+ env.highlightedCode = highlightedCode;
875
+
876
+ _.hooks.run('before-insert', env);
877
+
878
+ env.element.innerHTML = env.highlightedCode;
879
+
880
+ _.hooks.run('after-highlight', env);
881
+ _.hooks.run('complete', env);
882
+ callback && callback.call(env.element);
883
+ }
884
+
885
+ _.hooks.run('before-sanity-check', env);
886
+
887
+ // plugins may change/add the parent/element
888
+ parent = env.element.parentElement;
889
+ if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
890
+ parent.setAttribute('tabindex', '0');
891
+ }
892
+
893
+ if (!env.code) {
894
+ _.hooks.run('complete', env);
895
+ callback && callback.call(env.element);
896
+ return;
897
+ }
898
+
899
+ _.hooks.run('before-highlight', env);
900
+
901
+ if (!env.grammar) {
902
+ insertHighlightedCode(_.util.encode(env.code));
903
+ return;
904
+ }
905
+
906
+ if (async && _self.Worker) {
907
+ var worker = new Worker(_.filename);
908
+
909
+ worker.onmessage = function (evt) {
910
+ insertHighlightedCode(evt.data);
911
+ };
912
+
913
+ worker.postMessage(JSON.stringify({
914
+ language: env.language,
915
+ code: env.code,
916
+ immediateClose: true
917
+ }));
918
+ } else {
919
+ insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
920
+ }
921
+ },
922
+
923
+ /**
924
+ * Low-level function, only use if you know what you’re doing. It accepts a string of text as input
925
+ * and the language definitions to use, and returns a string with the HTML produced.
926
+ *
927
+ * The following hooks will be run:
928
+ * 1. `before-tokenize`
929
+ * 2. `after-tokenize`
930
+ * 3. `wrap`: On each {@link Token}.
931
+ *
932
+ * @param {string} text A string with the code to be highlighted.
933
+ * @param {Grammar} grammar An object containing the tokens to use.
934
+ *
935
+ * Usually a language definition like `Prism.languages.markup`.
936
+ * @param {string} language The name of the language definition passed to `grammar`.
937
+ * @returns {string} The highlighted HTML.
938
+ * @memberof Prism
939
+ * @public
940
+ * @example
941
+ * Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
942
+ */
943
+ highlight: function (text, grammar, language) {
944
+ var env = {
945
+ code: text,
946
+ grammar: grammar,
947
+ language: language
948
+ };
949
+ _.hooks.run('before-tokenize', env);
950
+ if (!env.grammar) {
951
+ throw new Error('The language "' + env.language + '" has no grammar.');
952
+ }
953
+ env.tokens = _.tokenize(env.code, env.grammar);
954
+ _.hooks.run('after-tokenize', env);
955
+ return Token.stringify(_.util.encode(env.tokens), env.language);
956
+ },
957
+
958
+ /**
959
+ * This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
960
+ * and the language definitions to use, and returns an array with the tokenized code.
961
+ *
962
+ * When the language definition includes nested tokens, the function is called recursively on each of these tokens.
963
+ *
964
+ * This method could be useful in other contexts as well, as a very crude parser.
965
+ *
966
+ * @param {string} text A string with the code to be highlighted.
967
+ * @param {Grammar} grammar An object containing the tokens to use.
968
+ *
969
+ * Usually a language definition like `Prism.languages.markup`.
970
+ * @returns {TokenStream} An array of strings and tokens, a token stream.
971
+ * @memberof Prism
972
+ * @public
973
+ * @example
974
+ * let code = `var foo = 0;`;
975
+ * let tokens = Prism.tokenize(code, Prism.languages.javascript);
976
+ * tokens.forEach(token => {
977
+ * if (token instanceof Prism.Token && token.type === 'number') {
978
+ * console.log(`Found numeric literal: ${token.content}`);
979
+ * }
980
+ * });
981
+ */
982
+ tokenize: function (text, grammar) {
983
+ var rest = grammar.rest;
984
+ if (rest) {
985
+ for (var token in rest) {
986
+ grammar[token] = rest[token];
987
+ }
988
+
989
+ delete grammar.rest;
990
+ }
991
+
992
+ var tokenList = new LinkedList();
993
+ addAfter(tokenList, tokenList.head, text);
994
+
995
+ matchGrammar(text, tokenList, grammar, tokenList.head, 0);
996
+
997
+ return toArray(tokenList);
998
+ },
999
+
1000
+ /**
1001
+ * @namespace
1002
+ * @memberof Prism
1003
+ * @public
1004
+ */
1005
+ hooks: {
1006
+ all: {},
1007
+
1008
+ /**
1009
+ * Adds the given callback to the list of callbacks for the given hook.
1010
+ *
1011
+ * The callback will be invoked when the hook it is registered for is run.
1012
+ * Hooks are usually directly run by a highlight function but you can also run hooks yourself.
1013
+ *
1014
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
1015
+ *
1016
+ * @param {string} name The name of the hook.
1017
+ * @param {HookCallback} callback The callback function which is given environment variables.
1018
+ * @public
1019
+ */
1020
+ add: function (name, callback) {
1021
+ var hooks = _.hooks.all;
1022
+
1023
+ hooks[name] = hooks[name] || [];
1024
+
1025
+ hooks[name].push(callback);
1026
+ },
1027
+
1028
+ /**
1029
+ * Runs a hook invoking all registered callbacks with the given environment variables.
1030
+ *
1031
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
1032
+ *
1033
+ * @param {string} name The name of the hook.
1034
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
1035
+ * @public
1036
+ */
1037
+ run: function (name, env) {
1038
+ var callbacks = _.hooks.all[name];
1039
+
1040
+ if (!callbacks || !callbacks.length) {
1041
+ return;
1042
+ }
1043
+
1044
+ for (var i = 0, callback; (callback = callbacks[i++]);) {
1045
+ callback(env);
1046
+ }
1047
+ }
1048
+ },
1049
+
1050
+ Token: Token
1051
+ };
1052
+ _self.Prism = _;
1053
+
1054
+
1055
+ // Typescript note:
1056
+ // The following can be used to import the Token type in JSDoc:
1057
+ //
1058
+ // @typedef {InstanceType<import("./prism-core")["Token"]>} Token
1059
+
1060
+ /**
1061
+ * Creates a new token.
1062
+ *
1063
+ * @param {string} type See {@link Token#type type}
1064
+ * @param {string | TokenStream} content See {@link Token#content content}
1065
+ * @param {string|string[]} [alias] The alias(es) of the token.
1066
+ * @param {string} [matchedStr=""] A copy of the full string this token was created from.
1067
+ * @class
1068
+ * @global
1069
+ * @public
1070
+ */
1071
+ function Token(type, content, alias, matchedStr) {
1072
+ /**
1073
+ * The type of the token.
1074
+ *
1075
+ * This is usually the key of a pattern in a {@link Grammar}.
1076
+ *
1077
+ * @type {string}
1078
+ * @see GrammarToken
1079
+ * @public
1080
+ */
1081
+ this.type = type;
1082
+ /**
1083
+ * The strings or tokens contained by this token.
1084
+ *
1085
+ * This will be a token stream if the pattern matched also defined an `inside` grammar.
1086
+ *
1087
+ * @type {string | TokenStream}
1088
+ * @public
1089
+ */
1090
+ this.content = content;
1091
+ /**
1092
+ * The alias(es) of the token.
1093
+ *
1094
+ * @type {string|string[]}
1095
+ * @see GrammarToken
1096
+ * @public
1097
+ */
1098
+ this.alias = alias;
1099
+ // Copy of the full string this token was created from
1100
+ this.length = (matchedStr || '').length | 0;
1101
+ }
1102
+
1103
+ /**
1104
+ * A token stream is an array of strings and {@link Token Token} objects.
1105
+ *
1106
+ * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
1107
+ * them.
1108
+ *
1109
+ * 1. No adjacent strings.
1110
+ * 2. No empty strings.
1111
+ *
1112
+ * The only exception here is the token stream that only contains the empty string and nothing else.
1113
+ *
1114
+ * @typedef {Array<string | Token>} TokenStream
1115
+ * @global
1116
+ * @public
1117
+ */
1118
+
1119
+ /**
1120
+ * Converts the given token or token stream to an HTML representation.
1121
+ *
1122
+ * The following hooks will be run:
1123
+ * 1. `wrap`: On each {@link Token}.
1124
+ *
1125
+ * @param {string | Token | TokenStream} o The token or token stream to be converted.
1126
+ * @param {string} language The name of current language.
1127
+ * @returns {string} The HTML representation of the token or token stream.
1128
+ * @memberof Token
1129
+ * @static
1130
+ */
1131
+ Token.stringify = function stringify(o, language) {
1132
+ if (typeof o == 'string') {
1133
+ return o;
1134
+ }
1135
+ if (Array.isArray(o)) {
1136
+ var s = '';
1137
+ o.forEach(function (e) {
1138
+ s += stringify(e, language);
1139
+ });
1140
+ return s;
1141
+ }
1142
+
1143
+ var env = {
1144
+ type: o.type,
1145
+ content: stringify(o.content, language),
1146
+ tag: 'span',
1147
+ classes: ['token', o.type],
1148
+ attributes: {},
1149
+ language: language
1150
+ };
1151
+
1152
+ var aliases = o.alias;
1153
+ if (aliases) {
1154
+ if (Array.isArray(aliases)) {
1155
+ Array.prototype.push.apply(env.classes, aliases);
1156
+ } else {
1157
+ env.classes.push(aliases);
1158
+ }
1159
+ }
1160
+
1161
+ _.hooks.run('wrap', env);
1162
+
1163
+ var attributes = '';
1164
+ for (var name in env.attributes) {
1165
+ attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '&quot;') + '"';
1166
+ }
1167
+
1168
+ return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
1169
+ };
1170
+
1171
+ /**
1172
+ * @param {RegExp} pattern
1173
+ * @param {number} pos
1174
+ * @param {string} text
1175
+ * @param {boolean} lookbehind
1176
+ * @returns {RegExpExecArray | null}
1177
+ */
1178
+ function matchPattern(pattern, pos, text, lookbehind) {
1179
+ pattern.lastIndex = pos;
1180
+ var match = pattern.exec(text);
1181
+ if (match && lookbehind && match[1]) {
1182
+ // change the match to remove the text matched by the Prism lookbehind group
1183
+ var lookbehindLength = match[1].length;
1184
+ match.index += lookbehindLength;
1185
+ match[0] = match[0].slice(lookbehindLength);
1186
+ }
1187
+ return match;
1188
+ }
1189
+
1190
+ /**
1191
+ * @param {string} text
1192
+ * @param {LinkedList<string | Token>} tokenList
1193
+ * @param {any} grammar
1194
+ * @param {LinkedListNode<string | Token>} startNode
1195
+ * @param {number} startPos
1196
+ * @param {RematchOptions} [rematch]
1197
+ * @returns {void}
1198
+ * @private
1199
+ *
1200
+ * @typedef RematchOptions
1201
+ * @property {string} cause
1202
+ * @property {number} reach
1203
+ */
1204
+ function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
1205
+ for (var token in grammar) {
1206
+ if (!grammar.hasOwnProperty(token) || !grammar[token]) {
1207
+ continue;
1208
+ }
1209
+
1210
+ var patterns = grammar[token];
1211
+ patterns = Array.isArray(patterns) ? patterns : [patterns];
1212
+
1213
+ for (var j = 0; j < patterns.length; ++j) {
1214
+ if (rematch && rematch.cause == token + ',' + j) {
1215
+ return;
1216
+ }
1217
+
1218
+ var patternObj = patterns[j];
1219
+ var inside = patternObj.inside;
1220
+ var lookbehind = !!patternObj.lookbehind;
1221
+ var greedy = !!patternObj.greedy;
1222
+ var alias = patternObj.alias;
1223
+
1224
+ if (greedy && !patternObj.pattern.global) {
1225
+ // Without the global flag, lastIndex won't work
1226
+ var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
1227
+ patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
1228
+ }
1229
+
1230
+ /** @type {RegExp} */
1231
+ var pattern = patternObj.pattern || patternObj;
1232
+
1233
+ for ( // iterate the token list and keep track of the current token/string position
1234
+ var currentNode = startNode.next, pos = startPos;
1235
+ currentNode !== tokenList.tail;
1236
+ pos += currentNode.value.length, currentNode = currentNode.next
1237
+ ) {
1238
+
1239
+ if (rematch && pos >= rematch.reach) {
1240
+ break;
1241
+ }
1242
+
1243
+ var str = currentNode.value;
1244
+
1245
+ if (tokenList.length > text.length) {
1246
+ // Something went terribly wrong, ABORT, ABORT!
1247
+ return;
1248
+ }
1249
+
1250
+ if (str instanceof Token) {
1251
+ continue;
1252
+ }
1253
+
1254
+ var removeCount = 1; // this is the to parameter of removeBetween
1255
+ var match;
1256
+
1257
+ if (greedy) {
1258
+ match = matchPattern(pattern, pos, text, lookbehind);
1259
+ if (!match || match.index >= text.length) {
1260
+ break;
1261
+ }
1262
+
1263
+ var from = match.index;
1264
+ var to = match.index + match[0].length;
1265
+ var p = pos;
1266
+
1267
+ // find the node that contains the match
1268
+ p += currentNode.value.length;
1269
+ while (from >= p) {
1270
+ currentNode = currentNode.next;
1271
+ p += currentNode.value.length;
1272
+ }
1273
+ // adjust pos (and p)
1274
+ p -= currentNode.value.length;
1275
+ pos = p;
1276
+
1277
+ // the current node is a Token, then the match starts inside another Token, which is invalid
1278
+ if (currentNode.value instanceof Token) {
1279
+ continue;
1280
+ }
1281
+
1282
+ // find the last node which is affected by this match
1283
+ for (
1284
+ var k = currentNode;
1285
+ k !== tokenList.tail && (p < to || typeof k.value === 'string');
1286
+ k = k.next
1287
+ ) {
1288
+ removeCount++;
1289
+ p += k.value.length;
1290
+ }
1291
+ removeCount--;
1292
+
1293
+ // replace with the new match
1294
+ str = text.slice(pos, p);
1295
+ match.index -= pos;
1296
+ } else {
1297
+ match = matchPattern(pattern, 0, str, lookbehind);
1298
+ if (!match) {
1299
+ continue;
1300
+ }
1301
+ }
1302
+
1303
+ // eslint-disable-next-line no-redeclare
1304
+ var from = match.index;
1305
+ var matchStr = match[0];
1306
+ var before = str.slice(0, from);
1307
+ var after = str.slice(from + matchStr.length);
1308
+
1309
+ var reach = pos + str.length;
1310
+ if (rematch && reach > rematch.reach) {
1311
+ rematch.reach = reach;
1312
+ }
1313
+
1314
+ var removeFrom = currentNode.prev;
1315
+
1316
+ if (before) {
1317
+ removeFrom = addAfter(tokenList, removeFrom, before);
1318
+ pos += before.length;
1319
+ }
1320
+
1321
+ removeRange(tokenList, removeFrom, removeCount);
1322
+
1323
+ var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
1324
+ currentNode = addAfter(tokenList, removeFrom, wrapped);
1325
+
1326
+ if (after) {
1327
+ addAfter(tokenList, currentNode, after);
1328
+ }
1329
+
1330
+ if (removeCount > 1) {
1331
+ // at least one Token object was removed, so we have to do some rematching
1332
+ // this can only happen if the current pattern is greedy
1333
+
1334
+ /** @type {RematchOptions} */
1335
+ var nestedRematch = {
1336
+ cause: token + ',' + j,
1337
+ reach: reach
1338
+ };
1339
+ matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
1340
+
1341
+ // the reach might have been extended because of the rematching
1342
+ if (rematch && nestedRematch.reach > rematch.reach) {
1343
+ rematch.reach = nestedRematch.reach;
1344
+ }
1345
+ }
1346
+ }
1347
+ }
1348
+ }
1349
+ }
1350
+
1351
+ /**
1352
+ * @typedef LinkedListNode
1353
+ * @property {T} value
1354
+ * @property {LinkedListNode<T> | null} prev The previous node.
1355
+ * @property {LinkedListNode<T> | null} next The next node.
1356
+ * @template T
1357
+ * @private
1358
+ */
1359
+
1360
+ /**
1361
+ * @template T
1362
+ * @private
1363
+ */
1364
+ function LinkedList() {
1365
+ /** @type {LinkedListNode<T>} */
1366
+ var head = { value: null, prev: null, next: null };
1367
+ /** @type {LinkedListNode<T>} */
1368
+ var tail = { value: null, prev: head, next: null };
1369
+ head.next = tail;
1370
+
1371
+ /** @type {LinkedListNode<T>} */
1372
+ this.head = head;
1373
+ /** @type {LinkedListNode<T>} */
1374
+ this.tail = tail;
1375
+ this.length = 0;
1376
+ }
1377
+
1378
+ /**
1379
+ * Adds a new node with the given value to the list.
1380
+ *
1381
+ * @param {LinkedList<T>} list
1382
+ * @param {LinkedListNode<T>} node
1383
+ * @param {T} value
1384
+ * @returns {LinkedListNode<T>} The added node.
1385
+ * @template T
1386
+ */
1387
+ function addAfter(list, node, value) {
1388
+ // assumes that node != list.tail && values.length >= 0
1389
+ var next = node.next;
1390
+
1391
+ var newNode = { value: value, prev: node, next: next };
1392
+ node.next = newNode;
1393
+ next.prev = newNode;
1394
+ list.length++;
1395
+
1396
+ return newNode;
1397
+ }
1398
+ /**
1399
+ * Removes `count` nodes after the given node. The given node will not be removed.
1400
+ *
1401
+ * @param {LinkedList<T>} list
1402
+ * @param {LinkedListNode<T>} node
1403
+ * @param {number} count
1404
+ * @template T
1405
+ */
1406
+ function removeRange(list, node, count) {
1407
+ var next = node.next;
1408
+ for (var i = 0; i < count && next !== list.tail; i++) {
1409
+ next = next.next;
1410
+ }
1411
+ node.next = next;
1412
+ next.prev = node;
1413
+ list.length -= i;
1414
+ }
1415
+ /**
1416
+ * @param {LinkedList<T>} list
1417
+ * @returns {T[]}
1418
+ * @template T
1419
+ */
1420
+ function toArray(list) {
1421
+ var array = [];
1422
+ var node = list.head.next;
1423
+ while (node !== list.tail) {
1424
+ array.push(node.value);
1425
+ node = node.next;
1426
+ }
1427
+ return array;
1428
+ }
1429
+
1430
+
1431
+ if (!_self.document) {
1432
+ if (!_self.addEventListener) {
1433
+ // in Node.js
1434
+ return _;
1435
+ }
1436
+
1437
+ if (!_.disableWorkerMessageHandler) {
1438
+ // In worker
1439
+ _self.addEventListener('message', function (evt) {
1440
+ var message = JSON.parse(evt.data);
1441
+ var lang = message.language;
1442
+ var code = message.code;
1443
+ var immediateClose = message.immediateClose;
1444
+
1445
+ _self.postMessage(_.highlight(code, _.languages[lang], lang));
1446
+ if (immediateClose) {
1447
+ _self.close();
1448
+ }
1449
+ }, false);
1450
+ }
1451
+
1452
+ return _;
1453
+ }
1454
+
1455
+ // Get current script and highlight
1456
+ var script = _.util.currentScript();
1457
+
1458
+ if (script) {
1459
+ _.filename = script.src;
1460
+
1461
+ if (script.hasAttribute('data-manual')) {
1462
+ _.manual = true;
1463
+ }
1464
+ }
1465
+
1466
+ function highlightAutomaticallyCallback() {
1467
+ if (!_.manual) {
1468
+ _.highlightAll();
1469
+ }
1470
+ }
1471
+
1472
+ if (!_.manual) {
1473
+ // If the document state is "loading", then we'll use DOMContentLoaded.
1474
+ // If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
1475
+ // DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
1476
+ // might take longer one animation frame to execute which can create a race condition where only some plugins have
1477
+ // been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
1478
+ // See https://github.com/PrismJS/prism/issues/2102
1479
+ var readyState = document.readyState;
1480
+ if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
1481
+ document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
1482
+ } else {
1483
+ if (window.requestAnimationFrame) {
1484
+ window.requestAnimationFrame(highlightAutomaticallyCallback);
1485
+ } else {
1486
+ window.setTimeout(highlightAutomaticallyCallback, 16);
1487
+ }
1488
+ }
1489
+ }
1490
+
1491
+ return _;
1492
+
1493
+ }(_self));
1494
+
1495
+ if (typeof module !== 'undefined' && module.exports) {
1496
+ module.exports = Prism;
1497
+ }
1498
+
1499
+ // hack for components to work correctly in node.js
1500
+ if (typeof global !== 'undefined') {
1501
+ global.Prism = Prism;
1502
+ }
1503
+
1504
+ // some additional documentation/types
1505
+
1506
+ /**
1507
+ * The expansion of a simple `RegExp` literal to support additional properties.
1508
+ *
1509
+ * @typedef GrammarToken
1510
+ * @property {RegExp} pattern The regular expression of the token.
1511
+ * @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
1512
+ * behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
1513
+ * @property {boolean} [greedy=false] Whether the token is greedy.
1514
+ * @property {string|string[]} [alias] An optional alias or list of aliases.
1515
+ * @property {Grammar} [inside] The nested grammar of this token.
1516
+ *
1517
+ * The `inside` grammar will be used to tokenize the text value of each token of this kind.
1518
+ *
1519
+ * This can be used to make nested and even recursive language definitions.
1520
+ *
1521
+ * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
1522
+ * each another.
1523
+ * @global
1524
+ * @public
1525
+ */
1526
+
1527
+ /**
1528
+ * @typedef Grammar
1529
+ * @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
1530
+ * @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
1531
+ * @global
1532
+ * @public
1533
+ */
1534
+
1535
+ /**
1536
+ * A function which will invoked after an element was successfully highlighted.
1537
+ *
1538
+ * @callback HighlightCallback
1539
+ * @param {Element} element The element successfully highlighted.
1540
+ * @returns {void}
1541
+ * @global
1542
+ * @public
1543
+ */
1544
+
1545
+ /**
1546
+ * @callback HookCallback
1547
+ * @param {Object<string, any>} env The environment variables of the hook.
1548
+ * @returns {void}
1549
+ * @global
1550
+ * @public
1551
+ */
1552
+
1553
+ Prism.languages.clike = {
1554
+ 'comment': [
1555
+ {
1556
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1557
+ lookbehind: true,
1558
+ greedy: true
1559
+ },
1560
+ {
1561
+ pattern: /(^|[^\\:])\/\/.*/,
1562
+ lookbehind: true,
1563
+ greedy: true
1564
+ }
1565
+ ],
1566
+ 'string': {
1567
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1568
+ greedy: true
1569
+ },
1570
+ 'class-name': {
1571
+ pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
1572
+ lookbehind: true,
1573
+ inside: {
1574
+ 'punctuation': /[.\\]/
1575
+ }
1576
+ },
1577
+ 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
1578
+ 'boolean': /\b(?:false|true)\b/,
1579
+ 'function': /\b\w+(?=\()/,
1580
+ 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
1581
+ 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
1582
+ 'punctuation': /[{}[\];(),.:]/
1583
+ };
1584
+
1585
+ (function (Prism) {
1586
+
1587
+ /**
1588
+ * Returns the placeholder for the given language id and index.
1589
+ *
1590
+ * @param {string} language
1591
+ * @param {string|number} index
1592
+ * @returns {string}
1593
+ */
1594
+ function getPlaceholder(language, index) {
1595
+ return '___' + language.toUpperCase() + index + '___';
1596
+ }
1597
+
1598
+ Object.defineProperties(Prism.languages['markup-templating'] = {}, {
1599
+ buildPlaceholders: {
1600
+ /**
1601
+ * Tokenize all inline templating expressions matching `placeholderPattern`.
1602
+ *
1603
+ * If `replaceFilter` is provided, only matches of `placeholderPattern` for which `replaceFilter` returns
1604
+ * `true` will be replaced.
1605
+ *
1606
+ * @param {object} env The environment of the `before-tokenize` hook.
1607
+ * @param {string} language The language id.
1608
+ * @param {RegExp} placeholderPattern The matches of this pattern will be replaced by placeholders.
1609
+ * @param {(match: string) => boolean} [replaceFilter]
1610
+ */
1611
+ value: function (env, language, placeholderPattern, replaceFilter) {
1612
+ if (env.language !== language) {
1613
+ return;
1614
+ }
1615
+
1616
+ var tokenStack = env.tokenStack = [];
1617
+
1618
+ env.code = env.code.replace(placeholderPattern, function (match) {
1619
+ if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
1620
+ return match;
1621
+ }
1622
+ var i = tokenStack.length;
1623
+ var placeholder;
1624
+
1625
+ // Check for existing strings
1626
+ while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1) {
1627
+ ++i;
1628
+ }
1629
+
1630
+ // Create a sparse array
1631
+ tokenStack[i] = match;
1632
+
1633
+ return placeholder;
1634
+ });
1635
+
1636
+ // Switch the grammar to markup
1637
+ env.grammar = Prism.languages.markup;
1638
+ }
1639
+ },
1640
+ tokenizePlaceholders: {
1641
+ /**
1642
+ * Replace placeholders with proper tokens after tokenizing.
1643
+ *
1644
+ * @param {object} env The environment of the `after-tokenize` hook.
1645
+ * @param {string} language The language id.
1646
+ */
1647
+ value: function (env, language) {
1648
+ if (env.language !== language || !env.tokenStack) {
1649
+ return;
1650
+ }
1651
+
1652
+ // Switch the grammar back
1653
+ env.grammar = Prism.languages[language];
1654
+
1655
+ var j = 0;
1656
+ var keys = Object.keys(env.tokenStack);
1657
+
1658
+ function walkTokens(tokens) {
1659
+ for (var i = 0; i < tokens.length; i++) {
1660
+ // all placeholders are replaced already
1661
+ if (j >= keys.length) {
1662
+ break;
1663
+ }
1664
+
1665
+ var token = tokens[i];
1666
+ if (typeof token === 'string' || (token.content && typeof token.content === 'string')) {
1667
+ var k = keys[j];
1668
+ var t = env.tokenStack[k];
1669
+ var s = typeof token === 'string' ? token : token.content;
1670
+ var placeholder = getPlaceholder(language, k);
1671
+
1672
+ var index = s.indexOf(placeholder);
1673
+ if (index > -1) {
1674
+ ++j;
1675
+
1676
+ var before = s.substring(0, index);
1677
+ var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);
1678
+ var after = s.substring(index + placeholder.length);
1679
+
1680
+ var replacement = [];
1681
+ if (before) {
1682
+ replacement.push.apply(replacement, walkTokens([before]));
1683
+ }
1684
+ replacement.push(middle);
1685
+ if (after) {
1686
+ replacement.push.apply(replacement, walkTokens([after]));
1687
+ }
1688
+
1689
+ if (typeof token === 'string') {
1690
+ tokens.splice.apply(tokens, [i, 1].concat(replacement));
1691
+ } else {
1692
+ token.content = replacement;
1693
+ }
1694
+ }
1695
+ } else if (token.content /* && typeof token.content !== 'string' */) {
1696
+ walkTokens(token.content);
1697
+ }
1698
+ }
1699
+
1700
+ return tokens;
1701
+ }
1702
+
1703
+ walkTokens(env.tokens);
1704
+ }
1705
+ }
1706
+ });
1707
+
1708
+ }(Prism));
1709
+
1710
+ Prism.languages.c = Prism.languages.extend('clike', {
1711
+ 'comment': {
1712
+ pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
1713
+ greedy: true
1714
+ },
1715
+ 'string': {
1716
+ // https://en.cppreference.com/w/c/language/string_literal
1717
+ pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
1718
+ greedy: true
1719
+ },
1720
+ 'class-name': {
1721
+ pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
1722
+ lookbehind: true
1723
+ },
1724
+ 'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,
1725
+ 'function': /\b[a-z_]\w*(?=\s*\()/i,
1726
+ 'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
1727
+ 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
1728
+ });
1729
+
1730
+ Prism.languages.insertBefore('c', 'string', {
1731
+ 'char': {
1732
+ // https://en.cppreference.com/w/c/language/character_constant
1733
+ pattern: /'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,
1734
+ greedy: true
1735
+ }
1736
+ });
1737
+
1738
+ Prism.languages.insertBefore('c', 'string', {
1739
+ 'macro': {
1740
+ // allow for multiline macro definitions
1741
+ // spaces after the # character compile fine with gcc
1742
+ pattern: /(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
1743
+ lookbehind: true,
1744
+ greedy: true,
1745
+ alias: 'property',
1746
+ inside: {
1747
+ 'string': [
1748
+ {
1749
+ // highlight the path of the include statement as a string
1750
+ pattern: /^(#\s*include\s*)<[^>]+>/,
1751
+ lookbehind: true
1752
+ },
1753
+ Prism.languages.c['string']
1754
+ ],
1755
+ 'char': Prism.languages.c['char'],
1756
+ 'comment': Prism.languages.c['comment'],
1757
+ 'macro-name': [
1758
+ {
1759
+ pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
1760
+ lookbehind: true
1761
+ },
1762
+ {
1763
+ pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
1764
+ lookbehind: true,
1765
+ alias: 'function'
1766
+ }
1767
+ ],
1768
+ // highlight macro directives as keywords
1769
+ 'directive': {
1770
+ pattern: /^(#\s*)[a-z]+/,
1771
+ lookbehind: true,
1772
+ alias: 'keyword'
1773
+ },
1774
+ 'directive-hash': /^#/,
1775
+ 'punctuation': /##|\\(?=[\r\n])/,
1776
+ 'expression': {
1777
+ pattern: /\S[\s\S]*/,
1778
+ inside: Prism.languages.c
1779
+ }
1780
+ }
1781
+ }
1782
+ });
1783
+
1784
+ Prism.languages.insertBefore('c', 'function', {
1785
+ // highlight predefined macros as constants
1786
+ 'constant': /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/
1787
+ });
1788
+
1789
+ delete Prism.languages.c['boolean'];
1790
+
1791
+ (function (Prism) {
1792
+
1793
+ var keyword = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
1794
+ var modName = /\b(?!<keyword>)\w+(?:\s*\.\s*\w+)*\b/.source.replace(/<keyword>/g, function () { return keyword.source; });
1795
+
1796
+ Prism.languages.cpp = Prism.languages.extend('c', {
1797
+ 'class-name': [
1798
+ {
1799
+ pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source
1800
+ .replace(/<keyword>/g, function () { return keyword.source; })),
1801
+ lookbehind: true
1802
+ },
1803
+ // This is intended to capture the class name of method implementations like:
1804
+ // void foo::bar() const {}
1805
+ // However! The `foo` in the above example could also be a namespace, so we only capture the class name if
1806
+ // it starts with an uppercase letter. This approximation should give decent results.
1807
+ /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,
1808
+ // This will capture the class name before destructors like:
1809
+ // Foo::~Foo() {}
1810
+ /\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,
1811
+ // This also intends to capture the class name of method implementations but here the class has template
1812
+ // parameters, so it can't be a namespace (until C++ adds generic namespaces).
1813
+ /\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/
1814
+ ],
1815
+ 'keyword': keyword,
1816
+ 'number': {
1817
+ pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
1818
+ greedy: true
1819
+ },
1820
+ 'operator': />>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
1821
+ 'boolean': /\b(?:false|true)\b/
1822
+ });
1823
+
1824
+ Prism.languages.insertBefore('cpp', 'string', {
1825
+ 'module': {
1826
+ // https://en.cppreference.com/w/cpp/language/modules
1827
+ pattern: RegExp(
1828
+ /(\b(?:import|module)\s+)/.source +
1829
+ '(?:' +
1830
+ // header-name
1831
+ /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source +
1832
+ '|' +
1833
+ // module name or partition or both
1834
+ /<mod-name>(?:\s*:\s*<mod-name>)?|:\s*<mod-name>/.source.replace(/<mod-name>/g, function () { return modName; }) +
1835
+ ')'
1836
+ ),
1837
+ lookbehind: true,
1838
+ greedy: true,
1839
+ inside: {
1840
+ 'string': /^[<"][\s\S]+/,
1841
+ 'operator': /:/,
1842
+ 'punctuation': /\./
1843
+ }
1844
+ },
1845
+ 'raw-string': {
1846
+ pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
1847
+ alias: 'string',
1848
+ greedy: true
1849
+ }
1850
+ });
1851
+
1852
+ Prism.languages.insertBefore('cpp', 'keyword', {
1853
+ 'generic-function': {
1854
+ pattern: /\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,
1855
+ inside: {
1856
+ 'function': /^\w+/,
1857
+ 'generic': {
1858
+ pattern: /<[\s\S]+/,
1859
+ alias: 'class-name',
1860
+ inside: Prism.languages.cpp
1861
+ }
1862
+ }
1863
+ }
1864
+ });
1865
+
1866
+ Prism.languages.insertBefore('cpp', 'operator', {
1867
+ 'double-colon': {
1868
+ pattern: /::/,
1869
+ alias: 'punctuation'
1870
+ }
1871
+ });
1872
+
1873
+ Prism.languages.insertBefore('cpp', 'class-name', {
1874
+ // the base clause is an optional list of parent classes
1875
+ // https://en.cppreference.com/w/cpp/language/class
1876
+ 'base-clause': {
1877
+ pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
1878
+ lookbehind: true,
1879
+ greedy: true,
1880
+ inside: Prism.languages.extend('cpp', {})
1881
+ }
1882
+ });
1883
+
1884
+ Prism.languages.insertBefore('inside', 'double-colon', {
1885
+ // All untokenized words that are not namespaces should be class names
1886
+ 'class-name': /\b[a-z_]\w*\b(?!\s*::)/i
1887
+ }, Prism.languages.cpp['base-clause']);
1888
+
1889
+ }(Prism));
1890
+
1891
+ (function (Prism) {
1892
+
1893
+ /**
1894
+ * Replaces all placeholders "<<n>>" of given pattern with the n-th replacement (zero based).
1895
+ *
1896
+ * Note: This is a simple text based replacement. Be careful when using backreferences!
1897
+ *
1898
+ * @param {string} pattern the given pattern.
1899
+ * @param {string[]} replacements a list of replacement which can be inserted into the given pattern.
1900
+ * @returns {string} the pattern with all placeholders replaced with their corresponding replacements.
1901
+ * @example replace(/a<<0>>a/.source, [/b+/.source]) === /a(?:b+)a/.source
1902
+ */
1903
+ function replace(pattern, replacements) {
1904
+ return pattern.replace(/<<(\d+)>>/g, function (m, index) {
1905
+ return '(?:' + replacements[+index] + ')';
1906
+ });
1907
+ }
1908
+ /**
1909
+ * @param {string} pattern
1910
+ * @param {string[]} replacements
1911
+ * @param {string} [flags]
1912
+ * @returns {RegExp}
1913
+ */
1914
+ function re(pattern, replacements, flags) {
1915
+ return RegExp(replace(pattern, replacements), flags || '');
1916
+ }
1917
+
1918
+ /**
1919
+ * Creates a nested pattern where all occurrences of the string `<<self>>` are replaced with the pattern itself.
1920
+ *
1921
+ * @param {string} pattern
1922
+ * @param {number} depthLog2
1923
+ * @returns {string}
1924
+ */
1925
+ function nested(pattern, depthLog2) {
1926
+ for (var i = 0; i < depthLog2; i++) {
1927
+ pattern = pattern.replace(/<<self>>/g, function () { return '(?:' + pattern + ')'; });
1928
+ }
1929
+ return pattern.replace(/<<self>>/g, '[^\\s\\S]');
1930
+ }
1931
+
1932
+ // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/
1933
+ var keywordKinds = {
1934
+ // keywords which represent a return or variable type
1935
+ type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void',
1936
+ // keywords which are used to declare a type
1937
+ typeDeclaration: 'class enum interface record struct',
1938
+ // contextual keywords
1939
+ // ("var" and "dynamic" are missing because they are used like types)
1940
+ contextual: 'add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)',
1941
+ // all other keywords
1942
+ other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield'
1943
+ };
1944
+
1945
+ // keywords
1946
+ function keywordsToPattern(words) {
1947
+ return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b';
1948
+ }
1949
+ var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);
1950
+ var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other));
1951
+ var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other);
1952
+ var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other);
1953
+
1954
+ // types
1955
+ var generic = nested(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source, 2); // the idea behind the other forbidden characters is to prevent false positives. Same for tupleElement.
1956
+ var nestedRound = nested(/\((?:[^()]|<<self>>)*\)/.source, 2);
1957
+ var name = /@?\b[A-Za-z_]\w*\b/.source;
1958
+ var genericName = replace(/<<0>>(?:\s*<<1>>)?/.source, [name, generic]);
1959
+ var identifier = replace(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source, [nonTypeKeywords, genericName]);
1960
+ var array = /\[\s*(?:,\s*)*\]/.source;
1961
+ var typeExpressionWithoutTuple = replace(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source, [identifier, array]);
1962
+ var tupleElement = replace(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [generic, nestedRound, array]);
1963
+ var tuple = replace(/\(<<0>>+(?:,<<0>>+)+\)/.source, [tupleElement]);
1964
+ var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source, [tuple, identifier, array]);
1965
+
1966
+ var typeInside = {
1967
+ 'keyword': keywords,
1968
+ 'punctuation': /[<>()?,.:[\]]/
1969
+ };
1970
+
1971
+ // strings & characters
1972
+ // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#character-literals
1973
+ // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#string-literals
1974
+ var character = /'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source; // simplified pattern
1975
+ var regularString = /"(?:\\.|[^\\"\r\n])*"/.source;
1976
+ var verbatimString = /@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;
1977
+
1978
+
1979
+ Prism.languages.csharp = Prism.languages.extend('clike', {
1980
+ 'string': [
1981
+ {
1982
+ pattern: re(/(^|[^$\\])<<0>>/.source, [verbatimString]),
1983
+ lookbehind: true,
1984
+ greedy: true
1985
+ },
1986
+ {
1987
+ pattern: re(/(^|[^@$\\])<<0>>/.source, [regularString]),
1988
+ lookbehind: true,
1989
+ greedy: true
1990
+ }
1991
+ ],
1992
+ 'class-name': [
1993
+ {
1994
+ // Using static
1995
+ // using static System.Math;
1996
+ pattern: re(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source, [identifier]),
1997
+ lookbehind: true,
1998
+ inside: typeInside
1999
+ },
2000
+ {
2001
+ // Using alias (type)
2002
+ // using Project = PC.MyCompany.Project;
2003
+ pattern: re(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source, [name, typeExpression]),
2004
+ lookbehind: true,
2005
+ inside: typeInside
2006
+ },
2007
+ {
2008
+ // Using alias (alias)
2009
+ // using Project = PC.MyCompany.Project;
2010
+ pattern: re(/(\busing\s+)<<0>>(?=\s*=)/.source, [name]),
2011
+ lookbehind: true
2012
+ },
2013
+ {
2014
+ // Type declarations
2015
+ // class Foo<A, B>
2016
+ // interface Foo<out A, B>
2017
+ pattern: re(/(\b<<0>>\s+)<<1>>/.source, [typeDeclarationKeywords, genericName]),
2018
+ lookbehind: true,
2019
+ inside: typeInside
2020
+ },
2021
+ {
2022
+ // Single catch exception declaration
2023
+ // catch(Foo)
2024
+ // (things like catch(Foo e) is covered by variable declaration)
2025
+ pattern: re(/(\bcatch\s*\(\s*)<<0>>/.source, [identifier]),
2026
+ lookbehind: true,
2027
+ inside: typeInside
2028
+ },
2029
+ {
2030
+ // Name of the type parameter of generic constraints
2031
+ // where Foo : class
2032
+ pattern: re(/(\bwhere\s+)<<0>>/.source, [name]),
2033
+ lookbehind: true
2034
+ },
2035
+ {
2036
+ // Casts and checks via as and is.
2037
+ // as Foo<A>, is Bar<B>
2038
+ // (things like if(a is Foo b) is covered by variable declaration)
2039
+ pattern: re(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source, [typeExpressionWithoutTuple]),
2040
+ lookbehind: true,
2041
+ inside: typeInside
2042
+ },
2043
+ {
2044
+ // Variable, field and parameter declaration
2045
+ // (Foo bar, Bar baz, Foo[,,] bay, Foo<Bar, FooBar<Bar>> bax)
2046
+ pattern: re(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source, [typeExpression, nonContextualKeywords, name]),
2047
+ inside: typeInside
2048
+ }
2049
+ ],
2050
+ 'keyword': keywords,
2051
+ // https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure#literals
2052
+ 'number': /(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,
2053
+ 'operator': />>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,
2054
+ 'punctuation': /\?\.?|::|[{}[\];(),.:]/
2055
+ });
2056
+
2057
+ Prism.languages.insertBefore('csharp', 'number', {
2058
+ 'range': {
2059
+ pattern: /\.\./,
2060
+ alias: 'operator'
2061
+ }
2062
+ });
2063
+
2064
+ Prism.languages.insertBefore('csharp', 'punctuation', {
2065
+ 'named-parameter': {
2066
+ pattern: re(/([(,]\s*)<<0>>(?=\s*:)/.source, [name]),
2067
+ lookbehind: true,
2068
+ alias: 'punctuation'
2069
+ }
2070
+ });
2071
+
2072
+ Prism.languages.insertBefore('csharp', 'class-name', {
2073
+ 'namespace': {
2074
+ // namespace Foo.Bar {}
2075
+ // using Foo.Bar;
2076
+ pattern: re(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source, [name]),
2077
+ lookbehind: true,
2078
+ inside: {
2079
+ 'punctuation': /\./
2080
+ }
2081
+ },
2082
+ 'type-expression': {
2083
+ // default(Foo), typeof(Foo<Bar>), sizeof(int)
2084
+ pattern: re(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source, [nestedRound]),
2085
+ lookbehind: true,
2086
+ alias: 'class-name',
2087
+ inside: typeInside
2088
+ },
2089
+ 'return-type': {
2090
+ // Foo<Bar> ForBar(); Foo IFoo.Bar() => 0
2091
+ // int this[int index] => 0; T IReadOnlyList<T>.this[int index] => this[index];
2092
+ // int Foo => 0; int Foo { get; set } = 0;
2093
+ pattern: re(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source, [typeExpression, identifier]),
2094
+ inside: typeInside,
2095
+ alias: 'class-name'
2096
+ },
2097
+ 'constructor-invocation': {
2098
+ // new List<Foo<Bar[]>> { }
2099
+ pattern: re(/(\bnew\s+)<<0>>(?=\s*[[({])/.source, [typeExpression]),
2100
+ lookbehind: true,
2101
+ inside: typeInside,
2102
+ alias: 'class-name'
2103
+ },
2104
+ /*'explicit-implementation': {
2105
+ // int IFoo<Foo>.Bar => 0; void IFoo<Foo<Foo>>.Foo<T>();
2106
+ pattern: replace(/\b<<0>>(?=\.<<1>>)/, className, methodOrPropertyDeclaration),
2107
+ inside: classNameInside,
2108
+ alias: 'class-name'
2109
+ },*/
2110
+ 'generic-method': {
2111
+ // foo<Bar>()
2112
+ pattern: re(/<<0>>\s*<<1>>(?=\s*\()/.source, [name, generic]),
2113
+ inside: {
2114
+ 'function': re(/^<<0>>/.source, [name]),
2115
+ 'generic': {
2116
+ pattern: RegExp(generic),
2117
+ alias: 'class-name',
2118
+ inside: typeInside
2119
+ }
2120
+ }
2121
+ },
2122
+ 'type-list': {
2123
+ // The list of types inherited or of generic constraints
2124
+ // class Foo<F> : Bar, IList<FooBar>
2125
+ // where F : Bar, IList<int>
2126
+ pattern: re(
2127
+ /\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,
2128
+ [typeDeclarationKeywords, genericName, name, typeExpression, keywords.source, nestedRound, /\bnew\s*\(\s*\)/.source]
2129
+ ),
2130
+ lookbehind: true,
2131
+ inside: {
2132
+ 'record-arguments': {
2133
+ pattern: re(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source, [genericName, nestedRound]),
2134
+ lookbehind: true,
2135
+ greedy: true,
2136
+ inside: Prism.languages.csharp
2137
+ },
2138
+ 'keyword': keywords,
2139
+ 'class-name': {
2140
+ pattern: RegExp(typeExpression),
2141
+ greedy: true,
2142
+ inside: typeInside
2143
+ },
2144
+ 'punctuation': /[,()]/
2145
+ }
2146
+ },
2147
+ 'preprocessor': {
2148
+ pattern: /(^[\t ]*)#.*/m,
2149
+ lookbehind: true,
2150
+ alias: 'property',
2151
+ inside: {
2152
+ // highlight preprocessor directives as keywords
2153
+ 'directive': {
2154
+ pattern: /(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,
2155
+ lookbehind: true,
2156
+ alias: 'keyword'
2157
+ }
2158
+ }
2159
+ }
2160
+ });
2161
+
2162
+ // attributes
2163
+ var regularStringOrCharacter = regularString + '|' + character;
2164
+ var regularStringCharacterOrComment = replace(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source, [regularStringOrCharacter]);
2165
+ var roundExpression = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
2166
+
2167
+ // https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/attributes/#attribute-targets
2168
+ var attrTarget = /\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source;
2169
+ var attr = replace(/<<0>>(?:\s*\(<<1>>*\))?/.source, [identifier, roundExpression]);
2170
+
2171
+ Prism.languages.insertBefore('csharp', 'class-name', {
2172
+ 'attribute': {
2173
+ // Attributes
2174
+ // [Foo], [Foo(1), Bar(2, Prop = "foo")], [return: Foo(1), Bar(2)], [assembly: Foo(Bar)]
2175
+ pattern: re(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source, [attrTarget, attr]),
2176
+ lookbehind: true,
2177
+ greedy: true,
2178
+ inside: {
2179
+ 'target': {
2180
+ pattern: re(/^<<0>>(?=\s*:)/.source, [attrTarget]),
2181
+ alias: 'keyword'
2182
+ },
2183
+ 'attribute-arguments': {
2184
+ pattern: re(/\(<<0>>*\)/.source, [roundExpression]),
2185
+ inside: Prism.languages.csharp
2186
+ },
2187
+ 'class-name': {
2188
+ pattern: RegExp(identifier),
2189
+ inside: {
2190
+ 'punctuation': /\./
2191
+ }
2192
+ },
2193
+ 'punctuation': /[:,]/
2194
+ }
2195
+ }
2196
+ });
2197
+
2198
+
2199
+ // string interpolation
2200
+ var formatString = /:[^}\r\n]+/.source;
2201
+ // multi line
2202
+ var mInterpolationRound = nested(replace(/[^"'/()]|<<0>>|\(<<self>>*\)/.source, [regularStringCharacterOrComment]), 2);
2203
+ var mInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [mInterpolationRound, formatString]);
2204
+ // single line
2205
+ var sInterpolationRound = nested(replace(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source, [regularStringOrCharacter]), 2);
2206
+ var sInterpolation = replace(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source, [sInterpolationRound, formatString]);
2207
+
2208
+ function createInterpolationInside(interpolation, interpolationRound) {
2209
+ return {
2210
+ 'interpolation': {
2211
+ pattern: re(/((?:^|[^{])(?:\{\{)*)<<0>>/.source, [interpolation]),
2212
+ lookbehind: true,
2213
+ inside: {
2214
+ 'format-string': {
2215
+ pattern: re(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source, [interpolationRound, formatString]),
2216
+ lookbehind: true,
2217
+ inside: {
2218
+ 'punctuation': /^:/
2219
+ }
2220
+ },
2221
+ 'punctuation': /^\{|\}$/,
2222
+ 'expression': {
2223
+ pattern: /[\s\S]+/,
2224
+ alias: 'language-csharp',
2225
+ inside: Prism.languages.csharp
2226
+ }
2227
+ }
2228
+ },
2229
+ 'string': /[\s\S]+/
2230
+ };
2231
+ }
2232
+
2233
+ Prism.languages.insertBefore('csharp', 'string', {
2234
+ 'interpolation-string': [
2235
+ {
2236
+ pattern: re(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source, [mInterpolation]),
2237
+ lookbehind: true,
2238
+ greedy: true,
2239
+ inside: createInterpolationInside(mInterpolation, mInterpolationRound),
2240
+ },
2241
+ {
2242
+ pattern: re(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source, [sInterpolation]),
2243
+ lookbehind: true,
2244
+ greedy: true,
2245
+ inside: createInterpolationInside(sInterpolation, sInterpolationRound),
2246
+ }
2247
+ ],
2248
+ 'char': {
2249
+ pattern: RegExp(character),
2250
+ greedy: true
2251
+ }
2252
+ });
2253
+
2254
+ Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp;
2255
+
2256
+ }(Prism));
2257
+
2258
+ (function (Prism) {
2259
+
2260
+ var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
2261
+
2262
+ Prism.languages.css = {
2263
+ 'comment': /\/\*[\s\S]*?\*\//,
2264
+ 'atrule': {
2265
+ pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
2266
+ inside: {
2267
+ 'rule': /^@[\w-]+/,
2268
+ 'selector-function-argument': {
2269
+ pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
2270
+ lookbehind: true,
2271
+ alias: 'selector'
2272
+ },
2273
+ 'keyword': {
2274
+ pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
2275
+ lookbehind: true
2276
+ }
2277
+ // See rest below
2278
+ }
2279
+ },
2280
+ 'url': {
2281
+ // https://drafts.csswg.org/css-values-3/#urls
2282
+ pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
2283
+ greedy: true,
2284
+ inside: {
2285
+ 'function': /^url/i,
2286
+ 'punctuation': /^\(|\)$/,
2287
+ 'string': {
2288
+ pattern: RegExp('^' + string.source + '$'),
2289
+ alias: 'url'
2290
+ }
2291
+ }
2292
+ },
2293
+ 'selector': {
2294
+ pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
2295
+ lookbehind: true
2296
+ },
2297
+ 'string': {
2298
+ pattern: string,
2299
+ greedy: true
2300
+ },
2301
+ 'property': {
2302
+ pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
2303
+ lookbehind: true
2304
+ },
2305
+ 'important': /!important\b/i,
2306
+ 'function': {
2307
+ pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
2308
+ lookbehind: true
2309
+ },
2310
+ 'punctuation': /[(){};:,]/
2311
+ };
2312
+
2313
+ Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
2314
+
2315
+ var markup = Prism.languages.markup;
2316
+ if (markup) {
2317
+ markup.tag.addInlined('style', 'css');
2318
+ markup.tag.addAttribute('style', 'css');
2319
+ }
2320
+
2321
+ }(Prism));
2322
+
2323
+ (function (Prism) {
2324
+
2325
+ var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
2326
+
2327
+ // full package (optional) + parent classes (optional)
2328
+ var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
2329
+
2330
+ // based on the java naming conventions
2331
+ var className = {
2332
+ pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),
2333
+ lookbehind: true,
2334
+ inside: {
2335
+ 'namespace': {
2336
+ pattern: /^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,
2337
+ inside: {
2338
+ 'punctuation': /\./
2339
+ }
2340
+ },
2341
+ 'punctuation': /\./
2342
+ }
2343
+ };
2344
+
2345
+ Prism.languages.java = Prism.languages.extend('clike', {
2346
+ 'string': {
2347
+ pattern: /(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,
2348
+ lookbehind: true,
2349
+ greedy: true
2350
+ },
2351
+ 'class-name': [
2352
+ className,
2353
+ {
2354
+ // variables, parameters, and constructor references
2355
+ // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
2356
+ pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),
2357
+ lookbehind: true,
2358
+ inside: className.inside
2359
+ },
2360
+ {
2361
+ // class names based on keyword
2362
+ // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods)
2363
+ pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source),
2364
+ lookbehind: true,
2365
+ inside: className.inside
2366
+ }
2367
+ ],
2368
+ 'keyword': keywords,
2369
+ 'function': [
2370
+ Prism.languages.clike.function,
2371
+ {
2372
+ pattern: /(::\s*)[a-z_]\w*/,
2373
+ lookbehind: true
2374
+ }
2375
+ ],
2376
+ 'number': /\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,
2377
+ 'operator': {
2378
+ pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,
2379
+ lookbehind: true
2380
+ },
2381
+ 'constant': /\b[A-Z][A-Z_\d]+\b/
2382
+ });
2383
+
2384
+ Prism.languages.insertBefore('java', 'string', {
2385
+ 'triple-quoted-string': {
2386
+ // http://openjdk.java.net/jeps/355#Description
2387
+ pattern: /"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,
2388
+ greedy: true,
2389
+ alias: 'string'
2390
+ },
2391
+ 'char': {
2392
+ pattern: /'(?:\\.|[^'\\\r\n]){1,6}'/,
2393
+ greedy: true
2394
+ }
2395
+ });
2396
+
2397
+ Prism.languages.insertBefore('java', 'class-name', {
2398
+ 'annotation': {
2399
+ pattern: /(^|[^.])@\w+(?:\s*\.\s*\w+)*/,
2400
+ lookbehind: true,
2401
+ alias: 'punctuation'
2402
+ },
2403
+ 'generics': {
2404
+ pattern: /<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,
2405
+ inside: {
2406
+ 'class-name': className,
2407
+ 'keyword': keywords,
2408
+ 'punctuation': /[<>(),.:]/,
2409
+ 'operator': /[?&|]/
2410
+ }
2411
+ },
2412
+ 'import': [
2413
+ {
2414
+ pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source),
2415
+ lookbehind: true,
2416
+ inside: {
2417
+ 'namespace': className.inside.namespace,
2418
+ 'punctuation': /\./,
2419
+ 'operator': /\*/,
2420
+ 'class-name': /\w+/
2421
+ }
2422
+ },
2423
+ {
2424
+ pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source),
2425
+ lookbehind: true,
2426
+ alias: 'static',
2427
+ inside: {
2428
+ 'namespace': className.inside.namespace,
2429
+ 'static': /\b\w+$/,
2430
+ 'punctuation': /\./,
2431
+ 'operator': /\*/,
2432
+ 'class-name': /\w+/
2433
+ }
2434
+ }
2435
+ ],
2436
+ 'namespace': {
2437
+ pattern: RegExp(
2438
+ /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/
2439
+ .source.replace(/<keyword>/g, function () { return keywords.source; })),
2440
+ lookbehind: true,
2441
+ inside: {
2442
+ 'punctuation': /\./,
2443
+ }
2444
+ }
2445
+ });
2446
+ }(Prism));
2447
+
2448
+ Prism.languages.javascript = Prism.languages.extend('clike', {
2449
+ 'class-name': [
2450
+ Prism.languages.clike['class-name'],
2451
+ {
2452
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
2453
+ lookbehind: true
2454
+ }
2455
+ ],
2456
+ 'keyword': [
2457
+ {
2458
+ pattern: /((?:^|\})\s*)catch\b/,
2459
+ lookbehind: true
2460
+ },
2461
+ {
2462
+ 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/,
2463
+ lookbehind: true
2464
+ },
2465
+ ],
2466
+ // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
2467
+ 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
2468
+ 'number': {
2469
+ pattern: RegExp(
2470
+ /(^|[^\w$])/.source +
2471
+ '(?:' +
2472
+ (
2473
+ // constant
2474
+ /NaN|Infinity/.source +
2475
+ '|' +
2476
+ // binary integer
2477
+ /0[bB][01]+(?:_[01]+)*n?/.source +
2478
+ '|' +
2479
+ // octal integer
2480
+ /0[oO][0-7]+(?:_[0-7]+)*n?/.source +
2481
+ '|' +
2482
+ // hexadecimal integer
2483
+ /0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
2484
+ '|' +
2485
+ // decimal bigint
2486
+ /\d+(?:_\d+)*n/.source +
2487
+ '|' +
2488
+ // decimal number (integer or float) but no bigint
2489
+ /(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
2490
+ ) +
2491
+ ')' +
2492
+ /(?![\w$])/.source
2493
+ ),
2494
+ lookbehind: true
2495
+ },
2496
+ 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
2497
+ });
2498
+
2499
+ Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
2500
+
2501
+ Prism.languages.insertBefore('javascript', 'keyword', {
2502
+ 'regex': {
2503
+ pattern: RegExp(
2504
+ // lookbehind
2505
+ // eslint-disable-next-line regexp/no-dupe-characters-character-class
2506
+ /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
2507
+ // Regex pattern:
2508
+ // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
2509
+ // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
2510
+ // with the only syntax, so we have to define 2 different regex patterns.
2511
+ /\//.source +
2512
+ '(?:' +
2513
+ /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
2514
+ '|' +
2515
+ // `v` flag syntax. This supports 3 levels of nested character classes.
2516
+ /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
2517
+ ')' +
2518
+ // lookahead
2519
+ /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
2520
+ ),
2521
+ lookbehind: true,
2522
+ greedy: true,
2523
+ inside: {
2524
+ 'regex-source': {
2525
+ pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
2526
+ lookbehind: true,
2527
+ alias: 'language-regex',
2528
+ inside: Prism.languages.regex
2529
+ },
2530
+ 'regex-delimiter': /^\/|\/$/,
2531
+ 'regex-flags': /^[a-z]+$/,
2532
+ }
2533
+ },
2534
+ // This must be declared before keyword because we use "function" inside the look-forward
2535
+ 'function-variable': {
2536
+ 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*=>))/,
2537
+ alias: 'function'
2538
+ },
2539
+ 'parameter': [
2540
+ {
2541
+ pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
2542
+ lookbehind: true,
2543
+ inside: Prism.languages.javascript
2544
+ },
2545
+ {
2546
+ pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
2547
+ lookbehind: true,
2548
+ inside: Prism.languages.javascript
2549
+ },
2550
+ {
2551
+ pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
2552
+ lookbehind: true,
2553
+ inside: Prism.languages.javascript
2554
+ },
2555
+ {
2556
+ 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*\{)/,
2557
+ lookbehind: true,
2558
+ inside: Prism.languages.javascript
2559
+ }
2560
+ ],
2561
+ 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
2562
+ });
2563
+
2564
+ Prism.languages.insertBefore('javascript', 'string', {
2565
+ 'hashbang': {
2566
+ pattern: /^#!.*/,
2567
+ greedy: true,
2568
+ alias: 'comment'
2569
+ },
2570
+ 'template-string': {
2571
+ pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
2572
+ greedy: true,
2573
+ inside: {
2574
+ 'template-punctuation': {
2575
+ pattern: /^`|`$/,
2576
+ alias: 'string'
2577
+ },
2578
+ 'interpolation': {
2579
+ pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
2580
+ lookbehind: true,
2581
+ inside: {
2582
+ 'interpolation-punctuation': {
2583
+ pattern: /^\$\{|\}$/,
2584
+ alias: 'punctuation'
2585
+ },
2586
+ rest: Prism.languages.javascript
2587
+ }
2588
+ },
2589
+ 'string': /[\s\S]+/
2590
+ }
2591
+ },
2592
+ 'string-property': {
2593
+ pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
2594
+ lookbehind: true,
2595
+ greedy: true,
2596
+ alias: 'property'
2597
+ }
2598
+ });
2599
+
2600
+ Prism.languages.insertBefore('javascript', 'operator', {
2601
+ 'literal-property': {
2602
+ pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
2603
+ lookbehind: true,
2604
+ alias: 'property'
2605
+ },
2606
+ });
2607
+
2608
+ if (Prism.languages.markup) {
2609
+ Prism.languages.markup.tag.addInlined('script', 'javascript');
2610
+
2611
+ // add attribute support for all DOM events.
2612
+ // https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
2613
+ Prism.languages.markup.tag.addAttribute(
2614
+ /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,
2615
+ 'javascript'
2616
+ );
2617
+ }
2618
+
2619
+ Prism.languages.js = Prism.languages.javascript;
2620
+
2621
+ Prism.languages.markup = {
2622
+ 'comment': {
2623
+ pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
2624
+ greedy: true
2625
+ },
2626
+ 'prolog': {
2627
+ pattern: /<\?[\s\S]+?\?>/,
2628
+ greedy: true
2629
+ },
2630
+ 'doctype': {
2631
+ // https://www.w3.org/TR/xml/#NT-doctypedecl
2632
+ pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
2633
+ greedy: true,
2634
+ inside: {
2635
+ 'internal-subset': {
2636
+ pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
2637
+ lookbehind: true,
2638
+ greedy: true,
2639
+ inside: null // see below
2640
+ },
2641
+ 'string': {
2642
+ pattern: /"[^"]*"|'[^']*'/,
2643
+ greedy: true
2644
+ },
2645
+ 'punctuation': /^<!|>$|[[\]]/,
2646
+ 'doctype-tag': /^DOCTYPE/i,
2647
+ 'name': /[^\s<>'"]+/
2648
+ }
2649
+ },
2650
+ 'cdata': {
2651
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
2652
+ greedy: true
2653
+ },
2654
+ 'tag': {
2655
+ pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
2656
+ greedy: true,
2657
+ inside: {
2658
+ 'tag': {
2659
+ pattern: /^<\/?[^\s>\/]+/,
2660
+ inside: {
2661
+ 'punctuation': /^<\/?/,
2662
+ 'namespace': /^[^\s>\/:]+:/
2663
+ }
2664
+ },
2665
+ 'special-attr': [],
2666
+ 'attr-value': {
2667
+ pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
2668
+ inside: {
2669
+ 'punctuation': [
2670
+ {
2671
+ pattern: /^=/,
2672
+ alias: 'attr-equals'
2673
+ },
2674
+ {
2675
+ pattern: /^(\s*)["']|["']$/,
2676
+ lookbehind: true
2677
+ }
2678
+ ]
2679
+ }
2680
+ },
2681
+ 'punctuation': /\/?>/,
2682
+ 'attr-name': {
2683
+ pattern: /[^\s>\/]+/,
2684
+ inside: {
2685
+ 'namespace': /^[^\s>\/:]+:/
2686
+ }
2687
+ }
2688
+
2689
+ }
2690
+ },
2691
+ 'entity': [
2692
+ {
2693
+ pattern: /&[\da-z]{1,8};/i,
2694
+ alias: 'named-entity'
2695
+ },
2696
+ /&#x?[\da-f]{1,8};/i
2697
+ ]
2698
+ };
2699
+
2700
+ Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
2701
+ Prism.languages.markup['entity'];
2702
+ Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
2703
+
2704
+ // Plugin to make entity title show the real entity, idea by Roman Komarov
2705
+ Prism.hooks.add('wrap', function (env) {
2706
+
2707
+ if (env.type === 'entity') {
2708
+ env.attributes['title'] = env.content.replace(/&amp;/, '&');
2709
+ }
2710
+ });
2711
+
2712
+ Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
2713
+ /**
2714
+ * Adds an inlined language to markup.
2715
+ *
2716
+ * An example of an inlined language is CSS with `<style>` tags.
2717
+ *
2718
+ * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
2719
+ * case insensitive.
2720
+ * @param {string} lang The language key.
2721
+ * @example
2722
+ * addInlined('style', 'css');
2723
+ */
2724
+ value: function addInlined(tagName, lang) {
2725
+ var includedCdataInside = {};
2726
+ includedCdataInside['language-' + lang] = {
2727
+ pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
2728
+ lookbehind: true,
2729
+ inside: Prism.languages[lang]
2730
+ };
2731
+ includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
2732
+
2733
+ var inside = {
2734
+ 'included-cdata': {
2735
+ pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
2736
+ inside: includedCdataInside
2737
+ }
2738
+ };
2739
+ inside['language-' + lang] = {
2740
+ pattern: /[\s\S]+/,
2741
+ inside: Prism.languages[lang]
2742
+ };
2743
+
2744
+ var def = {};
2745
+ def[tagName] = {
2746
+ pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
2747
+ lookbehind: true,
2748
+ greedy: true,
2749
+ inside: inside
2750
+ };
2751
+
2752
+ Prism.languages.insertBefore('markup', 'cdata', def);
2753
+ }
2754
+ });
2755
+ Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
2756
+ /**
2757
+ * Adds an pattern to highlight languages embedded in HTML attributes.
2758
+ *
2759
+ * An example of an inlined language is CSS with `style` attributes.
2760
+ *
2761
+ * @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
2762
+ * case insensitive.
2763
+ * @param {string} lang The language key.
2764
+ * @example
2765
+ * addAttribute('style', 'css');
2766
+ */
2767
+ value: function (attrName, lang) {
2768
+ Prism.languages.markup.tag.inside['special-attr'].push({
2769
+ pattern: RegExp(
2770
+ /(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
2771
+ 'i'
2772
+ ),
2773
+ lookbehind: true,
2774
+ inside: {
2775
+ 'attr-name': /^[^\s=]+/,
2776
+ 'attr-value': {
2777
+ pattern: /=[\s\S]+/,
2778
+ inside: {
2779
+ 'value': {
2780
+ pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
2781
+ lookbehind: true,
2782
+ alias: [lang, 'language-' + lang],
2783
+ inside: Prism.languages[lang]
2784
+ },
2785
+ 'punctuation': [
2786
+ {
2787
+ pattern: /^=/,
2788
+ alias: 'attr-equals'
2789
+ },
2790
+ /"|'/
2791
+ ]
2792
+ }
2793
+ }
2794
+ }
2795
+ });
2796
+ }
2797
+ });
2798
+
2799
+ Prism.languages.html = Prism.languages.markup;
2800
+ Prism.languages.mathml = Prism.languages.markup;
2801
+ Prism.languages.svg = Prism.languages.markup;
2802
+
2803
+ Prism.languages.xml = Prism.languages.extend('markup', {});
2804
+ Prism.languages.ssml = Prism.languages.xml;
2805
+ Prism.languages.atom = Prism.languages.xml;
2806
+ Prism.languages.rss = Prism.languages.xml;
2807
+
2808
+ /**
2809
+ * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
2810
+ * Modified by Miles Johnson: http://milesj.me
2811
+ * Rewritten by Tom Pavelec
2812
+ *
2813
+ * Supports PHP 5.3 - 8.0
2814
+ */
2815
+ (function (Prism) {
2816
+ var comment = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/;
2817
+ var constant = [
2818
+ {
2819
+ pattern: /\b(?:false|true)\b/i,
2820
+ alias: 'boolean'
2821
+ },
2822
+ {
2823
+ pattern: /(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,
2824
+ greedy: true,
2825
+ lookbehind: true,
2826
+ },
2827
+ {
2828
+ pattern: /(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,
2829
+ greedy: true,
2830
+ lookbehind: true,
2831
+ },
2832
+ /\b(?:null)\b/i,
2833
+ /\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/,
2834
+ ];
2835
+ var number = /\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i;
2836
+ var operator = /<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/;
2837
+ var punctuation = /[{}\[\](),:;]/;
2838
+
2839
+ Prism.languages.php = {
2840
+ 'delimiter': {
2841
+ pattern: /\?>$|^<\?(?:php(?=\s)|=)?/i,
2842
+ alias: 'important'
2843
+ },
2844
+ 'comment': comment,
2845
+ 'variable': /\$+(?:\w+\b|(?=\{))/,
2846
+ 'package': {
2847
+ pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
2848
+ lookbehind: true,
2849
+ inside: {
2850
+ 'punctuation': /\\/
2851
+ }
2852
+ },
2853
+ 'class-name-definition': {
2854
+ pattern: /(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,
2855
+ lookbehind: true,
2856
+ alias: 'class-name'
2857
+ },
2858
+ 'function-definition': {
2859
+ pattern: /(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,
2860
+ lookbehind: true,
2861
+ alias: 'function'
2862
+ },
2863
+ 'keyword': [
2864
+ {
2865
+ pattern: /(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,
2866
+ alias: 'type-casting',
2867
+ greedy: true,
2868
+ lookbehind: true
2869
+ },
2870
+ {
2871
+ pattern: /([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,
2872
+ alias: 'type-hint',
2873
+ greedy: true,
2874
+ lookbehind: true
2875
+ },
2876
+ {
2877
+ pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,
2878
+ alias: 'return-type',
2879
+ greedy: true,
2880
+ lookbehind: true
2881
+ },
2882
+ {
2883
+ pattern: /\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,
2884
+ alias: 'type-declaration',
2885
+ greedy: true
2886
+ },
2887
+ {
2888
+ pattern: /(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,
2889
+ alias: 'type-declaration',
2890
+ greedy: true,
2891
+ lookbehind: true
2892
+ },
2893
+ {
2894
+ pattern: /\b(?:parent|self|static)(?=\s*::)/i,
2895
+ alias: 'static-context',
2896
+ greedy: true
2897
+ },
2898
+ {
2899
+ // yield from
2900
+ pattern: /(\byield\s+)from\b/i,
2901
+ lookbehind: true
2902
+ },
2903
+ // `class` is always a keyword unlike other keywords
2904
+ /\bclass\b/i,
2905
+ {
2906
+ // https://www.php.net/manual/en/reserved.keywords.php
2907
+ //
2908
+ // keywords cannot be preceded by "->"
2909
+ // the complex lookbehind means `(?<!(?:->|::)\s*)`
2910
+ pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,
2911
+ lookbehind: true
2912
+ }
2913
+ ],
2914
+ 'argument-name': {
2915
+ pattern: /([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,
2916
+ lookbehind: true
2917
+ },
2918
+ 'class-name': [
2919
+ {
2920
+ pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
2921
+ greedy: true,
2922
+ lookbehind: true
2923
+ },
2924
+ {
2925
+ pattern: /(\|\s*)\b[a-z_]\w*(?!\\)\b/i,
2926
+ greedy: true,
2927
+ lookbehind: true
2928
+ },
2929
+ {
2930
+ pattern: /\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,
2931
+ greedy: true
2932
+ },
2933
+ {
2934
+ pattern: /(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,
2935
+ alias: 'class-name-fully-qualified',
2936
+ greedy: true,
2937
+ lookbehind: true,
2938
+ inside: {
2939
+ 'punctuation': /\\/
2940
+ }
2941
+ },
2942
+ {
2943
+ pattern: /(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,
2944
+ alias: 'class-name-fully-qualified',
2945
+ greedy: true,
2946
+ inside: {
2947
+ 'punctuation': /\\/
2948
+ }
2949
+ },
2950
+ {
2951
+ pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
2952
+ alias: 'class-name-fully-qualified',
2953
+ greedy: true,
2954
+ lookbehind: true,
2955
+ inside: {
2956
+ 'punctuation': /\\/
2957
+ }
2958
+ },
2959
+ {
2960
+ pattern: /\b[a-z_]\w*(?=\s*\$)/i,
2961
+ alias: 'type-declaration',
2962
+ greedy: true
2963
+ },
2964
+ {
2965
+ pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
2966
+ alias: ['class-name-fully-qualified', 'type-declaration'],
2967
+ greedy: true,
2968
+ inside: {
2969
+ 'punctuation': /\\/
2970
+ }
2971
+ },
2972
+ {
2973
+ pattern: /\b[a-z_]\w*(?=\s*::)/i,
2974
+ alias: 'static-context',
2975
+ greedy: true
2976
+ },
2977
+ {
2978
+ pattern: /(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,
2979
+ alias: ['class-name-fully-qualified', 'static-context'],
2980
+ greedy: true,
2981
+ inside: {
2982
+ 'punctuation': /\\/
2983
+ }
2984
+ },
2985
+ {
2986
+ pattern: /([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,
2987
+ alias: 'type-hint',
2988
+ greedy: true,
2989
+ lookbehind: true
2990
+ },
2991
+ {
2992
+ pattern: /([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,
2993
+ alias: ['class-name-fully-qualified', 'type-hint'],
2994
+ greedy: true,
2995
+ lookbehind: true,
2996
+ inside: {
2997
+ 'punctuation': /\\/
2998
+ }
2999
+ },
3000
+ {
3001
+ pattern: /(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,
3002
+ alias: 'return-type',
3003
+ greedy: true,
3004
+ lookbehind: true
3005
+ },
3006
+ {
3007
+ pattern: /(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,
3008
+ alias: ['class-name-fully-qualified', 'return-type'],
3009
+ greedy: true,
3010
+ lookbehind: true,
3011
+ inside: {
3012
+ 'punctuation': /\\/
3013
+ }
3014
+ }
3015
+ ],
3016
+ 'constant': constant,
3017
+ 'function': {
3018
+ pattern: /(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,
3019
+ lookbehind: true,
3020
+ inside: {
3021
+ 'punctuation': /\\/
3022
+ }
3023
+ },
3024
+ 'property': {
3025
+ pattern: /(->\s*)\w+/,
3026
+ lookbehind: true
3027
+ },
3028
+ 'number': number,
3029
+ 'operator': operator,
3030
+ 'punctuation': punctuation
3031
+ };
3032
+
3033
+ var string_interpolation = {
3034
+ pattern: /\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,
3035
+ lookbehind: true,
3036
+ inside: Prism.languages.php
3037
+ };
3038
+
3039
+ var string = [
3040
+ {
3041
+ pattern: /<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,
3042
+ alias: 'nowdoc-string',
3043
+ greedy: true,
3044
+ inside: {
3045
+ 'delimiter': {
3046
+ pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
3047
+ alias: 'symbol',
3048
+ inside: {
3049
+ 'punctuation': /^<<<'?|[';]$/
3050
+ }
3051
+ }
3052
+ }
3053
+ },
3054
+ {
3055
+ pattern: /<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,
3056
+ alias: 'heredoc-string',
3057
+ greedy: true,
3058
+ inside: {
3059
+ 'delimiter': {
3060
+ pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
3061
+ alias: 'symbol',
3062
+ inside: {
3063
+ 'punctuation': /^<<<"?|[";]$/
3064
+ }
3065
+ },
3066
+ 'interpolation': string_interpolation
3067
+ }
3068
+ },
3069
+ {
3070
+ pattern: /`(?:\\[\s\S]|[^\\`])*`/,
3071
+ alias: 'backtick-quoted-string',
3072
+ greedy: true
3073
+ },
3074
+ {
3075
+ pattern: /'(?:\\[\s\S]|[^\\'])*'/,
3076
+ alias: 'single-quoted-string',
3077
+ greedy: true
3078
+ },
3079
+ {
3080
+ pattern: /"(?:\\[\s\S]|[^\\"])*"/,
3081
+ alias: 'double-quoted-string',
3082
+ greedy: true,
3083
+ inside: {
3084
+ 'interpolation': string_interpolation
3085
+ }
3086
+ }
3087
+ ];
3088
+
3089
+ Prism.languages.insertBefore('php', 'variable', {
3090
+ 'string': string,
3091
+ 'attribute': {
3092
+ pattern: /#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,
3093
+ greedy: true,
3094
+ inside: {
3095
+ 'attribute-content': {
3096
+ pattern: /^(#\[)[\s\S]+(?=\]$)/,
3097
+ lookbehind: true,
3098
+ // inside can appear subset of php
3099
+ inside: {
3100
+ 'comment': comment,
3101
+ 'string': string,
3102
+ 'attribute-class-name': [
3103
+ {
3104
+ pattern: /([^:]|^)\b[a-z_]\w*(?!\\)\b/i,
3105
+ alias: 'class-name',
3106
+ greedy: true,
3107
+ lookbehind: true
3108
+ },
3109
+ {
3110
+ pattern: /([^:]|^)(?:\\?\b[a-z_]\w*)+/i,
3111
+ alias: [
3112
+ 'class-name',
3113
+ 'class-name-fully-qualified'
3114
+ ],
3115
+ greedy: true,
3116
+ lookbehind: true,
3117
+ inside: {
3118
+ 'punctuation': /\\/
3119
+ }
3120
+ }
3121
+ ],
3122
+ 'constant': constant,
3123
+ 'number': number,
3124
+ 'operator': operator,
3125
+ 'punctuation': punctuation
3126
+ }
3127
+ },
3128
+ 'delimiter': {
3129
+ pattern: /^#\[|\]$/,
3130
+ alias: 'punctuation'
3131
+ }
3132
+ }
3133
+ },
3134
+ });
3135
+
3136
+ Prism.hooks.add('before-tokenize', function (env) {
3137
+ if (!/<\?/.test(env.code)) {
3138
+ return;
3139
+ }
3140
+
3141
+ var phpPattern = /<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;
3142
+ Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
3143
+ });
3144
+
3145
+ Prism.hooks.add('after-tokenize', function (env) {
3146
+ Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');
3147
+ });
3148
+
3149
+ }(Prism));
3150
+
3151
+ Prism.languages.python = {
3152
+ 'comment': {
3153
+ pattern: /(^|[^\\])#.*/,
3154
+ lookbehind: true,
3155
+ greedy: true
3156
+ },
3157
+ 'string-interpolation': {
3158
+ pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
3159
+ greedy: true,
3160
+ inside: {
3161
+ 'interpolation': {
3162
+ // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
3163
+ pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
3164
+ lookbehind: true,
3165
+ inside: {
3166
+ 'format-spec': {
3167
+ pattern: /(:)[^:(){}]+(?=\}$)/,
3168
+ lookbehind: true
3169
+ },
3170
+ 'conversion-option': {
3171
+ pattern: /![sra](?=[:}]$)/,
3172
+ alias: 'punctuation'
3173
+ },
3174
+ rest: null
3175
+ }
3176
+ },
3177
+ 'string': /[\s\S]+/
3178
+ }
3179
+ },
3180
+ 'triple-quoted-string': {
3181
+ pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
3182
+ greedy: true,
3183
+ alias: 'string'
3184
+ },
3185
+ 'string': {
3186
+ pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
3187
+ greedy: true
3188
+ },
3189
+ 'function': {
3190
+ pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
3191
+ lookbehind: true
3192
+ },
3193
+ 'class-name': {
3194
+ pattern: /(\bclass\s+)\w+/i,
3195
+ lookbehind: true
3196
+ },
3197
+ 'decorator': {
3198
+ pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
3199
+ lookbehind: true,
3200
+ alias: ['annotation', 'punctuation'],
3201
+ inside: {
3202
+ 'punctuation': /\./
3203
+ }
3204
+ },
3205
+ 'keyword': /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
3206
+ 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
3207
+ 'boolean': /\b(?:False|None|True)\b/,
3208
+ 'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
3209
+ 'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
3210
+ 'punctuation': /[{}[\];(),.:]/
3211
+ };
3212
+
3213
+ Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
3214
+
3215
+ Prism.languages.py = Prism.languages.python;
3216
+
3217
+ /**
3218
+ * Original by Samuel Flores
3219
+ *
3220
+ * Adds the following new token classes:
3221
+ * constant, builtin, variable, symbol, regex
3222
+ */
3223
+ (function (Prism) {
3224
+ Prism.languages.ruby = Prism.languages.extend('clike', {
3225
+ 'comment': {
3226
+ pattern: /#.*|^=begin\s[\s\S]*?^=end/m,
3227
+ greedy: true
3228
+ },
3229
+ 'class-name': {
3230
+ pattern: /(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,
3231
+ lookbehind: true,
3232
+ inside: {
3233
+ 'punctuation': /[.\\]/
3234
+ }
3235
+ },
3236
+ 'keyword': /\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,
3237
+ 'operator': /\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,
3238
+ 'punctuation': /[(){}[\].,;]/,
3239
+ });
3240
+
3241
+ Prism.languages.insertBefore('ruby', 'operator', {
3242
+ 'double-colon': {
3243
+ pattern: /::/,
3244
+ alias: 'punctuation'
3245
+ },
3246
+ });
3247
+
3248
+ var interpolation = {
3249
+ pattern: /((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,
3250
+ lookbehind: true,
3251
+ inside: {
3252
+ 'content': {
3253
+ pattern: /^(#\{)[\s\S]+(?=\}$)/,
3254
+ lookbehind: true,
3255
+ inside: Prism.languages.ruby
3256
+ },
3257
+ 'delimiter': {
3258
+ pattern: /^#\{|\}$/,
3259
+ alias: 'punctuation'
3260
+ }
3261
+ }
3262
+ };
3263
+
3264
+ delete Prism.languages.ruby.function;
3265
+
3266
+ var percentExpression = '(?:' + [
3267
+ /([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,
3268
+ /\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,
3269
+ /\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,
3270
+ /\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,
3271
+ /<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source
3272
+ ].join('|') + ')';
3273
+
3274
+ var symbolName = /(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;
3275
+
3276
+ Prism.languages.insertBefore('ruby', 'keyword', {
3277
+ 'regex-literal': [
3278
+ {
3279
+ pattern: RegExp(/%r/.source + percentExpression + /[egimnosux]{0,6}/.source),
3280
+ greedy: true,
3281
+ inside: {
3282
+ 'interpolation': interpolation,
3283
+ 'regex': /[\s\S]+/
3284
+ }
3285
+ },
3286
+ {
3287
+ pattern: /(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,
3288
+ lookbehind: true,
3289
+ greedy: true,
3290
+ inside: {
3291
+ 'interpolation': interpolation,
3292
+ 'regex': /[\s\S]+/
3293
+ }
3294
+ }
3295
+ ],
3296
+ 'variable': /[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,
3297
+ 'symbol': [
3298
+ {
3299
+ pattern: RegExp(/(^|[^:]):/.source + symbolName),
3300
+ lookbehind: true,
3301
+ greedy: true
3302
+ },
3303
+ {
3304
+ pattern: RegExp(/([\r\n{(,][ \t]*)/.source + symbolName + /(?=:(?!:))/.source),
3305
+ lookbehind: true,
3306
+ greedy: true
3307
+ },
3308
+ ],
3309
+ 'method-definition': {
3310
+ pattern: /(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,
3311
+ lookbehind: true,
3312
+ inside: {
3313
+ 'function': /\b\w+$/,
3314
+ 'keyword': /^self\b/,
3315
+ 'class-name': /^\w+/,
3316
+ 'punctuation': /\./
3317
+ }
3318
+ }
3319
+ });
3320
+
3321
+ Prism.languages.insertBefore('ruby', 'string', {
3322
+ 'string-literal': [
3323
+ {
3324
+ pattern: RegExp(/%[qQiIwWs]?/.source + percentExpression),
3325
+ greedy: true,
3326
+ inside: {
3327
+ 'interpolation': interpolation,
3328
+ 'string': /[\s\S]+/
3329
+ }
3330
+ },
3331
+ {
3332
+ pattern: /("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,
3333
+ greedy: true,
3334
+ inside: {
3335
+ 'interpolation': interpolation,
3336
+ 'string': /[\s\S]+/
3337
+ }
3338
+ },
3339
+ {
3340
+ pattern: /<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
3341
+ alias: 'heredoc-string',
3342
+ greedy: true,
3343
+ inside: {
3344
+ 'delimiter': {
3345
+ pattern: /^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,
3346
+ inside: {
3347
+ 'symbol': /\b\w+/,
3348
+ 'punctuation': /^<<[-~]?/
3349
+ }
3350
+ },
3351
+ 'interpolation': interpolation,
3352
+ 'string': /[\s\S]+/
3353
+ }
3354
+ },
3355
+ {
3356
+ pattern: /<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,
3357
+ alias: 'heredoc-string',
3358
+ greedy: true,
3359
+ inside: {
3360
+ 'delimiter': {
3361
+ pattern: /^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,
3362
+ inside: {
3363
+ 'symbol': /\b\w+/,
3364
+ 'punctuation': /^<<[-~]?'|'$/,
3365
+ }
3366
+ },
3367
+ 'string': /[\s\S]+/
3368
+ }
3369
+ }
3370
+ ],
3371
+ 'command-literal': [
3372
+ {
3373
+ pattern: RegExp(/%x/.source + percentExpression),
3374
+ greedy: true,
3375
+ inside: {
3376
+ 'interpolation': interpolation,
3377
+ 'command': {
3378
+ pattern: /[\s\S]+/,
3379
+ alias: 'string'
3380
+ }
3381
+ }
3382
+ },
3383
+ {
3384
+ pattern: /`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,
3385
+ greedy: true,
3386
+ inside: {
3387
+ 'interpolation': interpolation,
3388
+ 'command': {
3389
+ pattern: /[\s\S]+/,
3390
+ alias: 'string'
3391
+ }
3392
+ }
3393
+ }
3394
+ ]
3395
+ });
3396
+
3397
+ delete Prism.languages.ruby.string;
3398
+
3399
+ Prism.languages.insertBefore('ruby', 'number', {
3400
+ 'builtin': /\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,
3401
+ 'constant': /\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/
3402
+ });
3403
+
3404
+ Prism.languages.rb = Prism.languages.ruby;
3405
+ }(Prism));
3406
+
3407
+ // restore the original Prism reference
3408
+ window.Prism = oldprism;
3409
+ return Prism;
3410
+ }(undefined, undefined);
3411
+
3412
+ const option = (name) => (editor) => editor.options.get(name);
3413
+ const register$2 = (editor) => {
3414
+ const registerOption = editor.options.register;
3415
+ registerOption('codesample_languages', {
3416
+ processor: 'object[]'
3417
+ });
3418
+ registerOption('codesample_global_prismjs', {
3419
+ processor: 'boolean',
3420
+ default: false
3421
+ });
3422
+ };
3423
+ const getLanguages$1 = option('codesample_languages');
3424
+ const useGlobalPrismJS = option('codesample_global_prismjs');
3425
+
3426
+ const get = (editor) => Global.Prism && useGlobalPrismJS(editor) ? Global.Prism : prismjs;
3427
+
3428
+ const isCodeSample = (elm) => {
3429
+ return isNonNullable(elm) && elm.nodeName === 'PRE' && elm.className.indexOf('language-') !== -1;
3430
+ };
3431
+
3432
+ const getSelectedCodeSample = (editor) => {
3433
+ const node = editor.selection ? editor.selection.getNode() : null;
3434
+ return isCodeSample(node) ? Optional.some(node) : Optional.none();
3435
+ };
3436
+ const insertCodeSample = (editor, language, code) => {
3437
+ const dom = editor.dom;
3438
+ editor.undoManager.transact(() => {
3439
+ const node = getSelectedCodeSample(editor);
3440
+ code = global$1.DOM.encode(code);
3441
+ return node.fold(() => {
3442
+ editor.insertContent('<pre id="__new" class="language-' + language + '">' + code + '</pre>');
3443
+ const newPre = dom.select('#__new')[0];
3444
+ dom.setAttrib(newPre, 'id', null);
3445
+ editor.selection.select(newPre);
3446
+ }, (n) => {
3447
+ dom.setAttrib(n, 'class', 'language-' + language);
3448
+ n.innerHTML = code;
3449
+ get(editor).highlightElement(n);
3450
+ editor.selection.select(n);
3451
+ });
3452
+ });
3453
+ };
3454
+ const getCurrentCode = (editor) => {
3455
+ const node = getSelectedCodeSample(editor);
3456
+ return node.bind((n) => Optional.from(n.textContent)).getOr('');
3457
+ };
3458
+
3459
+ const getLanguages = (editor) => {
3460
+ const defaultLanguages = [
3461
+ { text: 'HTML/XML', value: 'markup' },
3462
+ { text: 'JavaScript', value: 'javascript' },
3463
+ { text: 'CSS', value: 'css' },
3464
+ { text: 'PHP', value: 'php' },
3465
+ { text: 'Ruby', value: 'ruby' },
3466
+ { text: 'Python', value: 'python' },
3467
+ { text: 'Java', value: 'java' },
3468
+ { text: 'C', value: 'c' },
3469
+ { text: 'C#', value: 'csharp' },
3470
+ { text: 'C++', value: 'cpp' }
3471
+ ];
3472
+ const customLanguages = getLanguages$1(editor);
3473
+ return customLanguages ? customLanguages : defaultLanguages;
3474
+ };
3475
+ const getCurrentLanguage = (editor, fallback) => {
3476
+ const node = getSelectedCodeSample(editor);
3477
+ return node.fold(() => fallback, (n) => {
3478
+ const matches = n.className.match(/language-(\w+)/);
3479
+ return matches ? matches[1] : fallback;
3480
+ });
3481
+ };
3482
+
3483
+ const open = (editor) => {
3484
+ const languages = getLanguages(editor);
3485
+ const defaultLanguage = head(languages).fold(constant(''), (l) => l.value);
3486
+ const currentLanguage = getCurrentLanguage(editor, defaultLanguage);
3487
+ const currentCode = getCurrentCode(editor);
3488
+ editor.windowManager.open({
3489
+ title: 'Insert/Edit Code Sample',
3490
+ size: 'large',
3491
+ body: {
3492
+ type: 'panel',
3493
+ items: [
3494
+ {
3495
+ type: 'listbox',
3496
+ name: 'language',
3497
+ label: 'Language',
3498
+ items: languages
3499
+ },
3500
+ {
3501
+ type: 'textarea',
3502
+ name: 'code',
3503
+ label: 'Code view'
3504
+ }
3505
+ ]
3506
+ },
3507
+ buttons: [
3508
+ {
3509
+ type: 'cancel',
3510
+ name: 'cancel',
3511
+ text: 'Cancel'
3512
+ },
3513
+ {
3514
+ type: 'submit',
3515
+ name: 'save',
3516
+ text: 'Save',
3517
+ primary: true
3518
+ }
3519
+ ],
3520
+ initialData: {
3521
+ language: currentLanguage,
3522
+ code: currentCode
3523
+ },
3524
+ onSubmit: (api) => {
3525
+ const data = api.getData();
3526
+ insertCodeSample(editor, data.language, data.code);
3527
+ api.close();
3528
+ }
3529
+ });
3530
+ };
3531
+
3532
+ const register$1 = (editor) => {
3533
+ editor.addCommand('codesample', () => {
3534
+ const node = editor.selection.getNode();
3535
+ if (editor.selection.isCollapsed() || isCodeSample(node)) {
3536
+ open(editor);
3537
+ }
3538
+ else {
3539
+ editor.formatter.toggle('code');
3540
+ }
3541
+ });
3542
+ };
3543
+
3544
+ var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
3545
+
3546
+ const setup = (editor) => {
3547
+ editor.on('PreProcess', (e) => {
3548
+ const dom = editor.dom;
3549
+ const pres = dom.select('pre[contenteditable=false]', e.node);
3550
+ global.each(global.grep(pres, isCodeSample), (elm) => {
3551
+ const code = elm.textContent;
3552
+ dom.setAttrib(elm, 'class', trim(dom.getAttrib(elm, 'class')));
3553
+ dom.setAttrib(elm, 'contentEditable', null);
3554
+ dom.setAttrib(elm, 'data-mce-highlighted', null);
3555
+ // Empty the pre element
3556
+ let child;
3557
+ while ((child = elm.firstChild)) {
3558
+ elm.removeChild(child);
3559
+ }
3560
+ const codeElm = dom.add(elm, 'code');
3561
+ // Needs to be textContent since innerText produces BR:s
3562
+ codeElm.textContent = code;
3563
+ });
3564
+ });
3565
+ editor.on('SetContent', () => {
3566
+ const dom = editor.dom;
3567
+ const unprocessedCodeSamples = global.grep(dom.select('pre'), (elm) => {
3568
+ return isCodeSample(elm) && dom.getAttrib(elm, 'data-mce-highlighted') !== 'true';
3569
+ });
3570
+ if (unprocessedCodeSamples.length) {
3571
+ editor.undoManager.transact(() => {
3572
+ global.each(unprocessedCodeSamples, (elm) => {
3573
+ var _a;
3574
+ global.each(dom.select('br', elm), (elm) => {
3575
+ dom.replace(editor.getDoc().createTextNode('\n'), elm);
3576
+ });
3577
+ elm.innerHTML = dom.encode((_a = elm.textContent) !== null && _a !== void 0 ? _a : '');
3578
+ get(editor).highlightElement(elm);
3579
+ dom.setAttrib(elm, 'data-mce-highlighted', true);
3580
+ elm.className = trim(elm.className);
3581
+ });
3582
+ });
3583
+ }
3584
+ });
3585
+ editor.on('PreInit', () => {
3586
+ editor.parser.addNodeFilter('pre', (nodes) => {
3587
+ var _a;
3588
+ for (let i = 0, l = nodes.length; i < l; i++) {
3589
+ const node = nodes[i];
3590
+ const isCodeSample = ((_a = node.attr('class')) !== null && _a !== void 0 ? _a : '').indexOf('language-') !== -1;
3591
+ if (isCodeSample) {
3592
+ node.attr('contenteditable', 'false');
3593
+ node.attr('data-mce-highlighted', 'false');
3594
+ }
3595
+ }
3596
+ });
3597
+ });
3598
+ };
3599
+
3600
+ const onSetupEditable = (editor, onChanged = noop) => (api) => {
3601
+ const nodeChanged = () => {
3602
+ api.setEnabled(editor.selection.isEditable());
3603
+ onChanged(api);
3604
+ };
3605
+ editor.on('NodeChange', nodeChanged);
3606
+ nodeChanged();
3607
+ return () => {
3608
+ editor.off('NodeChange', nodeChanged);
3609
+ };
3610
+ };
3611
+ const isCodeSampleSelection = (editor) => {
3612
+ const node = editor.selection.getStart();
3613
+ return editor.dom.is(node, 'pre[class*="language-"]');
3614
+ };
3615
+ const register = (editor) => {
3616
+ const onAction = () => editor.execCommand('codesample');
3617
+ editor.ui.registry.addToggleButton('codesample', {
3618
+ icon: 'code-sample',
3619
+ tooltip: 'Insert/edit code sample',
3620
+ onAction,
3621
+ onSetup: onSetupEditable(editor, (api) => {
3622
+ api.setActive(isCodeSampleSelection(editor));
3623
+ })
3624
+ });
3625
+ editor.ui.registry.addMenuItem('codesample', {
3626
+ text: 'Code sample...',
3627
+ icon: 'code-sample',
3628
+ onAction,
3629
+ onSetup: onSetupEditable(editor)
3630
+ });
3631
+ };
3632
+
3633
+ var Plugin = () => {
3634
+ global$2.add('codesample', (editor) => {
3635
+ register$2(editor);
3636
+ setup(editor);
3637
+ register(editor);
3638
+ register$1(editor);
3639
+ editor.on('dblclick', (ev) => {
3640
+ if (isCodeSample(ev.target)) {
3641
+ open(editor);
3642
+ }
3643
+ });
3644
+ });
3645
+ };
3646
+
3647
+ Plugin();
3648
+ /** *****
3649
+ * DO NOT EXPORT ANYTHING
3650
+ *
3651
+ * IF YOU DO ROLLUP WILL LEAVE A GLOBAL ON THE PAGE
3652
+ *******/
3653
+
3654
+ })();