jass 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (503) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +47 -0
  3. data/README.md +45 -0
  4. data/lib/jass.rb +55 -0
  5. data/lib/jass/base.rb +141 -0
  6. data/lib/jass/bundle_processor.rb +28 -0
  7. data/lib/jass/compiler.rb +112 -0
  8. data/lib/jass/dependency.rb +14 -0
  9. data/lib/jass/errors.rb +29 -0
  10. data/lib/jass/es6_processor.rb +17 -0
  11. data/lib/jass/function.rb +13 -0
  12. data/lib/jass/global_directive_processor.rb +12 -0
  13. data/lib/jass/plugin.rb +13 -0
  14. data/lib/jass/railtie.rb +12 -0
  15. data/lib/jass/version.rb +3 -0
  16. data/vendor/node_modules/@types/acorn/index.d.ts +256 -0
  17. data/vendor/node_modules/@types/acorn/package.json +29 -0
  18. data/vendor/node_modules/@types/estree/index.d.ts +546 -0
  19. data/vendor/node_modules/@types/estree/package.json +22 -0
  20. data/vendor/node_modules/acorn-dynamic-import/lib/index.js +17 -0
  21. data/vendor/node_modules/acorn-dynamic-import/lib/inject.js +72 -0
  22. data/vendor/node_modules/acorn-dynamic-import/lib/walk.js +22 -0
  23. data/vendor/node_modules/acorn-dynamic-import/package.json +45 -0
  24. data/vendor/node_modules/acorn-dynamic-import/src/index.js +4 -0
  25. data/vendor/node_modules/acorn-dynamic-import/src/inject.js +52 -0
  26. data/vendor/node_modules/acorn-dynamic-import/src/walk.js +12 -0
  27. data/vendor/node_modules/acorn-es7-plugin/acorn-es7-plugin.js +17 -0
  28. data/vendor/node_modules/acorn-es7-plugin/acorn-v3.js +333 -0
  29. data/vendor/node_modules/acorn-es7-plugin/acorn-v4.js +194 -0
  30. data/vendor/node_modules/acorn-es7-plugin/package.json +29 -0
  31. data/vendor/node_modules/acorn-jsx/index.js +3 -0
  32. data/vendor/node_modules/acorn-jsx/inject.js +449 -0
  33. data/vendor/node_modules/acorn-jsx/package.json +28 -0
  34. data/vendor/node_modules/acorn-jsx/xhtml.js +255 -0
  35. data/vendor/node_modules/acorn/bin/_acorn.js +69 -0
  36. data/vendor/node_modules/acorn/bin/acorn +4 -0
  37. data/vendor/node_modules/acorn/bin/run_test262.js +22 -0
  38. data/vendor/node_modules/acorn/bin/test262.whitelist +409 -0
  39. data/vendor/node_modules/acorn/dist/acorn.es.js +5305 -0
  40. data/vendor/node_modules/acorn/dist/acorn.js +5336 -0
  41. data/vendor/node_modules/acorn/dist/acorn_loose.es.js +1412 -0
  42. data/vendor/node_modules/acorn/dist/acorn_loose.js +1422 -0
  43. data/vendor/node_modules/acorn/dist/walk.es.js +419 -0
  44. data/vendor/node_modules/acorn/dist/walk.js +439 -0
  45. data/vendor/node_modules/acorn/package.json +56 -0
  46. data/vendor/node_modules/ansi-styles/index.js +165 -0
  47. data/vendor/node_modules/ansi-styles/package.json +56 -0
  48. data/vendor/node_modules/arr-diff/index.js +58 -0
  49. data/vendor/node_modules/arr-diff/package.json +49 -0
  50. data/vendor/node_modules/arr-flatten/index.js +22 -0
  51. data/vendor/node_modules/arr-flatten/package.json +76 -0
  52. data/vendor/node_modules/array-unique/index.js +28 -0
  53. data/vendor/node_modules/array-unique/package.json +37 -0
  54. data/vendor/node_modules/braces/index.js +399 -0
  55. data/vendor/node_modules/braces/package.json +83 -0
  56. data/vendor/node_modules/buble/bin/buble +24 -0
  57. data/vendor/node_modules/buble/bin/handleError.js +58 -0
  58. data/vendor/node_modules/buble/bin/runBuble.js +150 -0
  59. data/vendor/node_modules/buble/bin/showHelp.js +16 -0
  60. data/vendor/node_modules/buble/dist/buble-browser-deps.umd.js +14857 -0
  61. data/vendor/node_modules/buble/dist/buble-browser.cjs.js +9941 -0
  62. data/vendor/node_modules/buble/dist/buble-browser.es.js +9933 -0
  63. data/vendor/node_modules/buble/dist/buble.cjs.js +9433 -0
  64. data/vendor/node_modules/buble/dist/buble.es.js +9425 -0
  65. data/vendor/node_modules/buble/package.json +74 -0
  66. data/vendor/node_modules/buble/register.js +90 -0
  67. data/vendor/node_modules/buble/src/index.js +98 -0
  68. data/vendor/node_modules/buble/src/program/BlockStatement.js +373 -0
  69. data/vendor/node_modules/buble/src/program/Node.js +112 -0
  70. data/vendor/node_modules/buble/src/program/Program.js +74 -0
  71. data/vendor/node_modules/buble/src/program/Scope.js +116 -0
  72. data/vendor/node_modules/buble/src/program/extractNames.js +35 -0
  73. data/vendor/node_modules/buble/src/program/keys.js +4 -0
  74. data/vendor/node_modules/buble/src/program/types/ArrayExpression.js +70 -0
  75. data/vendor/node_modules/buble/src/program/types/ArrowFunctionExpression.js +52 -0
  76. data/vendor/node_modules/buble/src/program/types/AssignmentExpression.js +185 -0
  77. data/vendor/node_modules/buble/src/program/types/BinaryExpression.js +12 -0
  78. data/vendor/node_modules/buble/src/program/types/BreakStatement.js +26 -0
  79. data/vendor/node_modules/buble/src/program/types/CallExpression.js +104 -0
  80. data/vendor/node_modules/buble/src/program/types/ClassBody.js +237 -0
  81. data/vendor/node_modules/buble/src/program/types/ClassDeclaration.js +79 -0
  82. data/vendor/node_modules/buble/src/program/types/ClassExpression.js +51 -0
  83. data/vendor/node_modules/buble/src/program/types/ContinueStatement.js +17 -0
  84. data/vendor/node_modules/buble/src/program/types/ExportDefaultDeclaration.js +10 -0
  85. data/vendor/node_modules/buble/src/program/types/ExportNamedDeclaration.js +10 -0
  86. data/vendor/node_modules/buble/src/program/types/ForInStatement.js +76 -0
  87. data/vendor/node_modules/buble/src/program/types/ForOfStatement.js +89 -0
  88. data/vendor/node_modules/buble/src/program/types/ForStatement.js +54 -0
  89. data/vendor/node_modules/buble/src/program/types/FunctionDeclaration.js +25 -0
  90. data/vendor/node_modules/buble/src/program/types/FunctionExpression.js +74 -0
  91. data/vendor/node_modules/buble/src/program/types/Identifier.js +54 -0
  92. data/vendor/node_modules/buble/src/program/types/IfStatement.js +29 -0
  93. data/vendor/node_modules/buble/src/program/types/ImportDeclaration.js +10 -0
  94. data/vendor/node_modules/buble/src/program/types/ImportDefaultSpecifier.js +8 -0
  95. data/vendor/node_modules/buble/src/program/types/ImportSpecifier.js +8 -0
  96. data/vendor/node_modules/buble/src/program/types/JSXAttribute.js +20 -0
  97. data/vendor/node_modules/buble/src/program/types/JSXClosingElement.js +27 -0
  98. data/vendor/node_modules/buble/src/program/types/JSXClosingFragment.js +22 -0
  99. data/vendor/node_modules/buble/src/program/types/JSXElement.js +57 -0
  100. data/vendor/node_modules/buble/src/program/types/JSXExpressionContainer.js +10 -0
  101. data/vendor/node_modules/buble/src/program/types/JSXFragment.js +4 -0
  102. data/vendor/node_modules/buble/src/program/types/JSXOpeningElement.js +93 -0
  103. data/vendor/node_modules/buble/src/program/types/JSXOpeningFragment.js +7 -0
  104. data/vendor/node_modules/buble/src/program/types/JSXSpreadAttribute.js +10 -0
  105. data/vendor/node_modules/buble/src/program/types/Literal.js +43 -0
  106. data/vendor/node_modules/buble/src/program/types/MemberExpression.js +13 -0
  107. data/vendor/node_modules/buble/src/program/types/NewExpression.js +55 -0
  108. data/vendor/node_modules/buble/src/program/types/ObjectExpression.js +250 -0
  109. data/vendor/node_modules/buble/src/program/types/Property.js +52 -0
  110. data/vendor/node_modules/buble/src/program/types/ReturnStatement.js +32 -0
  111. data/vendor/node_modules/buble/src/program/types/SpreadElement.js +12 -0
  112. data/vendor/node_modules/buble/src/program/types/Super.js +88 -0
  113. data/vendor/node_modules/buble/src/program/types/TaggedTemplateExpression.js +63 -0
  114. data/vendor/node_modules/buble/src/program/types/TemplateElement.js +7 -0
  115. data/vendor/node_modules/buble/src/program/types/TemplateLiteral.js +80 -0
  116. data/vendor/node_modules/buble/src/program/types/ThisExpression.js +31 -0
  117. data/vendor/node_modules/buble/src/program/types/UpdateExpression.js +32 -0
  118. data/vendor/node_modules/buble/src/program/types/VariableDeclaration.js +101 -0
  119. data/vendor/node_modules/buble/src/program/types/VariableDeclarator.js +43 -0
  120. data/vendor/node_modules/buble/src/program/types/index.js +98 -0
  121. data/vendor/node_modules/buble/src/program/types/shared/LoopStatement.js +105 -0
  122. data/vendor/node_modules/buble/src/program/types/shared/ModuleDeclaration.js +10 -0
  123. data/vendor/node_modules/buble/src/program/wrap.js +68 -0
  124. data/vendor/node_modules/buble/src/support.js +97 -0
  125. data/vendor/node_modules/buble/src/utils/CompileError.js +30 -0
  126. data/vendor/node_modules/buble/src/utils/array.js +11 -0
  127. data/vendor/node_modules/buble/src/utils/checkConst.js +8 -0
  128. data/vendor/node_modules/buble/src/utils/deindent.js +30 -0
  129. data/vendor/node_modules/buble/src/utils/destructure.js +377 -0
  130. data/vendor/node_modules/buble/src/utils/getSnippet.js +30 -0
  131. data/vendor/node_modules/buble/src/utils/isReference.js +41 -0
  132. data/vendor/node_modules/buble/src/utils/locate.js +20 -0
  133. data/vendor/node_modules/buble/src/utils/patterns.js +1 -0
  134. data/vendor/node_modules/buble/src/utils/removeTrailingComma.js +13 -0
  135. data/vendor/node_modules/buble/src/utils/reserved.js +6 -0
  136. data/vendor/node_modules/buble/src/utils/spread.js +70 -0
  137. data/vendor/node_modules/builtin-modules/builtin-modules.json +39 -0
  138. data/vendor/node_modules/builtin-modules/index.js +10 -0
  139. data/vendor/node_modules/builtin-modules/package.json +40 -0
  140. data/vendor/node_modules/builtin-modules/static.js +2 -0
  141. data/vendor/node_modules/chalk/index.js +228 -0
  142. data/vendor/node_modules/chalk/package.json +66 -0
  143. data/vendor/node_modules/chalk/templates.js +128 -0
  144. data/vendor/node_modules/chalk/types/index.d.ts +97 -0
  145. data/vendor/node_modules/color-convert/conversions.js +861 -0
  146. data/vendor/node_modules/color-convert/index.js +78 -0
  147. data/vendor/node_modules/color-convert/package.json +46 -0
  148. data/vendor/node_modules/color-convert/route.js +97 -0
  149. data/vendor/node_modules/color-name/index.js +152 -0
  150. data/vendor/node_modules/color-name/package.json +25 -0
  151. data/vendor/node_modules/color-name/test.js +7 -0
  152. data/vendor/node_modules/date-time/index.js +33 -0
  153. data/vendor/node_modules/date-time/package.json +39 -0
  154. data/vendor/node_modules/escape-string-regexp/index.js +11 -0
  155. data/vendor/node_modules/escape-string-regexp/package.json +41 -0
  156. data/vendor/node_modules/estree-walker/dist/estree-walker.es.js +57 -0
  157. data/vendor/node_modules/estree-walker/dist/estree-walker.umd.js +68 -0
  158. data/vendor/node_modules/estree-walker/package.json +34 -0
  159. data/vendor/node_modules/estree-walker/src/estree-walker.js +51 -0
  160. data/vendor/node_modules/expand-brackets/index.js +163 -0
  161. data/vendor/node_modules/expand-brackets/package.json +62 -0
  162. data/vendor/node_modules/expand-range/index.js +43 -0
  163. data/vendor/node_modules/expand-range/package.json +73 -0
  164. data/vendor/node_modules/extglob/index.js +178 -0
  165. data/vendor/node_modules/extglob/package.json +60 -0
  166. data/vendor/node_modules/filename-regex/index.js +10 -0
  167. data/vendor/node_modules/filename-regex/package.json +50 -0
  168. data/vendor/node_modules/fill-range/index.js +408 -0
  169. data/vendor/node_modules/fill-range/package.json +61 -0
  170. data/vendor/node_modules/for-in/index.js +16 -0
  171. data/vendor/node_modules/for-in/package.json +68 -0
  172. data/vendor/node_modules/for-own/index.js +19 -0
  173. data/vendor/node_modules/for-own/package.json +70 -0
  174. data/vendor/node_modules/glob-base/index.js +51 -0
  175. data/vendor/node_modules/glob-base/package.json +52 -0
  176. data/vendor/node_modules/glob-parent/index.js +10 -0
  177. data/vendor/node_modules/glob-parent/package.json +35 -0
  178. data/vendor/node_modules/glob-parent/test.js +28 -0
  179. data/vendor/node_modules/has-flag/index.js +8 -0
  180. data/vendor/node_modules/has-flag/package.json +44 -0
  181. data/vendor/node_modules/irregular-plurals/irregular-plurals.json +146 -0
  182. data/vendor/node_modules/irregular-plurals/package.json +39 -0
  183. data/vendor/node_modules/is-buffer/index.js +21 -0
  184. data/vendor/node_modules/is-buffer/package.json +51 -0
  185. data/vendor/node_modules/is-dotfile/index.js +14 -0
  186. data/vendor/node_modules/is-dotfile/package.json +69 -0
  187. data/vendor/node_modules/is-equal-shallow/index.js +27 -0
  188. data/vendor/node_modules/is-equal-shallow/package.json +54 -0
  189. data/vendor/node_modules/is-extendable/index.js +13 -0
  190. data/vendor/node_modules/is-extendable/package.json +51 -0
  191. data/vendor/node_modules/is-extglob/index.js +11 -0
  192. data/vendor/node_modules/is-extglob/package.json +48 -0
  193. data/vendor/node_modules/is-glob/index.js +14 -0
  194. data/vendor/node_modules/is-glob/package.json +60 -0
  195. data/vendor/node_modules/is-module/index.js +11 -0
  196. data/vendor/node_modules/is-module/package.json +20 -0
  197. data/vendor/node_modules/is-number/index.js +19 -0
  198. data/vendor/node_modules/is-number/package.json +59 -0
  199. data/vendor/node_modules/is-posix-bracket/index.js +10 -0
  200. data/vendor/node_modules/is-posix-bracket/package.json +64 -0
  201. data/vendor/node_modules/is-primitive/index.js +13 -0
  202. data/vendor/node_modules/is-primitive/package.json +46 -0
  203. data/vendor/node_modules/is-reference/dist/is-reference.es.js +26 -0
  204. data/vendor/node_modules/is-reference/dist/is-reference.js +34 -0
  205. data/vendor/node_modules/is-reference/dist/types/index.d.ts +2 -0
  206. data/vendor/node_modules/is-reference/package.json +47 -0
  207. data/vendor/node_modules/isarray/index.js +5 -0
  208. data/vendor/node_modules/isarray/package.json +45 -0
  209. data/vendor/node_modules/isarray/test.js +20 -0
  210. data/vendor/node_modules/isobject/index.js +14 -0
  211. data/vendor/node_modules/isobject/package.json +67 -0
  212. data/vendor/node_modules/kind-of/index.js +116 -0
  213. data/vendor/node_modules/kind-of/package.json +90 -0
  214. data/vendor/node_modules/locate-character/dist/locate-character.es.js +43 -0
  215. data/vendor/node_modules/locate-character/dist/locate-character.umd.js +54 -0
  216. data/vendor/node_modules/locate-character/dist/types/index.d.ts +17 -0
  217. data/vendor/node_modules/locate-character/package.json +41 -0
  218. data/vendor/node_modules/magic-string/dist/magic-string.cjs.js +1300 -0
  219. data/vendor/node_modules/magic-string/dist/magic-string.es.js +1296 -0
  220. data/vendor/node_modules/magic-string/dist/magic-string.umd.js +1352 -0
  221. data/vendor/node_modules/magic-string/index.d.ts +83 -0
  222. data/vendor/node_modules/magic-string/node_modules/vlq/dist/vlq.js +91 -0
  223. data/vendor/node_modules/magic-string/node_modules/vlq/package.json +27 -0
  224. data/vendor/node_modules/magic-string/node_modules/vlq/src/vlq.js +78 -0
  225. data/vendor/node_modules/magic-string/package.json +55 -0
  226. data/vendor/node_modules/micromatch/index.js +431 -0
  227. data/vendor/node_modules/micromatch/lib/chars.js +67 -0
  228. data/vendor/node_modules/micromatch/lib/expand.js +304 -0
  229. data/vendor/node_modules/micromatch/lib/glob.js +193 -0
  230. data/vendor/node_modules/micromatch/lib/utils.js +149 -0
  231. data/vendor/node_modules/micromatch/package.json +114 -0
  232. data/vendor/node_modules/minimist/index.js +236 -0
  233. data/vendor/node_modules/minimist/package.json +45 -0
  234. data/vendor/node_modules/nodent-compiler/compiler.js +171 -0
  235. data/vendor/node_modules/nodent-compiler/lib/arboriculture.js +2694 -0
  236. data/vendor/node_modules/nodent-compiler/lib/output.js +934 -0
  237. data/vendor/node_modules/nodent-compiler/lib/parser.js +291 -0
  238. data/vendor/node_modules/nodent-compiler/package.json +37 -0
  239. data/vendor/node_modules/normalize-path/index.js +19 -0
  240. data/vendor/node_modules/normalize-path/package.json +78 -0
  241. data/vendor/node_modules/object.omit/index.js +40 -0
  242. data/vendor/node_modules/object.omit/package.json +67 -0
  243. data/vendor/node_modules/os-homedir/index.js +24 -0
  244. data/vendor/node_modules/os-homedir/package.json +41 -0
  245. data/vendor/node_modules/parse-glob/index.js +156 -0
  246. data/vendor/node_modules/parse-glob/package.json +62 -0
  247. data/vendor/node_modules/parse-ms/index.js +16 -0
  248. data/vendor/node_modules/parse-ms/package.json +34 -0
  249. data/vendor/node_modules/path-parse/index.js +93 -0
  250. data/vendor/node_modules/path-parse/index.min.js +1 -0
  251. data/vendor/node_modules/path-parse/package.json +33 -0
  252. data/vendor/node_modules/path-parse/test.js +77 -0
  253. data/vendor/node_modules/path-parse/test.min.js +1 -0
  254. data/vendor/node_modules/plur/index.js +20 -0
  255. data/vendor/node_modules/plur/package.json +42 -0
  256. data/vendor/node_modules/preserve/index.js +54 -0
  257. data/vendor/node_modules/preserve/package.json +48 -0
  258. data/vendor/node_modules/preserve/test.js +48 -0
  259. data/vendor/node_modules/pretty-ms/index.js +48 -0
  260. data/vendor/node_modules/pretty-ms/package.json +48 -0
  261. data/vendor/node_modules/randomatic/index.js +82 -0
  262. data/vendor/node_modules/randomatic/node_modules/is-number/index.js +22 -0
  263. data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +116 -0
  264. data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +90 -0
  265. data/vendor/node_modules/randomatic/node_modules/is-number/package.json +83 -0
  266. data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +119 -0
  267. data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +90 -0
  268. data/vendor/node_modules/randomatic/package.json +78 -0
  269. data/vendor/node_modules/regex-cache/index.js +68 -0
  270. data/vendor/node_modules/regex-cache/package.json +64 -0
  271. data/vendor/node_modules/remove-trailing-separator/index.js +17 -0
  272. data/vendor/node_modules/remove-trailing-separator/package.json +37 -0
  273. data/vendor/node_modules/repeat-element/index.js +18 -0
  274. data/vendor/node_modules/repeat-element/package.json +44 -0
  275. data/vendor/node_modules/repeat-string/index.js +70 -0
  276. data/vendor/node_modules/repeat-string/package.json +77 -0
  277. data/vendor/node_modules/require-relative/index.js +33 -0
  278. data/vendor/node_modules/require-relative/package.json +22 -0
  279. data/vendor/node_modules/resolve/index.js +8 -0
  280. data/vendor/node_modules/resolve/lib/async.js +203 -0
  281. data/vendor/node_modules/resolve/lib/caller.js +8 -0
  282. data/vendor/node_modules/resolve/lib/core.js +53 -0
  283. data/vendor/node_modules/resolve/lib/core.json +69 -0
  284. data/vendor/node_modules/resolve/lib/node-modules-paths.js +45 -0
  285. data/vendor/node_modules/resolve/lib/sync.js +93 -0
  286. data/vendor/node_modules/resolve/package.json +40 -0
  287. data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js +804 -0
  288. data/vendor/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.es.js +800 -0
  289. data/vendor/node_modules/rollup-plugin-commonjs/package.json +52 -0
  290. data/vendor/node_modules/rollup-plugin-commonjs/src/ast-utils.js +104 -0
  291. data/vendor/node_modules/rollup-plugin-commonjs/src/defaultResolver.js +39 -0
  292. data/vendor/node_modules/rollup-plugin-commonjs/src/helpers.js +19 -0
  293. data/vendor/node_modules/rollup-plugin-commonjs/src/index.js +198 -0
  294. data/vendor/node_modules/rollup-plugin-commonjs/src/transform.js +431 -0
  295. data/vendor/node_modules/rollup-plugin-commonjs/src/utils.js +13 -0
  296. data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js +218 -0
  297. data/vendor/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.es.js +214 -0
  298. data/vendor/node_modules/rollup-plugin-node-resolve/package.json +51 -0
  299. data/vendor/node_modules/rollup-plugin-node-resolve/src/empty.js +1 -0
  300. data/vendor/node_modules/rollup-plugin-node-resolve/src/index.js +205 -0
  301. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +223 -0
  302. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +214 -0
  303. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +217 -0
  304. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es.js +55 -0
  305. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.es6.js +59 -0
  306. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js +65 -0
  307. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/package.json +33 -0
  308. data/vendor/node_modules/rollup-pluginutils/node_modules/estree-walker/src/estree-walker.js +49 -0
  309. data/vendor/node_modules/rollup-pluginutils/package.json +40 -0
  310. data/vendor/node_modules/rollup-pluginutils/src/addExtension.js +6 -0
  311. data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +147 -0
  312. data/vendor/node_modules/rollup-pluginutils/src/createFilter.js +33 -0
  313. data/vendor/node_modules/rollup-pluginutils/src/index.js +4 -0
  314. data/vendor/node_modules/rollup-pluginutils/src/makeLegalIdentifier.js +15 -0
  315. data/vendor/node_modules/rollup-pluginutils/src/utils/ensureArray.js +5 -0
  316. data/vendor/node_modules/rollup/bin/rollup +4085 -0
  317. data/vendor/node_modules/rollup/dist/rollup.browser.js +19829 -0
  318. data/vendor/node_modules/rollup/dist/rollup.es.js +23586 -0
  319. data/vendor/node_modules/rollup/dist/rollup.js +23597 -0
  320. data/vendor/node_modules/rollup/dist/typings/Chunk.d.ts +85 -0
  321. data/vendor/node_modules/rollup/dist/typings/ExternalModule.d.ts +30 -0
  322. data/vendor/node_modules/rollup/dist/typings/Graph.d.ts +47 -0
  323. data/vendor/node_modules/rollup/dist/typings/Module.d.ts +130 -0
  324. data/vendor/node_modules/rollup/dist/typings/ast/CallOptions.d.ts +20 -0
  325. data/vendor/node_modules/rollup/dist/typings/ast/Entity.d.ts +16 -0
  326. data/vendor/node_modules/rollup/dist/typings/ast/ExecutionPathOptions.d.ts +57 -0
  327. data/vendor/node_modules/rollup/dist/typings/ast/clone.d.ts +1 -0
  328. data/vendor/node_modules/rollup/dist/typings/ast/enhance.d.ts +3 -0
  329. data/vendor/node_modules/rollup/dist/typings/ast/keys.d.ts +4 -0
  330. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrayExpression.d.ts +14 -0
  331. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrayPattern.d.ts +14 -0
  332. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ArrowFunctionExpression.d.ts +25 -0
  333. data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentExpression.d.ts +13 -0
  334. data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentPattern.d.ts +16 -0
  335. data/vendor/node_modules/rollup/dist/typings/ast/nodes/AssignmentProperty.d.ts +10 -0
  336. data/vendor/node_modules/rollup/dist/typings/ast/nodes/AwaitExpression.d.ts +8 -0
  337. data/vendor/node_modules/rollup/dist/typings/ast/nodes/BinaryExpression.d.ts +13 -0
  338. data/vendor/node_modules/rollup/dist/typings/ast/nodes/BlockStatement.d.ts +19 -0
  339. data/vendor/node_modules/rollup/dist/typings/ast/nodes/BreakStatement.d.ts +9 -0
  340. data/vendor/node_modules/rollup/dist/typings/ast/nodes/CallExpression.d.ts +22 -0
  341. data/vendor/node_modules/rollup/dist/typings/ast/nodes/CatchClause.d.ts +14 -0
  342. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassBody.d.ts +13 -0
  343. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassDeclaration.d.ts +14 -0
  344. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ClassExpression.d.ts +10 -0
  345. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ConditionalExpression.d.ts +28 -0
  346. data/vendor/node_modules/rollup/dist/typings/ast/nodes/DoWhileStatement.d.ts +9 -0
  347. data/vendor/node_modules/rollup/dist/typings/ast/nodes/EmptyStatement.d.ts +8 -0
  348. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportAllDeclaration.d.ts +12 -0
  349. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportDefaultDeclaration.d.ts +21 -0
  350. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportNamedDeclaration.d.ts +21 -0
  351. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExportSpecifier.d.ts +8 -0
  352. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ExpressionStatement.d.ts +10 -0
  353. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForInStatement.d.ts +20 -0
  354. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForOfStatement.d.ts +21 -0
  355. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ForStatement.d.ts +19 -0
  356. data/vendor/node_modules/rollup/dist/typings/ast/nodes/FunctionDeclaration.d.ts +9 -0
  357. data/vendor/node_modules/rollup/dist/typings/ast/nodes/FunctionExpression.d.ts +6 -0
  358. data/vendor/node_modules/rollup/dist/typings/ast/nodes/Identifier.d.ts +29 -0
  359. data/vendor/node_modules/rollup/dist/typings/ast/nodes/IfStatement.d.ts +17 -0
  360. data/vendor/node_modules/rollup/dist/typings/ast/nodes/Import.d.ts +14 -0
  361. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportDeclaration.d.ts +17 -0
  362. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportDefaultSpecifier.d.ts +7 -0
  363. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportNamespaceSpecifier.d.ts +7 -0
  364. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ImportSpecifier.d.ts +8 -0
  365. data/vendor/node_modules/rollup/dist/typings/ast/nodes/LabeledStatement.d.ts +10 -0
  366. data/vendor/node_modules/rollup/dist/typings/ast/nodes/Literal.d.ts +22 -0
  367. data/vendor/node_modules/rollup/dist/typings/ast/nodes/LogicalExpression.d.ts +23 -0
  368. data/vendor/node_modules/rollup/dist/typings/ast/nodes/MemberExpression.d.ts +34 -0
  369. data/vendor/node_modules/rollup/dist/typings/ast/nodes/MethodDefinition.d.ts +16 -0
  370. data/vendor/node_modules/rollup/dist/typings/ast/nodes/NewExpression.d.ts +14 -0
  371. data/vendor/node_modules/rollup/dist/typings/ast/nodes/NodeType.d.ts +64 -0
  372. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ObjectExpression.d.ts +22 -0
  373. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ObjectPattern.d.ts +15 -0
  374. data/vendor/node_modules/rollup/dist/typings/ast/nodes/Program.d.ts +9 -0
  375. data/vendor/node_modules/rollup/dist/typings/ast/nodes/Property.d.ts +30 -0
  376. data/vendor/node_modules/rollup/dist/typings/ast/nodes/RestElement.d.ts +14 -0
  377. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ReturnStatement.d.ts +9 -0
  378. data/vendor/node_modules/rollup/dist/typings/ast/nodes/SequenceExpression.d.ts +13 -0
  379. data/vendor/node_modules/rollup/dist/typings/ast/nodes/SpreadElement.d.ts +6 -0
  380. data/vendor/node_modules/rollup/dist/typings/ast/nodes/SwitchCase.d.ts +11 -0
  381. data/vendor/node_modules/rollup/dist/typings/ast/nodes/SwitchStatement.d.ts +12 -0
  382. data/vendor/node_modules/rollup/dist/typings/ast/nodes/TaggedTemplateExpression.d.ts +13 -0
  383. data/vendor/node_modules/rollup/dist/typings/ast/nodes/TemplateElement.d.ts +12 -0
  384. data/vendor/node_modules/rollup/dist/typings/ast/nodes/TemplateLiteral.d.ts +12 -0
  385. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ThisExpression.d.ts +17 -0
  386. data/vendor/node_modules/rollup/dist/typings/ast/nodes/ThrowStatement.d.ts +8 -0
  387. data/vendor/node_modules/rollup/dist/typings/ast/nodes/UnaryExpression.d.ts +16 -0
  388. data/vendor/node_modules/rollup/dist/typings/ast/nodes/UnknownNode.d.ts +5 -0
  389. data/vendor/node_modules/rollup/dist/typings/ast/nodes/UpdateExpression.d.ts +13 -0
  390. data/vendor/node_modules/rollup/dist/typings/ast/nodes/VariableDeclaration.d.ts +21 -0
  391. data/vendor/node_modules/rollup/dist/typings/ast/nodes/VariableDeclarator.d.ts +13 -0
  392. data/vendor/node_modules/rollup/dist/typings/ast/nodes/WhileStatement.d.ts +9 -0
  393. data/vendor/node_modules/rollup/dist/typings/ast/nodes/YieldExpression.d.ts +9 -0
  394. data/vendor/node_modules/rollup/dist/typings/ast/nodes/index.d.ts +6 -0
  395. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/ClassNode.d.ts +17 -0
  396. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Expression.d.ts +21 -0
  397. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/FunctionNode.d.ts +25 -0
  398. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Node.d.ts +133 -0
  399. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/Pattern.d.ts +4 -0
  400. data/vendor/node_modules/rollup/dist/typings/ast/nodes/shared/pureFunctions.d.ts +4 -0
  401. data/vendor/node_modules/rollup/dist/typings/ast/scopes/BlockScope.d.ts +9 -0
  402. data/vendor/node_modules/rollup/dist/typings/ast/scopes/CatchScope.d.ts +10 -0
  403. data/vendor/node_modules/rollup/dist/typings/ast/scopes/FunctionScope.d.ts +20 -0
  404. data/vendor/node_modules/rollup/dist/typings/ast/scopes/GlobalScope.d.ts +7 -0
  405. data/vendor/node_modules/rollup/dist/typings/ast/scopes/ModuleScope.d.ts +11 -0
  406. data/vendor/node_modules/rollup/dist/typings/ast/scopes/ParameterScope.d.ts +16 -0
  407. data/vendor/node_modules/rollup/dist/typings/ast/scopes/ReturnValueScope.d.ts +11 -0
  408. data/vendor/node_modules/rollup/dist/typings/ast/scopes/Scope.d.ts +42 -0
  409. data/vendor/node_modules/rollup/dist/typings/ast/utils/extractNames.d.ts +2 -0
  410. data/vendor/node_modules/rollup/dist/typings/ast/values.d.ts +31 -0
  411. data/vendor/node_modules/rollup/dist/typings/ast/variables/ArgumentsVariable.d.ts +15 -0
  412. data/vendor/node_modules/rollup/dist/typings/ast/variables/ExportDefaultVariable.d.ts +16 -0
  413. data/vendor/node_modules/rollup/dist/typings/ast/variables/ExternalVariable.d.ts +12 -0
  414. data/vendor/node_modules/rollup/dist/typings/ast/variables/GlobalVariable.d.ts +11 -0
  415. data/vendor/node_modules/rollup/dist/typings/ast/variables/LocalVariable.d.ts +21 -0
  416. data/vendor/node_modules/rollup/dist/typings/ast/variables/NamespaceVariable.d.ts +20 -0
  417. data/vendor/node_modules/rollup/dist/typings/ast/variables/ParameterVariable.d.ts +5 -0
  418. data/vendor/node_modules/rollup/dist/typings/ast/variables/ReplaceableInitializationVariable.d.ts +14 -0
  419. data/vendor/node_modules/rollup/dist/typings/ast/variables/ThisVariable.d.ts +4 -0
  420. data/vendor/node_modules/rollup/dist/typings/ast/variables/Variable.d.ts +43 -0
  421. data/vendor/node_modules/rollup/dist/typings/ast/variables/VariableReassignmentTracker.d.ts +11 -0
  422. data/vendor/node_modules/rollup/dist/typings/finalisers/amd.d.ts +11 -0
  423. data/vendor/node_modules/rollup/dist/typings/finalisers/cjs.d.ts +10 -0
  424. data/vendor/node_modules/rollup/dist/typings/finalisers/es.d.ts +9 -0
  425. data/vendor/node_modules/rollup/dist/typings/finalisers/iife.d.ts +10 -0
  426. data/vendor/node_modules/rollup/dist/typings/finalisers/index.d.ts +15 -0
  427. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/esModuleExport.d.ts +2 -0
  428. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getExportBlock.d.ts +2 -0
  429. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getGlobalNameMaker.d.ts +4 -0
  430. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/getInteropBlock.d.ts +3 -0
  431. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/sanitize.d.ts +2 -0
  432. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/setupNamespace.d.ts +2 -0
  433. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/trimEmptyImports.d.ts +2 -0
  434. data/vendor/node_modules/rollup/dist/typings/finalisers/shared/warnOnBuiltins.d.ts +2 -0
  435. data/vendor/node_modules/rollup/dist/typings/finalisers/system.d.ts +8 -0
  436. data/vendor/node_modules/rollup/dist/typings/finalisers/umd.d.ts +10 -0
  437. data/vendor/node_modules/rollup/dist/typings/node-entry.d.ts +6 -0
  438. data/vendor/node_modules/rollup/dist/typings/rollup/index.d.ts +167 -0
  439. data/vendor/node_modules/rollup/dist/typings/utils/callIfFunction.d.ts +1 -0
  440. data/vendor/node_modules/rollup/dist/typings/utils/collapseSourcemaps.d.ts +5 -0
  441. data/vendor/node_modules/rollup/dist/typings/utils/commondir.d.ts +1 -0
  442. data/vendor/node_modules/rollup/dist/typings/utils/defaults.d.ts +6 -0
  443. data/vendor/node_modules/rollup/dist/typings/utils/deprecateOptions.d.ts +6 -0
  444. data/vendor/node_modules/rollup/dist/typings/utils/ensureArray.d.ts +2 -0
  445. data/vendor/node_modules/rollup/dist/typings/utils/entryHashing.d.ts +3 -0
  446. data/vendor/node_modules/rollup/dist/typings/utils/error.d.ts +18 -0
  447. data/vendor/node_modules/rollup/dist/typings/utils/first-sync.d.ts +1 -0
  448. data/vendor/node_modules/rollup/dist/typings/utils/first.d.ts +1 -0
  449. data/vendor/node_modules/rollup/dist/typings/utils/flushTime.d.ts +5 -0
  450. data/vendor/node_modules/rollup/dist/typings/utils/fs.d.ts +3 -0
  451. data/vendor/node_modules/rollup/dist/typings/utils/getCodeFrame.d.ts +1 -0
  452. data/vendor/node_modules/rollup/dist/typings/utils/getExportMode.d.ts +3 -0
  453. data/vendor/node_modules/rollup/dist/typings/utils/getIndentString.d.ts +4 -0
  454. data/vendor/node_modules/rollup/dist/typings/utils/identifierHelpers.d.ts +3 -0
  455. data/vendor/node_modules/rollup/dist/typings/utils/mergeOptions.d.ts +19 -0
  456. data/vendor/node_modules/rollup/dist/typings/utils/object.d.ts +7 -0
  457. data/vendor/node_modules/rollup/dist/typings/utils/path.d.ts +6 -0
  458. data/vendor/node_modules/rollup/dist/typings/utils/promise.d.ts +2 -0
  459. data/vendor/node_modules/rollup/dist/typings/utils/relativeId.d.ts +1 -0
  460. data/vendor/node_modules/rollup/dist/typings/utils/renderHelpers.d.ts +26 -0
  461. data/vendor/node_modules/rollup/dist/typings/utils/sourceMappingURL.d.ts +3 -0
  462. data/vendor/node_modules/rollup/dist/typings/utils/timers.d.ts +7 -0
  463. data/vendor/node_modules/rollup/dist/typings/utils/transform.d.ts +25 -0
  464. data/vendor/node_modules/rollup/dist/typings/utils/transformBundle.d.ts +3 -0
  465. data/vendor/node_modules/rollup/dist/typings/watch/chokidar.d.ts +3 -0
  466. data/vendor/node_modules/rollup/dist/typings/watch/fileWatchers.d.ts +14 -0
  467. data/vendor/node_modules/rollup/dist/typings/watch/index.d.ts +47 -0
  468. data/vendor/node_modules/rollup/package.json +122 -0
  469. data/vendor/node_modules/rollup/typings/package.json.d.ts +3 -0
  470. data/vendor/node_modules/signal-exit/index.js +157 -0
  471. data/vendor/node_modules/signal-exit/package.json +38 -0
  472. data/vendor/node_modules/signal-exit/signals.js +53 -0
  473. data/vendor/node_modules/source-map/dist/source-map.debug.js +3091 -0
  474. data/vendor/node_modules/source-map/dist/source-map.js +3090 -0
  475. data/vendor/node_modules/source-map/dist/source-map.min.js +2 -0
  476. data/vendor/node_modules/source-map/lib/array-set.js +121 -0
  477. data/vendor/node_modules/source-map/lib/base64-vlq.js +140 -0
  478. data/vendor/node_modules/source-map/lib/base64.js +67 -0
  479. data/vendor/node_modules/source-map/lib/binary-search.js +111 -0
  480. data/vendor/node_modules/source-map/lib/mapping-list.js +79 -0
  481. data/vendor/node_modules/source-map/lib/quick-sort.js +114 -0
  482. data/vendor/node_modules/source-map/lib/source-map-consumer.js +1082 -0
  483. data/vendor/node_modules/source-map/lib/source-map-generator.js +416 -0
  484. data/vendor/node_modules/source-map/lib/source-node.js +413 -0
  485. data/vendor/node_modules/source-map/lib/util.js +417 -0
  486. data/vendor/node_modules/source-map/package.json +72 -0
  487. data/vendor/node_modules/source-map/source-map.js +8 -0
  488. data/vendor/node_modules/sourcemap-codec/dist/sourcemap-codec.es.js +129 -0
  489. data/vendor/node_modules/sourcemap-codec/dist/sourcemap-codec.umd.js +140 -0
  490. data/vendor/node_modules/sourcemap-codec/dist/types/sourcemap-codec.d.ts +5 -0
  491. data/vendor/node_modules/sourcemap-codec/package.json +52 -0
  492. data/vendor/node_modules/supports-color/browser.js +5 -0
  493. data/vendor/node_modules/supports-color/index.js +135 -0
  494. data/vendor/node_modules/supports-color/package.json +53 -0
  495. data/vendor/node_modules/time-zone/index.js +10 -0
  496. data/vendor/node_modules/time-zone/package.json +35 -0
  497. data/vendor/node_modules/vlq/dist/types/vlq.d.ts +2 -0
  498. data/vendor/node_modules/vlq/dist/vlq.es.js +64 -0
  499. data/vendor/node_modules/vlq/dist/vlq.js +75 -0
  500. data/vendor/node_modules/vlq/package.json +30 -0
  501. data/vendor/package.json +15 -0
  502. data/vendor/yarn.lock +453 -0
  503. metadata +641 -0
@@ -0,0 +1,1296 @@
1
+ import { encode } from 'vlq';
2
+
3
+ function Chunk ( start, end, content ) {
4
+ this.start = start;
5
+ this.end = end;
6
+ this.original = content;
7
+
8
+ this.intro = '';
9
+ this.outro = '';
10
+
11
+ this.content = content;
12
+ this.storeName = false;
13
+ this.edited = false;
14
+
15
+ // we make these non-enumerable, for sanity while debugging
16
+ Object.defineProperties( this, {
17
+ previous: { writable: true, value: null },
18
+ next: { writable: true, value: null }
19
+ });
20
+ }
21
+
22
+ Chunk.prototype = {
23
+ appendLeft: function appendLeft ( content ) {
24
+ this.outro += content;
25
+ },
26
+
27
+ appendRight: function appendRight ( content ) {
28
+ this.intro = this.intro + content;
29
+ },
30
+
31
+ clone: function clone () {
32
+ var chunk = new Chunk( this.start, this.end, this.original );
33
+
34
+ chunk.intro = this.intro;
35
+ chunk.outro = this.outro;
36
+ chunk.content = this.content;
37
+ chunk.storeName = this.storeName;
38
+ chunk.edited = this.edited;
39
+
40
+ return chunk;
41
+ },
42
+
43
+ contains: function contains ( index ) {
44
+ return this.start < index && index < this.end;
45
+ },
46
+
47
+ eachNext: function eachNext ( fn ) {
48
+ var chunk = this;
49
+ while ( chunk ) {
50
+ fn( chunk );
51
+ chunk = chunk.next;
52
+ }
53
+ },
54
+
55
+ eachPrevious: function eachPrevious ( fn ) {
56
+ var chunk = this;
57
+ while ( chunk ) {
58
+ fn( chunk );
59
+ chunk = chunk.previous;
60
+ }
61
+ },
62
+
63
+ edit: function edit ( content, storeName, contentOnly ) {
64
+ this.content = content;
65
+ if ( !contentOnly ) {
66
+ this.intro = '';
67
+ this.outro = '';
68
+ }
69
+ this.storeName = storeName;
70
+
71
+ this.edited = true;
72
+
73
+ return this;
74
+ },
75
+
76
+ prependLeft: function prependLeft ( content ) {
77
+ this.outro = content + this.outro;
78
+ },
79
+
80
+ prependRight: function prependRight ( content ) {
81
+ this.intro = content + this.intro;
82
+ },
83
+
84
+ split: function split ( index ) {
85
+ var sliceIndex = index - this.start;
86
+
87
+ var originalBefore = this.original.slice( 0, sliceIndex );
88
+ var originalAfter = this.original.slice( sliceIndex );
89
+
90
+ this.original = originalBefore;
91
+
92
+ var newChunk = new Chunk( index, this.end, originalAfter );
93
+ newChunk.outro = this.outro;
94
+ this.outro = '';
95
+
96
+ this.end = index;
97
+
98
+ if ( this.edited ) {
99
+ // TODO is this block necessary?...
100
+ newChunk.edit( '', false );
101
+ this.content = '';
102
+ } else {
103
+ this.content = originalBefore;
104
+ }
105
+
106
+ newChunk.next = this.next;
107
+ if ( newChunk.next ) { newChunk.next.previous = newChunk; }
108
+ newChunk.previous = this;
109
+ this.next = newChunk;
110
+
111
+ return newChunk;
112
+ },
113
+
114
+ toString: function toString () {
115
+ return this.intro + this.content + this.outro;
116
+ },
117
+
118
+ trimEnd: function trimEnd ( rx ) {
119
+ this.outro = this.outro.replace( rx, '' );
120
+ if ( this.outro.length ) { return true; }
121
+
122
+ var trimmed = this.content.replace( rx, '' );
123
+
124
+ if ( trimmed.length ) {
125
+ if ( trimmed !== this.content ) {
126
+ this.split( this.start + trimmed.length ).edit( '', false );
127
+ }
128
+
129
+ return true;
130
+ } else {
131
+ this.edit( '', false );
132
+
133
+ this.intro = this.intro.replace( rx, '' );
134
+ if ( this.intro.length ) { return true; }
135
+ }
136
+ },
137
+
138
+ trimStart: function trimStart ( rx ) {
139
+ this.intro = this.intro.replace( rx, '' );
140
+ if ( this.intro.length ) { return true; }
141
+
142
+ var trimmed = this.content.replace( rx, '' );
143
+
144
+ if ( trimmed.length ) {
145
+ if ( trimmed !== this.content ) {
146
+ this.split( this.end - trimmed.length );
147
+ this.edit( '', false );
148
+ }
149
+
150
+ return true;
151
+ } else {
152
+ this.edit( '', false );
153
+
154
+ this.outro = this.outro.replace( rx, '' );
155
+ if ( this.outro.length ) { return true; }
156
+ }
157
+ }
158
+ };
159
+
160
+ var _btoa;
161
+
162
+ if ( typeof window !== 'undefined' && typeof window.btoa === 'function' ) {
163
+ _btoa = window.btoa;
164
+ } else if ( typeof Buffer === 'function' ) {
165
+ _btoa = function (str) { return new Buffer( str ).toString( 'base64' ); };
166
+ } else {
167
+ _btoa = function () {
168
+ throw new Error( 'Unsupported environment: `window.btoa` or `Buffer` should be supported.' );
169
+ };
170
+ }
171
+
172
+ var btoa = _btoa;
173
+
174
+ function SourceMap ( properties ) {
175
+ this.version = 3;
176
+
177
+ this.file = properties.file;
178
+ this.sources = properties.sources;
179
+ this.sourcesContent = properties.sourcesContent;
180
+ this.names = properties.names;
181
+ this.mappings = properties.mappings;
182
+ }
183
+
184
+ SourceMap.prototype = {
185
+ toString: function toString () {
186
+ return JSON.stringify( this );
187
+ },
188
+
189
+ toUrl: function toUrl () {
190
+ return 'data:application/json;charset=utf-8;base64,' + btoa( this.toString() );
191
+ }
192
+ };
193
+
194
+ function guessIndent ( code ) {
195
+ var lines = code.split( '\n' );
196
+
197
+ var tabbed = lines.filter( function (line) { return /^\t+/.test( line ); } );
198
+ var spaced = lines.filter( function (line) { return /^ {2,}/.test( line ); } );
199
+
200
+ if ( tabbed.length === 0 && spaced.length === 0 ) {
201
+ return null;
202
+ }
203
+
204
+ // More lines tabbed than spaced? Assume tabs, and
205
+ // default to tabs in the case of a tie (or nothing
206
+ // to go on)
207
+ if ( tabbed.length >= spaced.length ) {
208
+ return '\t';
209
+ }
210
+
211
+ // Otherwise, we need to guess the multiple
212
+ var min = spaced.reduce( function ( previous, current ) {
213
+ var numSpaces = /^ +/.exec( current )[0].length;
214
+ return Math.min( numSpaces, previous );
215
+ }, Infinity );
216
+
217
+ return new Array( min + 1 ).join( ' ' );
218
+ }
219
+
220
+ function getRelativePath ( from, to ) {
221
+ var fromParts = from.split( /[\/\\]/ );
222
+ var toParts = to.split( /[\/\\]/ );
223
+
224
+ fromParts.pop(); // get dirname
225
+
226
+ while ( fromParts[0] === toParts[0] ) {
227
+ fromParts.shift();
228
+ toParts.shift();
229
+ }
230
+
231
+ if ( fromParts.length ) {
232
+ var i = fromParts.length;
233
+ while ( i-- ) { fromParts[i] = '..'; }
234
+ }
235
+
236
+ return fromParts.concat( toParts ).join( '/' );
237
+ }
238
+
239
+ var toString = Object.prototype.toString;
240
+
241
+ function isObject ( thing ) {
242
+ return toString.call( thing ) === '[object Object]';
243
+ }
244
+
245
+ function getLocator ( source ) {
246
+ var originalLines = source.split( '\n' );
247
+
248
+ var start = 0;
249
+ var lineRanges = originalLines.map( function ( line, i ) {
250
+ var end = start + line.length + 1;
251
+ var range = { start: start, end: end, line: i };
252
+
253
+ start = end;
254
+ return range;
255
+ });
256
+
257
+ var i = 0;
258
+
259
+ function rangeContains ( range, index ) {
260
+ return range.start <= index && index < range.end;
261
+ }
262
+
263
+ function getLocation ( range, index ) {
264
+ return { line: range.line, column: index - range.start };
265
+ }
266
+
267
+ return function locate ( index ) {
268
+ var range = lineRanges[i];
269
+
270
+ var d = index >= range.end ? 1 : -1;
271
+
272
+ while ( range ) {
273
+ if ( rangeContains( range, index ) ) { return getLocation( range, index ); }
274
+
275
+ i += d;
276
+ range = lineRanges[i];
277
+ }
278
+ };
279
+ }
280
+
281
+ function Mappings ( hires ) {
282
+ var this$1 = this;
283
+
284
+ var offsets = {
285
+ generatedCodeColumn: 0,
286
+ sourceIndex: 0,
287
+ sourceCodeLine: 0,
288
+ sourceCodeColumn: 0,
289
+ sourceCodeName: 0
290
+ };
291
+
292
+ var generatedCodeLine = 0;
293
+ var generatedCodeColumn = 0;
294
+
295
+ this.raw = [];
296
+ var rawSegments = this.raw[ generatedCodeLine ] = [];
297
+
298
+ var pending = null;
299
+
300
+ this.addEdit = function ( sourceIndex, content, original, loc, nameIndex ) {
301
+ if ( content.length ) {
302
+ rawSegments.push([
303
+ generatedCodeColumn,
304
+ sourceIndex,
305
+ loc.line,
306
+ loc.column,
307
+ nameIndex ]);
308
+ } else if ( pending ) {
309
+ rawSegments.push( pending );
310
+ }
311
+
312
+ this$1.advance( content );
313
+ pending = null;
314
+ };
315
+
316
+ this.addUneditedChunk = function ( sourceIndex, chunk, original, loc, sourcemapLocations ) {
317
+ var originalCharIndex = chunk.start;
318
+ var first = true;
319
+
320
+ while ( originalCharIndex < chunk.end ) {
321
+ if ( hires || first || sourcemapLocations[ originalCharIndex ] ) {
322
+ rawSegments.push([
323
+ generatedCodeColumn,
324
+ sourceIndex,
325
+ loc.line,
326
+ loc.column,
327
+ -1
328
+ ]);
329
+ }
330
+
331
+ if ( original[ originalCharIndex ] === '\n' ) {
332
+ loc.line += 1;
333
+ loc.column = 0;
334
+ generatedCodeLine += 1;
335
+ this$1.raw[ generatedCodeLine ] = rawSegments = [];
336
+ generatedCodeColumn = 0;
337
+ } else {
338
+ loc.column += 1;
339
+ generatedCodeColumn += 1;
340
+ }
341
+
342
+ originalCharIndex += 1;
343
+ first = false;
344
+ }
345
+
346
+ pending = [
347
+ generatedCodeColumn,
348
+ sourceIndex,
349
+ loc.line,
350
+ loc.column,
351
+ -1 ];
352
+ };
353
+
354
+ this.advance = function (str) {
355
+ if ( !str ) { return; }
356
+
357
+ var lines = str.split( '\n' );
358
+ var lastLine = lines.pop();
359
+
360
+ if ( lines.length ) {
361
+ generatedCodeLine += lines.length;
362
+ this$1.raw[ generatedCodeLine ] = rawSegments = [];
363
+ generatedCodeColumn = lastLine.length;
364
+ } else {
365
+ generatedCodeColumn += lastLine.length;
366
+ }
367
+ };
368
+
369
+ this.encode = function () {
370
+ return this$1.raw.map( function (segments) {
371
+ var generatedCodeColumn = 0;
372
+
373
+ return segments.map( function (segment) {
374
+ var arr = [
375
+ segment[0] - generatedCodeColumn,
376
+ segment[1] - offsets.sourceIndex,
377
+ segment[2] - offsets.sourceCodeLine,
378
+ segment[3] - offsets.sourceCodeColumn
379
+ ];
380
+
381
+ generatedCodeColumn = segment[0];
382
+ offsets.sourceIndex = segment[1];
383
+ offsets.sourceCodeLine = segment[2];
384
+ offsets.sourceCodeColumn = segment[3];
385
+
386
+ if ( ~segment[4] ) {
387
+ arr.push( segment[4] - offsets.sourceCodeName );
388
+ offsets.sourceCodeName = segment[4];
389
+ }
390
+
391
+ return encode( arr );
392
+ }).join( ',' );
393
+ }).join( ';' );
394
+ };
395
+ }
396
+
397
+ var Stats = function Stats () {
398
+ Object.defineProperties( this, {
399
+ startTimes: { value: {} }
400
+ });
401
+ };
402
+
403
+ Stats.prototype.time = function time ( label ) {
404
+ this.startTimes[ label ] = process.hrtime();
405
+ };
406
+
407
+ Stats.prototype.timeEnd = function timeEnd ( label ) {
408
+ var elapsed = process.hrtime( this.startTimes[ label ] );
409
+
410
+ if ( !this[ label ] ) { this[ label ] = 0; }
411
+ this[ label ] += elapsed[0] * 1e3 + elapsed[1] * 1e-6;
412
+ };
413
+
414
+ var warned = {
415
+ insertLeft: false,
416
+ insertRight: false,
417
+ storeName: false
418
+ };
419
+
420
+ function MagicString$1 ( string, options ) {
421
+ if ( options === void 0 ) options = {};
422
+
423
+ var chunk = new Chunk( 0, string.length, string );
424
+
425
+ Object.defineProperties( this, {
426
+ original: { writable: true, value: string },
427
+ outro: { writable: true, value: '' },
428
+ intro: { writable: true, value: '' },
429
+ firstChunk: { writable: true, value: chunk },
430
+ lastChunk: { writable: true, value: chunk },
431
+ lastSearchedChunk: { writable: true, value: chunk },
432
+ byStart: { writable: true, value: {} },
433
+ byEnd: { writable: true, value: {} },
434
+ filename: { writable: true, value: options.filename },
435
+ indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
436
+ sourcemapLocations: { writable: true, value: {} },
437
+ storedNames: { writable: true, value: {} },
438
+ indentStr: { writable: true, value: guessIndent( string ) }
439
+ });
440
+
441
+ this.byStart[ 0 ] = chunk;
442
+ this.byEnd[ string.length ] = chunk;
443
+ }
444
+
445
+ MagicString$1.prototype = {
446
+ addSourcemapLocation: function addSourcemapLocation ( char ) {
447
+ this.sourcemapLocations[ char ] = true;
448
+ },
449
+
450
+ append: function append ( content ) {
451
+ if ( typeof content !== 'string' ) { throw new TypeError( 'outro content must be a string' ); }
452
+
453
+ this.outro += content;
454
+ return this;
455
+ },
456
+
457
+ appendLeft: function appendLeft ( index, content ) {
458
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
459
+
460
+ this._split( index );
461
+
462
+ var chunk = this.byEnd[ index ];
463
+
464
+ if ( chunk ) {
465
+ chunk.appendLeft( content );
466
+ } else {
467
+ this.intro += content;
468
+ }
469
+
470
+ return this;
471
+ },
472
+
473
+ appendRight: function appendRight ( index, content ) {
474
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
475
+
476
+ this._split( index );
477
+
478
+ var chunk = this.byStart[ index ];
479
+
480
+ if ( chunk ) {
481
+ chunk.appendRight( content );
482
+ } else {
483
+ this.outro += content;
484
+ }
485
+
486
+ return this;
487
+ },
488
+
489
+ clone: function clone () {
490
+ var cloned = new MagicString$1( this.original, { filename: this.filename });
491
+
492
+ var originalChunk = this.firstChunk;
493
+ var clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
494
+
495
+ while ( originalChunk ) {
496
+ cloned.byStart[ clonedChunk.start ] = clonedChunk;
497
+ cloned.byEnd[ clonedChunk.end ] = clonedChunk;
498
+
499
+ var nextOriginalChunk = originalChunk.next;
500
+ var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
501
+
502
+ if ( nextClonedChunk ) {
503
+ clonedChunk.next = nextClonedChunk;
504
+ nextClonedChunk.previous = clonedChunk;
505
+
506
+ clonedChunk = nextClonedChunk;
507
+ }
508
+
509
+ originalChunk = nextOriginalChunk;
510
+ }
511
+
512
+ cloned.lastChunk = clonedChunk;
513
+
514
+ if ( this.indentExclusionRanges ) {
515
+ cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
516
+ }
517
+
518
+ Object.keys( this.sourcemapLocations ).forEach( function (loc) {
519
+ cloned.sourcemapLocations[ loc ] = true;
520
+ });
521
+
522
+ return cloned;
523
+ },
524
+
525
+ generateMap: function generateMap ( options ) {
526
+ var this$1 = this;
527
+
528
+ options = options || {};
529
+
530
+ var sourceIndex = 0;
531
+ var names = Object.keys( this.storedNames );
532
+ var mappings = new Mappings( options.hires );
533
+
534
+ var locate = getLocator( this.original );
535
+
536
+ if ( this.intro ) {
537
+ mappings.advance( this.intro );
538
+ }
539
+
540
+ this.firstChunk.eachNext( function (chunk) {
541
+ var loc = locate( chunk.start );
542
+
543
+ if ( chunk.intro.length ) { mappings.advance( chunk.intro ); }
544
+
545
+ if ( chunk.edited ) {
546
+ mappings.addEdit( sourceIndex, chunk.content, chunk.original, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
547
+ } else {
548
+ mappings.addUneditedChunk( sourceIndex, chunk, this$1.original, loc, this$1.sourcemapLocations );
549
+ }
550
+
551
+ if ( chunk.outro.length ) { mappings.advance( chunk.outro ); }
552
+ });
553
+
554
+ var map = new SourceMap({
555
+ file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
556
+ sources: [ options.source ? getRelativePath( options.file || '', options.source ) : null ],
557
+ sourcesContent: options.includeContent ? [ this.original ] : [ null ],
558
+ names: names,
559
+ mappings: mappings.encode()
560
+ });
561
+ return map;
562
+ },
563
+
564
+ getIndentString: function getIndentString () {
565
+ return this.indentStr === null ? '\t' : this.indentStr;
566
+ },
567
+
568
+ indent: function indent ( indentStr, options ) {
569
+ var this$1 = this;
570
+
571
+ var pattern = /^[^\r\n]/gm;
572
+
573
+ if ( isObject( indentStr ) ) {
574
+ options = indentStr;
575
+ indentStr = undefined;
576
+ }
577
+
578
+ indentStr = indentStr !== undefined ? indentStr : ( this.indentStr || '\t' );
579
+
580
+ if ( indentStr === '' ) { return this; } // noop
581
+
582
+ options = options || {};
583
+
584
+ // Process exclusion ranges
585
+ var isExcluded = {};
586
+
587
+ if ( options.exclude ) {
588
+ var exclusions = typeof options.exclude[0] === 'number' ? [ options.exclude ] : options.exclude;
589
+ exclusions.forEach( function (exclusion) {
590
+ for ( var i = exclusion[0]; i < exclusion[1]; i += 1 ) {
591
+ isExcluded[i] = true;
592
+ }
593
+ });
594
+ }
595
+
596
+ var shouldIndentNextCharacter = options.indentStart !== false;
597
+ var replacer = function (match) {
598
+ if ( shouldIndentNextCharacter ) { return ("" + indentStr + match); }
599
+ shouldIndentNextCharacter = true;
600
+ return match;
601
+ };
602
+
603
+ this.intro = this.intro.replace( pattern, replacer );
604
+
605
+ var charIndex = 0;
606
+
607
+ var chunk = this.firstChunk;
608
+
609
+ while ( chunk ) {
610
+ var end = chunk.end;
611
+
612
+ if ( chunk.edited ) {
613
+ if ( !isExcluded[ charIndex ] ) {
614
+ chunk.content = chunk.content.replace( pattern, replacer );
615
+
616
+ if ( chunk.content.length ) {
617
+ shouldIndentNextCharacter = chunk.content[ chunk.content.length - 1 ] === '\n';
618
+ }
619
+ }
620
+ } else {
621
+ charIndex = chunk.start;
622
+
623
+ while ( charIndex < end ) {
624
+ if ( !isExcluded[ charIndex ] ) {
625
+ var char = this$1.original[ charIndex ];
626
+
627
+ if ( char === '\n' ) {
628
+ shouldIndentNextCharacter = true;
629
+ } else if ( char !== '\r' && shouldIndentNextCharacter ) {
630
+ shouldIndentNextCharacter = false;
631
+
632
+ if ( charIndex === chunk.start ) {
633
+ chunk.prependRight( indentStr );
634
+ } else {
635
+ this$1._splitChunk( chunk, charIndex );
636
+ chunk = chunk.next;
637
+ chunk.prependRight( indentStr );
638
+ }
639
+ }
640
+ }
641
+
642
+ charIndex += 1;
643
+ }
644
+ }
645
+
646
+ charIndex = chunk.end;
647
+ chunk = chunk.next;
648
+ }
649
+
650
+ this.outro = this.outro.replace( pattern, replacer );
651
+
652
+ return this;
653
+ },
654
+
655
+ insert: function insert () {
656
+ throw new Error( 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)' );
657
+ },
658
+
659
+ insertLeft: function insertLeft ( index, content ) {
660
+ if ( !warned.insertLeft ) {
661
+ console.warn( 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead' ); // eslint-disable-line no-console
662
+ warned.insertLeft = true;
663
+ }
664
+
665
+ return this.appendLeft( index, content );
666
+ },
667
+
668
+ insertRight: function insertRight ( index, content ) {
669
+ if ( !warned.insertRight ) {
670
+ console.warn( 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead' ); // eslint-disable-line no-console
671
+ warned.insertRight = true;
672
+ }
673
+
674
+ return this.prependRight( index, content );
675
+ },
676
+
677
+ move: function move ( start, end, index ) {
678
+ if ( index >= start && index <= end ) { throw new Error( 'Cannot move a selection inside itself' ); }
679
+
680
+ this._split( start );
681
+ this._split( end );
682
+ this._split( index );
683
+
684
+ var first = this.byStart[ start ];
685
+ var last = this.byEnd[ end ];
686
+
687
+ var oldLeft = first.previous;
688
+ var oldRight = last.next;
689
+
690
+ var newRight = this.byStart[ index ];
691
+ if ( !newRight && last === this.lastChunk ) { return this; }
692
+ var newLeft = newRight ? newRight.previous : this.lastChunk;
693
+
694
+ if ( oldLeft ) { oldLeft.next = oldRight; }
695
+ if ( oldRight ) { oldRight.previous = oldLeft; }
696
+
697
+ if ( newLeft ) { newLeft.next = first; }
698
+ if ( newRight ) { newRight.previous = last; }
699
+
700
+ if ( !first.previous ) { this.firstChunk = last.next; }
701
+ if ( !last.next ) {
702
+ this.lastChunk = first.previous;
703
+ this.lastChunk.next = null;
704
+ }
705
+
706
+ first.previous = newLeft;
707
+ last.next = newRight || null;
708
+
709
+ if ( !newLeft ) { this.firstChunk = first; }
710
+ if ( !newRight ) { this.lastChunk = last; }
711
+
712
+ return this;
713
+ },
714
+
715
+ overwrite: function overwrite ( start, end, content, options ) {
716
+ var this$1 = this;
717
+
718
+ if ( typeof content !== 'string' ) { throw new TypeError( 'replacement content must be a string' ); }
719
+
720
+ while ( start < 0 ) { start += this$1.original.length; }
721
+ while ( end < 0 ) { end += this$1.original.length; }
722
+
723
+ if ( end > this.original.length ) { throw new Error( 'end is out of bounds' ); }
724
+ if ( start === end ) { throw new Error( 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead' ); }
725
+
726
+ this._split( start );
727
+ this._split( end );
728
+
729
+ if ( options === true ) {
730
+ if ( !warned.storeName ) {
731
+ console.warn( 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string' ); // eslint-disable-line no-console
732
+ warned.storeName = true;
733
+ }
734
+
735
+ options = { storeName: true };
736
+ }
737
+ var storeName = options !== undefined ? options.storeName : false;
738
+ var contentOnly = options !== undefined ? options.contentOnly : false;
739
+
740
+ if ( storeName ) {
741
+ var original = this.original.slice( start, end );
742
+ this.storedNames[ original ] = true;
743
+ }
744
+
745
+ var first = this.byStart[ start ];
746
+ var last = this.byEnd[ end ];
747
+
748
+ if ( first ) {
749
+ if ( end > first.end && first.next !== this.byStart[ first.end ] ) {
750
+ throw new Error( 'Cannot overwrite across a split point' );
751
+ }
752
+
753
+ first.edit( content, storeName, contentOnly );
754
+
755
+ if ( first !== last ) {
756
+ var chunk = first.next;
757
+ while ( chunk !== last ) {
758
+ chunk.edit( '', false );
759
+ chunk = chunk.next;
760
+ }
761
+
762
+ chunk.edit( '', false );
763
+ }
764
+ }
765
+
766
+ else {
767
+ // must be inserting at the end
768
+ var newChunk = new Chunk( start, end, '' ).edit( content, storeName );
769
+
770
+ // TODO last chunk in the array may not be the last chunk, if it's moved...
771
+ last.next = newChunk;
772
+ newChunk.previous = last;
773
+ }
774
+
775
+ return this;
776
+ },
777
+
778
+ prepend: function prepend ( content ) {
779
+ if ( typeof content !== 'string' ) { throw new TypeError( 'outro content must be a string' ); }
780
+
781
+ this.intro = content + this.intro;
782
+ return this;
783
+ },
784
+
785
+ prependLeft: function prependLeft ( index, content ) {
786
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
787
+
788
+ this._split( index );
789
+
790
+ var chunk = this.byEnd[ index ];
791
+
792
+ if ( chunk ) {
793
+ chunk.prependLeft( content );
794
+ } else {
795
+ this.intro = content + this.intro;
796
+ }
797
+
798
+ return this;
799
+ },
800
+
801
+ prependRight: function prependRight ( index, content ) {
802
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
803
+
804
+ this._split( index );
805
+
806
+ var chunk = this.byStart[ index ];
807
+
808
+ if ( chunk ) {
809
+ chunk.prependRight( content );
810
+ } else {
811
+ this.outro = content + this.outro;
812
+ }
813
+
814
+ return this;
815
+ },
816
+
817
+ remove: function remove ( start, end ) {
818
+ var this$1 = this;
819
+
820
+ while ( start < 0 ) { start += this$1.original.length; }
821
+ while ( end < 0 ) { end += this$1.original.length; }
822
+
823
+ if ( start === end ) { return this; }
824
+
825
+ if ( start < 0 || end > this.original.length ) { throw new Error( 'Character is out of bounds' ); }
826
+ if ( start > end ) { throw new Error( 'end must be greater than start' ); }
827
+
828
+ this._split( start );
829
+ this._split( end );
830
+
831
+ var chunk = this.byStart[ start ];
832
+
833
+ while ( chunk ) {
834
+ chunk.intro = '';
835
+ chunk.outro = '';
836
+ chunk.edit( '' );
837
+
838
+ chunk = end > chunk.end ? this$1.byStart[ chunk.end ] : null;
839
+ }
840
+
841
+ return this;
842
+ },
843
+
844
+ slice: function slice ( start, end ) {
845
+ var this$1 = this;
846
+ if ( start === void 0 ) start = 0;
847
+ if ( end === void 0 ) end = this.original.length;
848
+
849
+ while ( start < 0 ) { start += this$1.original.length; }
850
+ while ( end < 0 ) { end += this$1.original.length; }
851
+
852
+ var result = '';
853
+
854
+ // find start chunk
855
+ var chunk = this.firstChunk;
856
+ while ( chunk && ( chunk.start > start || chunk.end <= start ) ) {
857
+
858
+ // found end chunk before start
859
+ if ( chunk.start < end && chunk.end >= end ) {
860
+ return result;
861
+ }
862
+
863
+ chunk = chunk.next;
864
+ }
865
+
866
+ if ( chunk && chunk.edited && chunk.start !== start ) { throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); }
867
+
868
+ var startChunk = chunk;
869
+ while ( chunk ) {
870
+ if ( chunk.intro && ( startChunk !== chunk || chunk.start === start ) ) {
871
+ result += chunk.intro;
872
+ }
873
+
874
+ var containsEnd = chunk.start < end && chunk.end >= end;
875
+ if ( containsEnd && chunk.edited && chunk.end !== end ) { throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
876
+
877
+ var sliceStart = startChunk === chunk ? start - chunk.start : 0;
878
+ var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
879
+
880
+ result += chunk.content.slice( sliceStart, sliceEnd );
881
+
882
+ if ( chunk.outro && ( !containsEnd || chunk.end === end ) ) {
883
+ result += chunk.outro;
884
+ }
885
+
886
+ if ( containsEnd ) {
887
+ break;
888
+ }
889
+
890
+ chunk = chunk.next;
891
+ }
892
+
893
+ return result;
894
+ },
895
+
896
+ // TODO deprecate this? not really very useful
897
+ snip: function snip ( start, end ) {
898
+ var clone = this.clone();
899
+ clone.remove( 0, start );
900
+ clone.remove( end, clone.original.length );
901
+
902
+ return clone;
903
+ },
904
+
905
+ _split: function _split ( index ) {
906
+ var this$1 = this;
907
+
908
+ if ( this.byStart[ index ] || this.byEnd[ index ] ) { return; }
909
+
910
+ var chunk = this.lastSearchedChunk;
911
+ var searchForward = index > chunk.end;
912
+
913
+ while ( true ) {
914
+ if ( chunk.contains( index ) ) { return this$1._splitChunk( chunk, index ); }
915
+
916
+ chunk = searchForward ?
917
+ this$1.byStart[ chunk.end ] :
918
+ this$1.byEnd[ chunk.start ];
919
+ }
920
+ },
921
+
922
+ _splitChunk: function _splitChunk ( chunk, index ) {
923
+ if ( chunk.edited && chunk.content.length ) { // zero-length edited chunks are a special case (overlapping replacements)
924
+ var loc = getLocator( this.original )( index );
925
+ throw new Error( ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")") );
926
+ }
927
+
928
+ var newChunk = chunk.split( index );
929
+
930
+ this.byEnd[ index ] = chunk;
931
+ this.byStart[ index ] = newChunk;
932
+ this.byEnd[ newChunk.end ] = newChunk;
933
+
934
+ if ( chunk === this.lastChunk ) { this.lastChunk = newChunk; }
935
+
936
+ this.lastSearchedChunk = chunk;
937
+ return true;
938
+ },
939
+
940
+ toString: function toString () {
941
+ var str = this.intro;
942
+
943
+ var chunk = this.firstChunk;
944
+ while ( chunk ) {
945
+ str += chunk.toString();
946
+ chunk = chunk.next;
947
+ }
948
+
949
+ return str + this.outro;
950
+ },
951
+
952
+ trimLines: function trimLines () {
953
+ return this.trim('[\\r\\n]');
954
+ },
955
+
956
+ trim: function trim ( charType ) {
957
+ return this.trimStart( charType ).trimEnd( charType );
958
+ },
959
+
960
+ trimEnd: function trimEnd ( charType ) {
961
+ var this$1 = this;
962
+
963
+ var rx = new RegExp( ( charType || '\\s' ) + '+$' );
964
+
965
+ this.outro = this.outro.replace( rx, '' );
966
+ if ( this.outro.length ) { return this; }
967
+
968
+ var chunk = this.lastChunk;
969
+
970
+ do {
971
+ var end = chunk.end;
972
+ var aborted = chunk.trimEnd( rx );
973
+
974
+ // if chunk was trimmed, we have a new lastChunk
975
+ if ( chunk.end !== end ) {
976
+ if ( this$1.lastChunk === chunk ) {
977
+ this$1.lastChunk = chunk.next;
978
+ }
979
+
980
+ this$1.byEnd[ chunk.end ] = chunk;
981
+ this$1.byStart[ chunk.next.start ] = chunk.next;
982
+ this$1.byEnd[ chunk.next.end ] = chunk.next;
983
+ }
984
+
985
+ if ( aborted ) { return this$1; }
986
+ chunk = chunk.previous;
987
+ } while ( chunk );
988
+
989
+ return this;
990
+ },
991
+
992
+ trimStart: function trimStart ( charType ) {
993
+ var this$1 = this;
994
+
995
+ var rx = new RegExp( '^' + ( charType || '\\s' ) + '+' );
996
+
997
+ this.intro = this.intro.replace( rx, '' );
998
+ if ( this.intro.length ) { return this; }
999
+
1000
+ var chunk = this.firstChunk;
1001
+
1002
+ do {
1003
+ var end = chunk.end;
1004
+ var aborted = chunk.trimStart( rx );
1005
+
1006
+ if ( chunk.end !== end ) {
1007
+ // special case...
1008
+ if ( chunk === this$1.lastChunk ) { this$1.lastChunk = chunk.next; }
1009
+
1010
+ this$1.byEnd[ chunk.end ] = chunk;
1011
+ this$1.byStart[ chunk.next.start ] = chunk.next;
1012
+ this$1.byEnd[ chunk.next.end ] = chunk.next;
1013
+ }
1014
+
1015
+ if ( aborted ) { return this$1; }
1016
+ chunk = chunk.next;
1017
+ } while ( chunk );
1018
+
1019
+ return this;
1020
+ }
1021
+ };
1022
+
1023
+ var hasOwnProp = Object.prototype.hasOwnProperty;
1024
+
1025
+ function Bundle ( options ) {
1026
+ if ( options === void 0 ) options = {};
1027
+
1028
+ this.intro = options.intro || '';
1029
+ this.separator = options.separator !== undefined ? options.separator : '\n';
1030
+
1031
+ this.sources = [];
1032
+
1033
+ this.uniqueSources = [];
1034
+ this.uniqueSourceIndexByFilename = {};
1035
+ }
1036
+
1037
+ Bundle.prototype = {
1038
+ addSource: function addSource ( source ) {
1039
+ if ( source instanceof MagicString$1 ) {
1040
+ return this.addSource({
1041
+ content: source,
1042
+ filename: source.filename,
1043
+ separator: this.separator
1044
+ });
1045
+ }
1046
+
1047
+ if ( !isObject( source ) || !source.content ) {
1048
+ throw new Error( 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`' );
1049
+ }
1050
+
1051
+ [ 'filename', 'indentExclusionRanges', 'separator' ].forEach( function (option) {
1052
+ if ( !hasOwnProp.call( source, option ) ) { source[ option ] = source.content[ option ]; }
1053
+ });
1054
+
1055
+ if ( source.separator === undefined ) { // TODO there's a bunch of this sort of thing, needs cleaning up
1056
+ source.separator = this.separator;
1057
+ }
1058
+
1059
+ if ( source.filename ) {
1060
+ if ( !hasOwnProp.call( this.uniqueSourceIndexByFilename, source.filename ) ) {
1061
+ this.uniqueSourceIndexByFilename[ source.filename ] = this.uniqueSources.length;
1062
+ this.uniqueSources.push({ filename: source.filename, content: source.content.original });
1063
+ } else {
1064
+ var uniqueSource = this.uniqueSources[ this.uniqueSourceIndexByFilename[ source.filename ] ];
1065
+ if ( source.content.original !== uniqueSource.content ) {
1066
+ throw new Error( ("Illegal source: same filename (" + (source.filename) + "), different contents") );
1067
+ }
1068
+ }
1069
+ }
1070
+
1071
+ this.sources.push( source );
1072
+ return this;
1073
+ },
1074
+
1075
+ append: function append ( str, options ) {
1076
+ this.addSource({
1077
+ content: new MagicString$1( str ),
1078
+ separator: ( options && options.separator ) || ''
1079
+ });
1080
+
1081
+ return this;
1082
+ },
1083
+
1084
+ clone: function clone () {
1085
+ var bundle = new Bundle({
1086
+ intro: this.intro,
1087
+ separator: this.separator
1088
+ });
1089
+
1090
+ this.sources.forEach( function (source) {
1091
+ bundle.addSource({
1092
+ filename: source.filename,
1093
+ content: source.content.clone(),
1094
+ separator: source.separator
1095
+ });
1096
+ });
1097
+
1098
+ return bundle;
1099
+ },
1100
+
1101
+ generateMap: function generateMap ( options ) {
1102
+ var this$1 = this;
1103
+ if ( options === void 0 ) options = {};
1104
+
1105
+ var names = [];
1106
+ this.sources.forEach( function (source) {
1107
+ Object.keys( source.content.storedNames ).forEach( function (name) {
1108
+ if ( !~names.indexOf( name ) ) { names.push( name ); }
1109
+ });
1110
+ });
1111
+
1112
+ var mappings = new Mappings( options.hires );
1113
+
1114
+ if ( this.intro ) {
1115
+ mappings.advance( this.intro );
1116
+ }
1117
+
1118
+ this.sources.forEach( function ( source, i ) {
1119
+ if ( i > 0 ) {
1120
+ mappings.advance( this$1.separator );
1121
+ }
1122
+
1123
+ var sourceIndex = source.filename ? this$1.uniqueSourceIndexByFilename[ source.filename ] : -1;
1124
+ var magicString = source.content;
1125
+ var locate = getLocator( magicString.original );
1126
+
1127
+ if ( magicString.intro ) {
1128
+ mappings.advance( magicString.intro );
1129
+ }
1130
+
1131
+ magicString.firstChunk.eachNext( function (chunk) {
1132
+ var loc = locate( chunk.start );
1133
+
1134
+ if ( chunk.intro.length ) { mappings.advance( chunk.intro ); }
1135
+
1136
+ if ( source.filename ) {
1137
+ if ( chunk.edited ) {
1138
+ mappings.addEdit( sourceIndex, chunk.content, chunk.original, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
1139
+ } else {
1140
+ mappings.addUneditedChunk( sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations );
1141
+ }
1142
+ }
1143
+
1144
+ else {
1145
+ mappings.advance( chunk.content );
1146
+ }
1147
+
1148
+ if ( chunk.outro.length ) { mappings.advance( chunk.outro ); }
1149
+ });
1150
+
1151
+ if ( magicString.outro ) {
1152
+ mappings.advance( magicString.outro );
1153
+ }
1154
+ });
1155
+
1156
+ return new SourceMap({
1157
+ file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
1158
+ sources: this.uniqueSources.map( function (source) {
1159
+ return options.file ? getRelativePath( options.file, source.filename ) : source.filename;
1160
+ }),
1161
+ sourcesContent: this.uniqueSources.map( function (source) {
1162
+ return options.includeContent ? source.content : null;
1163
+ }),
1164
+ names: names,
1165
+ mappings: mappings.encode()
1166
+ });
1167
+ },
1168
+
1169
+ getIndentString: function getIndentString () {
1170
+ var indentStringCounts = {};
1171
+
1172
+ this.sources.forEach( function (source) {
1173
+ var indentStr = source.content.indentStr;
1174
+
1175
+ if ( indentStr === null ) { return; }
1176
+
1177
+ if ( !indentStringCounts[ indentStr ] ) { indentStringCounts[ indentStr ] = 0; }
1178
+ indentStringCounts[ indentStr ] += 1;
1179
+ });
1180
+
1181
+ return ( Object.keys( indentStringCounts ).sort( function ( a, b ) {
1182
+ return indentStringCounts[a] - indentStringCounts[b];
1183
+ })[0] ) || '\t';
1184
+ },
1185
+
1186
+ indent: function indent ( indentStr ) {
1187
+ var this$1 = this;
1188
+
1189
+ if ( !arguments.length ) {
1190
+ indentStr = this.getIndentString();
1191
+ }
1192
+
1193
+ if ( indentStr === '' ) { return this; } // noop
1194
+
1195
+ var trailingNewline = !this.intro || this.intro.slice( -1 ) === '\n';
1196
+
1197
+ this.sources.forEach( function ( source, i ) {
1198
+ var separator = source.separator !== undefined ? source.separator : this$1.separator;
1199
+ var indentStart = trailingNewline || ( i > 0 && /\r?\n$/.test( separator ) );
1200
+
1201
+ source.content.indent( indentStr, {
1202
+ exclude: source.indentExclusionRanges,
1203
+ indentStart: indentStart//: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
1204
+ });
1205
+
1206
+ // TODO this is a very slow way to determine this
1207
+ trailingNewline = source.content.toString().slice( 0, -1 ) === '\n';
1208
+ });
1209
+
1210
+ if ( this.intro ) {
1211
+ this.intro = indentStr + this.intro.replace( /^[^\n]/gm, function ( match, index ) {
1212
+ return index > 0 ? indentStr + match : match;
1213
+ });
1214
+ }
1215
+
1216
+ return this;
1217
+ },
1218
+
1219
+ prepend: function prepend ( str ) {
1220
+ this.intro = str + this.intro;
1221
+ return this;
1222
+ },
1223
+
1224
+ toString: function toString () {
1225
+ var this$1 = this;
1226
+
1227
+ var body = this.sources.map( function ( source, i ) {
1228
+ var separator = source.separator !== undefined ? source.separator : this$1.separator;
1229
+ var str = ( i > 0 ? separator : '' ) + source.content.toString();
1230
+
1231
+ return str;
1232
+ }).join( '' );
1233
+
1234
+ return this.intro + body;
1235
+ },
1236
+
1237
+ trimLines: function trimLines () {
1238
+ return this.trim('[\\r\\n]');
1239
+ },
1240
+
1241
+ trim: function trim ( charType ) {
1242
+ return this.trimStart( charType ).trimEnd( charType );
1243
+ },
1244
+
1245
+ trimStart: function trimStart ( charType ) {
1246
+ var this$1 = this;
1247
+
1248
+ var rx = new RegExp( '^' + ( charType || '\\s' ) + '+' );
1249
+ this.intro = this.intro.replace( rx, '' );
1250
+
1251
+ if ( !this.intro ) {
1252
+ var source;
1253
+ var i = 0;
1254
+
1255
+ do {
1256
+ source = this$1.sources[i];
1257
+
1258
+ if ( !source ) {
1259
+ break;
1260
+ }
1261
+
1262
+ source.content.trimStart( charType );
1263
+ i += 1;
1264
+ } while ( source.content.toString() === '' ); // TODO faster way to determine non-empty source?
1265
+ }
1266
+
1267
+ return this;
1268
+ },
1269
+
1270
+ trimEnd: function trimEnd ( charType ) {
1271
+ var this$1 = this;
1272
+
1273
+ var rx = new RegExp( ( charType || '\\s' ) + '+$' );
1274
+
1275
+ var source;
1276
+ var i = this.sources.length - 1;
1277
+
1278
+ do {
1279
+ source = this$1.sources[i];
1280
+
1281
+ if ( !source ) {
1282
+ this$1.intro = this$1.intro.replace( rx, '' );
1283
+ break;
1284
+ }
1285
+
1286
+ source.content.trimEnd( charType );
1287
+ i -= 1;
1288
+ } while ( source.content.toString() === '' ); // TODO faster way to determine non-empty source?
1289
+
1290
+ return this;
1291
+ }
1292
+ };
1293
+
1294
+ export { Bundle };
1295
+ export default MagicString$1;
1296
+ //# sourceMappingURL=magic-string.es.js.map