@kumologica/sdk 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (540) hide show
  1. package/README.md +1 -0
  2. package/bin/kl.js +3 -0
  3. package/cli/cli.js +6 -0
  4. package/cli/commands/build-commands/aws.js +49 -0
  5. package/cli/commands/build-commands/azure.js +43 -0
  6. package/cli/commands/build-commands/kumohub.js +7 -0
  7. package/cli/commands/build.js +6 -0
  8. package/cli/commands/create.js +32 -0
  9. package/cli/commands/deploy-commands/kumohub.js +114 -0
  10. package/cli/commands/deploy.js +6 -0
  11. package/cli/commands/doc-commands/html.js +61 -0
  12. package/cli/commands/doc.js +6 -0
  13. package/cli/commands/export-commands/cloudformation.js +338 -0
  14. package/cli/commands/export-commands/serverless.js +164 -0
  15. package/cli/commands/export-commands/terraform-commands/aws.js +193 -0
  16. package/cli/commands/export-commands/terraform-commands/azure.js +148 -0
  17. package/cli/commands/export-commands/terraform.js +6 -0
  18. package/cli/commands/export-commands/utils/validator.js +152 -0
  19. package/cli/commands/export.js +6 -0
  20. package/cli/commands/import-commands/mulesoft.js +61 -0
  21. package/cli/commands/import.js +6 -0
  22. package/cli/commands/open.js +46 -0
  23. package/cli/commands/test-utils/TestSuiteController.js +359 -0
  24. package/cli/commands/test-utils/TestSuiteController.test.js +171 -0
  25. package/cli/commands/test-utils/fixtures/example3-flow.json +148 -0
  26. package/cli/commands/test-utils/fixtures/package.json +6 -0
  27. package/cli/commands/test-utils/fixtures/s3-event.js +43 -0
  28. package/cli/commands/test-utils/util/output.js +14 -0
  29. package/cli/commands/test-utils/util/updates/index.js +17 -0
  30. package/cli/commands/test-utils/util/updates/pkg.js +13 -0
  31. package/cli/commands/test-utils/util/updates/templates/default-settings.js +209 -0
  32. package/cli/commands/test.js +66 -0
  33. package/cli/commands/utils.js +14 -0
  34. package/package.json +158 -0
  35. package/src/app/lib/aws/aws-profile.js +43 -0
  36. package/src/app/lib/aws/ca-alexa-api.js +29 -0
  37. package/src/app/lib/aws/ca-apigw-api.js +216 -0
  38. package/src/app/lib/aws/ca-cloudwatch-api.js +78 -0
  39. package/src/app/lib/aws/ca-codecommit-api.js +63 -0
  40. package/src/app/lib/aws/ca-dynamodb-api.js +27 -0
  41. package/src/app/lib/aws/ca-elb-api.js +44 -0
  42. package/src/app/lib/aws/ca-events-api.js +27 -0
  43. package/src/app/lib/aws/ca-iot-api.js +105 -0
  44. package/src/app/lib/aws/ca-s3-api.js +115 -0
  45. package/src/app/lib/aws/ca-sns-api.js +38 -0
  46. package/src/app/lib/aws/ca-sqs-api.js +51 -0
  47. package/src/app/lib/aws/cf.js +439 -0
  48. package/src/app/lib/aws/index.js +970 -0
  49. package/src/app/lib/aws/kl-iam-api.js +27 -0
  50. package/src/app/lib/aws/kl-rekognition-api.js +66 -0
  51. package/src/app/lib/aws/kl-ssm-api.js +24 -0
  52. package/src/app/lib/azure/index.js +80 -0
  53. package/src/app/lib/dependencies.js +50 -0
  54. package/src/app/lib/kumohub/index.js +201 -0
  55. package/src/app/lib/runtime-loader/index.js +42 -0
  56. package/src/app/lib/serverless/index.js +318 -0
  57. package/src/app/lib/stores/aws-cloud-config-store.js +35 -0
  58. package/src/app/lib/stores/azure-config-store.js +24 -0
  59. package/src/app/lib/stores/kumohub-config-store.js +24 -0
  60. package/src/app/lib/stores/project-info-config-store.js +26 -0
  61. package/src/app/lib/stores/settings-cloud-store.js +117 -0
  62. package/src/app/lib/stores/settings-cloud-store.spec.js +26 -0
  63. package/src/app/lib/stores/settings-network-store.js +119 -0
  64. package/src/app/lib/stores/settings-network-store.spec.js +27 -0
  65. package/src/app/lib/stores/store.js +97 -0
  66. package/src/app/lib/stores/test-config-store.js +26 -0
  67. package/src/app/lib/stores/user-preference-store.js +44 -0
  68. package/src/app/lib/utils/editor.js +98 -0
  69. package/src/app/lib/utils/fix-path.js +15 -0
  70. package/src/app/main-process/favicon.ico +0 -0
  71. package/src/app/main-process/main-window.js +209 -0
  72. package/src/app/main-process/menu.js +219 -0
  73. package/src/app/main-process/modal-home.js +118 -0
  74. package/src/app/main-process/modal-newproject.js +119 -0
  75. package/src/app/main-process/modal-nodelibrary.js +90 -0
  76. package/src/app/main-process/modal-welcome.js +114 -0
  77. package/src/app/main-process/runtime-manager.js +141 -0
  78. package/src/app/main.js +590 -0
  79. package/src/app/preload.js +633 -0
  80. package/src/app/ui/editor-api/lib/admin/context.js +42 -0
  81. package/src/app/ui/editor-api/lib/admin/flow.js +55 -0
  82. package/src/app/ui/editor-api/lib/admin/flows.js +53 -0
  83. package/src/app/ui/editor-api/lib/admin/index.js +155 -0
  84. package/src/app/ui/editor-api/lib/admin/nodes.js +164 -0
  85. package/src/app/ui/editor-api/lib/auth/clients.js +17 -0
  86. package/src/app/ui/editor-api/lib/auth/index.js +267 -0
  87. package/src/app/ui/editor-api/lib/auth/permissions.js +51 -0
  88. package/src/app/ui/editor-api/lib/auth/strategies.js +144 -0
  89. package/src/app/ui/editor-api/lib/auth/tokens.js +138 -0
  90. package/src/app/ui/editor-api/lib/auth/users.js +122 -0
  91. package/src/app/ui/editor-api/lib/editor/comms.js +247 -0
  92. package/src/app/ui/editor-api/lib/editor/credentials.js +22 -0
  93. package/src/app/ui/editor-api/lib/editor/index.js +234 -0
  94. package/src/app/ui/editor-api/lib/editor/library.js +69 -0
  95. package/src/app/ui/editor-api/lib/editor/locales.js +37 -0
  96. package/src/app/ui/editor-api/lib/editor/projects.js +497 -0
  97. package/src/app/ui/editor-api/lib/editor/settings.js +118 -0
  98. package/src/app/ui/editor-api/lib/editor/sshkeys.js +87 -0
  99. package/src/app/ui/editor-api/lib/editor/theme.js +184 -0
  100. package/src/app/ui/editor-api/lib/editor/ui.js +149 -0
  101. package/src/app/ui/editor-api/lib/index.js +149 -0
  102. package/src/app/ui/editor-api/lib/runner/index.js +81 -0
  103. package/src/app/ui/editor-api/lib/util.js +51 -0
  104. package/src/app/ui/editor-client/README.md +10 -0
  105. package/src/app/ui/editor-client/constants.js +5 -0
  106. package/src/app/ui/editor-client/index.js +3 -0
  107. package/src/app/ui/editor-client/public/favicon.ico +0 -0
  108. package/src/app/ui/editor-client/public/red/images/bolt.png +0 -0
  109. package/src/app/ui/editor-client/public/red/images/debugger/continue-full.png +0 -0
  110. package/src/app/ui/editor-client/public/red/images/debugger/continue-outline.png +0 -0
  111. package/src/app/ui/editor-client/public/red/images/debugger/pause.png +0 -0
  112. package/src/app/ui/editor-client/public/red/images/debugger/restart.png +0 -0
  113. package/src/app/ui/editor-client/public/red/images/debugger/stepover.png +0 -0
  114. package/src/app/ui/editor-client/public/red/images/debugger/stop.png +0 -0
  115. package/src/app/ui/editor-client/public/red/images/deploy-flows-o.png +0 -0
  116. package/src/app/ui/editor-client/public/red/images/deploy-flows.png +0 -0
  117. package/src/app/ui/editor-client/public/red/images/deploy-full-o.png +0 -0
  118. package/src/app/ui/editor-client/public/red/images/deploy-full.png +0 -0
  119. package/src/app/ui/editor-client/public/red/images/deploy-nodes-o.png +0 -0
  120. package/src/app/ui/editor-client/public/red/images/deploy-nodes.png +0 -0
  121. package/src/app/ui/editor-client/public/red/images/deploy-reload.png +0 -0
  122. package/src/app/ui/editor-client/public/red/images/grip.png +0 -0
  123. package/src/app/ui/editor-client/public/red/images/icons/arrow-in.png +0 -0
  124. package/src/app/ui/editor-client/public/red/images/icons/bolt.png +0 -0
  125. package/src/app/ui/editor-client/public/red/images/icons/node-changed.png +0 -0
  126. package/src/app/ui/editor-client/public/red/images/icons/node-error.png +0 -0
  127. package/src/app/ui/editor-client/public/red/images/icons/node-play.png +0 -0
  128. package/src/app/ui/editor-client/public/red/images/kumologica-app.png +0 -0
  129. package/src/app/ui/editor-client/public/red/images/node-red-256.png +0 -0
  130. package/src/app/ui/editor-client/public/red/images/node-red-icon-black.svg +9 -0
  131. package/src/app/ui/editor-client/public/red/images/node-red-icon.svg +33 -0
  132. package/src/app/ui/editor-client/public/red/images/node-red.png +0 -0
  133. package/src/app/ui/editor-client/public/red/images/pw_maze_white.png +0 -0
  134. package/src/app/ui/editor-client/public/red/images/spin.svg +41 -0
  135. package/src/app/ui/editor-client/public/red/images/spinner.gif +0 -0
  136. package/src/app/ui/editor-client/public/red/images/subflow_tab.png +0 -0
  137. package/src/app/ui/editor-client/public/red/images/test-icon.png +0 -0
  138. package/src/app/ui/editor-client/public/red/images/typedInput/09.png +0 -0
  139. package/src/app/ui/editor-client/public/red/images/typedInput/az.png +0 -0
  140. package/src/app/ui/editor-client/public/red/images/typedInput/bin.png +0 -0
  141. package/src/app/ui/editor-client/public/red/images/typedInput/bool.png +0 -0
  142. package/src/app/ui/editor-client/public/red/images/typedInput/env.png +0 -0
  143. package/src/app/ui/editor-client/public/red/images/typedInput/expr.png +0 -0
  144. package/src/app/ui/editor-client/public/red/images/typedInput/json.png +0 -0
  145. package/src/app/ui/editor-client/public/red/images/typedInput/re.png +0 -0
  146. package/src/app/ui/editor-client/public/red/keymap.json +54 -0
  147. package/src/app/ui/editor-client/public/red/main-modals.js +14 -0
  148. package/src/app/ui/editor-client/public/red/main-modals.min.js +16 -0
  149. package/src/app/ui/editor-client/public/red/main.js +10 -0
  150. package/src/app/ui/editor-client/public/red/main.min.js +16 -0
  151. package/src/app/ui/editor-client/public/red/red.js +44903 -0
  152. package/src/app/ui/editor-client/public/red/red.min.js +16 -0
  153. package/src/app/ui/editor-client/public/red/style.min.css +24 -0
  154. package/src/app/ui/editor-client/public/vendor/ace/LICENSE +24 -0
  155. package/src/app/ui/editor-client/public/vendor/ace/ace.js +17 -0
  156. package/src/app/ui/editor-client/public/vendor/ace/ext-language_tools.js +8 -0
  157. package/src/app/ui/editor-client/public/vendor/ace/ext-searchbox.js +8 -0
  158. package/src/app/ui/editor-client/public/vendor/ace/mode-css.js +8 -0
  159. package/src/app/ui/editor-client/public/vendor/ace/mode-handlebars.js +8 -0
  160. package/src/app/ui/editor-client/public/vendor/ace/mode-html.js +8 -0
  161. package/src/app/ui/editor-client/public/vendor/ace/mode-javascript.js +8 -0
  162. package/src/app/ui/editor-client/public/vendor/ace/mode-json.js +8 -0
  163. package/src/app/ui/editor-client/public/vendor/ace/mode-jsonata.js +1 -0
  164. package/src/app/ui/editor-client/public/vendor/ace/mode-markdown.js +8 -0
  165. package/src/app/ui/editor-client/public/vendor/ace/mode-properties.js +8 -0
  166. package/src/app/ui/editor-client/public/vendor/ace/mode-python.js +8 -0
  167. package/src/app/ui/editor-client/public/vendor/ace/mode-sql.js +8 -0
  168. package/src/app/ui/editor-client/public/vendor/ace/mode-swift.js +8 -0
  169. package/src/app/ui/editor-client/public/vendor/ace/mode-text.js +8 -0
  170. package/src/app/ui/editor-client/public/vendor/ace/mode-xml.js +8 -0
  171. package/src/app/ui/editor-client/public/vendor/ace/mode-yaml.js +8 -0
  172. package/src/app/ui/editor-client/public/vendor/ace/snippets/css.js +8 -0
  173. package/src/app/ui/editor-client/public/vendor/ace/snippets/handlebars.js +8 -0
  174. package/src/app/ui/editor-client/public/vendor/ace/snippets/html.js +8 -0
  175. package/src/app/ui/editor-client/public/vendor/ace/snippets/javascript.js +8 -0
  176. package/src/app/ui/editor-client/public/vendor/ace/snippets/json.js +8 -0
  177. package/src/app/ui/editor-client/public/vendor/ace/snippets/jsonata.js +1 -0
  178. package/src/app/ui/editor-client/public/vendor/ace/snippets/markdown.js +8 -0
  179. package/src/app/ui/editor-client/public/vendor/ace/snippets/properties.js +8 -0
  180. package/src/app/ui/editor-client/public/vendor/ace/snippets/python.js +8 -0
  181. package/src/app/ui/editor-client/public/vendor/ace/snippets/sql.js +8 -0
  182. package/src/app/ui/editor-client/public/vendor/ace/snippets/swift.js +8 -0
  183. package/src/app/ui/editor-client/public/vendor/ace/snippets/text.js +8 -0
  184. package/src/app/ui/editor-client/public/vendor/ace/snippets/xml.js +8 -0
  185. package/src/app/ui/editor-client/public/vendor/ace/snippets/yaml.js +8 -0
  186. package/src/app/ui/editor-client/public/vendor/ace/theme-chrome.js +8 -0
  187. package/src/app/ui/editor-client/public/vendor/ace/theme-tomorrow.js +8 -0
  188. package/src/app/ui/editor-client/public/vendor/ace/worker-css.js +1 -0
  189. package/src/app/ui/editor-client/public/vendor/ace/worker-html.js +1 -0
  190. package/src/app/ui/editor-client/public/vendor/ace/worker-javascript.js +1 -0
  191. package/src/app/ui/editor-client/public/vendor/ace/worker-json.js +1 -0
  192. package/src/app/ui/editor-client/public/vendor/ace/worker-jsonata.js +2140 -0
  193. package/src/app/ui/editor-client/public/vendor/ace/worker-xml.js +1 -0
  194. package/src/app/ui/editor-client/public/vendor/beautifyjs/beautify.min.js +1 -0
  195. package/src/app/ui/editor-client/public/vendor/bootstrap/css/bootstrap.min.css +9 -0
  196. package/src/app/ui/editor-client/public/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  197. package/src/app/ui/editor-client/public/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  198. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/active-line.js +72 -0
  199. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/coffeescript-lint.js +47 -0
  200. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/javascript-hint.js +157 -0
  201. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/javascript-lint.js +63 -0
  202. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/jshint.js +29591 -0
  203. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/lint.css +73 -0
  204. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/lint.js +252 -0
  205. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/show-hint.css +36 -0
  206. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/show-hint.js +460 -0
  207. package/src/app/ui/editor-client/public/vendor/code-mirror/addon/sql-hint.js +304 -0
  208. package/src/app/ui/editor-client/public/vendor/code-mirror/lib/codemirror.css +350 -0
  209. package/src/app/ui/editor-client/public/vendor/code-mirror/lib/codemirror.js +9800 -0
  210. package/src/app/ui/editor-client/public/vendor/code-mirror/mode/javascript.js +927 -0
  211. package/src/app/ui/editor-client/public/vendor/code-mirror/mode/sql.js +494 -0
  212. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/base16-dark.css +38 -0
  213. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/monokai.css +42 -0
  214. package/src/app/ui/editor-client/public/vendor/code-mirror/theme/solarized.css +168 -0
  215. package/src/app/ui/editor-client/public/vendor/d3-context-menu/d3-context-menu.css +43 -0
  216. package/src/app/ui/editor-client/public/vendor/d3-context-menu/d3-context-menu.js +87 -0
  217. package/src/app/ui/editor-client/public/vendor/easy-json-schema/index.js +88 -0
  218. package/src/app/ui/editor-client/public/vendor/font-awesome/css/font-awesome.min.css +4 -0
  219. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  220. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  221. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
  222. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  223. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  224. package/src/app/ui/editor-client/public/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  225. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.eot +0 -0
  226. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.svg +2105 -0
  227. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.ttf +0 -0
  228. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.woff +0 -0
  229. package/src/app/ui/editor-client/public/vendor/icofont/fonts/icofont.woff2 +0 -0
  230. package/src/app/ui/editor-client/public/vendor/icofont/icofont.min.css +7 -0
  231. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/animated-overlay.gif +0 -0
  232. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  233. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  234. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  235. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  236. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  237. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  238. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  239. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  240. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  241. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  242. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  243. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  244. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  245. package/src/app/ui/editor-client/public/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css +5 -0
  246. package/src/app/ui/editor-client/public/vendor/jsonata/jsonata.min.js +183 -0
  247. package/src/app/ui/editor-client/public/vendor/misc/toggleswitch.css +181 -0
  248. package/src/app/ui/editor-client/public/vendor/misc/toggleswitch.js +48 -0
  249. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.css +7 -0
  250. package/src/app/ui/editor-client/public/vendor/simplemde/simplemde.min.js +15 -0
  251. package/src/app/ui/editor-client/public/vendor/vendor.css +0 -0
  252. package/src/app/ui/editor-client/public/vendor/vendor.js +125 -0
  253. package/src/app/ui/editor-client/public/vendor/xterm/lib/xterm.js +2 -0
  254. package/src/app/ui/editor-client/src/ace/README.md +50 -0
  255. package/src/app/ui/editor-client/src/ace/mode/nrjavascript.js +35 -0
  256. package/src/app/ui/editor-client/src/ace/mode/nrjavascript_worker.js +189 -0
  257. package/src/app/ui/editor-client/src/favicon.ico +0 -0
  258. package/src/app/ui/editor-client/src/images/bolt.png +0 -0
  259. package/src/app/ui/editor-client/src/images/debugger/continue-full.png +0 -0
  260. package/src/app/ui/editor-client/src/images/debugger/continue-outline.png +0 -0
  261. package/src/app/ui/editor-client/src/images/debugger/pause.png +0 -0
  262. package/src/app/ui/editor-client/src/images/debugger/restart.png +0 -0
  263. package/src/app/ui/editor-client/src/images/debugger/stepover.png +0 -0
  264. package/src/app/ui/editor-client/src/images/debugger/stop.png +0 -0
  265. package/src/app/ui/editor-client/src/images/deploy-flows-o.png +0 -0
  266. package/src/app/ui/editor-client/src/images/deploy-flows.png +0 -0
  267. package/src/app/ui/editor-client/src/images/deploy-full-o.png +0 -0
  268. package/src/app/ui/editor-client/src/images/deploy-full.png +0 -0
  269. package/src/app/ui/editor-client/src/images/deploy-nodes-o.png +0 -0
  270. package/src/app/ui/editor-client/src/images/deploy-nodes.png +0 -0
  271. package/src/app/ui/editor-client/src/images/deploy-reload.png +0 -0
  272. package/src/app/ui/editor-client/src/images/grip.png +0 -0
  273. package/src/app/ui/editor-client/src/images/icons/arrow-in.png +0 -0
  274. package/src/app/ui/editor-client/src/images/icons/bolt.png +0 -0
  275. package/src/app/ui/editor-client/src/images/icons/node-changed.png +0 -0
  276. package/src/app/ui/editor-client/src/images/icons/node-error.png +0 -0
  277. package/src/app/ui/editor-client/src/images/icons/node-play.png +0 -0
  278. package/src/app/ui/editor-client/src/images/kumologica-app.png +0 -0
  279. package/src/app/ui/editor-client/src/images/node-red-256.png +0 -0
  280. package/src/app/ui/editor-client/src/images/node-red-icon-black.svg +9 -0
  281. package/src/app/ui/editor-client/src/images/node-red-icon.svg +33 -0
  282. package/src/app/ui/editor-client/src/images/node-red.png +0 -0
  283. package/src/app/ui/editor-client/src/images/pw_maze_white.png +0 -0
  284. package/src/app/ui/editor-client/src/images/spin.svg +41 -0
  285. package/src/app/ui/editor-client/src/images/spinner.gif +0 -0
  286. package/src/app/ui/editor-client/src/images/subflow_tab.png +0 -0
  287. package/src/app/ui/editor-client/src/images/test-icon.png +0 -0
  288. package/src/app/ui/editor-client/src/images/typedInput/09.png +0 -0
  289. package/src/app/ui/editor-client/src/images/typedInput/az.png +0 -0
  290. package/src/app/ui/editor-client/src/images/typedInput/bin.png +0 -0
  291. package/src/app/ui/editor-client/src/images/typedInput/bool.png +0 -0
  292. package/src/app/ui/editor-client/src/images/typedInput/env.png +0 -0
  293. package/src/app/ui/editor-client/src/images/typedInput/expr.png +0 -0
  294. package/src/app/ui/editor-client/src/images/typedInput/json.png +0 -0
  295. package/src/app/ui/editor-client/src/images/typedInput/re.png +0 -0
  296. package/src/app/ui/editor-client/src/js/comms.js +174 -0
  297. package/src/app/ui/editor-client/src/js/events.js +39 -0
  298. package/src/app/ui/editor-client/src/js/font-awesome.js +818 -0
  299. package/src/app/ui/editor-client/src/js/history.js +337 -0
  300. package/src/app/ui/editor-client/src/js/i18n.js +81 -0
  301. package/src/app/ui/editor-client/src/js/jquery-addons.js +21 -0
  302. package/src/app/ui/editor-client/src/js/keymap.json +54 -0
  303. package/src/app/ui/editor-client/src/js/main-modals.js +14 -0
  304. package/src/app/ui/editor-client/src/js/main.js +10 -0
  305. package/src/app/ui/editor-client/src/js/modals/modal-home.js +162 -0
  306. package/src/app/ui/editor-client/src/js/modals/modal-new-project.js +86 -0
  307. package/src/app/ui/editor-client/src/js/modals/modal-node-library.js +255 -0
  308. package/src/app/ui/editor-client/src/js/modals/modal-welcome.js +102 -0
  309. package/src/app/ui/editor-client/src/js/nodes.js +1736 -0
  310. package/src/app/ui/editor-client/src/js/red.js +704 -0
  311. package/src/app/ui/editor-client/src/js/settings.js +275 -0
  312. package/src/app/ui/editor-client/src/js/text/bidi.js +116 -0
  313. package/src/app/ui/editor-client/src/js/text/format.js +1316 -0
  314. package/src/app/ui/editor-client/src/js/ui/actions.js +39 -0
  315. package/src/app/ui/editor-client/src/js/ui/clipboard.js +510 -0
  316. package/src/app/ui/editor-client/src/js/ui/common/checkboxSet.js +117 -0
  317. package/src/app/ui/editor-client/src/js/ui/common/editableList.js +322 -0
  318. package/src/app/ui/editor-client/src/js/ui/common/menu.js +277 -0
  319. package/src/app/ui/editor-client/src/js/ui/common/panels.js +104 -0
  320. package/src/app/ui/editor-client/src/js/ui/common/popover.js +268 -0
  321. package/src/app/ui/editor-client/src/js/ui/common/searchBox.js +98 -0
  322. package/src/app/ui/editor-client/src/js/ui/common/stack.js +184 -0
  323. package/src/app/ui/editor-client/src/js/ui/common/tabs.js +730 -0
  324. package/src/app/ui/editor-client/src/js/ui/common/treeList.js +170 -0
  325. package/src/app/ui/editor-client/src/js/ui/common/typedInput.js +819 -0
  326. package/src/app/ui/editor-client/src/js/ui/common/typedInputLong.js +829 -0
  327. package/src/app/ui/editor-client/src/js/ui/deploy.js +422 -0
  328. package/src/app/ui/editor-client/src/js/ui/diff.js +2225 -0
  329. package/src/app/ui/editor-client/src/js/ui/editor.js +3020 -0
  330. package/src/app/ui/editor-client/src/js/ui/editors/buffer.js +195 -0
  331. package/src/app/ui/editor-client/src/js/ui/editors/expression.js +627 -0
  332. package/src/app/ui/editor-client/src/js/ui/editors/js.js +89 -0
  333. package/src/app/ui/editor-client/src/js/ui/editors/json.js +107 -0
  334. package/src/app/ui/editor-client/src/js/ui/editors/markdown.js +267 -0
  335. package/src/app/ui/editor-client/src/js/ui/editors/string.js +75 -0
  336. package/src/app/ui/editor-client/src/js/ui/event-log.js +107 -0
  337. package/src/app/ui/editor-client/src/js/ui/header.js +372 -0
  338. package/src/app/ui/editor-client/src/js/ui/keyboard.js +565 -0
  339. package/src/app/ui/editor-client/src/js/ui/library.js +570 -0
  340. package/src/app/ui/editor-client/src/js/ui/logviewer.js +116 -0
  341. package/src/app/ui/editor-client/src/js/ui/notifications.js +282 -0
  342. package/src/app/ui/editor-client/src/js/ui/palette-editor.js +1061 -0
  343. package/src/app/ui/editor-client/src/js/ui/palette.js +788 -0
  344. package/src/app/ui/editor-client/src/js/ui/project-info.js +232 -0
  345. package/src/app/ui/editor-client/src/js/ui/projects/projectSettings.js +1651 -0
  346. package/src/app/ui/editor-client/src/js/ui/projects/projectUserSettings.js +404 -0
  347. package/src/app/ui/editor-client/src/js/ui/projects/projects.js +2395 -0
  348. package/src/app/ui/editor-client/src/js/ui/projects/tab-versionControl.js +1383 -0
  349. package/src/app/ui/editor-client/src/js/ui/search.js +366 -0
  350. package/src/app/ui/editor-client/src/js/ui/sidebar.js +409 -0
  351. package/src/app/ui/editor-client/src/js/ui/state.js +14 -0
  352. package/src/app/ui/editor-client/src/js/ui/subflow.js +748 -0
  353. package/src/app/ui/editor-client/src/js/ui/tab-awsDeploy.js +1427 -0
  354. package/src/app/ui/editor-client/src/js/ui/tab-azure.js +852 -0
  355. package/src/app/ui/editor-client/src/js/ui/tab-config.js +452 -0
  356. package/src/app/ui/editor-client/src/js/ui/tab-context.js +406 -0
  357. package/src/app/ui/editor-client/src/js/ui/tab-info.js +661 -0
  358. package/src/app/ui/editor-client/src/js/ui/tab-kumohub.js +800 -0
  359. package/src/app/ui/editor-client/src/js/ui/tab-nodeInfo.js +60 -0
  360. package/src/app/ui/editor-client/src/js/ui/tab-test.js +915 -0
  361. package/src/app/ui/editor-client/src/js/ui/terminal.js +240 -0
  362. package/src/app/ui/editor-client/src/js/ui/touch/radialMenu.js +170 -0
  363. package/src/app/ui/editor-client/src/js/ui/tray.js +411 -0
  364. package/src/app/ui/editor-client/src/js/ui/typeSearch.js +411 -0
  365. package/src/app/ui/editor-client/src/js/ui/ui-settings.js +422 -0
  366. package/src/app/ui/editor-client/src/js/ui/update-panel.js +84 -0
  367. package/src/app/ui/editor-client/src/js/ui/userSettings.js +673 -0
  368. package/src/app/ui/editor-client/src/js/ui/utils.js +1287 -0
  369. package/src/app/ui/editor-client/src/js/ui/view-navigator.js +169 -0
  370. package/src/app/ui/editor-client/src/js/ui/view-tools.js +123 -0
  371. package/src/app/ui/editor-client/src/js/ui/view.js +5333 -0
  372. package/src/app/ui/editor-client/src/js/ui/workspaces.js +498 -0
  373. package/src/app/ui/editor-client/src/js/user.js +282 -0
  374. package/src/app/ui/editor-client/src/js/validators.js +54 -0
  375. package/src/app/ui/editor-client/src/kumologica-app.png +0 -0
  376. package/src/app/ui/editor-client/src/sass/ace.scss +29 -0
  377. package/src/app/ui/editor-client/src/sass/bootstrap.scss +21 -0
  378. package/src/app/ui/editor-client/src/sass/colors.scss +76 -0
  379. package/src/app/ui/editor-client/src/sass/debug.scss +383 -0
  380. package/src/app/ui/editor-client/src/sass/diff.scss +695 -0
  381. package/src/app/ui/editor-client/src/sass/dragdrop.scss +37 -0
  382. package/src/app/ui/editor-client/src/sass/dropdownMenu.scss +93 -0
  383. package/src/app/ui/editor-client/src/sass/editor.scss +683 -0
  384. package/src/app/ui/editor-client/src/sass/flow.scss +330 -0
  385. package/src/app/ui/editor-client/src/sass/forms.scss +1093 -0
  386. package/src/app/ui/editor-client/src/sass/header.scss +502 -0
  387. package/src/app/ui/editor-client/src/sass/jquery.scss +152 -0
  388. package/src/app/ui/editor-client/src/sass/keyboard.scss +136 -0
  389. package/src/app/ui/editor-client/src/sass/library.scss +54 -0
  390. package/src/app/ui/editor-client/src/sass/mixins.scss +283 -0
  391. package/src/app/ui/editor-client/src/sass/modals/modalHome.scss +138 -0
  392. package/src/app/ui/editor-client/src/sass/modals/modalNewProject.scss +96 -0
  393. package/src/app/ui/editor-client/src/sass/modals/modalNodeLibrary.scss +131 -0
  394. package/src/app/ui/editor-client/src/sass/modals/modalWelcome.scss +102 -0
  395. package/src/app/ui/editor-client/src/sass/notifications.scss +118 -0
  396. package/src/app/ui/editor-client/src/sass/palette-editor.scss +275 -0
  397. package/src/app/ui/editor-client/src/sass/palette.scss +279 -0
  398. package/src/app/ui/editor-client/src/sass/panels.scss +61 -0
  399. package/src/app/ui/editor-client/src/sass/popover.scss +166 -0
  400. package/src/app/ui/editor-client/src/sass/project-info.scss +74 -0
  401. package/src/app/ui/editor-client/src/sass/projects.scss +875 -0
  402. package/src/app/ui/editor-client/src/sass/search.scss +201 -0
  403. package/src/app/ui/editor-client/src/sass/sidebar.scss +201 -0
  404. package/src/app/ui/editor-client/src/sass/style.scss +170 -0
  405. package/src/app/ui/editor-client/src/sass/tab-azure.scss +68 -0
  406. package/src/app/ui/editor-client/src/sass/tab-cloud.scss +67 -0
  407. package/src/app/ui/editor-client/src/sass/tab-config.scss +100 -0
  408. package/src/app/ui/editor-client/src/sass/tab-context.scss +54 -0
  409. package/src/app/ui/editor-client/src/sass/tab-info.scss +307 -0
  410. package/src/app/ui/editor-client/src/sass/tab-kumohub.scss +68 -0
  411. package/src/app/ui/editor-client/src/sass/tab-test.scss +257 -0
  412. package/src/app/ui/editor-client/src/sass/tabs.scss +395 -0
  413. package/src/app/ui/editor-client/src/sass/terminal.scss +246 -0
  414. package/src/app/ui/editor-client/src/sass/ui/common/checkboxSet.scss +29 -0
  415. package/src/app/ui/editor-client/src/sass/ui/common/editableList.scss +81 -0
  416. package/src/app/ui/editor-client/src/sass/ui/common/nodeList.scss +65 -0
  417. package/src/app/ui/editor-client/src/sass/ui/common/searchBox.scss +77 -0
  418. package/src/app/ui/editor-client/src/sass/ui/common/stack.scss +26 -0
  419. package/src/app/ui/editor-client/src/sass/ui/common/treeList.scss +108 -0
  420. package/src/app/ui/editor-client/src/sass/ui/common/typedInput.scss +181 -0
  421. package/src/app/ui/editor-client/src/sass/ui/common/typedInputLong.scss +183 -0
  422. package/src/app/ui/editor-client/src/sass/ui-settings.scss +119 -0
  423. package/src/app/ui/editor-client/src/sass/update-panel.scss +18 -0
  424. package/src/app/ui/editor-client/src/sass/userSettings.scss +93 -0
  425. package/src/app/ui/editor-client/src/sass/widgetStyle.scss +23 -0
  426. package/src/app/ui/editor-client/src/sass/workspace.scss +123 -0
  427. package/src/app/ui/editor-client/src/sass/workspaceToolbar.scss +85 -0
  428. package/src/app/ui/editor-client/src/vendor/ace/LICENSE +24 -0
  429. package/src/app/ui/editor-client/src/vendor/ace/ace.js +17 -0
  430. package/src/app/ui/editor-client/src/vendor/ace/ext-language_tools.js +8 -0
  431. package/src/app/ui/editor-client/src/vendor/ace/ext-searchbox.js +8 -0
  432. package/src/app/ui/editor-client/src/vendor/ace/mode-css.js +8 -0
  433. package/src/app/ui/editor-client/src/vendor/ace/mode-handlebars.js +8 -0
  434. package/src/app/ui/editor-client/src/vendor/ace/mode-html.js +8 -0
  435. package/src/app/ui/editor-client/src/vendor/ace/mode-javascript.js +8 -0
  436. package/src/app/ui/editor-client/src/vendor/ace/mode-json.js +8 -0
  437. package/src/app/ui/editor-client/src/vendor/ace/mode-markdown.js +8 -0
  438. package/src/app/ui/editor-client/src/vendor/ace/mode-properties.js +8 -0
  439. package/src/app/ui/editor-client/src/vendor/ace/mode-python.js +8 -0
  440. package/src/app/ui/editor-client/src/vendor/ace/mode-sql.js +8 -0
  441. package/src/app/ui/editor-client/src/vendor/ace/mode-swift.js +8 -0
  442. package/src/app/ui/editor-client/src/vendor/ace/mode-text.js +8 -0
  443. package/src/app/ui/editor-client/src/vendor/ace/mode-xml.js +8 -0
  444. package/src/app/ui/editor-client/src/vendor/ace/mode-yaml.js +8 -0
  445. package/src/app/ui/editor-client/src/vendor/ace/snippets/css.js +8 -0
  446. package/src/app/ui/editor-client/src/vendor/ace/snippets/handlebars.js +8 -0
  447. package/src/app/ui/editor-client/src/vendor/ace/snippets/html.js +8 -0
  448. package/src/app/ui/editor-client/src/vendor/ace/snippets/javascript.js +8 -0
  449. package/src/app/ui/editor-client/src/vendor/ace/snippets/json.js +8 -0
  450. package/src/app/ui/editor-client/src/vendor/ace/snippets/markdown.js +8 -0
  451. package/src/app/ui/editor-client/src/vendor/ace/snippets/properties.js +8 -0
  452. package/src/app/ui/editor-client/src/vendor/ace/snippets/python.js +8 -0
  453. package/src/app/ui/editor-client/src/vendor/ace/snippets/sql.js +8 -0
  454. package/src/app/ui/editor-client/src/vendor/ace/snippets/swift.js +8 -0
  455. package/src/app/ui/editor-client/src/vendor/ace/snippets/text.js +8 -0
  456. package/src/app/ui/editor-client/src/vendor/ace/snippets/xml.js +8 -0
  457. package/src/app/ui/editor-client/src/vendor/ace/snippets/yaml.js +8 -0
  458. package/src/app/ui/editor-client/src/vendor/ace/theme-chrome.js +8 -0
  459. package/src/app/ui/editor-client/src/vendor/ace/theme-tomorrow.js +8 -0
  460. package/src/app/ui/editor-client/src/vendor/ace/worker-css.js +1 -0
  461. package/src/app/ui/editor-client/src/vendor/ace/worker-html.js +1 -0
  462. package/src/app/ui/editor-client/src/vendor/ace/worker-javascript.js +1 -0
  463. package/src/app/ui/editor-client/src/vendor/ace/worker-json.js +1 -0
  464. package/src/app/ui/editor-client/src/vendor/ace/worker-xml.js +1 -0
  465. package/src/app/ui/editor-client/src/vendor/beautifyjs/beautify.min.js +1 -0
  466. package/src/app/ui/editor-client/src/vendor/bootstrap/css/bootstrap.css +5406 -0
  467. package/src/app/ui/editor-client/src/vendor/bootstrap/css/bootstrap.min.css +9 -0
  468. package/src/app/ui/editor-client/src/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  469. package/src/app/ui/editor-client/src/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  470. package/src/app/ui/editor-client/src/vendor/bootstrap/js/bootstrap.min.js +6 -0
  471. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/active-line.js +72 -0
  472. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/coffeescript-lint.js +47 -0
  473. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/javascript-hint.js +157 -0
  474. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/javascript-lint.js +63 -0
  475. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/jshint.js +29591 -0
  476. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/lint.css +73 -0
  477. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/lint.js +252 -0
  478. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/show-hint.css +36 -0
  479. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/show-hint.js +460 -0
  480. package/src/app/ui/editor-client/src/vendor/code-mirror/addon/sql-hint.js +304 -0
  481. package/src/app/ui/editor-client/src/vendor/code-mirror/lib/codemirror.css +350 -0
  482. package/src/app/ui/editor-client/src/vendor/code-mirror/lib/codemirror.js +9800 -0
  483. package/src/app/ui/editor-client/src/vendor/code-mirror/mode/javascript.js +927 -0
  484. package/src/app/ui/editor-client/src/vendor/code-mirror/mode/sql.js +494 -0
  485. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/base16-dark.css +38 -0
  486. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/monokai.css +42 -0
  487. package/src/app/ui/editor-client/src/vendor/code-mirror/theme/solarized.css +168 -0
  488. package/src/app/ui/editor-client/src/vendor/d3/d3.v3.min.js +4 -0
  489. package/src/app/ui/editor-client/src/vendor/d3/d3.v4.min.js +2 -0
  490. package/src/app/ui/editor-client/src/vendor/d3-context-menu/d3-context-menu.css +43 -0
  491. package/src/app/ui/editor-client/src/vendor/d3-context-menu/d3-context-menu.js +87 -0
  492. package/src/app/ui/editor-client/src/vendor/easy-json-schema/index.js +88 -0
  493. package/src/app/ui/editor-client/src/vendor/font-awesome/css/font-awesome.min.css +4 -0
  494. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  495. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  496. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.svg +2671 -0
  497. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  498. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  499. package/src/app/ui/editor-client/src/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  500. package/src/app/ui/editor-client/src/vendor/i18next/i18next.min.js +5 -0
  501. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.eot +0 -0
  502. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.svg +2105 -0
  503. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.ttf +0 -0
  504. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.woff +0 -0
  505. package/src/app/ui/editor-client/src/vendor/icofont/fonts/icofont.woff2 +0 -0
  506. package/src/app/ui/editor-client/src/vendor/icofont/icofont.min.css +7 -0
  507. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/animated-overlay.gif +0 -0
  508. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  509. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  510. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  511. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  512. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  513. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  514. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  515. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  516. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  517. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  518. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  519. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  520. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  521. package/src/app/ui/editor-client/src/vendor/jquery/css/smoothness/jquery-ui-1.10.3.custom.min.css +5 -0
  522. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery-1.11.3.min.js +5 -0
  523. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery-ui-1.10.3.custom.min.js +7 -0
  524. package/src/app/ui/editor-client/src/vendor/jquery/js/jquery.ui.touch-punch.min.js +11 -0
  525. package/src/app/ui/editor-client/src/vendor/jsonata/formatter.js +183 -0
  526. package/src/app/ui/editor-client/src/vendor/jsonata/mode-jsonata.js +134 -0
  527. package/src/app/ui/editor-client/src/vendor/jsonata/snippets-jsonata.js +11 -0
  528. package/src/app/ui/editor-client/src/vendor/jsonata/worker-jsonata.js +2140 -0
  529. package/src/app/ui/editor-client/src/vendor/marked/marked.min.js +6 -0
  530. package/src/app/ui/editor-client/src/vendor/misc/toggleswitch.css +181 -0
  531. package/src/app/ui/editor-client/src/vendor/misc/toggleswitch.js +48 -0
  532. package/src/app/ui/editor-client/templates/index.mst +314 -0
  533. package/src/app/ui/editor-client/templates/modals/modalHome.mst +107 -0
  534. package/src/app/ui/editor-client/templates/modals/modalNewProject.mst +104 -0
  535. package/src/app/ui/editor-client/templates/modals/modalNodeLibrary.mst +72 -0
  536. package/src/app/ui/editor-client/templates/modals/modalWelcome.mst +111 -0
  537. package/src/assets/eula.txt +170 -0
  538. package/src/assets/icon.icns +0 -0
  539. package/src/assets/kumologica-app.png +0 -0
  540. package/src/assets/license_en.txt +170 -0
@@ -0,0 +1,2140 @@
1
+ var runtime=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),o=new O(n||[]);return i._invoke=function(e,t,r){var n=f;return function(a,i){if(n===d)throw new Error("Generator is already running");if(n===h){if("throw"===a)throw i;return Y()}for(r.method=a,r.arg=i;;){var o=r.delegate;if(o){var s=S(o,r);if(s){if(s===g)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var u=p(e,t,r);if("normal"===u.type){if(n=r.done?h:l,u.arg===g)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=h,r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f="suspendedStart",l="suspendedYield",d="executing",h="completed",g={};function v(){}function b(){}function m(){}var y={};u(y,i,function(){return this});var k=Object.getPrototypeOf,x=k&&k(k(R([])));x&&x!==r&&n.call(x,i)&&(y=x);var w=m.prototype=v.prototype=Object.create(y);function E(e){["next","throw","return"].forEach(function(t){u(e,t,function(e){return this._invoke(t,e)})})}function A(e,t){var r;this._invoke=function(a,i){function o(){return new t(function(r,o){!function r(a,i,o,s){var u=p(e[a],e,i);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then(function(e){r("next",e,o,s)},function(e){r("throw",e,o,s)}):t.resolve(f).then(function(e){c.value=e,o(c)},function(e){return r("throw",e,o,s)})}s(u.arg)}(a,i,r,o)})}return r=r?r.then(o,o):o()}}function S(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method))return g;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var a=p(n,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function R(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function r(){for(;++a<e.length;)if(n.call(e,a))return r.value=e[a],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}return{next:Y}}function Y(){return{value:t,done:!0}}return b.prototype=m,u(w,"constructor",m),u(m,"constructor",b),b.displayName=u(m,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,u(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},E(A.prototype),u(A.prototype,o,function(){return this}),e.AsyncIterator=A,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var o=new A(c(t,r,n,a),i);return e.isGeneratorFunction(r)?o:o.next().then(function(e){return e.done?e.value:o.next()})},E(w),u(w,s,"Generator"),u(w,i,function(){return this}),u(w,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=R,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(D),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function a(n,a){return s.type="throw",s.arg=e,r.next=n,a&&(r.method="next",r.arg=t),!!a}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return a("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return a(o.catchLoc,!0);if(this.prev<o.finallyLoc)return a(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return a(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return a(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),D(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;D(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:R(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}("object"==typeof module?module.exports:{});try{regeneratorRuntime=runtime}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=runtime:Function("r","regeneratorRuntime = r")(runtime)}Number.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},String.fromCodePoint||function(e){var t=function(t){for(var r=[],n=0,a="",i=0,o=arguments.length;i!==o;++i){var s=+arguments[i];if(!(s<1114111&&s>>>0===s))throw RangeError("Invalid code point: "+s);s<=65535?n=r.push(s):(s-=65536,n=r.push(55296+(s>>10),s%1024+56320)),n>=16383&&(a+=e.apply(null,r),r.length=0)}return a+e.apply(null,r)};try{Object.defineProperty(String,"fromCodePoint",{value:t,configurable:!0,writable:!0})}catch(e){String.fromCodePoint=t}}(String.fromCharCode),Object.is||(Object.is=function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}),String.prototype.codePointAt||function(){"use strict";var e=function(){try{var e={},t=Object.defineProperty,r=t(e,e,e)&&t}catch(e){}return r}(),t=function(e){if(null==this)throw TypeError();var t=String(this),r=t.length,n=e?Number(e):0;if(n!=n&&(n=0),!(n<0||n>=r)){var a,i=t.charCodeAt(n);return i>=55296&&i<=56319&&r>n+1&&(a=t.charCodeAt(n+1))>=56320&&a<=57343?1024*(i-55296)+a-56320+65536:i}};e?e(String.prototype,"codePointAt",{value:t,configurable:!0,writable:!0}):String.prototype.codePointAt=t}(),Math.log10=Math.log10||function(e){return Math.log(e)*Math.LOG10E},function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsonata=e()}}(function(){return function(){return function e(t,r,n){function a(o,s){if(!r[o]){if(!t[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(i)return i(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var p=r[o]={exports:{}};t[o][0].call(p.exports,function(e){return a(t[o][1][e]||e)},p,p.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<n.length;o++)a(n[o]);return a}}()({1:[function(e,t,r){"use strict";var n=e("./utils"),a=function(){var e=n.stringToArray,t=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],r=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"],a=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],i=["Thousand","Million","Billion","Trillion"];var o={};t.forEach(function(e,t){o[e.toLowerCase()]=t}),r.forEach(function(e,t){o[e.toLowerCase()]=t}),a.forEach(function(e,t){var r=e.toLowerCase();o[r]=10*(t+2),o[r.substring(0,e.length-1)+"ieth"]=o[r]}),o.hundredth=100,i.forEach(function(e,t){var r=e.toLowerCase(),n=Math.pow(10,3*(t+1));o[r]=n,o[r+"th"]=n});var s=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],u={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function c(e,t){if(void 0!==e)return l(e=Math.floor(e),h(t))}var p={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},f={UPPER:"upper",LOWER:"lower",TITLE:"title"};function l(n,o){var u,c=n<0;switch(n=Math.abs(n),o.primary){case p.LETTERS:u=function(e,t){for(var r=[],n=t.charCodeAt(0);e>0;)r.unshift(String.fromCharCode((e-1)%26+n)),e=Math.floor((e-1)/26);return r.join("")}(n,o.case===f.UPPER?"A":"a");break;case p.ROMAN:u=function e(t){for(var r=0;r<s.length;r++){var n=s[r];if(t>=n[0])return n[1]+e(t-n[0])}return""}(n),o.case===f.UPPER&&(u=u.toUpperCase());break;case p.WORDS:u=function(e,n){return function e(n,o,s){var u="";if(n<=19)u=(o?" and ":"")+(s?r[n]:t[n]);else if(n<100){var c=Math.floor(n/10),p=n%10;u=(o?" and ":"")+a[c-2],p>0?u+="-"+e(p,!1,s):s&&(u=u.substring(0,u.length-1)+"ieth")}else if(n<1e3){var f=Math.floor(n/100),l=n%100;u=(o?", ":"")+t[f]+" Hundred",l>0?u+=e(l,!0,s):s&&(u+="th")}else{var d=Math.floor(Math.log10(n)/3);d>i.length&&(d=i.length);var h=Math.pow(10,3*d),g=Math.floor(n/h),v=n-g*h;u=(o?", ":"")+e(g,!1,!1)+" "+i[d-1],v>0?u+=e(v,!0,s):s&&(u+="th")}return u}(e,!1,n)}(n,o.ordinal),o.case===f.UPPER?u=u.toUpperCase():o.case===f.LOWER&&(u=u.toLowerCase());break;case p.DECIMAL:u=""+n;var l=o.mandatoryDigits-u.length;if(l>0){var d=new Array(l+1).join("0");u=d+u}if(48!==o.zeroCode&&(u=e(u).map(function(e){return String.fromCodePoint(e.codePointAt(0)+o.zeroCode-48)}).join("")),o.regular)for(var h=Math.floor((u.length-1)/o.groupingSeparators.position);h>0;h--){var g=u.length-h*o.groupingSeparators.position;u=u.substr(0,g)+o.groupingSeparators.character+u.substr(g)}else o.groupingSeparators.reverse().forEach(function(e){var t=u.length-e.position;u=u.substr(0,t)+e.character+u.substr(t)});if(o.ordinal){var v={1:"st",2:"nd",3:"rd"}[u[u.length-1]];(!v||u.length>1&&"1"===u[u.length-2])&&(v="th"),u+=v}break;case p.SEQUENCE:throw{code:"D3130",value:o.token}}return c&&(u="-"+u),u}var d=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function h(t){var r,n={type:"integer",primary:p.DECIMAL,case:f.LOWER,ordinal:!1},a=t.lastIndexOf(";");switch(-1===a?r=t:(r=t.substring(0,a),"o"===t.substring(a+1)[0]&&(n.ordinal=!0)),r){case"A":n.case=f.UPPER;case"a":n.primary=p.LETTERS;break;case"I":n.case=f.UPPER;case"i":n.primary=p.ROMAN;break;case"W":n.case=f.UPPER,n.primary=p.WORDS;break;case"Ww":n.case=f.TITLE,n.primary=p.WORDS;break;case"w":n.primary=p.WORDS;break;default:var i=null,o=0,s=0,u=[],c=0;if(e(r).map(function(e){return e.codePointAt(0)}).reverse().forEach(function(e){for(var t=!1,r=0;r<d.length;r++){var n=d[r];if(e>=n&&e<=n+9){if(t=!0,o++,c++,null===i)i=n;else if(n!==i)throw{code:"D3131"};break}}t||(35===e?(c++,s++):u.push({position:c,character:String.fromCodePoint(e)}))}),o>0){n.primary=p.DECIMAL,n.zeroCode=i,n.mandatoryDigits=o,n.optionalDigits=s;var l=function(e){if(0===e.length)return 0;for(var t=e[0].character,r=1;r<e.length;r++)if(e[r].character!==t)return 0;for(var n=e.map(function(e){return e.position}),a=n.reduce(function e(t,r){return 0===r?t:e(r,t%r)}),i=1;i<=n.length;i++)if(-1===n.indexOf(i*a))return 0;return a}(u);l>0?(n.regular=!0,n.groupingSeparators={position:l,character:u[0].character}):(n.regular=!1,n.groupingSeparators=u)}else n.primary=p.SEQUENCE,n.token=r}return n}var g={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function v(e){for(var t=[],r={type:"datetime",parts:t},n=function(r,n){if(n>r){var a=e.substring(r,n);a=a.split("]]").join("]"),t.push({type:"literal",value:a})}},a=0,i=0;i<e.length;){if("["===e.charAt(i)){if("["===e.charAt(i+1)){n(a,i),t.push({type:"literal",value:"["}),a=i+=2;continue}if(n(a,i),a=i,-1===(i=e.indexOf("]",a)))throw{code:"D3135"};var o,s=e.substring(a+1,i),u={type:"marker",component:(s=s.split(/\s+/).join("")).charAt(0)},c=s.lastIndexOf(",");if(-1!==c){var p=s.substring(c+1),l=p.indexOf("-"),d=void 0,v=void 0,b=function(e){return void 0===e||"*"===e?void 0:parseInt(e)};-1===l?d=p:(d=p.substring(0,l),v=p.substring(l+1));var m={min:b(d),max:b(v)};u.width=m,o=s.substring(1,c)}else o=s.substring(1);if(1===o.length)u.presentation1=o;else if(o.length>1){var y=o.charAt(o.length-1);-1!=="atco".indexOf(y)?(u.presentation2=y,"o"===y&&(u.ordinal=!0),u.presentation1=o.substring(0,o.length-1)):u.presentation1=o}else u.presentation1=g[u.component];if(void 0===u.presentation1)throw{code:"D3132",value:u.component};if("n"===u.presentation1[0])u.names=f.LOWER;else if("N"===u.presentation1[0])"n"===u.presentation1[1]?u.names=f.TITLE:u.names=f.UPPER;else if(-1!=="YMDdFWwXxHhmsf".indexOf(u.component)){var k=u.presentation1;if(u.presentation2&&(k+=";"+u.presentation2),u.integerFormat=h(k),u.width&&void 0!==u.width.min&&u.integerFormat.mandatoryDigits<u.width.min&&(u.integerFormat.mandatoryDigits=u.width.min),-1!=="YMD".indexOf(u.component))if(u.n=-1,u.width&&void 0!==u.width.max)u.n=u.width.max,u.integerFormat.mandatoryDigits=u.n;else{var x=u.integerFormat.mandatoryDigits+u.integerFormat.optionalDigits;x>=2&&(u.n=x)}}"Z"!==u.component&&"z"!==u.component||(u.integerFormat=h(u.presentation1)),t.push(u),a=i+1}i++}return n(a,i),r}var b=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],m=["January","February","March","April","May","June","July","August","September","October","November","December"],y=function(e){var t=Date.UTC(e.year,e.month),r=new Date(t).getUTCDay();return 0===r&&(r=7),r>4?t+864e5*(8-r):t-864e5*(r-1)},k=function e(t,r){return{year:t,month:r,nextMonth:function(){return 11===r?e(t+1,0):e(t,r+1)},previousMonth:function(){return 0===r?e(t-1,11):e(t,r-1)},nextYear:function(){return e(t+1,r)},previousYear:function(){return e(t-1,r)}}},x=function(e,t){return(t-e)/6048e5+1},w=function(e,t){var r;switch(t){case"Y":r=e.getUTCFullYear();break;case"M":r=e.getUTCMonth()+1;break;case"D":r=e.getUTCDate();break;case"d":r=(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(e.getUTCFullYear(),0))/864e5+1;break;case"F":0===(r=e.getUTCDay())&&(r=7);break;case"W":var n=k(e.getUTCFullYear(),0),a=y(n),i=Date.UTC(n.year,e.getUTCMonth(),e.getUTCDate()),o=x(a,i);if(o>52)i>=y(n.nextYear())&&(o=1);else if(o<1){var s=y(n.previousYear());o=x(s,i)}r=Math.floor(o);break;case"w":var u=k(e.getUTCFullYear(),e.getUTCMonth()),c=y(u),p=Date.UTC(u.year,u.month,e.getUTCDate()),f=x(c,p);if(f>4)p>=y(u.nextMonth())&&(f=1);else if(f<1){var l=y(u.previousMonth());f=x(l,p)}r=Math.floor(f);break;case"X":var d=k(e.getUTCFullYear(),0),h=y(d),g=y(d.nextYear()),v=e.getTime();r=v<h?d.year-1:v>=g?d.year+1:d.year;break;case"x":var b=k(e.getUTCFullYear(),e.getUTCMonth()),m=y(b),w=b.nextMonth(),E=y(w),A=e.getTime();r=A<m?b.previousMonth().month+1:A>=E?w.month+1:b.month+1;break;case"H":r=e.getUTCHours();break;case"h":r=e.getUTCHours(),0===(r%=12)&&(r=12);break;case"P":r=e.getUTCHours()>=12?"pm":"am";break;case"m":r=e.getUTCMinutes();break;case"s":r=e.getUTCSeconds();break;case"f":r=e.getUTCMilliseconds();break;case"Z":case"z":break;case"C":case"E":r="ISO"}return r},E=null;function A(e,t,r){var n=0,a=0;if(void 0!==r){var i=parseInt(r);n=Math.floor(i/100),a=i%100}var o;void 0===t?(null===E&&(E=v("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),o=E):o=v(t);var s=new Date(e+60*(60*n+a)*1e3),u="";return o.parts.forEach(function(e){"literal"===e.type?u+=e.value:u+=function(e,t){var r=w(e,t.component);if(-1!=="YMDdFWwXxHhms".indexOf(t.component))if("Y"===t.component&&-1!==t.n&&(r%=Math.pow(10,t.n)),t.names){if("M"===t.component||"x"===t.component)r=m[r-1];else{if("F"!==t.component)throw{code:"D3133",value:t.component};r=b[r]}t.names===f.UPPER?r=r.toUpperCase():t.names===f.LOWER&&(r=r.toLowerCase()),t.width&&r.length>t.width.max&&(r=r.substring(0,t.width.max))}else r=l(r,t.integerFormat);else if("f"===t.component)r=l(r,t.integerFormat);else if("Z"===t.component||"z"===t.component){var i=100*n+a;if(t.integerFormat.regular)r=l(i,t.integerFormat);else{var o=t.integerFormat.mandatoryDigits;if(1===o||2===o)r=l(n,t.integerFormat),0!==a&&(r+=":"+c(a,"00"));else{if(3!==o&&4!==o)throw{code:"D3134",value:o};r=l(i,t.integerFormat)}}i>=0&&(r="+"+r),"z"===t.component&&(r="GMT"+r),0===i&&"t"===t.presentation2&&(r="Z")}return r}(s,e)}),u}function S(e){var t={};if("datetime"===e.type)t.type="datetime",t.parts=e.parts.map(function(e){var t={};if("literal"===e.type)t.regex=e.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if("Z"===e.component||"z"===e.component){var r;Array.isArray(e.integerFormat.groupingSeparators)||(r=e.integerFormat.groupingSeparators),t.regex="","z"===e.component&&(t.regex="GMT"),t.regex+="[-+][0-9]+",r&&(t.regex+=r.character+"[0-9]+"),t.parse=function(t){"z"===e.component&&(t=t.substring(3));var n=0,a=0;r?(n=Number.parseInt(t.substring(0,t.indexOf(r.character))),a=Number.parseInt(t.substring(t.indexOf(r.character)+1))):t.length-1<=2?n=Number.parseInt(t):(n=Number.parseInt(t.substring(0,3)),a=Number.parseInt(t.substring(3)));return 60*n+a}}else if(e.integerFormat)e.integerFormat.n=e.n,t=S(e.integerFormat);else{t.regex="[a-zA-Z]+";var n={};if("M"===e.component||"x"===e.component)m.forEach(function(t,r){e.width&&e.width.max?n[t.substring(0,e.width.max)]=r+1:n[t]=r+1});else if("F"===e.component)b.forEach(function(t,r){r>0&&(e.width&&e.width.max?n[t.substring(0,e.width.max)]=r:n[t]=r)});else{if("P"!==e.component)throw{code:"D3133",value:e.component};n={am:0,AM:0,pm:1,PM:1}}t.parse=function(e){return n[e]}}return t.component=e.component,t});else{t.type="integer";var r,n=e.case===f.UPPER;switch(r=e.n&&e.n>0?0===e.optionalDigits?"{".concat(e.n,"}"):"{".concat(e.n-e.optionalDigits,",").concat(e.n,"}"):"+",e.primary){case p.LETTERS:t.regex=n?"[A-Z]+":"[a-z]+",t.parse=function(e){return function(e,t){for(var r=t.charCodeAt(0),n=0,a=0;a<e.length;a++)n+=(e.charCodeAt(e.length-a-1)-r+1)*Math.pow(26,a);return n}(e,n?"A":"a")};break;case p.ROMAN:t.regex=n?"[MDCLXVI]+":"[mdclxvi]+",t.parse=function(e){return function(e){for(var t=0,r=1,n=e.length-1;n>=0;n--){var a=e[n],i=u[a];i<r?t-=i:(r=i,t+=i)}return t}(n?e:e.toUpperCase())};break;case p.WORDS:t.regex="(?:"+Object.keys(o).concat("and","[\\-, ]").join("|")+")+",t.parse=function(e){return t=e.toLowerCase(),r=t.split(/,\s|\sand\s|[\s\\-]/).map(function(e){return o[e]}),n=[0],r.forEach(function(e){if(e<100){var t=n.pop();t>=1e3&&(n.push(t),t=0),n.push(t+e)}else n.push(n.pop()*e)}),n.reduce(function(e,t){return e+t},0);var t,r,n};break;case p.DECIMAL:t.regex="[0-9]".concat(r),e.ordinal&&(t.regex+="(?:th|st|nd|rd)"),t.parse=function(t){var r=t;return e.ordinal&&(r=t.substring(0,t.length-2)),e.regular?r=r.split(",").join(""):e.groupingSeparators.forEach(function(e){r=r.split(e.character).join("")}),48!==e.zeroCode&&(r=r.split("").map(function(t){return String.fromCodePoint(t.codePointAt(0)-e.zeroCode+48)}).join("")),parseInt(r)};break;case p.SEQUENCE:throw{code:"D3130",value:e.token}}}return t}var T=new RegExp("^\\d{4}(-[01]\\d)*(-[0-3]\\d)*(T[0-2]\\d:[0-5]\\d:[0-5]\\d)*(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");return{formatInteger:c,parseInteger:function(e,t){if(void 0!==e)return S(h(t)).parse(e)},fromMillis:function(e,t,r){if(void 0!==e)return A.call(this,e,t,r)},toMillis:function(e,t){if(void 0!==e){if(void 0===t){if(!T.test(e))throw{stack:(new Error).stack,code:"D3110",value:e};return Date.parse(e)}return function(e,t){var r=S(v(t)),n="^"+r.parts.map(function(e){return"("+e.regex+")"}).join("")+"$",a=new RegExp(n,"i").exec(e);if(null!==a){for(var i={},o=1;o<a.length;o++){var s=r.parts[o-1];s.parse&&(i[s.component]=s.parse(a[o]))}if(0===Object.getOwnPropertyNames(i).length)return;var u=0,c=function(e){u<<=1,u+=e?1:0},p=function(e){return!(~e&u||!(e&u))};"YXMxWwdD".split("").forEach(function(e){return c(i[e])});var f=!p(161)&&p(130),l=p(84),d=!l&&p(72);u=0,"PHhmsf".split("").forEach(function(e){return c(i[e])});var h=!p(23)&&p(47),g=(f?"YD":l?"XxwF":d?"XWF":"YMD")+(h?"Phmsf":"Hmsf"),b=this.environment.timestamp,m=!1,y=!1;if(g.split("").forEach(function(e){if(void 0===i[e])m?(i[e]=-1!=="MDd".indexOf(e)?1:0,y=!0):i[e]=w(b,e);else if(m=!0,y)throw{code:"D3136"}}),i.M>0?i.M-=1:i.M=0,f){var k=Date.UTC(i.Y,0),x=1e3*(i.d-1)*60*60*24,E=new Date(k+x);i.M=E.getUTCMonth(),i.D=E.getUTCDate()}if(l)throw{code:"D3136"};if(d)throw{code:"D3136"};h&&(i.H=12===i.h?0:i.h,1===i.P&&(i.H+=12));var A=Date.UTC(i.Y,i.M,i.D,i.H,i.m,i.s,i.f);return(i.Z||i.z)&&(A-=60*(i.Z||i.z)*1e3),A}}.call(this,e,t)}}}}();t.exports=a},{"./utils":6}],2:[function(e,t,r){(function(r){(function(){"use strict";function n(e){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=e("./utils"),i=function(){var e=regeneratorRuntime.mark(O),t=regeneratorRuntime.mark(R),i=regeneratorRuntime.mark(Y),o=regeneratorRuntime.mark(P),s=regeneratorRuntime.mark(M),u=regeneratorRuntime.mark(U),c=regeneratorRuntime.mark(N),p=regeneratorRuntime.mark(I),f=regeneratorRuntime.mark(L),l=regeneratorRuntime.mark(z),d=regeneratorRuntime.mark($),h=regeneratorRuntime.mark(q),g=a.isNumeric,v=a.isArrayOfStrings,b=a.isArrayOfNumbers,m=a.createSequence,y=a.isSequence,k=a.isFunction,x=a.isLambda,w=a.isIterable,E=a.getFunctionArity,A=a.isDeepEqual,S=a.stringToArray;function T(e,t,r){if(void 0!==e){var n=S(e),a=n.length;if(a+t<0&&(t=0),void 0!==r){if(r<=0)return"";var i=t>=0?t+r:a+t+r;return n.slice(t,i).join("")}return n.slice(t).join("")}}function D(e){if(void 0!==e)return S(e).length}function O(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.apply(this,[r]),!w(n)){e.next=4;break}return e.delegateYield(n,"t0",3);case 3:n=e.t0;case 4:if(!n||"number"==typeof n.start||"number"===n.end||Array.isArray(n.groups)||k(n.next)){e.next=6;break}throw{code:"T1010",stack:(new Error).stack};case 6:return e.abrupt("return",n);case 7:case"end":return e.stop()}},e,this)}function R(e,r){var n,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==e){t.next=2;break}return t.abrupt("return",void 0);case 2:if("string"!=typeof r){t.next=6;break}n=-1!==e.indexOf(r),t.next=9;break;case 6:return t.delegateYield(O(r,e),"t0",7);case 7:a=t.t0,n=void 0!==a;case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}},t)}function Y(e,t,r){var n,a,o;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(void 0!==e){i.next=2;break}return i.abrupt("return",void 0);case 2:if(!(r<0)){i.next=4;break}throw{stack:(new Error).stack,value:r,code:"D3040",index:3};case 4:if(n=m(),!(void 0===r||r>0)){i.next=17;break}return a=0,i.delegateYield(O(t,e),"t0",8);case 8:if(void 0===(o=i.t0)){i.next=17;break}case 10:if(void 0===o||!(void 0===r||a<r)){i.next=17;break}return n.push({match:o.match,index:o.start,groups:o.groups}),i.delegateYield(O(o.next),"t1",13);case 13:o=i.t1,a++,i.next=10;break;case 17:return i.abrupt("return",n);case 18:case"end":return i.stop()}},i)}function P(e,t,r,n){var a,i,s,u,c,p,f,l;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(void 0!==e){o.next=2;break}return o.abrupt("return",void 0);case 2:if(a=this,""!==t){o.next=5;break}throw{code:"D3010",stack:(new Error).stack,value:t,index:2};case 5:if(!(n<0)){o.next=7;break}throw{code:"D3011",stack:(new Error).stack,value:n,index:4};case 7:if(i="string"==typeof r?function(e){for(var t="",n=0,a=r.indexOf("$",n);-1!==a&&n<r.length;){t+=r.substring(n,a),n=a+1;var i=r.charAt(n);if("$"===i)t+="$",n++;else if("0"===i)t+=e.match,n++;else{var o;if(o=0===e.groups.length?1:Math.floor(Math.log(e.groups.length)*Math.LOG10E)+1,a=parseInt(r.substring(n,n+o),10),o>1&&a>e.groups.length&&(a=parseInt(r.substring(n,n+o-1),10)),isNaN(a))t+="$";else{if(e.groups.length>0){var s=e.groups[a-1];void 0!==s&&(t+=s)}n+=a.toString().length}}a=r.indexOf("$",n)}return t+=r.substring(n)}:r,s="",u=0,!(void 0===n||n>0)){o.next=44;break}if(c=0,"string"!=typeof t){o.next=18;break}for(p=e.indexOf(t,u);-1!==p&&(void 0===n||c<n);)s+=e.substring(u,p),s+=r,u=p+t.length,c++,p=e.indexOf(t,u);s+=e.substring(u),o.next=42;break;case 18:return o.delegateYield(O(t,e),"t0",19);case 19:if(void 0===(f=o.t0)){o.next=41;break}case 21:if(void 0===f||!(void 0===n||c<n)){o.next=38;break}if(s+=e.substring(u,f.start),l=i.apply(a,[f]),!w(l)){o.next=27;break}return o.delegateYield(l,"t1",26);case 26:l=o.t1;case 27:if("string"!=typeof l){o.next=31;break}s+=l,o.next=32;break;case 31:throw{code:"D3012",stack:(new Error).stack,value:l};case 32:return u=f.start+f.match.length,c++,o.delegateYield(O(f.next),"t2",35);case 35:f=o.t2,o.next=21;break;case 38:s+=e.substring(u),o.next=42;break;case 41:s=e;case 42:o.next=45;break;case 44:s=e;case 45:return o.abrupt("return",s);case 46:case"end":return o.stop()}},o,this)}function M(e,t,r){var n,a,i,o;return regeneratorRuntime.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(void 0!==e){s.next=2;break}return s.abrupt("return",void 0);case 2:if(!(r<0)){s.next=4;break}throw{code:"D3020",stack:(new Error).stack,value:r,index:3};case 4:if(n=[],!(void 0===r||r>0)){s.next=27;break}if("string"!=typeof t){s.next=10;break}n=e.split(t,r),s.next=27;break;case 10:return a=0,s.delegateYield(O(t,e),"t0",12);case 12:if(void 0===(i=s.t0)){s.next=26;break}o=0;case 15:if(void 0===i||!(void 0===r||a<r)){s.next=23;break}return n.push(e.substring(o,i.start)),o=i.end,s.delegateYield(O(i.next),"t1",19);case 19:i=s.t1,a++,s.next=15;break;case 23:(void 0===r||a<r)&&n.push(e.substring(o)),s.next=27;break;case 26:n.push(e);case 27:return s.abrupt("return",n);case 28:case"end":return s.stop()}},s)}function j(e,t){var r;if(void 0!==e){if(t){var n=e.toString().split("e");e=+(n[0]+"e"+(n[1]?+n[1]+t:t))}var a=(r=Math.round(e))-e;return.5===Math.abs(a)&&1===Math.abs(r%2)&&(r-=1),t&&(r=+((n=r.toString().split("e"))[0]+"e"+(n[1]?+n[1]-t:-t))),Object.is(r,-0)&&(r=0),r}}function C(e){if(void 0!==e){var t=!1;if(Array.isArray(e)){if(1===e.length)t=C(e[0]);else if(e.length>1){t=e.filter(function(e){return C(e)}).length>0}}else"string"==typeof e?e.length>0&&(t=!0):g(e)?0!==e&&(t=!0):null!==e&&"object"===n(e)?Object.keys(e).length>0&&(t=!0):"boolean"==typeof e&&!0===e&&(t=!0);return t}}function F(e,t,r,n){var a=[t],i=E(e);return i>=2&&a.push(r),i>=3&&a.push(n),a}function U(e,t){var r,n,a,i;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(void 0!==e){o.next=2;break}return o.abrupt("return",void 0);case 2:r=m(),n=0;case 4:if(!(n<e.length)){o.next=12;break}return a=F(t,e[n],n,e),o.delegateYield(t.apply(this,a),"t0",7);case 7:void 0!==(i=o.t0)&&r.push(i);case 9:n++,o.next=4;break;case 12:return o.abrupt("return",r);case 13:case"end":return o.stop()}},u,this)}function N(e,t){var r,n,a,i;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(void 0!==e){o.next=2;break}return o.abrupt("return",void 0);case 2:r=m(),n=0;case 4:if(!(n<e.length)){o.next=13;break}return a=e[n],i=F(t,a,n,e),o.delegateYield(t.apply(this,i),"t0",8);case 8:C(o.t0)&&r.push(a);case 10:n++,o.next=4;break;case 13:return o.abrupt("return",r);case 14:case"end":return o.stop()}},c,this)}function I(e,t){var r,n,a,i,o,s,u;return regeneratorRuntime.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(void 0!==e){c.next=2;break}return c.abrupt("return",void 0);case 2:r=!1,a=0;case 4:if(!(a<e.length)){c.next=22;break}if(i=e[a],o=!0,void 0===t){c.next=12;break}return s=F(t,i,a,e),c.delegateYield(t.apply(this,s),"t0",10);case 10:u=c.t0,o=C(u);case 12:if(!o){c.next=19;break}if(r){c.next=18;break}n=i,r=!0,c.next=19;break;case 18:throw{stack:(new Error).stack,code:"D3138",index:a};case 19:a++,c.next=4;break;case 22:if(r){c.next=24;break}throw{stack:(new Error).stack,code:"D3139"};case 24:return c.abrupt("return",n);case 25:case"end":return c.stop()}},p,this)}function L(e,t,r){var n,a,i,o;return regeneratorRuntime.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(void 0!==e){s.next=2;break}return s.abrupt("return",void 0);case 2:if(!((a=E(t))<2)){s.next=5;break}throw{stack:(new Error).stack,code:"D3050",index:1};case 5:void 0===r&&e.length>0?(n=e[0],i=1):(n=r,i=0);case 6:if(!(i<e.length)){s.next=15;break}return o=[n,e[i]],a>=3&&o.push(i),a>=4&&o.push(e),s.delegateYield(t.apply(this,o),"t0",11);case 11:n=s.t0,i++,s.next=6;break;case 15:return s.abrupt("return",n);case 16:case"end":return s.stop()}},f,this)}function _(e,t){return void 0===e?t:void 0===t?e:(Array.isArray(e)||(e=m(e)),Array.isArray(t)||(t=[t]),e.concat(t))}function z(e,t){var r,n,a,i;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:r=m(),o.t0=regeneratorRuntime.keys(e);case 2:if((o.t1=o.t0()).done){o.next=10;break}return n=o.t1.value,a=F(t,e[n],n,e),o.delegateYield(t.apply(this,a),"t2",6);case 6:void 0!==(i=o.t2)&&r.push(i),o.next=2;break;case 10:return o.abrupt("return",r);case 11:case"end":return o.stop()}},l,this)}function $(e,t){var r,n,a,i;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(void 0!==e){o.next=2;break}return o.abrupt("return",void 0);case 2:if(!(e.length<=1)){o.next=4;break}return o.abrupt("return",e);case 4:if(void 0!==t){o.next=10;break}if(b(e)||v(e)){o.next=7;break}throw{stack:(new Error).stack,code:"D3070",index:1};case 7:r=regeneratorRuntime.mark(function e(t,r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t>r);case 1:case"end":return e.stop()}},e)}),o.next=11;break;case 10:r=t;case 11:return n=regeneratorRuntime.mark(function e(t,n){var a,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=regeneratorRuntime.mark(function e(t,n,a){return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(0!==n.length){i.next=4;break}Array.prototype.push.apply(t,a),i.next=16;break;case 4:if(0!==a.length){i.next=8;break}Array.prototype.push.apply(t,n),i.next=16;break;case 8:return i.delegateYield(r(n[0],a[0]),"t0",9);case 9:if(!i.t0){i.next=14;break}return t.push(a[0]),i.delegateYield(e(t,n,a.slice(1)),"t1",12);case 12:i.next=16;break;case 14:return t.push(n[0]),i.delegateYield(e(t,n.slice(1),a),"t2",16);case 16:case"end":return i.stop()}},e)}),i=[],e.delegateYield(a(i,t,n),"t0",3);case 3:return e.abrupt("return",i);case 4:case"end":return e.stop()}},e)}),a=regeneratorRuntime.mark(function e(t){var r,a,i;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(Array.isArray(t)&&!(t.length<=1)){o.next=4;break}return o.abrupt("return",t);case 4:return r=Math.floor(t.length/2),a=t.slice(0,r),i=t.slice(r),o.delegateYield(e(a),"t0",8);case 8:return a=o.t0,o.delegateYield(e(i),"t1",10);case 10:return i=o.t1,o.delegateYield(n(a,i),"t2",12);case 12:return o.abrupt("return",o.t2);case 13:case"end":return o.stop()}},e)}),o.delegateYield(a(e),"t0",14);case 14:return i=o.t0,o.abrupt("return",i);case 16:case"end":return o.stop()}},d)}function q(e,t){var r,n,a,i;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:r={},o.t0=regeneratorRuntime.keys(e);case 2:if((o.t1=o.t0()).done){o.next=11;break}return n=o.t1.value,a=e[n],i=F(t,a,n,e),o.delegateYield(t.apply(this,i),"t2",7);case 7:C(o.t2)&&(r[n]=a),o.next=2;break;case 11:return 0===Object.keys(r).length&&(r=void 0),o.abrupt("return",r);case 13:case"end":return o.stop()}},h,this)}return{sum:function(e){if(void 0!==e){var t=0;return e.forEach(function(e){t+=e}),t}},count:function(e){return void 0===e?0:e.length},max:function(e){if(void 0!==e&&0!==e.length)return Math.max.apply(Math,e)},min:function(e){if(void 0!==e&&0!==e.length)return Math.min.apply(Math,e)},average:function(e){if(void 0!==e&&0!==e.length){var t=0;return e.forEach(function(e){t+=e}),t/e.length}},string:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0!==e){var r;if("string"==typeof e)r=e;else if(k(e))r="";else{if("number"==typeof e&&!isFinite(e))throw{code:"D3001",value:e,stack:(new Error).stack};var n=t?2:0;Array.isArray(e)&&e.outerWrapper&&(e=e[0]),r=JSON.stringify(e,function(e,t){return null!=t&&t.toPrecision&&g(t)?Number(t.toPrecision(15)):t&&k(t)?"":t},n)}return r}},substring:T,substringBefore:function(e,t){if(void 0!==e){var r=e.indexOf(t);return r>-1?e.substr(0,r):e}},substringAfter:function(e,t){if(void 0!==e){var r=e.indexOf(t);return r>-1?e.substr(r+t.length):e}},lowercase:function(e){if(void 0!==e)return e.toLowerCase()},uppercase:function(e){if(void 0!==e)return e.toUpperCase()},length:D,trim:function(e){if(void 0!==e){var t=e.replace(/[ \t\n\r]+/gm," ");return" "===t.charAt(0)&&(t=t.substring(1))," "===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),t}},pad:function(e,t,r){if(void 0!==e){var n;void 0!==r&&0!==r.length||(r=" ");var a=Math.abs(t)-D(e);if(a>0){var i=new Array(a+1).join(r);r.length>1&&(i=T(i,0,a)),n=t>0?e+i:i+e}else n=e;return n}},match:Y,contains:R,replace:P,split:M,join:function(e,t){if(void 0!==e)return void 0===t&&(t=""),e.join(t)},formatNumber:function(e,t,r){if(void 0!==e){var n={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"};void 0!==r&&Object.keys(r).forEach(function(e){n[e]=r[e]});for(var a=[],i=n["zero-digit"].charCodeAt(0),o=i;o<i+10;o++)a.push(String.fromCharCode(o));var s=a.concat([n["decimal-separator"],n["exponent-separator"],n["grouping-separator"],n.digit,n["pattern-separator"]]),u=t.split(n["pattern-separator"]);if(u.length>2)throw{code:"D3080",stack:(new Error).stack};var c=u.map(function(e){var t,r,a,i,o=function(){for(var t,r=0;r<e.length;r++)if(t=e.charAt(r),-1!==s.indexOf(t)&&t!==n["exponent-separator"])return e.substring(0,r)}(),u=function(){for(var t,r=e.length-1;r>=0;r--)if(t=e.charAt(r),-1!==s.indexOf(t)&&t!==n["exponent-separator"])return e.substring(r+1)}(),c=e.substring(o.length,e.length-u.length),p=e.indexOf(n["exponent-separator"],o.length);-1===p||p>e.length-u.length?(t=c,r=void 0):(t=c.substring(0,p),r=c.substring(p+1));var f=t.indexOf(n["decimal-separator"]);return-1===f?(a=t,i=u):(a=t.substring(0,f),i=t.substring(f+1)),{prefix:o,suffix:u,activePart:c,mantissaPart:t,exponentPart:r,integerPart:a,fractionalPart:i,subpicture:e}});c.forEach(function(e){var t,r,i=e.subpicture,o=i.indexOf(n["decimal-separator"]);o!==i.lastIndexOf(n["decimal-separator"])&&(t="D3081"),i.indexOf(n.percent)!==i.lastIndexOf(n.percent)&&(t="D3082"),i.indexOf(n["per-mille"])!==i.lastIndexOf(n["per-mille"])&&(t="D3083"),-1!==i.indexOf(n.percent)&&-1!==i.indexOf(n["per-mille"])&&(t="D3084");var u=!1;for(r=0;r<e.mantissaPart.length;r++){var c=e.mantissaPart.charAt(r);if(-1!==a.indexOf(c)||c===n.digit){u=!0;break}}u||(t="D3085"),-1!==e.activePart.split("").map(function(e){return-1===s.indexOf(e)?"p":"a"}).join("").indexOf("p")&&(t="D3086"),-1!==o?i.charAt(o-1)!==n["grouping-separator"]&&i.charAt(o+1)!==n["grouping-separator"]||(t="D3087"):e.integerPart.charAt(e.integerPart.length-1)===n["grouping-separator"]&&(t="D3088"),-1!==i.indexOf(n["grouping-separator"]+n["grouping-separator"])&&(t="D3089");var p=e.integerPart.indexOf(n.digit);-1!==p&&e.integerPart.substring(0,p).split("").filter(function(e){return a.indexOf(e)>-1}).length>0&&(t="D3090"),-1!==(p=e.fractionalPart.lastIndexOf(n.digit))&&e.fractionalPart.substring(p).split("").filter(function(e){return a.indexOf(e)>-1}).length>0&&(t="D3091");var f="string"==typeof e.exponentPart;if(f&&e.exponentPart.length>0&&(-1!==i.indexOf(n.percent)||-1!==i.indexOf(n["per-mille"]))&&(t="D3092"),f&&(0===e.exponentPart.length||e.exponentPart.split("").filter(function(e){return-1===a.indexOf(e)}).length>0)&&(t="D3093"),t)throw{code:t,stack:(new Error).stack}});var p,f,l,d,h=c.map(function(e){var t=function(t,r){for(var i=[],o=t.indexOf(n["grouping-separator"]);-1!==o;){var s=(r?t.substring(0,o):t.substring(o)).split("").filter(function(e){return-1!==a.indexOf(e)||e===n.digit}).length;i.push(s),o=e.integerPart.indexOf(n["grouping-separator"],o+1)}return i},r=t(e.integerPart),i=function(e){if(0===e.length)return 0;for(var t=e.reduce(function e(t,r){return 0===r?t:e(r,t%r)}),r=1;r<=e.length;r++)if(-1===e.indexOf(r*t))return 0;return t}(r),o=t(e.fractionalPart,!0),s=e.integerPart.split("").filter(function(e){return-1!==a.indexOf(e)}).length,u=s,c=e.fractionalPart.split(""),p=c.filter(function(e){return-1!==a.indexOf(e)}).length,f=c.filter(function(e){return-1!==a.indexOf(e)||e===n.digit}).length,l="string"==typeof e.exponentPart;0===s&&0===f&&(l?(p=1,f=1):s=1),l&&0===s&&-1!==e.integerPart.indexOf(n.digit)&&(s=1),0===s&&0===p&&(p=1);var d=0;return l&&(d=e.exponentPart.split("").filter(function(e){return-1!==a.indexOf(e)}).length),{integerPartGroupingPositions:r,regularGrouping:i,minimumIntegerPartSize:s,scalingFactor:u,prefix:e.prefix,fractionalPartGroupingPositions:o,minimumFactionalPartSize:p,maximumFactionalPartSize:f,minimumExponentSize:d,suffix:e.suffix,picture:e.subpicture}}),g=n["minus-sign"],v=n["zero-digit"],b=n["decimal-separator"],m=n["grouping-separator"];if(1===h.length&&(h.push(JSON.parse(JSON.stringify(h[0]))),h[1].prefix=g+h[1].prefix),f=-1!==(p=e>=0?h[0]:h[1]).picture.indexOf(n.percent)?100*e:-1!==p.picture.indexOf(n["per-mille"])?1e3*e:e,0===p.minimumExponentSize)l=f;else{var y=Math.pow(10,p.scalingFactor),k=Math.pow(10,p.scalingFactor-1);for(l=f,d=0;l<k;)l*=10,d-=1;for(;l>y;)l/=10,d+=1}var x=function(e,t){var r=Math.abs(e).toFixed(t);return"0"!==v&&(r=r.split("").map(function(e){return e>="0"&&e<="9"?a[e.charCodeAt(0)-48]:e}).join("")),r},w=x(j(l,p.maximumFactionalPartSize),p.maximumFactionalPartSize),E=w.indexOf(".");for(-1===E?w+=b:w=w.replace(".",b);w.charAt(0)===v;)w=w.substring(1);for(;w.charAt(w.length-1)===v;)w=w.substring(0,w.length-1);E=w.indexOf(b);var A=p.minimumIntegerPartSize-E,S=p.minimumFactionalPartSize-(w.length-E-1);if(w=(A>0?new Array(A+1).join(v):"")+w,w+=S>0?new Array(S+1).join(v):"",E=w.indexOf(b),p.regularGrouping>0)for(var T=Math.floor((E-1)/p.regularGrouping),D=1;D<=T;D++)w=[w.slice(0,E-D*p.regularGrouping),m,w.slice(E-D*p.regularGrouping)].join("");else p.integerPartGroupingPositions.forEach(function(e){w=[w.slice(0,E-e),m,w.slice(E-e)].join(""),E++});if(E=w.indexOf(b),p.fractionalPartGroupingPositions.forEach(function(e){w=[w.slice(0,e+E+1),m,w.slice(e+E+1)].join("")}),E=w.indexOf(b),-1!==p.picture.indexOf(b)&&E!==w.length-1||(w=w.substring(0,w.length-1)),void 0!==d){var O=x(d,0);(A=p.minimumExponentSize-O.length)>0&&(O=new Array(A+1).join(v)+O),w=w+n["exponent-separator"]+(d<0?g:"")+O}return w=p.prefix+w+p.suffix}},formatBase:function(e,t){if(void 0!==e){if(e=j(e),(t=void 0===t?10:j(t))<2||t>36)throw{code:"D3100",stack:(new Error).stack,value:t};return e.toString(t)}},number:function(e){var t;if(void 0!==e){if("number"==typeof e)t=e;else if("string"==typeof e&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(e)&&!isNaN(parseFloat(e))&&isFinite(e))t=parseFloat(e);else if(!0===e)t=1;else{if(!1!==e)throw{code:"D3030",value:e,stack:(new Error).stack,index:1};t=0}return t}},floor:function(e){if(void 0!==e)return Math.floor(e)},ceil:function(e){if(void 0!==e)return Math.ceil(e)},round:j,abs:function(e){if(void 0!==e)return Math.abs(e)},sqrt:function(e){if(void 0!==e){if(e<0)throw{stack:(new Error).stack,code:"D3060",index:1,value:e};return Math.sqrt(e)}},power:function(e,t){var r;if(void 0!==e){if(r=Math.pow(e,t),!isFinite(r))throw{stack:(new Error).stack,code:"D3061",index:1,value:e,exp:t};return r}},random:function(){return Math.random()},boolean:C,not:function(e){if(void 0!==e)return!C(e)},map:U,zip:function(){for(var e=[],t=Array.prototype.slice.call(arguments),r=Math.min.apply(Math,t.map(function(e){return Array.isArray(e)?e.length:0})),n=0;n<r;n++){var a=t.map(function(e){return e[n]});e.push(a)}return e},filter:N,single:I,foldLeft:L,sift:q,keys:function e(t){var r=m();if(Array.isArray(t)){var a={};t.forEach(function(t){e(t).forEach(function(e){a[e]=!0})}),r=e(a)}else null===t||"object"!==n(t)||x(t)||Object.keys(t).forEach(function(e){return r.push(e)});return r},lookup:function e(t,r){var a;if(Array.isArray(t)){a=m();for(var i=0;i<t.length;i++){var o=e(t[i],r);void 0!==o&&(Array.isArray(o)?o.forEach(function(e){return a.push(e)}):a.push(o))}}else null!==t&&"object"===n(t)&&(a=t[r]);return a},append:_,exists:function(e){return void 0!==e},spread:function e(t){var r=m();if(Array.isArray(t))t.forEach(function(t){r=_(r,e(t))});else if(null===t||"object"!==n(t)||x(t))r=t;else for(var a in t){var i={};i[a]=t[a],r.push(i)}return r},merge:function(e){if(void 0!==e){var t={};return e.forEach(function(e){for(var r in e)t[r]=e[r]}),t}},reverse:function(e){if(void 0!==e){if(e.length<=1)return e;for(var t=e.length,r=new Array(t),n=0;n<t;n++)r[t-n-1]=e[n];return r}},each:z,error:function(e){throw{code:"D3137",stack:(new Error).stack,message:e||"$error() function evaluated"}},assert:function(e,t){if(!e)throw{code:"D3141",stack:(new Error).stack,message:t||"$assert() statement failed"}},type:function(e){if(void 0!==e)return null===e?"null":g(e)?"number":"string"==typeof e?"string":"boolean"==typeof e?"boolean":Array.isArray(e)?"array":k(e)?"function":"object"},sort:$,shuffle:function(e){if(void 0!==e){if(e.length<=1)return e;for(var t=new Array(e.length),r=0;r<e.length;r++){var n=Math.floor(Math.random()*(r+1));r!==n&&(t[r]=t[n]),t[n]=e[r]}return t}},distinct:function(e){if(void 0!==e){if(!Array.isArray(e)||e.length<=1)return e;for(var t=y(e)?m():[],r=0;r<e.length;r++){for(var n=e[r],a=!1,i=0;i<t.length;i++)if(A(n,t[i])){a=!0;break}a||t.push(n)}return t}},base64encode:function(e){if(void 0!==e)return("undefined"!=typeof window?window.btoa:function(e){return new r.Buffer.from(e,"binary").toString("base64")})(e)},base64decode:function(e){if(void 0!==e)return("undefined"!=typeof window?window.atob:function(e){return new r.Buffer.from(e,"base64").toString("binary")})(e)},encodeUrlComponent:function(e){if(void 0!==e){var t;try{t=encodeURIComponent(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"encodeUrlComponent"}}return t}},encodeUrl:function(e){if(void 0!==e){var t;try{t=encodeURI(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"encodeUrl"}}return t}},decodeUrlComponent:function(e){if(void 0!==e){var t;try{t=decodeURIComponent(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"decodeUrlComponent"}}return t}},decodeUrl:function(e){if(void 0!==e){var t;try{t=decodeURI(e)}catch(t){throw{code:"D3140",stack:(new Error).stack,value:e,functionName:"decodeUrl"}}return t}}}}();t.exports=i}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utils":6}],3:[function(e,t,r){"use strict";function n(e){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=e("./datetime"),i=e("./functions"),o=e("./utils"),s=e("./parser"),u=e("./signature"),c=function(){var e=regeneratorRuntime.mark(L),t=regeneratorRuntime.mark(_),r=regeneratorRuntime.mark($),c=regeneratorRuntime.mark(q),p=regeneratorRuntime.mark(W),f=regeneratorRuntime.mark(G),l=regeneratorRuntime.mark(H),d=regeneratorRuntime.mark(Z),h=regeneratorRuntime.mark(re),g=regeneratorRuntime.mark(ie),v=regeneratorRuntime.mark(ue),b=regeneratorRuntime.mark(ce),m=regeneratorRuntime.mark(pe),y=regeneratorRuntime.mark(de),k=regeneratorRuntime.mark(ve),x=regeneratorRuntime.mark(be),w=regeneratorRuntime.mark(me),E=regeneratorRuntime.mark(ye),A=regeneratorRuntime.mark(xe),S=regeneratorRuntime.mark(Ee),T=regeneratorRuntime.mark(Te),D=regeneratorRuntime.mark(Re),O=o.isNumeric,R=o.isArrayOfStrings,Y=o.isArrayOfNumbers,P=o.createSequence,M=o.isSequence,j=o.isFunction,C=o.isLambda,F=o.isIterable,U=o.getFunctionArity,N=o.isDeepEqual,I=Ye(null);function L(t,r,n){var a,i,o,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(i=n.lookup("__evaluate_entry"))&&i(t,r,n),e.t0=t.type,e.next="path"===e.t0?5:"binary"===e.t0?8:"unary"===e.t0?11:"name"===e.t0?14:"string"===e.t0?16:"number"===e.t0?16:"value"===e.t0?16:"wildcard"===e.t0?18:"descendant"===e.t0?20:"parent"===e.t0?22:"condition"===e.t0?24:"block"===e.t0?27:"bind"===e.t0?30:"regex"===e.t0?33:"function"===e.t0?35:"variable"===e.t0?38:"lambda"===e.t0?40:"partial"===e.t0?42:"apply"===e.t0?45:"transform"===e.t0?48:50;break;case 5:return e.delegateYield(_(t,r,n),"t1",6);case 6:return a=e.t1,e.abrupt("break",50);case 8:return e.delegateYield(H(t,r,n),"t2",9);case 9:return a=e.t2,e.abrupt("break",50);case 11:return e.delegateYield(Z(t,r,n),"t3",12);case 12:return a=e.t3,e.abrupt("break",50);case 14:return a=B(t,r,n),e.abrupt("break",50);case 16:return a=J(t),e.abrupt("break",50);case 18:return a=X(t,r),e.abrupt("break",50);case 20:return a=Q(t,r),e.abrupt("break",50);case 22:return a=n.lookup(t.slot.label),e.abrupt("break",50);case 24:return e.delegateYield(ce(t,r,n),"t4",25);case 25:return a=e.t4,e.abrupt("break",50);case 27:return e.delegateYield(pe(t,r,n),"t5",28);case 28:return a=e.t5,e.abrupt("break",50);case 30:return e.delegateYield(ue(t,r,n),"t6",31);case 31:return a=e.t6,e.abrupt("break",50);case 33:return a=fe(t),e.abrupt("break",50);case 35:return e.delegateYield(be(t,r,n),"t7",36);case 36:return a=e.t7,e.abrupt("break",50);case 38:return a=le(t,r,n),e.abrupt("break",50);case 40:return a=ke(t,r,n),e.abrupt("break",50);case 42:return e.delegateYield(xe(t,r,n),"t8",43);case 43:return a=e.t8,e.abrupt("break",50);case 45:return e.delegateYield(ve(t,r,n),"t9",46);case 46:return a=e.t9,e.abrupt("break",50);case 48:return a=he(t,r,n),e.abrupt("break",50);case 50:if(!n.async||null!=a&&"function"==typeof a.then||(a=Promise.resolve(a)),!n.async||"function"!=typeof a.then||!t.nextFunction||"function"!=typeof a[t.nextFunction]){e.next=54;break}e.next=57;break;case 54:return e.next=56,a;case 56:a=e.sent;case 57:if(!Object.prototype.hasOwnProperty.call(t,"predicate")){e.next=65;break}o=0;case 59:if(!(o<t.predicate.length)){e.next=65;break}return e.delegateYield(G(t.predicate[o].expr,a,n),"t10",61);case 61:a=e.t10;case 62:o++,e.next=59;break;case 65:if("path"===t.type||!Object.prototype.hasOwnProperty.call(t,"group")){e.next=68;break}return e.delegateYield(ie(t.group,a,n),"t11",67);case 67:a=e.t11;case 68:return(s=n.lookup("__evaluate_exit"))&&s(t,r,n,a),a&&M(a)&&!a.tupleStream&&(t.keepArray&&(a.keepSingleton=!0),0===a.length?a=void 0:1===a.length&&(a=a.keepSingleton?a:a[0])),e.abrupt("return",a);case 72:case"end":return e.stop()}},e)}function _(e,r,n){var a,i,o,s,u,c;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:a=Array.isArray(r)&&"variable"!==e.steps[0].type?r:P(r),o=!1,s=void 0,u=0;case 4:if(!(u<e.steps.length)){t.next=25;break}if((c=e.steps[u]).tuple&&(o=!0),0!==u||!c.consarray){t.next=12;break}return t.delegateYield(L(c,a,n),"t0",9);case 9:i=t.t0,t.next=19;break;case 12:if(!o){t.next=17;break}return t.delegateYield(W(c,a,s,n),"t1",14);case 14:s=t.t1,t.next=19;break;case 17:return t.delegateYield($(c,a,n,u===e.steps.length-1),"t2",18);case 18:i=t.t2;case 19:if(o||void 0!==i&&0!==i.length){t.next=21;break}return t.abrupt("break",25);case 21:void 0===c.focus&&(a=i);case 22:u++,t.next=4;break;case 25:if(o)if(e.tuple)i=s;else for(i=P(),u=0;u<s.length;u++)i.push(s[u]["@"]);if(e.keepSingletonArray&&(Array.isArray(i)&&i.cons&&!i.sequence&&(i=P(i)),i.keepSingleton=!0),!e.hasOwnProperty("group")){t.next=30;break}return t.delegateYield(ie(e.group,o?s:i,n),"t3",29);case 29:i=t.t3;case 30:return t.abrupt("return",i);case 31:case"end":return t.stop()}},t)}function z(e,t){var r=Ye(e);for(var n in t)r.bind(n,t[n]);return r}function $(e,t,n,a){var i,o,s,u,c;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if("sort"!==e.type){r.next=7;break}return r.delegateYield(de(e,t,n),"t0",2);case 2:if(i=r.t0,!e.stages){r.next=6;break}return r.delegateYield(q(e.stages,i,n),"t1",5);case 5:i=r.t1;case 6:return r.abrupt("return",i);case 7:i=P(),o=0;case 9:if(!(o<t.length)){r.next=24;break}return r.delegateYield(L(e,t[o],n),"t2",11);case 11:if(s=r.t2,!e.stages){r.next=20;break}u=0;case 14:if(!(u<e.stages.length)){r.next=20;break}return r.delegateYield(G(e.stages[u].expr,s,n),"t3",16);case 16:s=r.t3;case 17:u++,r.next=14;break;case 20:void 0!==s&&i.push(s);case 21:o++,r.next=9;break;case 24:return c=P(),a&&1===i.length&&Array.isArray(i[0])&&!M(i[0])?c=i[0]:i.forEach(function(e){!Array.isArray(e)||e.cons?c.push(e):e.forEach(function(e){return c.push(e)})}),r.abrupt("return",c);case 27:case"end":return r.stop()}},r)}function q(e,t,r){var n,a,i,o;return regeneratorRuntime.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:n=t,a=0;case 2:if(!(a<e.length)){s.next=15;break}i=e[a],s.t0=i.type,s.next="filter"===s.t0?7:"index"===s.t0?10:12;break;case 7:return s.delegateYield(G(i.expr,n,r),"t1",8);case 8:return n=s.t1,s.abrupt("break",12);case 10:for(o=0;o<n.length;o++)n[o][i.value]=o;return s.abrupt("break",12);case 12:a++,s.next=2;break;case 15:return s.abrupt("return",n);case 16:case"end":return s.stop()}},c)}function W(e,t,r,n){var a,i,o,s,u,c,f,l;return regeneratorRuntime.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if("sort"!==e.type){p.next=15;break}if(!r){p.next=6;break}return p.delegateYield(de(e,r,n),"t0",3);case 3:a=p.t0,p.next=11;break;case 6:return p.delegateYield(de(e,t,n),"t1",7);case 7:for(i=p.t1,(a=P()).tupleStream=!0,o=0;o<i.length;o++)(s={"@":i[o]})[e.index]=o,a.push(s);case 11:if(!e.stages){p.next=14;break}return p.delegateYield(q(e.stages,a,n),"t2",13);case 13:a=p.t2;case 14:return p.abrupt("return",a);case 15:(a=P()).tupleStream=!0,u=n,void 0===r&&(r=t.map(function(e){return{"@":e}})),c=0;case 20:if(!(c<r.length)){p.next=28;break}return u=z(n,r[c]),p.delegateYield(L(e,r[c]["@"],u),"t3",23);case 23:if(void 0!==(f=p.t3))for(Array.isArray(f)||(f=[f]),l=0;l<f.length;l++)s={},Object.assign(s,r[c]),f.tupleStream?Object.assign(s,f[l]):(e.focus?(s[e.focus]=f[l],s["@"]=r[c]["@"]):s["@"]=f[l],e.index&&(s[e.index]=l),e.ancestor&&(s[e.ancestor.label]=r[c]["@"])),a.push(s);case 25:c++,p.next=20;break;case 28:if(!e.stages){p.next=31;break}return p.delegateYield(q(e.stages,a,n),"t4",30);case 30:a=p.t4;case 31:return p.abrupt("return",a);case 32:case"end":return p.stop()}},p)}function G(e,t,r){var n,a,o,s,u,c;return regeneratorRuntime.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(n=P(),t&&t.tupleStream&&(n.tupleStream=!0),Array.isArray(t)||(t=P(t)),"number"!==e.type){p.next=10;break}(a=Math.floor(e.value))<0&&(a=t.length+a),void 0!==(o=t[a])&&(Array.isArray(o)?n=o:n.push(o)),p.next=23;break;case 10:a=0;case 11:if(!(a<t.length)){p.next=23;break}return o=t[a],s=o,u=r,t.tupleStream&&(s=o["@"],u=z(r,o)),p.delegateYield(L(e,s,u),"t0",17);case 17:c=p.t0,O(c)&&(c=[c]),Y(c)?c.forEach(function(e){var r=Math.floor(e);r<0&&(r=t.length+r),r===a&&n.push(o)}):i.boolean(c)&&n.push(o);case 20:a++,p.next=11;break;case 23:return p.abrupt("return",n);case 24:case"end":return p.stop()}},f)}function H(e,t,r){var n,a,i,o,s;return regeneratorRuntime.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.delegateYield(L(e.lhs,t,r),"t0",1);case 1:if(a=u.t0,i=e.value,o=regeneratorRuntime.mark(function n(){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.delegateYield(L(e.rhs,t,r),"t0",1);case 1:return n.abrupt("return",n.t0);case 2:case"end":return n.stop()}},n)}),"and"!==i&&"or"!==i){u.next=15;break}return u.prev=5,u.delegateYield(re(a,o,i),"t1",7);case 7:return u.abrupt("return",u.t1);case 10:throw u.prev=10,u.t2=u.catch(5),u.t2.position=e.position,u.t2.token=i,u.t2;case 15:return u.delegateYield(o(),"t3",16);case 16:s=u.t3,u.prev=17,u.t4=i,u.next="+"===u.t4?21:"-"===u.t4?21:"*"===u.t4?21:"/"===u.t4?21:"%"===u.t4?21:"="===u.t4?23:"!="===u.t4?23:"<"===u.t4?25:"<="===u.t4?25:">"===u.t4?25:">="===u.t4?25:"&"===u.t4?27:".."===u.t4?29:"in"===u.t4?31:33;break;case 21:return n=V(a,s,i),u.abrupt("break",33);case 23:return n=K(a,s,i),u.abrupt("break",33);case 25:return n=ee(a,s,i),u.abrupt("break",33);case 27:return n=ae(a,s),u.abrupt("break",33);case 29:return n=se(a,s),u.abrupt("break",33);case 31:return n=te(a,s),u.abrupt("break",33);case 33:u.next=40;break;case 35:throw u.prev=35,u.t5=u.catch(17),u.t5.position=e.position,u.t5.token=i,u.t5;case 40:return u.abrupt("return",n);case 41:case"end":return u.stop()}},l,null,[[5,10],[17,35]])}function Z(e,t,r){var n,a,o,s;return regeneratorRuntime.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:u.t0=e.value,u.next="-"===u.t0?3:"["===u.t0?15:"{"===u.t0?27:30;break;case 3:return u.delegateYield(L(e.expression,t,r),"t1",4);case 4:if(void 0!==(n=u.t1)){u.next=9;break}n=void 0,u.next=14;break;case 9:if(!O(n)){u.next=13;break}n=-n,u.next=14;break;case 13:throw{code:"D1002",stack:(new Error).stack,position:e.position,token:e.value,value:n};case 14:return u.abrupt("break",30);case 15:n=[],a=0;case 17:if(!(a<e.expressions.length)){u.next=25;break}return o=e.expressions[a],u.delegateYield(L(o,t,r),"t2",20);case 20:void 0!==(s=u.t2)&&("["===o.value?n.push(s):n=i.append(n,s));case 22:a++,u.next=17;break;case 25:return e.consarray&&Object.defineProperty(n,"cons",{enumerable:!1,configurable:!1,value:!0}),u.abrupt("break",30);case 27:return u.delegateYield(ie(e,t,r),"t3",28);case 28:return n=u.t3,u.abrupt("break",30);case 30:return u.abrupt("return",n);case 31:case"end":return u.stop()}},d)}function B(e,t,r){return i.lookup(t,e.value)}function J(e){return e.value}function X(e,t){var r=P();return Array.isArray(t)&&t.outerWrapper&&t.length>0&&(t=t[0]),null!==t&&"object"===n(t)&&Object.keys(t).forEach(function(e){var n=t[e];Array.isArray(n)?(n=function e(t,r){void 0===r&&(r=[]);Array.isArray(t)?t.forEach(function(t){e(t,r)}):r.push(t);return r}(n),r=i.append(r,n)):r.push(n)}),r}function Q(e,t){var r,a=P();return void 0!==t&&(!function e(t,r){Array.isArray(t)||r.push(t);Array.isArray(t)?t.forEach(function(t){e(t,r)}):null!==t&&"object"===n(t)&&Object.keys(t).forEach(function(n){e(t[n],r)})}(t,a),r=1===a.length?a[0]:a),r}function V(e,t,r){var n;if(void 0!==e&&!O(e))throw{code:"T2001",stack:(new Error).stack,value:e};if(void 0!==t&&!O(t))throw{code:"T2002",stack:(new Error).stack,value:t};if(void 0===e||void 0===t)return n;switch(r){case"+":n=e+t;break;case"-":n=e-t;break;case"*":n=e*t;break;case"/":n=e/t;break;case"%":n=e%t}return n}function K(e,t,r){var a,i=n(e),o=n(t);if("undefined"===i||"undefined"===o)return!1;switch(r){case"=":a=N(e,t);break;case"!=":a=!N(e,t)}return a}function ee(e,t,r){var a,i=n(e),o=n(t);if(!("undefined"===i||"string"===i||"number"===i)||!("undefined"===o||"string"===o||"number"===o))throw{code:"T2010",stack:(new Error).stack,value:"string"!==i&&"number"!==i?e:t};if("undefined"!==i&&"undefined"!==o){if(i!==o)throw{code:"T2009",stack:(new Error).stack,value:e,value2:t};switch(r){case"<":a=e<t;break;case"<=":a=e<=t;break;case">":a=e>t;break;case">=":a=e>=t}return a}}function te(e,t){var r=!1;if(void 0===e||void 0===t)return!1;Array.isArray(t)||(t=[t]);for(var n=0;n<t.length;n++)if(t[n]===e){r=!0;break}return r}function re(e,t,r){var n,a;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:a=ne(e),i.t0=r,i.next="and"===i.t0?4:"or"===i.t0?12:20;break;case 4:if(i.t1=a,!i.t1){i.next=10;break}return i.t2=ne,i.delegateYield(t(),"t3",8);case 8:i.t4=i.t3,i.t1=(0,i.t2)(i.t4);case 10:return n=i.t1,i.abrupt("break",20);case 12:if(i.t5=a,i.t5){i.next=18;break}return i.t6=ne,i.delegateYield(t(),"t7",16);case 16:i.t8=i.t7,i.t5=(0,i.t6)(i.t8);case 18:return n=i.t5,i.abrupt("break",20);case 20:return i.abrupt("return",n);case 21:case"end":return i.stop()}},h)}function ne(e){var t=i.boolean(e);return void 0!==t&&t}function ae(e,t){var r="",n="";return void 0!==e&&(r=i.string(e)),void 0!==t&&(n=i.string(t)),r.concat(n)}function ie(e,t,r){var n,a,o,s,u,c,p,f,l,d,h,v,b;return regeneratorRuntime.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:n={},a={},o=!(!t||!t.tupleStream),Array.isArray(t)||(t=P(t)),0===t.length&&t.push(void 0),s=0;case 6:if(!(s<t.length)){g.next=31;break}u=t[s],c=o?z(r,u):r,p=0;case 10:if(!(p<e.lhs.length)){g.next=28;break}return f=e.lhs[p],g.delegateYield(L(f[0],o?u["@"]:u,c),"t0",13);case 13:if("string"==typeof(l=g.t0)||void 0===l){g.next=16;break}throw{code:"T1003",stack:(new Error).stack,position:e.position,value:l};case 16:if(void 0===l){g.next=25;break}if(d={data:u,exprIndex:p},!a.hasOwnProperty(l)){g.next=24;break}if(a[l].exprIndex===p){g.next=21;break}throw{code:"D1009",stack:(new Error).stack,position:e.position,value:l};case 21:a[l].data=i.append(a[l].data,u),g.next=25;break;case 24:a[l]=d;case 25:p++,g.next=10;break;case 28:s++,g.next=6;break;case 31:g.t1=regeneratorRuntime.keys(a);case 32:if((g.t2=g.t1()).done){g.next=43;break}return l=g.t2.value,d=a[l],h=d.data,c=r,o&&(v=oe(d.data),h=v["@"],delete v["@"],c=z(r,v)),g.delegateYield(L(e.lhs[d.exprIndex][1],h,c),"t3",39);case 39:void 0!==(b=g.t3)&&(n[l]=b),g.next=32;break;case 43:return g.abrupt("return",n);case 44:case"end":return g.stop()}},g)}function oe(e){if(!Array.isArray(e))return e;var t={};Object.assign(t,e[0]);for(var r=1;r<e.length;r++)for(var n in e[r])t[n]=i.append(t[n],e[r][n]);return t}function se(e,t){var r;if(void 0!==e&&!Number.isInteger(e))throw{code:"T2003",stack:(new Error).stack,value:e};if(void 0!==t&&!Number.isInteger(t))throw{code:"T2004",stack:(new Error).stack,value:t};if(void 0===e||void 0===t)return r;if(e>t)return r;var n=t-e+1;if(n>1e7)throw{code:"D2014",stack:(new Error).stack,value:n};r=new Array(n);for(var a=e,i=0;a<=t;a++,i++)r[i]=a;return r.sequence=!0,r}function ue(e,t,r){var n;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.delegateYield(L(e.rhs,t,r),"t0",1);case 1:return n=a.t0,r.bind(e.lhs.value,n),a.abrupt("return",n);case 4:case"end":return a.stop()}},v)}function ce(e,t,r){var n,a;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.delegateYield(L(e.condition,t,r),"t0",1);case 1:if(a=o.t0,!i.boolean(a)){o.next=7;break}return o.delegateYield(L(e.then,t,r),"t1",4);case 4:n=o.t1,o.next=10;break;case 7:if(void 0===e.else){o.next=10;break}return o.delegateYield(L(e.else,t,r),"t2",9);case 9:n=o.t2;case 10:return o.abrupt("return",n);case 11:case"end":return o.stop()}},b)}function pe(e,t,r){var n,a,i;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:a=Ye(r),i=0;case 2:if(!(i<e.expressions.length)){o.next=8;break}return o.delegateYield(L(e.expressions[i],t,a),"t0",4);case 4:n=o.t0;case 5:i++,o.next=2;break;case 8:return o.abrupt("return",n);case 9:case"end":return o.stop()}},m)}function fe(e){var t=new je.RegexEngine(e.value);return function r(n,a){var i;t.lastIndex=a||0;var o=t.exec(n);if(null!==o){if(i={match:o[0],start:o.index,end:o.index+o[0].length,groups:[]},o.length>1)for(var s=1;s<o.length;s++)i.groups.push(o[s]);i.next=function(){if(!(t.lastIndex>=n.length)){var a=r(n,t.lastIndex);if(a&&""===a.match)throw{code:"D1004",stack:(new Error).stack,position:e.position,value:e.value.source};return a}}}return i}}function le(e,t,r){return""===e.value?t&&t.outerWrapper?t[0]:t:r.lookup(e.value)}function de(e,t,r){var a,o,s,u,c;return regeneratorRuntime.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return o=t,s=!!t.tupleStream,u=regeneratorRuntime.mark(function t(a,i){var o,u,c,p,f,l,d,h,g;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:o=0,u=0;case 2:if(!(0===o&&u<e.terms.length)){t.next=35;break}return c=e.terms[u],p=a,f=r,s&&(p=a["@"],f=z(r,a)),t.delegateYield(L(c.expression,p,f),"t0",8);case 8:return l=t.t0,p=i,f=r,s&&(p=i["@"],f=z(r,i)),t.delegateYield(L(c.expression,p,f),"t1",13);case 13:if(d=t.t1,h=n(l),g=n(d),"undefined"!==h){t.next=19;break}return o="undefined"===g?0:1,t.abrupt("continue",32);case 19:if("undefined"!==g){t.next=22;break}return o=-1,t.abrupt("continue",32);case 22:if(!("string"!==h&&"number"!==h||"string"!==g&&"number"!==g)){t.next=24;break}throw{code:"T2008",stack:(new Error).stack,position:e.position,value:"string"!==h&&"number"!==h?l:d};case 24:if(h===g){t.next=26;break}throw{code:"T2007",stack:(new Error).stack,position:e.position,value:l,value2:d};case 26:if(l!==d){t.next=30;break}return t.abrupt("continue",32);case 30:o=l<d?-1:1;case 31:!0===c.descending&&(o=-o);case 32:u++,t.next=2;break;case 35:return t.abrupt("return",1===o);case 36:case"end":return t.stop()}},t)}),c={environment:r,input:t},p.delegateYield(i.sort.apply(c,[o,u]),"t0",5);case 5:return a=p.t0,p.abrupt("return",a);case 7:case"end":return p.stop()}},y)}function he(e,t,r){return Oe(regeneratorRuntime.mark(function t(a){var i,o,s,u,c,p,f,l,d,h,g;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==a){t.next=2;break}return t.abrupt("return",void 0);case 2:if(i=r.lookup("clone"),j(i)){t.next=5;break}throw{code:"T2013",stack:(new Error).stack,position:e.position};case 5:return t.delegateYield(me(i,[a],null,r),"t0",6);case 6:return o=t.t0,t.delegateYield(L(e.pattern,o,r),"t1",8);case 8:if(void 0===(s=t.t1)){t.next=33;break}Array.isArray(s)||(s=[s]),u=0;case 12:if(!(u<s.length)){t.next=33;break}return c=s[u],t.delegateYield(L(e.update,c,r),"t2",15);case 15:if(p=t.t2,"undefined"===(f=n(p))){t.next=21;break}if("object"===f&&null!==p&&!Array.isArray(p)){t.next=20;break}throw{code:"T2011",stack:(new Error).stack,position:e.update.position,value:p};case 20:for(l in p)c[l]=p[l];case 21:if(void 0===e.delete){t.next=30;break}return t.delegateYield(L(e.delete,c,r),"t3",23);case 23:if(void 0===(d=t.t3)){t.next=30;break}if(h=d,Array.isArray(d)||(d=[d]),R(d)){t.next=29;break}throw{code:"T2012",stack:(new Error).stack,position:e.delete.position,value:h};case 29:for(g=0;g<d.length;g++)"object"===n(c)&&null!==c&&delete c[d[g]];case 30:u++,t.next=12;break;case 33:return t.abrupt("return",o);case 34:case"end":return t.stop()}},t)}),"<(oa):o>")}var ge=s("function($f, $g) { function($x){ $g($f($x)) } }");function ve(e,t,r){var n,a,i,o;return regeneratorRuntime.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return s.delegateYield(L(e.lhs,t,r),"t0",1);case 1:if(a=s.t0,"function"!==e.rhs.type){s.next=7;break}return s.delegateYield(be(e.rhs,t,r,{context:a}),"t1",4);case 4:n=s.t1,s.next=20;break;case 7:return s.delegateYield(L(e.rhs,t,r),"t2",8);case 8:if(i=s.t2,j(i)){s.next=11;break}throw{code:"T2006",stack:(new Error).stack,position:e.position,value:i};case 11:if(!j(a)){s.next=18;break}return s.delegateYield(L(ge,null,r),"t3",13);case 13:return o=s.t3,s.delegateYield(me(o,[a,i],null,r),"t4",15);case 15:n=s.t4,s.next=20;break;case 18:return s.delegateYield(me(i,[a],null,r),"t5",19);case 19:n=s.t5;case 20:return s.abrupt("return",n);case 21:case"end":return s.stop()}},k)}function be(e,t,r,a){var i,o,s,u,c,p;return regeneratorRuntime.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.delegateYield(L(e.procedure,t,r),"t0",1);case 1:if(void 0!==(o=f.t0)||"path"!==e.procedure.type||!r.lookup(e.procedure.steps[0].value)){f.next=4;break}throw{code:"T1005",stack:(new Error).stack,position:e.position,token:e.procedure.steps[0].value};case 4:s=[],void 0!==a&&s.push(a.context),u=regeneratorRuntime.mark(function n(){var a,i;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.delegateYield(L(e.arguments[c],t,r),"t0",1);case 1:a=n.t0,j(a)?((i=regeneratorRuntime.mark(function e(){var t,n,i,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(t=o.length,n=new Array(t),i=0;i<t;i++)n[i]=o[i];return e.delegateYield(me(a,n,null,r),"t0",2);case 2:return e.abrupt("return",e.t0);case 3:case"end":return e.stop()}},e)})).arity=U(a),s.push(i)):s.push(a);case 3:case"end":return n.stop()}},n)}),c=0;case 8:if(!(c<e.arguments.length)){f.next=13;break}return f.delegateYield(u(),"t1",10);case 10:c++,f.next=8;break;case 13:return p="path"===e.procedure.type?e.procedure.steps[0].value:e.procedure.value,f.prev=14,"object"===n(o)&&(o.token=p,o.position=e.position),f.delegateYield(me(o,s,t,r),"t2",17);case 17:i=f.t2,f.next=25;break;case 20:throw f.prev=20,f.t3=f.catch(14),f.t3.position||(f.t3.position=e.position),f.t3.token||(f.t3.token=p),f.t3;case 25:return f.abrupt("return",i);case 26:case"end":return f.stop()}},x,null,[[14,20]])}function me(e,t,r,n){var a,i,o,s;return regeneratorRuntime.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.delegateYield(ye(e,t,r,n),"t0",1);case 1:a=u.t0;case 2:if(!C(a)||!0!==a.thunk){u.next=21;break}return u.delegateYield(L(a.body.procedure,a.input,a.environment),"t1",4);case 4:i=u.t1,"variable"===a.body.procedure.type&&(i.token=a.body.procedure.value),i.position=a.body.procedure.position,o=[],s=0;case 9:if(!(s<a.body.arguments.length)){u.next=17;break}return u.t2=o,u.delegateYield(L(a.body.arguments[s],a.input,a.environment),"t3",12);case 12:u.t4=u.t3,u.t2.push.call(u.t2,u.t4);case 14:s++,u.next=9;break;case 17:return u.delegateYield(ye(i,o,r,n),"t5",18);case 18:a=u.t5,u.next=2;break;case 21:return u.abrupt("return",a);case 22:case"end":return u.stop()}},w)}function ye(e,t,r,n){var a,i,o;return regeneratorRuntime.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(s.prev=0,i=t,e&&(i=we(e.signature,t,r)),!C(e)){s.next=8;break}return s.delegateYield(Ee(e,i),"t0",5);case 5:a=s.t0,s.next=24;break;case 8:if(!e||!0!==e._jsonata_function){s.next=16;break}if(o={environment:n,input:r},a=e.implementation.apply(o,i),!F(a)){s.next=14;break}return s.delegateYield(a,"t1",13);case 13:a=s.t1;case 14:s.next=24;break;case 16:if("function"!=typeof e){s.next=23;break}if(a=e.apply(r,i),!F(a)){s.next=21;break}return s.delegateYield(a,"t2",20);case 20:a=s.t2;case 21:s.next=24;break;case 23:throw{code:"T1006",stack:(new Error).stack};case 24:s.next=30;break;case 26:throw s.prev=26,s.t3=s.catch(0),e&&(void 0===s.t3.token&&void 0!==e.token&&(s.t3.token=e.token),s.t3.position=e.position),s.t3;case 30:return s.abrupt("return",a);case 31:case"end":return s.stop()}},E,null,[[0,26]])}function ke(e,t,r){var n={_jsonata_lambda:!0,input:t,environment:r,arguments:e.arguments,signature:e.signature,body:e.body};return!0===e.thunk&&(n.thunk=!0),n.apply=regeneratorRuntime.mark(function e(r,a){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.delegateYield(me(n,a,t,r.environment),"t0",1);case 1:return e.abrupt("return",e.t0);case 2:case"end":return e.stop()}},e)}),n}function xe(e,t,r){var n,a,i,o,s;return regeneratorRuntime.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:a=[],i=0;case 2:if(!(i<e.arguments.length)){u.next=15;break}if("operator"!==(o=e.arguments[i]).type||"?"!==o.value){u.next=8;break}a.push(o),u.next=12;break;case 8:return u.t0=a,u.delegateYield(L(o,t,r),"t1",10);case 10:u.t2=u.t1,u.t0.push.call(u.t0,u.t2);case 12:i++,u.next=2;break;case 15:return u.delegateYield(L(e.procedure,t,r),"t3",16);case 16:if(void 0!==(s=u.t3)||"path"!==e.procedure.type||!r.lookup(e.procedure.steps[0].value)){u.next=19;break}throw{code:"T1007",stack:(new Error).stack,position:e.position,token:e.procedure.steps[0].value};case 19:if(!C(s)){u.next=23;break}n=Ae(s,a),u.next=32;break;case 23:if(!s||!0!==s._jsonata_function){u.next=27;break}n=Se(s.implementation,a),u.next=32;break;case 27:if("function"!=typeof s){u.next=31;break}n=Se(s,a),u.next=32;break;case 31:throw{code:"T1008",stack:(new Error).stack,position:e.position,token:"path"===e.procedure.type?e.procedure.steps[0].value:e.procedure.value};case 32:return u.abrupt("return",n);case 33:case"end":return u.stop()}},A)}function we(e,t,r){return void 0===e?t:e.validate(t,r)}function Ee(e,t){var r,n;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(n=Ye(e.environment),e.arguments.forEach(function(e,r){n.bind(e.value,t[r])}),"function"!=typeof e.body){a.next=7;break}return a.delegateYield(Te(e.body,n),"t0",4);case 4:r=a.t0,a.next=9;break;case 7:return a.delegateYield(L(e.body,e.input,n),"t1",8);case 8:r=a.t1;case 9:return a.abrupt("return",r);case 10:case"end":return a.stop()}},S)}function Ae(e,t){var r=Ye(e.environment),n=[];return e.arguments.forEach(function(e,a){var i=t[a];i&&"operator"===i.type&&"?"===i.value?n.push(e):r.bind(e.value,i)}),{_jsonata_lambda:!0,input:e.input,environment:r,arguments:n,body:e.body}}function Se(e,t){var r=De(e),n="function("+(r=r.map(function(e){return"$"+e.trim()})).join(", ")+"){ _ }",a=s(n);return a.body=e,Ae(a,t)}function Te(e,t){var r,n,a,i;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(r=De(e),n=r.map(function(e){return t.lookup(e.trim())}),a={environment:t},i=e.apply(a,n),!F(i)){o.next=7;break}return o.delegateYield(i,"t0",6);case 6:i=o.t0;case 7:return o.abrupt("return",i);case 8:case"end":return o.stop()}},T)}function De(e){var t=e.toString();return/\(([^)]*)\)/.exec(t)[1].split(",")}function Oe(e,t){var r={_jsonata_function:!0,implementation:e};return void 0!==t&&(r.signature=u(t)),r}function Re(e,t){var r,n,a;return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:if(void 0!==e){i.next=2;break}return i.abrupt("return",void 0);case 2:r=this.input,void 0!==t&&(r=t,Array.isArray(r)&&!M(r)&&((r=P(r)).outerWrapper=!0)),i.prev=4,n=s(e,!1),i.next=12;break;case 8:throw i.prev=8,i.t0=i.catch(4),Me(i.t0),{stack:(new Error).stack,code:"D3120",value:i.t0.message,error:i.t0};case 12:return i.prev=12,i.delegateYield(L(n,r,this.environment),"t1",14);case 14:a=i.t1,i.next=21;break;case 17:throw i.prev=17,i.t2=i.catch(12),Me(i.t2),{stack:(new Error).stack,code:"D3121",value:i.t2.message,error:i.t2};case 21:return i.abrupt("return",a);case 22:case"end":return i.stop()}},D,this,[[4,8],[12,17]])}function Ye(e){var t={};return{bind:function(e,r){t[e]=r},lookup:function(r){var n;return t.hasOwnProperty(r)?n=t[r]:e&&(n=e.lookup(r)),n},timestamp:e?e.timestamp:null,async:!!e&&e.async,global:e?e.global:{ancestry:[null]}}}I.bind("sum",Oe(i.sum,"<a<n>:n>")),I.bind("count",Oe(i.count,"<a:n>")),I.bind("max",Oe(i.max,"<a<n>:n>")),I.bind("min",Oe(i.min,"<a<n>:n>")),I.bind("average",Oe(i.average,"<a<n>:n>")),I.bind("string",Oe(i.string,"<x-b?:s>")),I.bind("substring",Oe(i.substring,"<s-nn?:s>")),I.bind("substringBefore",Oe(i.substringBefore,"<s-s:s>")),I.bind("substringAfter",Oe(i.substringAfter,"<s-s:s>")),I.bind("lowercase",Oe(i.lowercase,"<s-:s>")),I.bind("uppercase",Oe(i.uppercase,"<s-:s>")),I.bind("length",Oe(i.length,"<s-:n>")),I.bind("trim",Oe(i.trim,"<s-:s>")),I.bind("pad",Oe(i.pad,"<s-ns?:s>")),I.bind("match",Oe(i.match,"<s-f<s:o>n?:a<o>>")),I.bind("contains",Oe(i.contains,"<s-(sf):b>")),I.bind("replace",Oe(i.replace,"<s-(sf)(sf)n?:s>")),I.bind("split",Oe(i.split,"<s-(sf)n?:a<s>>")),I.bind("join",Oe(i.join,"<a<s>s?:s>")),I.bind("formatNumber",Oe(i.formatNumber,"<n-so?:s>")),I.bind("formatBase",Oe(i.formatBase,"<n-n?:s>")),I.bind("formatInteger",Oe(a.formatInteger,"<n-s:s>")),I.bind("parseInteger",Oe(a.parseInteger,"<s-s:n>")),I.bind("number",Oe(i.number,"<(nsb)-:n>")),I.bind("floor",Oe(i.floor,"<n-:n>")),I.bind("ceil",Oe(i.ceil,"<n-:n>")),I.bind("round",Oe(i.round,"<n-n?:n>")),I.bind("abs",Oe(i.abs,"<n-:n>")),I.bind("sqrt",Oe(i.sqrt,"<n-:n>")),I.bind("power",Oe(i.power,"<n-n:n>")),I.bind("random",Oe(i.random,"<:n>")),I.bind("boolean",Oe(i.boolean,"<x-:b>")),I.bind("not",Oe(i.not,"<x-:b>")),I.bind("map",Oe(i.map,"<af>")),I.bind("zip",Oe(i.zip,"<a+>")),I.bind("filter",Oe(i.filter,"<af>")),I.bind("single",Oe(i.single,"<af?>")),I.bind("reduce",Oe(i.foldLeft,"<afj?:j>")),I.bind("sift",Oe(i.sift,"<o-f?:o>")),I.bind("keys",Oe(i.keys,"<x-:a<s>>")),I.bind("lookup",Oe(i.lookup,"<x-s:x>")),I.bind("append",Oe(i.append,"<xx:a>")),I.bind("exists",Oe(i.exists,"<x:b>")),I.bind("spread",Oe(i.spread,"<x-:a<o>>")),I.bind("merge",Oe(i.merge,"<a<o>:o>")),I.bind("reverse",Oe(i.reverse,"<a:a>")),I.bind("each",Oe(i.each,"<o-f:a>")),I.bind("error",Oe(i.error,"<s?:x>")),I.bind("assert",Oe(i.assert,"<bs?:x>")),I.bind("type",Oe(i.type,"<x:s>")),I.bind("sort",Oe(i.sort,"<af?:a>")),I.bind("shuffle",Oe(i.shuffle,"<a:a>")),I.bind("distinct",Oe(i.distinct,"<x:x>")),I.bind("base64encode",Oe(i.base64encode,"<s-:s>")),I.bind("base64decode",Oe(i.base64decode,"<s-:s>")),I.bind("encodeUrlComponent",Oe(i.encodeUrlComponent,"<s-:s>")),I.bind("encodeUrl",Oe(i.encodeUrl,"<s-:s>")),I.bind("decodeUrlComponent",Oe(i.decodeUrlComponent,"<s-:s>")),I.bind("decodeUrl",Oe(i.decodeUrl,"<s-:s>")),I.bind("eval",Oe(Re,"<sx?:x>")),I.bind("toMillis",Oe(a.toMillis,"<s-s?:n>")),I.bind("fromMillis",Oe(a.fromMillis,"<n-s?s?:s>")),I.bind("clone",Oe(function(e){if(void 0!==e)return JSON.parse(i.string(e))},"<(oa)-:o>"));var Pe={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e6. Attempted to allocate {{value}}.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function Me(e){var t=Pe[e.code];if(void 0!==t){var r=t.replace(/\{\{\{([^}]+)}}}/g,function(){return e[arguments[1]]});r=r.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(e[arguments[1]])}),e.message=r}}function je(e,t){var r,n;try{r=s(e,t&&t.recover),n=r.errors,delete r.errors}catch(e){throw Me(e),e}var i=Ye(I),o=new Date;return i.bind("now",Oe(function(e,t){return a.fromMillis(o.getTime(),e,t)},"<s?s?:s>")),i.bind("millis",Oe(function(){return o.getTime()},"<:n>")),t&&t.RegexEngine?je.RegexEngine=t.RegexEngine:je.RegexEngine=RegExp,{evaluate:function(e,t,a){if(void 0!==n){var s={code:"S0500",position:0};throw Me(s),s}var u,c,p;if(void 0!==t)for(var f in u=Ye(i),t)u.bind(f,t[f]);else u=i;if(u.bind("$",e),o=new Date,u.timestamp=o,Array.isArray(e)&&!M(e)&&((e=P(e)).outerWrapper=!0),"function"==typeof a){u.async=!0;var l=function(e){Me(e),a(e,null)};p=L(r,e,u),(c=p.next()).value.then(function e(t){(c=p.next(t)).done?a(null,c.value):c.value.then(e).catch(l)}).catch(l)}else try{for(p=L(r,e,u),c=p.next();!c.done;)c=p.next(c.value);return c.value}catch(s){throw Me(s),s}},assign:function(e,t){i.bind(e,t)},registerFunction:function(e,t,r){var n=Oe(t,r);i.bind(e,n)},ast:function(){return r},errors:function(){return n}}}return je.parser=s,je}();t.exports=c},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(e,t,r){"use strict";var n,a,i,o=e("./signature"),s=(n={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},a={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},i=function(e){var t=0,r=e.length,i=function(e,r){return{type:e,value:r,position:t}};return function o(s){if(t>=r)return null;for(var u=e.charAt(t);t<r&&" \t\n\r\v".indexOf(u)>-1;)t++,u=e.charAt(t);if("/"===u&&"*"===e.charAt(t+1)){var c=t;for(t+=2,u=e.charAt(t);"*"!==u||"/"!==e.charAt(t+1);)if(u=e.charAt(++t),t>=r)throw{code:"S0106",stack:(new Error).stack,position:c};return t+=2,u=e.charAt(t),o(s)}if(!0!==s&&"/"===u)return t++,i("regex",function(){for(var n,a,i=t,o=0;t<r;){var s=e.charAt(t);if("/"===s&&"\\"!==e.charAt(t-1)&&0===o){if(""===(n=e.substring(i,t)))throw{code:"S0301",stack:(new Error).stack,position:t};for(t++,s=e.charAt(t),i=t;"i"===s||"m"===s;)t++,s=e.charAt(t);return a=e.substring(i,t)+"g",new RegExp(n,a)}"("!==s&&"["!==s&&"{"!==s||"\\"===e.charAt(t-1)||o++,")"!==s&&"]"!==s&&"}"!==s||"\\"===e.charAt(t-1)||o--,t++}throw{code:"S0302",stack:(new Error).stack,position:t}}());if("."===u&&"."===e.charAt(t+1))return t+=2,i("operator","..");if(":"===u&&"="===e.charAt(t+1))return t+=2,i("operator",":=");if("!"===u&&"="===e.charAt(t+1))return t+=2,i("operator","!=");if(">"===u&&"="===e.charAt(t+1))return t+=2,i("operator",">=");if("<"===u&&"="===e.charAt(t+1))return t+=2,i("operator","<=");if("*"===u&&"*"===e.charAt(t+1))return t+=2,i("operator","**");if("~"===u&&">"===e.charAt(t+1))return t+=2,i("operator","~>");if(Object.prototype.hasOwnProperty.call(n,u))return t++,i("operator",u);if('"'===u||"'"===u){var p=u;t++;for(var f="";t<r;){if("\\"===(u=e.charAt(t)))if(t++,u=e.charAt(t),Object.prototype.hasOwnProperty.call(a,u))f+=a[u];else{if("u"!==u)throw{code:"S0103",stack:(new Error).stack,position:t,token:u};var l=e.substr(t+1,4);if(!/^[0-9a-fA-F]+$/.test(l))throw{code:"S0104",stack:(new Error).stack,position:t};var d=parseInt(l,16);f+=String.fromCharCode(d),t+=4}else{if(u===p)return t++,i("string",f);f+=u}t++}throw{code:"S0101",stack:(new Error).stack,position:t}}var h,g=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/.exec(e.substring(t));if(null!==g){var v=parseFloat(g[0]);if(!isNaN(v)&&isFinite(v))return t+=g[0].length,i("number",v);throw{code:"S0102",stack:(new Error).stack,position:t,token:g[0]}}if("`"===u){t++;var b=e.indexOf("`",t);if(-1!==b)return h=e.substring(t,b),t=b+1,i("name",h);throw t=r,{code:"S0105",stack:(new Error).stack,position:t}}for(var m,y=t;;)if(m=e.charAt(y),y===r||" \t\n\r\v".indexOf(m)>-1||Object.prototype.hasOwnProperty.call(n,m)){if("$"===e.charAt(t))return h=e.substring(t+1,y),t=y,i("variable",h);switch(h=e.substring(t,y),t=y,h){case"or":case"in":case"and":return i("operator",h);case"true":return i("value",!0);case"false":return i("value",!1);case"null":return i("value",null);default:return t===r&&""===h?null:i("name",h)}}else y++}},function(e,t){var r,a,s={},u=[],c=function(){var e=[];"(end)"!==r.id&&e.push({type:r.type,value:r.value,position:r.position});for(var t=a();null!==t;)e.push(t),t=a();return e},p={nud:function(){var e={code:"S0211",token:this.value,position:this.position};if(t)return e.remaining=c(),e.type="error",u.push(e),e;throw e.stack=(new Error).stack,e}},f=function(e,t){var r=s[e];return t=t||0,r?t>=r.lbp&&(r.lbp=t):((r=Object.create(p)).id=r.value=e,r.lbp=t,s[e]=r),r},l=function(e){if(t){e.remaining=c(),u.push(e);var n=s["(error)"];return(r=Object.create(n)).error=e,r.type="(error)",r}throw e.stack=(new Error).stack,e},d=function(t,n){if(t&&r.id!==t){var i={code:"(end)"===r.id?"S0203":"S0202",position:r.position,token:r.value,value:t};return l(i)}var o=a(n);if(null===o)return(r=s["(end)"]).position=e.length,r;var u,c=o.value,p=o.type;switch(p){case"name":case"variable":u=s["(name)"];break;case"operator":if(!(u=s[c]))return l({code:"S0204",stack:(new Error).stack,position:o.position,token:c});break;case"string":case"number":case"value":u=s["(literal)"];break;case"regex":p="regex",u=s["(regex)"];break;default:return l({code:"S0205",stack:(new Error).stack,position:o.position,token:c})}return(r=Object.create(u)).value=c,r.type=p,r.position=o.position,r},h=function(e){var t,n=r;for(d(null,!0),t=n.nud();e<r.lbp;)n=r,d(),t=n.led(t);return t},g=function(e){f(e,0).nud=function(){return this}},v=function(e,t,r){var a=t||n[e],i=f(e,a);return i.led=r||function(e){return this.lhs=e,this.rhs=h(a),this.type="binary",this},i},b=function(e,t,r){var n=f(e,t);return n.led=r,n},m=function(e,t){var r=f(e);return r.nud=t||function(){return this.expression=h(70),this.type="unary",this},r};g("(end)"),g("(name)"),g("(literal)"),g("(regex)"),f(":"),f(";"),f(","),f(")"),f("]"),f("}"),f(".."),v("."),v("+"),v("-"),v("*"),v("/"),v("%"),v("="),v("<"),v(">"),v("!="),v("<="),v(">="),v("&"),v("and"),v("or"),v("in"),g("and"),g("or"),g("in"),m("-"),v("~>"),b("(error)",10,function(e){return this.lhs=e,this.error=r.error,this.remaining=c(),this.type="error",this}),m("*",function(){return this.type="wildcard",this}),m("**",function(){return this.type="descendant",this}),m("%",function(){return this.type="parent",this}),v("(",n["("],function(e){if(this.procedure=e,this.type="function",this.arguments=[],")"!==r.id)for(;"operator"===r.type&&"?"===r.id?(this.type="partial",this.arguments.push(r),d("?")):this.arguments.push(h(0)),","===r.id;)d(",");if(d(")",!0),"name"===e.type&&("function"===e.value||"λ"===e.value)){if(this.arguments.forEach(function(e,t){if("variable"!==e.type)return l({code:"S0208",stack:(new Error).stack,position:e.position,token:e.value,value:t+1})}),this.type="lambda","<"===r.id){for(var t=r.position,n=1,a="<";n>0&&"{"!==r.id&&"(end)"!==r.id;){var i=d();">"===i.id?n--:"<"===i.id&&n++,a+=i.value}d(">");try{this.signature=o(a)}catch(e){return e.position=t+e.offset,l(e)}}d("{"),this.body=h(0),d("}")}return this}),m("(",function(){for(var e=[];")"!==r.id&&(e.push(h(0)),";"===r.id);)d(";");return d(")",!0),this.type="block",this.expressions=e,this}),m("[",function(){var e=[];if("]"!==r.id)for(;;){var t=h(0);if(".."===r.id){var n={type:"binary",value:"..",position:r.position,lhs:t};d(".."),n.rhs=h(0),t=n}if(e.push(t),","!==r.id)break;d(",")}return d("]",!0),this.expressions=e,this.type="unary",this}),v("[",n["["],function(e){if("]"===r.id){for(var t=e;t&&"binary"===t.type&&"["===t.value;)t=t.lhs;return t.keepArray=!0,d("]"),e}return this.lhs=e,this.rhs=h(n["]"]),this.type="binary",d("]",!0),this}),v("^",n["^"],function(e){d("(");for(var t=[];;){var n={descending:!1};if("<"===r.id?d("<"):">"===r.id&&(n.descending=!0,d(">")),n.expression=h(0),t.push(n),","!==r.id)break;d(",")}return d(")"),this.lhs=e,this.rhs=t,this.type="binary",this});var y=function(e){var t=[];if("}"!==r.id)for(;;){var n=h(0);d(":");var a=h(0);if(t.push([n,a]),","!==r.id)break;d(",")}return d("}",!0),void 0===e?(this.lhs=t,this.type="unary"):(this.lhs=e,this.rhs=t,this.type="binary"),this};m("{",y),v("{",n["{"],y),b(":=",n[":="],function(e){return"variable"!==e.type?l({code:"S0212",stack:(new Error).stack,position:e.position,token:e.value}):(this.lhs=e,this.rhs=h(n[":="]-1),this.type="binary",this)}),v("@",n["@"],function(e){return this.lhs=e,this.rhs=h(n["@"]),"variable"!==this.rhs.type?l({code:"S0214",stack:(new Error).stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),v("#",n["#"],function(e){return this.lhs=e,this.rhs=h(n["#"]),"variable"!==this.rhs.type?l({code:"S0214",stack:(new Error).stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),v("?",n["?"],function(e){return this.type="condition",this.condition=e,this.then=h(0),":"===r.id&&(d(":"),this.else=h(0)),this}),m("|",function(){return this.type="transform",this.pattern=h(0),d("|"),this.update=h(0),","===r.id&&(d(","),this.delete=h(0)),d("|"),this});var k=0,x=0,w=[],E=function e(t,r){switch(t.type){case"name":case"wildcard":r.level--,0===r.level&&(void 0===t.ancestor?t.ancestor=r:(w[r.index].slot.label=t.ancestor.label,t.ancestor=r),t.tuple=!0);break;case"parent":r.level++;break;case"block":t.expressions.length>0&&(t.tuple=!0,r=e(t.expressions[t.expressions.length-1],r));break;case"path":t.tuple=!0;var n=t.steps.length-1;for(r=e(t.steps[n--],r);r.level>0&&n>=0;)r=e(t.steps[n--],r);break;default:throw{code:"S0217",token:t.type,position:t.position}}return r},A=function(e,t){if(void 0!==t.seekingParent||"parent"===t.type){var r=void 0!==t.seekingParent?t.seekingParent:[];"parent"===t.type&&r.push(t.slot),void 0===e.seekingParent?e.seekingParent=r:Array.prototype.push.apply(e.seekingParent,r)}},S=function(e){var t=e.steps.length-1,r=e.steps[t],n=void 0!==r.seekingParent?r.seekingParent:[];"parent"===r.type&&n.push(r.slot);for(var a=0;a<n.length;a++){var i=n[a];for(t=e.steps.length-2;i.level>0;){if(t<0){void 0===e.seekingParent?e.seekingParent=[i]:e.seekingParent.push(i);break}for(var o=e.steps[t--];t>=0&&o.focus&&e.steps[t].focus;)o=e.steps[t--];i=E(o,i)}}};a=i(e),d();var T=h(0);if("(end)"!==r.id){var D={code:"S0201",position:r.position,token:r.value};l(D)}if("parent"===(T=function e(r){var n;switch(r.type){case"binary":switch(r.value){case".":var a=e(r.lhs);n="path"===a.type?a:{type:"path",steps:[a]},"parent"===a.type&&(n.seekingParent=[a.slot]);var i=e(r.rhs);"function"===i.type&&"path"===i.procedure.type&&1===i.procedure.steps.length&&"name"===i.procedure.steps[0].type&&"function"===n.steps[n.steps.length-1].type&&(n.steps[n.steps.length-1].nextFunction=i.procedure.steps[0].value),"path"===i.type?Array.prototype.push.apply(n.steps,i.steps):(void 0!==i.predicate&&(i.stages=i.predicate,delete i.predicate),n.steps.push(i)),n.steps.filter(function(e){if("number"===e.type||"value"===e.type)throw{code:"S0213",stack:(new Error).stack,position:e.position,value:e.value};return"string"===e.type}).forEach(function(e){e.type="name"}),n.steps.filter(function(e){return!0===e.keepArray}).length>0&&(n.keepSingletonArray=!0);var o=n.steps[0];"unary"===o.type&&"["===o.value&&(o.consarray=!0);var s=n.steps[n.steps.length-1];"unary"===s.type&&"["===s.value&&(s.consarray=!0),S(n);break;case"[":var c=n=e(r.lhs),p="predicate";if("path"===n.type&&(c=n.steps[n.steps.length-1],p="stages"),void 0!==c.group)throw{code:"S0209",stack:(new Error).stack,position:r.position};void 0===c[p]&&(c[p]=[]);var f=e(r.rhs);void 0!==f.seekingParent&&(f.seekingParent.forEach(function(e){1===e.level?E(c,e):e.level--}),A(c,f)),c[p].push({type:"filter",expr:f,position:r.position});break;case"{":if(void 0!==(n=e(r.lhs)).group)throw{code:"S0210",stack:(new Error).stack,position:r.position};n.group={lhs:r.rhs.map(function(t){return[e(t[0]),e(t[1])]}),position:r.position};break;case"^":"path"!==(n=e(r.lhs)).type&&(n={type:"path",steps:[n]});var l={type:"sort",position:r.position};l.terms=r.rhs.map(function(t){var r=e(t.expression);return A(l,r),{descending:t.descending,expression:r}}),n.steps.push(l),S(n);break;case":=":(n={type:"bind",value:r.value,position:r.position}).lhs=e(r.lhs),n.rhs=e(r.rhs),A(n,n.rhs);break;case"@":if(n=e(r.lhs),c=n,"path"===n.type&&(c=n.steps[n.steps.length-1]),void 0!==c.stages||void 0!==c.predicate)throw{code:"S0215",stack:(new Error).stack,position:r.position};if("sort"===c.type)throw{code:"S0216",stack:(new Error).stack,position:r.position};r.keepArray&&(c.keepArray=!0),c.focus=r.rhs.value,c.tuple=!0;break;case"#":n=e(r.lhs),c=n,"path"===n.type?c=n.steps[n.steps.length-1]:(n={type:"path",steps:[n]},void 0!==c.predicate&&(c.stages=c.predicate,delete c.predicate)),void 0===c.stages?c.index=r.rhs.value:c.stages.push({type:"index",value:r.rhs.value,position:r.position}),c.tuple=!0;break;case"~>":(n={type:"apply",value:r.value,position:r.position}).lhs=e(r.lhs),n.rhs=e(r.rhs);break;default:(n={type:r.type,value:r.value,position:r.position}).lhs=e(r.lhs),n.rhs=e(r.rhs),A(n,n.lhs),A(n,n.rhs)}break;case"unary":n={type:r.type,value:r.value,position:r.position},"["===r.value?n.expressions=r.expressions.map(function(t){var r=e(t);return A(n,r),r}):"{"===r.value?n.lhs=r.lhs.map(function(t){var r=e(t[0]);A(n,r);var a=e(t[1]);return A(n,a),[r,a]}):(n.expression=e(r.expression),"-"===r.value&&"number"===n.expression.type?(n=n.expression).value=-n.value:A(n,n.expression));break;case"function":case"partial":(n={type:r.type,name:r.name,value:r.value,position:r.position}).arguments=r.arguments.map(function(t){var r=e(t);return A(n,r),r}),n.procedure=e(r.procedure);break;case"lambda":n={type:r.type,arguments:r.arguments,signature:r.signature,position:r.position};var d=e(r.body);n.body=function e(t){var r;if("function"!==t.type||t.predicate)if("condition"===t.type)t.then=e(t.then),void 0!==t.else&&(t.else=e(t.else)),r=t;else if("block"===t.type){var n=t.expressions.length;n>0&&(t.expressions[n-1]=e(t.expressions[n-1])),r=t}else r=t;else{var a={type:"lambda",thunk:!0,arguments:[],position:t.position};a.body=t,r=a}return r}(d);break;case"condition":(n={type:r.type,position:r.position}).condition=e(r.condition),A(n,n.condition),n.then=e(r.then),A(n,n.then),void 0!==r.else&&(n.else=e(r.else),A(n,n.else));break;case"transform":(n={type:r.type,position:r.position}).pattern=e(r.pattern),n.update=e(r.update),void 0!==r.delete&&(n.delete=e(r.delete));break;case"block":(n={type:r.type,position:r.position}).expressions=r.expressions.map(function(t){var r=e(t);return A(n,r),(r.consarray||"path"===r.type&&r.steps[0].consarray)&&(n.consarray=!0),r});break;case"name":n={type:"path",steps:[r]},r.keepArray&&(n.keepSingletonArray=!0);break;case"parent":n={type:"parent",slot:{label:"!"+k++,level:1,index:x++}},w.push(n);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":n=r;break;case"operator":if("and"===r.value||"or"===r.value||"in"===r.value)r.type="name",n=e(r);else{if("?"!==r.value)throw{code:"S0201",stack:(new Error).stack,position:r.position,token:r.value};n=r}break;case"error":n=r,r.lhs&&(n=e(r.lhs));break;default:var h="S0206";"(end)"===r.id&&(h="S0207");var g={code:h,position:r.position,token:r.value};if(t)return u.push(g),{type:"error",error:g};throw g.stack=(new Error).stack,g}return r.keepArray&&(n.keepArray=!0),n}(T)).type||void 0!==T.seekingParent)throw{code:"S0217",token:T.type,position:T.position};return u.length>0&&(T.errors=u),T});t.exports=s},{"./signature":5}],5:[function(e,t,r){"use strict";function n(e){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=e("./utils"),i=function(){var e={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};return function(t){for(var r=1,i=[],o={},s=o;r<t.length;){var u=t.charAt(r);if(":"===u)break;var c=function(){i.push(o),s=o,o={}},p=function(e,t,r,n){for(var a=1,i=t;i<e.length;)if(i++,(u=e.charAt(i))===n){if(0==--a)break}else u===r&&a++;return i};switch(u){case"s":case"n":case"b":case"l":case"o":o.regex="["+u+"m]",o.type=u,c();break;case"a":o.regex="[asnblfom]",o.type=u,o.array=!0,c();break;case"f":o.regex="f",o.type=u,c();break;case"j":o.regex="[asnblom]",o.type=u,c();break;case"x":o.regex="[asnblfom]",o.type=u,c();break;case"-":s.context=!0,s.contextRegex=new RegExp(s.regex),s.regex+="?";break;case"?":case"+":s.regex+=u;break;case"(":var f=p(t,r,"(",")"),l=t.substring(r+1,f);if(-1!==l.indexOf("<"))throw{code:"S0402",stack:(new Error).stack,value:l,offset:r};o.regex="["+l+"m]",o.type="("+l+")",r=f,c();break;case"<":if("a"!==s.type&&"f"!==s.type)throw{code:"S0401",stack:(new Error).stack,value:s.type,offset:r};var d=p(t,r,"<",">");s.subtype=t.substring(r+1,d),r=d}r++}var h="^"+i.map(function(e){return"("+e.regex+")"}).join("")+"$",g=new RegExp(h),v=function(e){var t;if(a.isFunction(e))t="f";else switch(n(e)){case"string":t="s";break;case"number":t="n";break;case"boolean":t="b";break;case"object":t=null===e?"l":Array.isArray(e)?"a":"o";break;case"undefined":default:t="m"}return t};return{definition:t,validate:function(t,r){var n="";t.forEach(function(e){n+=v(e)});var a=g.exec(n);if(a){var o=[],s=0;return i.forEach(function(n,i){var u=t[s],c=a[i+1];if(""===c)if(n.context&&n.contextRegex){var p=v(r);if(!n.contextRegex.test(p))throw{code:"T0411",stack:(new Error).stack,value:r,index:s+1};o.push(r)}else o.push(u),s++;else c.split("").forEach(function(r){if("a"===n.type){if("m"===r)u=void 0;else{u=t[s];var a=!0;if(void 0!==n.subtype)if("a"!==r&&c!==n.subtype)a=!1;else if("a"===r&&u.length>0){var i=v(u[0]);a=i===n.subtype.charAt(0)&&0===u.filter(function(e){return v(e)!==i}).length}if(!a)throw{code:"T0412",stack:(new Error).stack,value:u,index:s+1,type:e[n.subtype]};"a"!==r&&(u=[u])}o.push(u),s++}else o.push(u),s++})}),o}!function(e,t){for(var r="^",n=0,a=0;a<i.length;a++){r+=i[a].regex;var o=t.match(r);if(null===o)throw{code:"T0410",stack:(new Error).stack,value:e[n],index:n+1};n=o[0].length}throw{code:"T0410",stack:(new Error).stack,value:e[n],index:n+1}}(t,n)}}}}();t.exports=i},{"./utils":6}],6:[function(e,t,r){"use strict";function n(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw o}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=function(){function e(e){var t=!1;if("number"==typeof e&&(t=!isNaN(e))&&!isFinite(e))throw{code:"D1001",value:e,stack:(new Error).stack};return t}var t=("function"==typeof Symbol?Symbol:{}).iterator||"@@iterator";return{isNumeric:e,isArrayOfStrings:function(e){var t=!1;return Array.isArray(e)&&(t=0===e.filter(function(e){return"string"!=typeof e}).length),t},isArrayOfNumbers:function(t){var r=!1;return Array.isArray(t)&&(r=0===t.filter(function(t){return!e(t)}).length),r},createSequence:function(){var e=[];return e.sequence=!0,1===arguments.length&&e.push(arguments[0]),e},isSequence:function(e){return!0===e.sequence&&Array.isArray(e)},isFunction:function(e){return e&&(!0===e._jsonata_function||!0===e._jsonata_lambda)||"function"==typeof e},isLambda:function(e){return e&&!0===e._jsonata_lambda},isIterable:function(e){return"object"===i(e)&&null!==e&&t in e&&"next"in e&&"function"==typeof e.next},getFunctionArity:function(e){return"number"==typeof e.arity?e.arity:"function"==typeof e.implementation?e.implementation.length:"number"==typeof e.length?e.length:e.arguments.length},isDeepEqual:function e(t,r){if(t===r)return!0;if("object"===i(t)&&"object"===i(r)&&null!==t&&null!==r){if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return!1;for(var n=0;n<t.length;n++)if(!e(t[n],r[n]))return!1;return!0}var a=Object.getOwnPropertyNames(t),o=Object.getOwnPropertyNames(r);if(a.length!==o.length)return!1;for(a=a.sort(),o=o.sort(),n=0;n<a.length;n++)if(a[n]!==o[n])return!1;for(n=0;n<a.length;n++){var s=a[n];if(!e(t[s],r[s]))return!1}return!0}return!1},stringToArray:function(e){var t,r=[],a=n(e);try{for(a.s();!(t=a.n()).done;){var i=t.value;r.push(i)}}catch(e){a.e(e)}finally{a.f()}return r}}}();t.exports=o},{}]},{},[3])(3)});;// jsonata-es5.min.js is prepended to this file as part of the Grunt build
2
+
3
+ ;(function(window) {
4
+ if (typeof window.window != "undefined" && window.document)
5
+ return;
6
+ if (window.require && window.define)
7
+ return;
8
+
9
+ if (!window.console) {
10
+ window.console = function() {
11
+ var msgs = Array.prototype.slice.call(arguments, 0);
12
+ postMessage({type: "log", data: msgs});
13
+ };
14
+ window.console.error =
15
+ window.console.warn =
16
+ window.console.log =
17
+ window.console.trace = window.console;
18
+ }
19
+ window.window = window;
20
+ window.ace = window;
21
+ window.onerror = function(message, file, line, col, err) {
22
+ postMessage({type: "error", data: {
23
+ message: message,
24
+ data: err.data,
25
+ file: file,
26
+ line: line,
27
+ col: col,
28
+ stack: err.stack
29
+ }});
30
+ };
31
+
32
+ window.normalizeModule = function(parentId, moduleName) {
33
+ // normalize plugin requires
34
+ if (moduleName.indexOf("!") !== -1) {
35
+ var chunks = moduleName.split("!");
36
+ return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]);
37
+ }
38
+ // normalize relative requires
39
+ if (moduleName.charAt(0) == ".") {
40
+ var base = parentId.split("/").slice(0, -1).join("/");
41
+ moduleName = (base ? base + "/" : "") + moduleName;
42
+
43
+ while (moduleName.indexOf(".") !== -1 && previous != moduleName) {
44
+ var previous = moduleName;
45
+ moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
46
+ }
47
+ }
48
+
49
+ return moduleName;
50
+ };
51
+
52
+ window.require = function require(parentId, id) {
53
+ if (!id) {
54
+ id = parentId;
55
+ parentId = null;
56
+ }
57
+ if (!id.charAt)
58
+ throw new Error("worker.js require() accepts only (parentId, id) as arguments");
59
+
60
+ id = window.normalizeModule(parentId, id);
61
+
62
+ var module = window.require.modules[id];
63
+ if (module) {
64
+ if (!module.initialized) {
65
+ module.initialized = true;
66
+ module.exports = module.factory().exports;
67
+ }
68
+ return module.exports;
69
+ }
70
+
71
+ if (!window.require.tlns)
72
+ return console.log("unable to load " + id);
73
+
74
+ var path = resolveModuleId(id, window.require.tlns);
75
+ if (path.slice(-3) != ".js") path += ".js";
76
+
77
+ window.require.id = id;
78
+ window.require.modules[id] = {}; // prevent infinite loop on broken modules
79
+ importScripts(path);
80
+ return window.require(parentId, id);
81
+ };
82
+ function resolveModuleId(id, paths) {
83
+ var testPath = id, tail = "";
84
+ while (testPath) {
85
+ var alias = paths[testPath];
86
+ if (typeof alias == "string") {
87
+ return alias + tail;
88
+ } else if (alias) {
89
+ return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name);
90
+ } else if (alias === false) {
91
+ return "";
92
+ }
93
+ var i = testPath.lastIndexOf("/");
94
+ if (i === -1) break;
95
+ tail = testPath.substr(i) + tail;
96
+ testPath = testPath.slice(0, i);
97
+ }
98
+ return id;
99
+ }
100
+ window.require.modules = {};
101
+ window.require.tlns = {};
102
+
103
+ window.define = function(id, deps, factory) {
104
+ if (arguments.length == 2) {
105
+ factory = deps;
106
+ if (typeof id != "string") {
107
+ deps = id;
108
+ id = window.require.id;
109
+ }
110
+ } else if (arguments.length == 1) {
111
+ factory = id;
112
+ deps = [];
113
+ id = window.require.id;
114
+ }
115
+
116
+ if (typeof factory != "function") {
117
+ window.require.modules[id] = {
118
+ exports: factory,
119
+ initialized: true
120
+ };
121
+ return;
122
+ }
123
+
124
+ if (!deps.length)
125
+ // If there is no dependencies, we inject "require", "exports" and
126
+ // "module" as dependencies, to provide CommonJS compatibility.
127
+ deps = ["require", "exports", "module"];
128
+
129
+ var req = function(childId) {
130
+ return window.require(id, childId);
131
+ };
132
+
133
+ window.require.modules[id] = {
134
+ exports: {},
135
+ factory: function() {
136
+ var module = this;
137
+ var returnExports = factory.apply(this, deps.map(function(dep) {
138
+ switch (dep) {
139
+ // Because "require", "exports" and "module" aren't actual
140
+ // dependencies, we must handle them seperately.
141
+ case "require": return req;
142
+ case "exports": return module.exports;
143
+ case "module": return module;
144
+ // But for all other dependencies, we can just go ahead and
145
+ // require them.
146
+ default: return req(dep);
147
+ }
148
+ }));
149
+ if (returnExports)
150
+ module.exports = returnExports;
151
+ return module;
152
+ }
153
+ };
154
+ };
155
+ window.define.amd = {};
156
+ require.tlns = {};
157
+ window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
158
+ for (var i in topLevelNamespaces)
159
+ require.tlns[i] = topLevelNamespaces[i];
160
+ };
161
+
162
+ window.initSender = function initSender() {
163
+
164
+ var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter;
165
+ var oop = window.require("ace/lib/oop");
166
+
167
+ var Sender = function() {};
168
+
169
+ (function() {
170
+
171
+ oop.implement(this, EventEmitter);
172
+
173
+ this.callback = function(data, callbackId) {
174
+ postMessage({
175
+ type: "call",
176
+ id: callbackId,
177
+ data: data
178
+ });
179
+ };
180
+
181
+ this.emit = function(name, data) {
182
+ postMessage({
183
+ type: "event",
184
+ name: name,
185
+ data: data
186
+ });
187
+ };
188
+
189
+ }).call(Sender.prototype);
190
+
191
+ return new Sender();
192
+ };
193
+
194
+ var main = window.main = null;
195
+ var sender = window.sender = null;
196
+
197
+ window.onmessage = function(e) {
198
+ var msg = e.data;
199
+ if (msg.event && sender) {
200
+ sender._signal(msg.event, msg.data);
201
+ }
202
+ else if (msg.command) {
203
+ if (main[msg.command])
204
+ main[msg.command].apply(main, msg.args);
205
+ else if (window[msg.command])
206
+ window[msg.command].apply(window, msg.args);
207
+ else
208
+ throw new Error("Unknown command:" + msg.command);
209
+ }
210
+ else if (msg.init) {
211
+ window.initBaseUrls(msg.tlns);
212
+ require("ace/lib/es5-shim");
213
+ sender = window.sender = window.initSender();
214
+ var clazz = require(msg.module)[msg.classname];
215
+ main = window.main = new clazz(sender);
216
+ }
217
+ };
218
+ })(this);
219
+
220
+ define("ace/lib/oop",["require","exports","module"], function(require, exports, module) {
221
+ "use strict";
222
+
223
+ exports.inherits = function(ctor, superCtor) {
224
+ ctor.super_ = superCtor;
225
+ ctor.prototype = Object.create(superCtor.prototype, {
226
+ constructor: {
227
+ value: ctor,
228
+ enumerable: false,
229
+ writable: true,
230
+ configurable: true
231
+ }
232
+ });
233
+ };
234
+
235
+ exports.mixin = function(obj, mixin) {
236
+ for (var key in mixin) {
237
+ obj[key] = mixin[key];
238
+ }
239
+ return obj;
240
+ };
241
+
242
+ exports.implement = function(proto, mixin) {
243
+ exports.mixin(proto, mixin);
244
+ };
245
+
246
+ });
247
+
248
+ define("ace/range",["require","exports","module"], function(require, exports, module) {
249
+ "use strict";
250
+ var comparePoints = function(p1, p2) {
251
+ return p1.row - p2.row || p1.column - p2.column;
252
+ };
253
+ var Range = function(startRow, startColumn, endRow, endColumn) {
254
+ this.start = {
255
+ row: startRow,
256
+ column: startColumn
257
+ };
258
+
259
+ this.end = {
260
+ row: endRow,
261
+ column: endColumn
262
+ };
263
+ };
264
+
265
+ (function() {
266
+ this.isEqual = function(range) {
267
+ return this.start.row === range.start.row &&
268
+ this.end.row === range.end.row &&
269
+ this.start.column === range.start.column &&
270
+ this.end.column === range.end.column;
271
+ };
272
+ this.toString = function() {
273
+ return ("Range: [" + this.start.row + "/" + this.start.column +
274
+ "] -> [" + this.end.row + "/" + this.end.column + "]");
275
+ };
276
+
277
+ this.contains = function(row, column) {
278
+ return this.compare(row, column) == 0;
279
+ };
280
+ this.compareRange = function(range) {
281
+ var cmp,
282
+ end = range.end,
283
+ start = range.start;
284
+
285
+ cmp = this.compare(end.row, end.column);
286
+ if (cmp == 1) {
287
+ cmp = this.compare(start.row, start.column);
288
+ if (cmp == 1) {
289
+ return 2;
290
+ } else if (cmp == 0) {
291
+ return 1;
292
+ } else {
293
+ return 0;
294
+ }
295
+ } else if (cmp == -1) {
296
+ return -2;
297
+ } else {
298
+ cmp = this.compare(start.row, start.column);
299
+ if (cmp == -1) {
300
+ return -1;
301
+ } else if (cmp == 1) {
302
+ return 42;
303
+ } else {
304
+ return 0;
305
+ }
306
+ }
307
+ };
308
+ this.comparePoint = function(p) {
309
+ return this.compare(p.row, p.column);
310
+ };
311
+ this.containsRange = function(range) {
312
+ return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
313
+ };
314
+ this.intersects = function(range) {
315
+ var cmp = this.compareRange(range);
316
+ return (cmp == -1 || cmp == 0 || cmp == 1);
317
+ };
318
+ this.isEnd = function(row, column) {
319
+ return this.end.row == row && this.end.column == column;
320
+ };
321
+ this.isStart = function(row, column) {
322
+ return this.start.row == row && this.start.column == column;
323
+ };
324
+ this.setStart = function(row, column) {
325
+ if (typeof row == "object") {
326
+ this.start.column = row.column;
327
+ this.start.row = row.row;
328
+ } else {
329
+ this.start.row = row;
330
+ this.start.column = column;
331
+ }
332
+ };
333
+ this.setEnd = function(row, column) {
334
+ if (typeof row == "object") {
335
+ this.end.column = row.column;
336
+ this.end.row = row.row;
337
+ } else {
338
+ this.end.row = row;
339
+ this.end.column = column;
340
+ }
341
+ };
342
+ this.inside = function(row, column) {
343
+ if (this.compare(row, column) == 0) {
344
+ if (this.isEnd(row, column) || this.isStart(row, column)) {
345
+ return false;
346
+ } else {
347
+ return true;
348
+ }
349
+ }
350
+ return false;
351
+ };
352
+ this.insideStart = function(row, column) {
353
+ if (this.compare(row, column) == 0) {
354
+ if (this.isEnd(row, column)) {
355
+ return false;
356
+ } else {
357
+ return true;
358
+ }
359
+ }
360
+ return false;
361
+ };
362
+ this.insideEnd = function(row, column) {
363
+ if (this.compare(row, column) == 0) {
364
+ if (this.isStart(row, column)) {
365
+ return false;
366
+ } else {
367
+ return true;
368
+ }
369
+ }
370
+ return false;
371
+ };
372
+ this.compare = function(row, column) {
373
+ if (!this.isMultiLine()) {
374
+ if (row === this.start.row) {
375
+ return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
376
+ }
377
+ }
378
+
379
+ if (row < this.start.row)
380
+ return -1;
381
+
382
+ if (row > this.end.row)
383
+ return 1;
384
+
385
+ if (this.start.row === row)
386
+ return column >= this.start.column ? 0 : -1;
387
+
388
+ if (this.end.row === row)
389
+ return column <= this.end.column ? 0 : 1;
390
+
391
+ return 0;
392
+ };
393
+ this.compareStart = function(row, column) {
394
+ if (this.start.row == row && this.start.column == column) {
395
+ return -1;
396
+ } else {
397
+ return this.compare(row, column);
398
+ }
399
+ };
400
+ this.compareEnd = function(row, column) {
401
+ if (this.end.row == row && this.end.column == column) {
402
+ return 1;
403
+ } else {
404
+ return this.compare(row, column);
405
+ }
406
+ };
407
+ this.compareInside = function(row, column) {
408
+ if (this.end.row == row && this.end.column == column) {
409
+ return 1;
410
+ } else if (this.start.row == row && this.start.column == column) {
411
+ return -1;
412
+ } else {
413
+ return this.compare(row, column);
414
+ }
415
+ };
416
+ this.clipRows = function(firstRow, lastRow) {
417
+ if (this.end.row > lastRow)
418
+ var end = {row: lastRow + 1, column: 0};
419
+ else if (this.end.row < firstRow)
420
+ var end = {row: firstRow, column: 0};
421
+
422
+ if (this.start.row > lastRow)
423
+ var start = {row: lastRow + 1, column: 0};
424
+ else if (this.start.row < firstRow)
425
+ var start = {row: firstRow, column: 0};
426
+
427
+ return Range.fromPoints(start || this.start, end || this.end);
428
+ };
429
+ this.extend = function(row, column) {
430
+ var cmp = this.compare(row, column);
431
+
432
+ if (cmp == 0)
433
+ return this;
434
+ else if (cmp == -1)
435
+ var start = {row: row, column: column};
436
+ else
437
+ var end = {row: row, column: column};
438
+
439
+ return Range.fromPoints(start || this.start, end || this.end);
440
+ };
441
+
442
+ this.isEmpty = function() {
443
+ return (this.start.row === this.end.row && this.start.column === this.end.column);
444
+ };
445
+ this.isMultiLine = function() {
446
+ return (this.start.row !== this.end.row);
447
+ };
448
+ this.clone = function() {
449
+ return Range.fromPoints(this.start, this.end);
450
+ };
451
+ this.collapseRows = function() {
452
+ if (this.end.column == 0)
453
+ return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
454
+ else
455
+ return new Range(this.start.row, 0, this.end.row, 0)
456
+ };
457
+ this.toScreenRange = function(session) {
458
+ var screenPosStart = session.documentToScreenPosition(this.start);
459
+ var screenPosEnd = session.documentToScreenPosition(this.end);
460
+
461
+ return new Range(
462
+ screenPosStart.row, screenPosStart.column,
463
+ screenPosEnd.row, screenPosEnd.column
464
+ );
465
+ };
466
+ this.moveBy = function(row, column) {
467
+ this.start.row += row;
468
+ this.start.column += column;
469
+ this.end.row += row;
470
+ this.end.column += column;
471
+ };
472
+
473
+ }).call(Range.prototype);
474
+ Range.fromPoints = function(start, end) {
475
+ return new Range(start.row, start.column, end.row, end.column);
476
+ };
477
+ Range.comparePoints = comparePoints;
478
+
479
+ Range.comparePoints = function(p1, p2) {
480
+ return p1.row - p2.row || p1.column - p2.column;
481
+ };
482
+
483
+
484
+ exports.Range = Range;
485
+ });
486
+
487
+ define("ace/apply_delta",["require","exports","module"], function(require, exports, module) {
488
+ "use strict";
489
+
490
+ function throwDeltaError(delta, errorText){
491
+ console.log("Invalid Delta:", delta);
492
+ throw "Invalid Delta: " + errorText;
493
+ }
494
+
495
+ function positionInDocument(docLines, position) {
496
+ return position.row >= 0 && position.row < docLines.length &&
497
+ position.column >= 0 && position.column <= docLines[position.row].length;
498
+ }
499
+
500
+ function validateDelta(docLines, delta) {
501
+ if (delta.action != "insert" && delta.action != "remove")
502
+ throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
503
+ if (!(delta.lines instanceof Array))
504
+ throwDeltaError(delta, "delta.lines must be an Array");
505
+ if (!delta.start || !delta.end)
506
+ throwDeltaError(delta, "delta.start/end must be an present");
507
+ var start = delta.start;
508
+ if (!positionInDocument(docLines, delta.start))
509
+ throwDeltaError(delta, "delta.start must be contained in document");
510
+ var end = delta.end;
511
+ if (delta.action == "remove" && !positionInDocument(docLines, end))
512
+ throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
513
+ var numRangeRows = end.row - start.row;
514
+ var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
515
+ if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
516
+ throwDeltaError(delta, "delta.range must match delta lines");
517
+ }
518
+
519
+ exports.applyDelta = function(docLines, delta, doNotValidate) {
520
+
521
+ var row = delta.start.row;
522
+ var startColumn = delta.start.column;
523
+ var line = docLines[row] || "";
524
+ switch (delta.action) {
525
+ case "insert":
526
+ var lines = delta.lines;
527
+ if (lines.length === 1) {
528
+ docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
529
+ } else {
530
+ var args = [row, 1].concat(delta.lines);
531
+ docLines.splice.apply(docLines, args);
532
+ docLines[row] = line.substring(0, startColumn) + docLines[row];
533
+ docLines[row + delta.lines.length - 1] += line.substring(startColumn);
534
+ }
535
+ break;
536
+ case "remove":
537
+ var endColumn = delta.end.column;
538
+ var endRow = delta.end.row;
539
+ if (row === endRow) {
540
+ docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
541
+ } else {
542
+ docLines.splice(
543
+ row, endRow - row + 1,
544
+ line.substring(0, startColumn) + docLines[endRow].substring(endColumn)
545
+ );
546
+ }
547
+ break;
548
+ }
549
+ }
550
+ });
551
+
552
+ define("ace/lib/event_emitter",["require","exports","module"], function(require, exports, module) {
553
+ "use strict";
554
+
555
+ var EventEmitter = {};
556
+ var stopPropagation = function() { this.propagationStopped = true; };
557
+ var preventDefault = function() { this.defaultPrevented = true; };
558
+
559
+ EventEmitter._emit =
560
+ EventEmitter._dispatchEvent = function(eventName, e) {
561
+ this._eventRegistry || (this._eventRegistry = {});
562
+ this._defaultHandlers || (this._defaultHandlers = {});
563
+
564
+ var listeners = this._eventRegistry[eventName] || [];
565
+ var defaultHandler = this._defaultHandlers[eventName];
566
+ if (!listeners.length && !defaultHandler)
567
+ return;
568
+
569
+ if (typeof e != "object" || !e)
570
+ e = {};
571
+
572
+ if (!e.type)
573
+ e.type = eventName;
574
+ if (!e.stopPropagation)
575
+ e.stopPropagation = stopPropagation;
576
+ if (!e.preventDefault)
577
+ e.preventDefault = preventDefault;
578
+
579
+ listeners = listeners.slice();
580
+ for (var i=0; i<listeners.length; i++) {
581
+ listeners[i](e, this);
582
+ if (e.propagationStopped)
583
+ break;
584
+ }
585
+
586
+ if (defaultHandler && !e.defaultPrevented)
587
+ return defaultHandler(e, this);
588
+ };
589
+
590
+
591
+ EventEmitter._signal = function(eventName, e) {
592
+ var listeners = (this._eventRegistry || {})[eventName];
593
+ if (!listeners)
594
+ return;
595
+ listeners = listeners.slice();
596
+ for (var i=0; i<listeners.length; i++)
597
+ listeners[i](e, this);
598
+ };
599
+
600
+ EventEmitter.once = function(eventName, callback) {
601
+ var _self = this;
602
+ callback && this.addEventListener(eventName, function newCallback() {
603
+ _self.removeEventListener(eventName, newCallback);
604
+ callback.apply(null, arguments);
605
+ });
606
+ };
607
+
608
+
609
+ EventEmitter.setDefaultHandler = function(eventName, callback) {
610
+ var handlers = this._defaultHandlers
611
+ if (!handlers)
612
+ handlers = this._defaultHandlers = {_disabled_: {}};
613
+
614
+ if (handlers[eventName]) {
615
+ var old = handlers[eventName];
616
+ var disabled = handlers._disabled_[eventName];
617
+ if (!disabled)
618
+ handlers._disabled_[eventName] = disabled = [];
619
+ disabled.push(old);
620
+ var i = disabled.indexOf(callback);
621
+ if (i != -1)
622
+ disabled.splice(i, 1);
623
+ }
624
+ handlers[eventName] = callback;
625
+ };
626
+ EventEmitter.removeDefaultHandler = function(eventName, callback) {
627
+ var handlers = this._defaultHandlers
628
+ if (!handlers)
629
+ return;
630
+ var disabled = handlers._disabled_[eventName];
631
+
632
+ if (handlers[eventName] == callback) {
633
+ var old = handlers[eventName];
634
+ if (disabled)
635
+ this.setDefaultHandler(eventName, disabled.pop());
636
+ } else if (disabled) {
637
+ var i = disabled.indexOf(callback);
638
+ if (i != -1)
639
+ disabled.splice(i, 1);
640
+ }
641
+ };
642
+
643
+ EventEmitter.on =
644
+ EventEmitter.addEventListener = function(eventName, callback, capturing) {
645
+ this._eventRegistry = this._eventRegistry || {};
646
+
647
+ var listeners = this._eventRegistry[eventName];
648
+ if (!listeners)
649
+ listeners = this._eventRegistry[eventName] = [];
650
+
651
+ if (listeners.indexOf(callback) == -1)
652
+ listeners[capturing ? "unshift" : "push"](callback);
653
+ return callback;
654
+ };
655
+
656
+ EventEmitter.off =
657
+ EventEmitter.removeListener =
658
+ EventEmitter.removeEventListener = function(eventName, callback) {
659
+ this._eventRegistry = this._eventRegistry || {};
660
+
661
+ var listeners = this._eventRegistry[eventName];
662
+ if (!listeners)
663
+ return;
664
+
665
+ var index = listeners.indexOf(callback);
666
+ if (index !== -1)
667
+ listeners.splice(index, 1);
668
+ };
669
+
670
+ EventEmitter.removeAllListeners = function(eventName) {
671
+ if (this._eventRegistry) this._eventRegistry[eventName] = [];
672
+ };
673
+
674
+ exports.EventEmitter = EventEmitter;
675
+
676
+ });
677
+
678
+ define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(require, exports, module) {
679
+ "use strict";
680
+
681
+ var oop = require("./lib/oop");
682
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
683
+
684
+ var Anchor = exports.Anchor = function(doc, row, column) {
685
+ this.$onChange = this.onChange.bind(this);
686
+ this.attach(doc);
687
+
688
+ if (typeof column == "undefined")
689
+ this.setPosition(row.row, row.column);
690
+ else
691
+ this.setPosition(row, column);
692
+ };
693
+
694
+ (function() {
695
+
696
+ oop.implement(this, EventEmitter);
697
+ this.getPosition = function() {
698
+ return this.$clipPositionToDocument(this.row, this.column);
699
+ };
700
+ this.getDocument = function() {
701
+ return this.document;
702
+ };
703
+ this.$insertRight = false;
704
+ this.onChange = function(delta) {
705
+ if (delta.start.row == delta.end.row && delta.start.row != this.row)
706
+ return;
707
+
708
+ if (delta.start.row > this.row)
709
+ return;
710
+
711
+ var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
712
+ this.setPosition(point.row, point.column, true);
713
+ };
714
+
715
+ function $pointsInOrder(point1, point2, equalPointsInOrder) {
716
+ var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
717
+ return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
718
+ }
719
+
720
+ function $getTransformedPoint(delta, point, moveIfEqual) {
721
+ var deltaIsInsert = delta.action == "insert";
722
+ var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
723
+ var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
724
+ var deltaStart = delta.start;
725
+ var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
726
+ if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
727
+ return {
728
+ row: point.row,
729
+ column: point.column
730
+ };
731
+ }
732
+ if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
733
+ return {
734
+ row: point.row + deltaRowShift,
735
+ column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
736
+ };
737
+ }
738
+
739
+ return {
740
+ row: deltaStart.row,
741
+ column: deltaStart.column
742
+ };
743
+ }
744
+ this.setPosition = function(row, column, noClip) {
745
+ var pos;
746
+ if (noClip) {
747
+ pos = {
748
+ row: row,
749
+ column: column
750
+ };
751
+ } else {
752
+ pos = this.$clipPositionToDocument(row, column);
753
+ }
754
+
755
+ if (this.row == pos.row && this.column == pos.column)
756
+ return;
757
+
758
+ var old = {
759
+ row: this.row,
760
+ column: this.column
761
+ };
762
+
763
+ this.row = pos.row;
764
+ this.column = pos.column;
765
+ this._signal("change", {
766
+ old: old,
767
+ value: pos
768
+ });
769
+ };
770
+ this.detach = function() {
771
+ this.document.removeEventListener("change", this.$onChange);
772
+ };
773
+ this.attach = function(doc) {
774
+ this.document = doc || this.document;
775
+ this.document.on("change", this.$onChange);
776
+ };
777
+ this.$clipPositionToDocument = function(row, column) {
778
+ var pos = {};
779
+
780
+ if (row >= this.document.getLength()) {
781
+ pos.row = Math.max(0, this.document.getLength() - 1);
782
+ pos.column = this.document.getLine(pos.row).length;
783
+ }
784
+ else if (row < 0) {
785
+ pos.row = 0;
786
+ pos.column = 0;
787
+ }
788
+ else {
789
+ pos.row = row;
790
+ pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
791
+ }
792
+
793
+ if (column < 0)
794
+ pos.column = 0;
795
+
796
+ return pos;
797
+ };
798
+
799
+ }).call(Anchor.prototype);
800
+
801
+ });
802
+
803
+ define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"], function(require, exports, module) {
804
+ "use strict";
805
+ var oop = require("./lib/oop");
806
+ var applyDelta = require("./apply_delta").applyDelta;
807
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
808
+ var Range = require("./range").Range;
809
+ var Anchor = require("./anchor").Anchor;
810
+
811
+ var Document = function(textOrLines) {
812
+ this.$lines = [""];
813
+ if (textOrLines.length === 0) {
814
+ this.$lines = [""];
815
+ } else if (Array.isArray(textOrLines)) {
816
+ this.insertMergedLines({row: 0, column: 0}, textOrLines);
817
+ } else {
818
+ this.insert({row: 0, column:0}, textOrLines);
819
+ }
820
+ };
821
+
822
+ (function() {
823
+
824
+ oop.implement(this, EventEmitter);
825
+ this.setValue = function(text) {
826
+ var len = this.getLength() - 1;
827
+ this.remove(new Range(0, 0, len, this.getLine(len).length));
828
+ this.insert({row: 0, column: 0}, text);
829
+ };
830
+ this.getValue = function() {
831
+ return this.getAllLines().join(this.getNewLineCharacter());
832
+ };
833
+ this.createAnchor = function(row, column) {
834
+ return new Anchor(this, row, column);
835
+ };
836
+ if ("aaa".split(/a/).length === 0) {
837
+ this.$split = function(text) {
838
+ return text.replace(/\r\n|\r/g, "\n").split("\n");
839
+ };
840
+ } else {
841
+ this.$split = function(text) {
842
+ return text.split(/\r\n|\r|\n/);
843
+ };
844
+ }
845
+
846
+
847
+ this.$detectNewLine = function(text) {
848
+ var match = text.match(/^.*?(\r\n|\r|\n)/m);
849
+ this.$autoNewLine = match ? match[1] : "\n";
850
+ this._signal("changeNewLineMode");
851
+ };
852
+ this.getNewLineCharacter = function() {
853
+ switch (this.$newLineMode) {
854
+ case "windows":
855
+ return "\r\n";
856
+ case "unix":
857
+ return "\n";
858
+ default:
859
+ return this.$autoNewLine || "\n";
860
+ }
861
+ };
862
+
863
+ this.$autoNewLine = "";
864
+ this.$newLineMode = "auto";
865
+ this.setNewLineMode = function(newLineMode) {
866
+ if (this.$newLineMode === newLineMode)
867
+ return;
868
+
869
+ this.$newLineMode = newLineMode;
870
+ this._signal("changeNewLineMode");
871
+ };
872
+ this.getNewLineMode = function() {
873
+ return this.$newLineMode;
874
+ };
875
+ this.isNewLine = function(text) {
876
+ return (text == "\r\n" || text == "\r" || text == "\n");
877
+ };
878
+ this.getLine = function(row) {
879
+ return this.$lines[row] || "";
880
+ };
881
+ this.getLines = function(firstRow, lastRow) {
882
+ return this.$lines.slice(firstRow, lastRow + 1);
883
+ };
884
+ this.getAllLines = function() {
885
+ return this.getLines(0, this.getLength());
886
+ };
887
+ this.getLength = function() {
888
+ return this.$lines.length;
889
+ };
890
+ this.getTextRange = function(range) {
891
+ return this.getLinesForRange(range).join(this.getNewLineCharacter());
892
+ };
893
+ this.getLinesForRange = function(range) {
894
+ var lines;
895
+ if (range.start.row === range.end.row) {
896
+ lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
897
+ } else {
898
+ lines = this.getLines(range.start.row, range.end.row);
899
+ lines[0] = (lines[0] || "").substring(range.start.column);
900
+ var l = lines.length - 1;
901
+ if (range.end.row - range.start.row == l)
902
+ lines[l] = lines[l].substring(0, range.end.column);
903
+ }
904
+ return lines;
905
+ };
906
+ this.insertLines = function(row, lines) {
907
+ console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
908
+ return this.insertFullLines(row, lines);
909
+ };
910
+ this.removeLines = function(firstRow, lastRow) {
911
+ console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
912
+ return this.removeFullLines(firstRow, lastRow);
913
+ };
914
+ this.insertNewLine = function(position) {
915
+ console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
916
+ return this.insertMergedLines(position, ["", ""]);
917
+ };
918
+ this.insert = function(position, text) {
919
+ if (this.getLength() <= 1)
920
+ this.$detectNewLine(text);
921
+
922
+ return this.insertMergedLines(position, this.$split(text));
923
+ };
924
+ this.insertInLine = function(position, text) {
925
+ var start = this.clippedPos(position.row, position.column);
926
+ var end = this.pos(position.row, position.column + text.length);
927
+
928
+ this.applyDelta({
929
+ start: start,
930
+ end: end,
931
+ action: "insert",
932
+ lines: [text]
933
+ }, true);
934
+
935
+ return this.clonePos(end);
936
+ };
937
+
938
+ this.clippedPos = function(row, column) {
939
+ var length = this.getLength();
940
+ if (row === undefined) {
941
+ row = length;
942
+ } else if (row < 0) {
943
+ row = 0;
944
+ } else if (row >= length) {
945
+ row = length - 1;
946
+ column = undefined;
947
+ }
948
+ var line = this.getLine(row);
949
+ if (column == undefined)
950
+ column = line.length;
951
+ column = Math.min(Math.max(column, 0), line.length);
952
+ return {row: row, column: column};
953
+ };
954
+
955
+ this.clonePos = function(pos) {
956
+ return {row: pos.row, column: pos.column};
957
+ };
958
+
959
+ this.pos = function(row, column) {
960
+ return {row: row, column: column};
961
+ };
962
+
963
+ this.$clipPosition = function(position) {
964
+ var length = this.getLength();
965
+ if (position.row >= length) {
966
+ position.row = Math.max(0, length - 1);
967
+ position.column = this.getLine(length - 1).length;
968
+ } else {
969
+ position.row = Math.max(0, position.row);
970
+ position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
971
+ }
972
+ return position;
973
+ };
974
+ this.insertFullLines = function(row, lines) {
975
+ row = Math.min(Math.max(row, 0), this.getLength());
976
+ var column = 0;
977
+ if (row < this.getLength()) {
978
+ lines = lines.concat([""]);
979
+ column = 0;
980
+ } else {
981
+ lines = [""].concat(lines);
982
+ row--;
983
+ column = this.$lines[row].length;
984
+ }
985
+ this.insertMergedLines({row: row, column: column}, lines);
986
+ };
987
+ this.insertMergedLines = function(position, lines) {
988
+ var start = this.clippedPos(position.row, position.column);
989
+ var end = {
990
+ row: start.row + lines.length - 1,
991
+ column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
992
+ };
993
+
994
+ this.applyDelta({
995
+ start: start,
996
+ end: end,
997
+ action: "insert",
998
+ lines: lines
999
+ });
1000
+
1001
+ return this.clonePos(end);
1002
+ };
1003
+ this.remove = function(range) {
1004
+ var start = this.clippedPos(range.start.row, range.start.column);
1005
+ var end = this.clippedPos(range.end.row, range.end.column);
1006
+ this.applyDelta({
1007
+ start: start,
1008
+ end: end,
1009
+ action: "remove",
1010
+ lines: this.getLinesForRange({start: start, end: end})
1011
+ });
1012
+ return this.clonePos(start);
1013
+ };
1014
+ this.removeInLine = function(row, startColumn, endColumn) {
1015
+ var start = this.clippedPos(row, startColumn);
1016
+ var end = this.clippedPos(row, endColumn);
1017
+
1018
+ this.applyDelta({
1019
+ start: start,
1020
+ end: end,
1021
+ action: "remove",
1022
+ lines: this.getLinesForRange({start: start, end: end})
1023
+ }, true);
1024
+
1025
+ return this.clonePos(start);
1026
+ };
1027
+ this.removeFullLines = function(firstRow, lastRow) {
1028
+ firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
1029
+ lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
1030
+ var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
1031
+ var deleteLastNewLine = lastRow < this.getLength() - 1;
1032
+ var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );
1033
+ var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );
1034
+ var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );
1035
+ var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length );
1036
+ var range = new Range(startRow, startCol, endRow, endCol);
1037
+ var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
1038
+
1039
+ this.applyDelta({
1040
+ start: range.start,
1041
+ end: range.end,
1042
+ action: "remove",
1043
+ lines: this.getLinesForRange(range)
1044
+ });
1045
+ return deletedLines;
1046
+ };
1047
+ this.removeNewLine = function(row) {
1048
+ if (row < this.getLength() - 1 && row >= 0) {
1049
+ this.applyDelta({
1050
+ start: this.pos(row, this.getLine(row).length),
1051
+ end: this.pos(row + 1, 0),
1052
+ action: "remove",
1053
+ lines: ["", ""]
1054
+ });
1055
+ }
1056
+ };
1057
+ this.replace = function(range, text) {
1058
+ if (!(range instanceof Range))
1059
+ range = Range.fromPoints(range.start, range.end);
1060
+ if (text.length === 0 && range.isEmpty())
1061
+ return range.start;
1062
+ if (text == this.getTextRange(range))
1063
+ return range.end;
1064
+
1065
+ this.remove(range);
1066
+ var end;
1067
+ if (text) {
1068
+ end = this.insert(range.start, text);
1069
+ }
1070
+ else {
1071
+ end = range.start;
1072
+ }
1073
+
1074
+ return end;
1075
+ };
1076
+ this.applyDeltas = function(deltas) {
1077
+ for (var i=0; i<deltas.length; i++) {
1078
+ this.applyDelta(deltas[i]);
1079
+ }
1080
+ };
1081
+ this.revertDeltas = function(deltas) {
1082
+ for (var i=deltas.length-1; i>=0; i--) {
1083
+ this.revertDelta(deltas[i]);
1084
+ }
1085
+ };
1086
+ this.applyDelta = function(delta, doNotValidate) {
1087
+ var isInsert = delta.action == "insert";
1088
+ if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
1089
+ : !Range.comparePoints(delta.start, delta.end)) {
1090
+ return;
1091
+ }
1092
+
1093
+ if (isInsert && delta.lines.length > 20000)
1094
+ this.$splitAndapplyLargeDelta(delta, 20000);
1095
+ applyDelta(this.$lines, delta, doNotValidate);
1096
+ this._signal("change", delta);
1097
+ };
1098
+
1099
+ this.$splitAndapplyLargeDelta = function(delta, MAX) {
1100
+ var lines = delta.lines;
1101
+ var l = lines.length;
1102
+ var row = delta.start.row;
1103
+ var column = delta.start.column;
1104
+ var from = 0, to = 0;
1105
+ do {
1106
+ from = to;
1107
+ to += MAX - 1;
1108
+ var chunk = lines.slice(from, to);
1109
+ if (to > l) {
1110
+ delta.lines = chunk;
1111
+ delta.start.row = row + from;
1112
+ delta.start.column = column;
1113
+ break;
1114
+ }
1115
+ chunk.push("");
1116
+ this.applyDelta({
1117
+ start: this.pos(row + from, column),
1118
+ end: this.pos(row + to, column = 0),
1119
+ action: delta.action,
1120
+ lines: chunk
1121
+ }, true);
1122
+ } while(true);
1123
+ };
1124
+ this.revertDelta = function(delta) {
1125
+ this.applyDelta({
1126
+ start: this.clonePos(delta.start),
1127
+ end: this.clonePos(delta.end),
1128
+ action: (delta.action == "insert" ? "remove" : "insert"),
1129
+ lines: delta.lines.slice()
1130
+ });
1131
+ };
1132
+ this.indexToPosition = function(index, startRow) {
1133
+ var lines = this.$lines || this.getAllLines();
1134
+ var newlineLength = this.getNewLineCharacter().length;
1135
+ for (var i = startRow || 0, l = lines.length; i < l; i++) {
1136
+ index -= lines[i].length + newlineLength;
1137
+ if (index < 0)
1138
+ return {row: i, column: index + lines[i].length + newlineLength};
1139
+ }
1140
+ return {row: l-1, column: lines[l-1].length};
1141
+ };
1142
+ this.positionToIndex = function(pos, startRow) {
1143
+ var lines = this.$lines || this.getAllLines();
1144
+ var newlineLength = this.getNewLineCharacter().length;
1145
+ var index = 0;
1146
+ var row = Math.min(pos.row, lines.length);
1147
+ for (var i = startRow || 0; i < row; ++i)
1148
+ index += lines[i].length + newlineLength;
1149
+
1150
+ return index + pos.column;
1151
+ };
1152
+
1153
+ }).call(Document.prototype);
1154
+
1155
+ exports.Document = Document;
1156
+ });
1157
+
1158
+ define("ace/lib/lang",["require","exports","module"], function(require, exports, module) {
1159
+ "use strict";
1160
+
1161
+ exports.last = function(a) {
1162
+ return a[a.length - 1];
1163
+ };
1164
+
1165
+ exports.stringReverse = function(string) {
1166
+ return string.split("").reverse().join("");
1167
+ };
1168
+
1169
+ exports.stringRepeat = function (string, count) {
1170
+ var result = '';
1171
+ while (count > 0) {
1172
+ if (count & 1)
1173
+ result += string;
1174
+
1175
+ if (count >>= 1)
1176
+ string += string;
1177
+ }
1178
+ return result;
1179
+ };
1180
+
1181
+ var trimBeginRegexp = /^\s\s*/;
1182
+ var trimEndRegexp = /\s\s*$/;
1183
+
1184
+ exports.stringTrimLeft = function (string) {
1185
+ return string.replace(trimBeginRegexp, '');
1186
+ };
1187
+
1188
+ exports.stringTrimRight = function (string) {
1189
+ return string.replace(trimEndRegexp, '');
1190
+ };
1191
+
1192
+ exports.copyObject = function(obj) {
1193
+ var copy = {};
1194
+ for (var key in obj) {
1195
+ copy[key] = obj[key];
1196
+ }
1197
+ return copy;
1198
+ };
1199
+
1200
+ exports.copyArray = function(array){
1201
+ var copy = [];
1202
+ for (var i=0, l=array.length; i<l; i++) {
1203
+ if (array[i] && typeof array[i] == "object")
1204
+ copy[i] = this.copyObject(array[i]);
1205
+ else
1206
+ copy[i] = array[i];
1207
+ }
1208
+ return copy;
1209
+ };
1210
+
1211
+ exports.deepCopy = function deepCopy(obj) {
1212
+ if (typeof obj !== "object" || !obj)
1213
+ return obj;
1214
+ var copy;
1215
+ if (Array.isArray(obj)) {
1216
+ copy = [];
1217
+ for (var key = 0; key < obj.length; key++) {
1218
+ copy[key] = deepCopy(obj[key]);
1219
+ }
1220
+ return copy;
1221
+ }
1222
+ if (Object.prototype.toString.call(obj) !== "[object Object]")
1223
+ return obj;
1224
+
1225
+ copy = {};
1226
+ for (var key in obj)
1227
+ copy[key] = deepCopy(obj[key]);
1228
+ return copy;
1229
+ };
1230
+
1231
+ exports.arrayToMap = function(arr) {
1232
+ var map = {};
1233
+ for (var i=0; i<arr.length; i++) {
1234
+ map[arr[i]] = 1;
1235
+ }
1236
+ return map;
1237
+
1238
+ };
1239
+
1240
+ exports.createMap = function(props) {
1241
+ var map = Object.create(null);
1242
+ for (var i in props) {
1243
+ map[i] = props[i];
1244
+ }
1245
+ return map;
1246
+ };
1247
+ exports.arrayRemove = function(array, value) {
1248
+ for (var i = 0; i <= array.length; i++) {
1249
+ if (value === array[i]) {
1250
+ array.splice(i, 1);
1251
+ }
1252
+ }
1253
+ };
1254
+
1255
+ exports.escapeRegExp = function(str) {
1256
+ return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
1257
+ };
1258
+
1259
+ exports.escapeHTML = function(str) {
1260
+ return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
1261
+ };
1262
+
1263
+ exports.getMatchOffsets = function(string, regExp) {
1264
+ var matches = [];
1265
+
1266
+ string.replace(regExp, function(str) {
1267
+ matches.push({
1268
+ offset: arguments[arguments.length-2],
1269
+ length: str.length
1270
+ });
1271
+ });
1272
+
1273
+ return matches;
1274
+ };
1275
+ exports.deferredCall = function(fcn) {
1276
+ var timer = null;
1277
+ var callback = function() {
1278
+ timer = null;
1279
+ fcn();
1280
+ };
1281
+
1282
+ var deferred = function(timeout) {
1283
+ deferred.cancel();
1284
+ timer = setTimeout(callback, timeout || 0);
1285
+ return deferred;
1286
+ };
1287
+
1288
+ deferred.schedule = deferred;
1289
+
1290
+ deferred.call = function() {
1291
+ this.cancel();
1292
+ fcn();
1293
+ return deferred;
1294
+ };
1295
+
1296
+ deferred.cancel = function() {
1297
+ clearTimeout(timer);
1298
+ timer = null;
1299
+ return deferred;
1300
+ };
1301
+
1302
+ deferred.isPending = function() {
1303
+ return timer;
1304
+ };
1305
+
1306
+ return deferred;
1307
+ };
1308
+
1309
+
1310
+ exports.delayedCall = function(fcn, defaultTimeout) {
1311
+ var timer = null;
1312
+ var callback = function() {
1313
+ timer = null;
1314
+ fcn();
1315
+ };
1316
+
1317
+ var _self = function(timeout) {
1318
+ if (timer == null)
1319
+ timer = setTimeout(callback, timeout || defaultTimeout);
1320
+ };
1321
+
1322
+ _self.delay = function(timeout) {
1323
+ timer && clearTimeout(timer);
1324
+ timer = setTimeout(callback, timeout || defaultTimeout);
1325
+ };
1326
+ _self.schedule = _self;
1327
+
1328
+ _self.call = function() {
1329
+ this.cancel();
1330
+ fcn();
1331
+ };
1332
+
1333
+ _self.cancel = function() {
1334
+ timer && clearTimeout(timer);
1335
+ timer = null;
1336
+ };
1337
+
1338
+ _self.isPending = function() {
1339
+ return timer;
1340
+ };
1341
+
1342
+ return _self;
1343
+ };
1344
+ });
1345
+
1346
+ define("ace/worker/mirror",["require","exports","module","ace/range","ace/document","ace/lib/lang"], function(require, exports, module) {
1347
+ "use strict";
1348
+
1349
+ var Range = require("../range").Range;
1350
+ var Document = require("../document").Document;
1351
+ var lang = require("../lib/lang");
1352
+
1353
+ var Mirror = exports.Mirror = function(sender) {
1354
+ this.sender = sender;
1355
+ var doc = this.doc = new Document("");
1356
+
1357
+ var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1358
+
1359
+ var _self = this;
1360
+ sender.on("change", function(e) {
1361
+ var data = e.data;
1362
+ if (data[0].start) {
1363
+ doc.applyDeltas(data);
1364
+ } else {
1365
+ for (var i = 0; i < data.length; i += 2) {
1366
+ if (Array.isArray(data[i+1])) {
1367
+ var d = {action: "insert", start: data[i], lines: data[i+1]};
1368
+ } else {
1369
+ var d = {action: "remove", start: data[i], end: data[i+1]};
1370
+ }
1371
+ doc.applyDelta(d, true);
1372
+ }
1373
+ }
1374
+ if (_self.$timeout)
1375
+ return deferredUpdate.schedule(_self.$timeout);
1376
+ _self.onUpdate();
1377
+ });
1378
+ };
1379
+
1380
+ (function() {
1381
+
1382
+ this.$timeout = 500;
1383
+
1384
+ this.setTimeout = function(timeout) {
1385
+ this.$timeout = timeout;
1386
+ };
1387
+
1388
+ this.setValue = function(value) {
1389
+ this.doc.setValue(value);
1390
+ this.deferredUpdate.schedule(this.$timeout);
1391
+ };
1392
+
1393
+ this.getValue = function(callbackId) {
1394
+ this.sender.callback(this.doc.getValue(), callbackId);
1395
+ };
1396
+
1397
+ this.onUpdate = function() {
1398
+ };
1399
+
1400
+ this.isPending = function() {
1401
+ return this.deferredUpdate.isPending();
1402
+ };
1403
+
1404
+ }).call(Mirror.prototype);
1405
+
1406
+ });
1407
+
1408
+ define("ace/lib/es5-shim",["require","exports","module"], function(require, exports, module) {
1409
+
1410
+ function Empty() {}
1411
+
1412
+ if (!Function.prototype.bind) {
1413
+ Function.prototype.bind = function bind(that) { // .length is 1
1414
+ var target = this;
1415
+ if (typeof target != "function") {
1416
+ throw new TypeError("Function.prototype.bind called on incompatible " + target);
1417
+ }
1418
+ var args = slice.call(arguments, 1); // for normal call
1419
+ var bound = function () {
1420
+
1421
+ if (this instanceof bound) {
1422
+
1423
+ var result = target.apply(
1424
+ this,
1425
+ args.concat(slice.call(arguments))
1426
+ );
1427
+ if (Object(result) === result) {
1428
+ return result;
1429
+ }
1430
+ return this;
1431
+
1432
+ } else {
1433
+ return target.apply(
1434
+ that,
1435
+ args.concat(slice.call(arguments))
1436
+ );
1437
+
1438
+ }
1439
+
1440
+ };
1441
+ if(target.prototype) {
1442
+ Empty.prototype = target.prototype;
1443
+ bound.prototype = new Empty();
1444
+ Empty.prototype = null;
1445
+ }
1446
+ return bound;
1447
+ };
1448
+ }
1449
+ var call = Function.prototype.call;
1450
+ var prototypeOfArray = Array.prototype;
1451
+ var prototypeOfObject = Object.prototype;
1452
+ var slice = prototypeOfArray.slice;
1453
+ var _toString = call.bind(prototypeOfObject.toString);
1454
+ var owns = call.bind(prototypeOfObject.hasOwnProperty);
1455
+ var defineGetter;
1456
+ var defineSetter;
1457
+ var lookupGetter;
1458
+ var lookupSetter;
1459
+ var supportsAccessors;
1460
+ if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
1461
+ defineGetter = call.bind(prototypeOfObject.__defineGetter__);
1462
+ defineSetter = call.bind(prototypeOfObject.__defineSetter__);
1463
+ lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
1464
+ lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
1465
+ }
1466
+ if ([1,2].splice(0).length != 2) {
1467
+ if(function() { // test IE < 9 to splice bug - see issue #138
1468
+ function makeArray(l) {
1469
+ var a = new Array(l+2);
1470
+ a[0] = a[1] = 0;
1471
+ return a;
1472
+ }
1473
+ var array = [], lengthBefore;
1474
+
1475
+ array.splice.apply(array, makeArray(20));
1476
+ array.splice.apply(array, makeArray(26));
1477
+
1478
+ lengthBefore = array.length; //46
1479
+ array.splice(5, 0, "XXX"); // add one element
1480
+
1481
+ lengthBefore + 1 == array.length
1482
+
1483
+ if (lengthBefore + 1 == array.length) {
1484
+ return true;// has right splice implementation without bugs
1485
+ }
1486
+ }()) {//IE 6/7
1487
+ var array_splice = Array.prototype.splice;
1488
+ Array.prototype.splice = function(start, deleteCount) {
1489
+ if (!arguments.length) {
1490
+ return [];
1491
+ } else {
1492
+ return array_splice.apply(this, [
1493
+ start === void 0 ? 0 : start,
1494
+ deleteCount === void 0 ? (this.length - start) : deleteCount
1495
+ ].concat(slice.call(arguments, 2)))
1496
+ }
1497
+ };
1498
+ } else {//IE8
1499
+ Array.prototype.splice = function(pos, removeCount){
1500
+ var length = this.length;
1501
+ if (pos > 0) {
1502
+ if (pos > length)
1503
+ pos = length;
1504
+ } else if (pos == void 0) {
1505
+ pos = 0;
1506
+ } else if (pos < 0) {
1507
+ pos = Math.max(length + pos, 0);
1508
+ }
1509
+
1510
+ if (!(pos+removeCount < length))
1511
+ removeCount = length - pos;
1512
+
1513
+ var removed = this.slice(pos, pos+removeCount);
1514
+ var insert = slice.call(arguments, 2);
1515
+ var add = insert.length;
1516
+ if (pos === length) {
1517
+ if (add) {
1518
+ this.push.apply(this, insert);
1519
+ }
1520
+ } else {
1521
+ var remove = Math.min(removeCount, length - pos);
1522
+ var tailOldPos = pos + remove;
1523
+ var tailNewPos = tailOldPos + add - remove;
1524
+ var tailCount = length - tailOldPos;
1525
+ var lengthAfterRemove = length - remove;
1526
+
1527
+ if (tailNewPos < tailOldPos) { // case A
1528
+ for (var i = 0; i < tailCount; ++i) {
1529
+ this[tailNewPos+i] = this[tailOldPos+i];
1530
+ }
1531
+ } else if (tailNewPos > tailOldPos) { // case B
1532
+ for (i = tailCount; i--; ) {
1533
+ this[tailNewPos+i] = this[tailOldPos+i];
1534
+ }
1535
+ } // else, add == remove (nothing to do)
1536
+
1537
+ if (add && pos === lengthAfterRemove) {
1538
+ this.length = lengthAfterRemove; // truncate array
1539
+ this.push.apply(this, insert);
1540
+ } else {
1541
+ this.length = lengthAfterRemove + add; // reserves space
1542
+ for (i = 0; i < add; ++i) {
1543
+ this[pos+i] = insert[i];
1544
+ }
1545
+ }
1546
+ }
1547
+ return removed;
1548
+ };
1549
+ }
1550
+ }
1551
+ if (!Array.isArray) {
1552
+ Array.isArray = function isArray(obj) {
1553
+ return _toString(obj) == "[object Array]";
1554
+ };
1555
+ }
1556
+ var boxedString = Object("a"),
1557
+ splitString = boxedString[0] != "a" || !(0 in boxedString);
1558
+
1559
+ if (!Array.prototype.forEach) {
1560
+ Array.prototype.forEach = function forEach(fun /*, thisp*/) {
1561
+ var object = toObject(this),
1562
+ self = splitString && _toString(this) == "[object String]" ?
1563
+ this.split("") :
1564
+ object,
1565
+ thisp = arguments[1],
1566
+ i = -1,
1567
+ length = self.length >>> 0;
1568
+ if (_toString(fun) != "[object Function]") {
1569
+ throw new TypeError(); // TODO message
1570
+ }
1571
+
1572
+ while (++i < length) {
1573
+ if (i in self) {
1574
+ fun.call(thisp, self[i], i, object);
1575
+ }
1576
+ }
1577
+ };
1578
+ }
1579
+ if (!Array.prototype.map) {
1580
+ Array.prototype.map = function map(fun /*, thisp*/) {
1581
+ var object = toObject(this),
1582
+ self = splitString && _toString(this) == "[object String]" ?
1583
+ this.split("") :
1584
+ object,
1585
+ length = self.length >>> 0,
1586
+ result = Array(length),
1587
+ thisp = arguments[1];
1588
+ if (_toString(fun) != "[object Function]") {
1589
+ throw new TypeError(fun + " is not a function");
1590
+ }
1591
+
1592
+ for (var i = 0; i < length; i++) {
1593
+ if (i in self)
1594
+ result[i] = fun.call(thisp, self[i], i, object);
1595
+ }
1596
+ return result;
1597
+ };
1598
+ }
1599
+ if (!Array.prototype.filter) {
1600
+ Array.prototype.filter = function filter(fun /*, thisp */) {
1601
+ var object = toObject(this),
1602
+ self = splitString && _toString(this) == "[object String]" ?
1603
+ this.split("") :
1604
+ object,
1605
+ length = self.length >>> 0,
1606
+ result = [],
1607
+ value,
1608
+ thisp = arguments[1];
1609
+ if (_toString(fun) != "[object Function]") {
1610
+ throw new TypeError(fun + " is not a function");
1611
+ }
1612
+
1613
+ for (var i = 0; i < length; i++) {
1614
+ if (i in self) {
1615
+ value = self[i];
1616
+ if (fun.call(thisp, value, i, object)) {
1617
+ result.push(value);
1618
+ }
1619
+ }
1620
+ }
1621
+ return result;
1622
+ };
1623
+ }
1624
+ if (!Array.prototype.every) {
1625
+ Array.prototype.every = function every(fun /*, thisp */) {
1626
+ var object = toObject(this),
1627
+ self = splitString && _toString(this) == "[object String]" ?
1628
+ this.split("") :
1629
+ object,
1630
+ length = self.length >>> 0,
1631
+ thisp = arguments[1];
1632
+ if (_toString(fun) != "[object Function]") {
1633
+ throw new TypeError(fun + " is not a function");
1634
+ }
1635
+
1636
+ for (var i = 0; i < length; i++) {
1637
+ if (i in self && !fun.call(thisp, self[i], i, object)) {
1638
+ return false;
1639
+ }
1640
+ }
1641
+ return true;
1642
+ };
1643
+ }
1644
+ if (!Array.prototype.some) {
1645
+ Array.prototype.some = function some(fun /*, thisp */) {
1646
+ var object = toObject(this),
1647
+ self = splitString && _toString(this) == "[object String]" ?
1648
+ this.split("") :
1649
+ object,
1650
+ length = self.length >>> 0,
1651
+ thisp = arguments[1];
1652
+ if (_toString(fun) != "[object Function]") {
1653
+ throw new TypeError(fun + " is not a function");
1654
+ }
1655
+
1656
+ for (var i = 0; i < length; i++) {
1657
+ if (i in self && fun.call(thisp, self[i], i, object)) {
1658
+ return true;
1659
+ }
1660
+ }
1661
+ return false;
1662
+ };
1663
+ }
1664
+ if (!Array.prototype.reduce) {
1665
+ Array.prototype.reduce = function reduce(fun /*, initial*/) {
1666
+ var object = toObject(this),
1667
+ self = splitString && _toString(this) == "[object String]" ?
1668
+ this.split("") :
1669
+ object,
1670
+ length = self.length >>> 0;
1671
+ if (_toString(fun) != "[object Function]") {
1672
+ throw new TypeError(fun + " is not a function");
1673
+ }
1674
+ if (!length && arguments.length == 1) {
1675
+ throw new TypeError("reduce of empty array with no initial value");
1676
+ }
1677
+
1678
+ var i = 0;
1679
+ var result;
1680
+ if (arguments.length >= 2) {
1681
+ result = arguments[1];
1682
+ } else {
1683
+ do {
1684
+ if (i in self) {
1685
+ result = self[i++];
1686
+ break;
1687
+ }
1688
+ if (++i >= length) {
1689
+ throw new TypeError("reduce of empty array with no initial value");
1690
+ }
1691
+ } while (true);
1692
+ }
1693
+
1694
+ for (; i < length; i++) {
1695
+ if (i in self) {
1696
+ result = fun.call(void 0, result, self[i], i, object);
1697
+ }
1698
+ }
1699
+
1700
+ return result;
1701
+ };
1702
+ }
1703
+ if (!Array.prototype.reduceRight) {
1704
+ Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
1705
+ var object = toObject(this),
1706
+ self = splitString && _toString(this) == "[object String]" ?
1707
+ this.split("") :
1708
+ object,
1709
+ length = self.length >>> 0;
1710
+ if (_toString(fun) != "[object Function]") {
1711
+ throw new TypeError(fun + " is not a function");
1712
+ }
1713
+ if (!length && arguments.length == 1) {
1714
+ throw new TypeError("reduceRight of empty array with no initial value");
1715
+ }
1716
+
1717
+ var result, i = length - 1;
1718
+ if (arguments.length >= 2) {
1719
+ result = arguments[1];
1720
+ } else {
1721
+ do {
1722
+ if (i in self) {
1723
+ result = self[i--];
1724
+ break;
1725
+ }
1726
+ if (--i < 0) {
1727
+ throw new TypeError("reduceRight of empty array with no initial value");
1728
+ }
1729
+ } while (true);
1730
+ }
1731
+
1732
+ do {
1733
+ if (i in this) {
1734
+ result = fun.call(void 0, result, self[i], i, object);
1735
+ }
1736
+ } while (i--);
1737
+
1738
+ return result;
1739
+ };
1740
+ }
1741
+ if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
1742
+ Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
1743
+ var self = splitString && _toString(this) == "[object String]" ?
1744
+ this.split("") :
1745
+ toObject(this),
1746
+ length = self.length >>> 0;
1747
+
1748
+ if (!length) {
1749
+ return -1;
1750
+ }
1751
+
1752
+ var i = 0;
1753
+ if (arguments.length > 1) {
1754
+ i = toInteger(arguments[1]);
1755
+ }
1756
+ i = i >= 0 ? i : Math.max(0, length + i);
1757
+ for (; i < length; i++) {
1758
+ if (i in self && self[i] === sought) {
1759
+ return i;
1760
+ }
1761
+ }
1762
+ return -1;
1763
+ };
1764
+ }
1765
+ if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
1766
+ Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
1767
+ var self = splitString && _toString(this) == "[object String]" ?
1768
+ this.split("") :
1769
+ toObject(this),
1770
+ length = self.length >>> 0;
1771
+
1772
+ if (!length) {
1773
+ return -1;
1774
+ }
1775
+ var i = length - 1;
1776
+ if (arguments.length > 1) {
1777
+ i = Math.min(i, toInteger(arguments[1]));
1778
+ }
1779
+ i = i >= 0 ? i : length - Math.abs(i);
1780
+ for (; i >= 0; i--) {
1781
+ if (i in self && sought === self[i]) {
1782
+ return i;
1783
+ }
1784
+ }
1785
+ return -1;
1786
+ };
1787
+ }
1788
+ if (!Object.getPrototypeOf) {
1789
+ Object.getPrototypeOf = function getPrototypeOf(object) {
1790
+ return object.__proto__ || (
1791
+ object.constructor ?
1792
+ object.constructor.prototype :
1793
+ prototypeOfObject
1794
+ );
1795
+ };
1796
+ }
1797
+ if (!Object.getOwnPropertyDescriptor) {
1798
+ var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
1799
+ "non-object: ";
1800
+ Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
1801
+ if ((typeof object != "object" && typeof object != "function") || object === null)
1802
+ throw new TypeError(ERR_NON_OBJECT + object);
1803
+ if (!owns(object, property))
1804
+ return;
1805
+
1806
+ var descriptor, getter, setter;
1807
+ descriptor = { enumerable: true, configurable: true };
1808
+ if (supportsAccessors) {
1809
+ var prototype = object.__proto__;
1810
+ object.__proto__ = prototypeOfObject;
1811
+
1812
+ var getter = lookupGetter(object, property);
1813
+ var setter = lookupSetter(object, property);
1814
+ object.__proto__ = prototype;
1815
+
1816
+ if (getter || setter) {
1817
+ if (getter) descriptor.get = getter;
1818
+ if (setter) descriptor.set = setter;
1819
+ return descriptor;
1820
+ }
1821
+ }
1822
+ descriptor.value = object[property];
1823
+ return descriptor;
1824
+ };
1825
+ }
1826
+ if (!Object.getOwnPropertyNames) {
1827
+ Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
1828
+ return Object.keys(object);
1829
+ };
1830
+ }
1831
+ if (!Object.create) {
1832
+ var createEmpty;
1833
+ if (Object.prototype.__proto__ === null) {
1834
+ createEmpty = function () {
1835
+ return { "__proto__": null };
1836
+ };
1837
+ } else {
1838
+ createEmpty = function () {
1839
+ var empty = {};
1840
+ for (var i in empty)
1841
+ empty[i] = null;
1842
+ empty.constructor =
1843
+ empty.hasOwnProperty =
1844
+ empty.propertyIsEnumerable =
1845
+ empty.isPrototypeOf =
1846
+ empty.toLocaleString =
1847
+ empty.toString =
1848
+ empty.valueOf =
1849
+ empty.__proto__ = null;
1850
+ return empty;
1851
+ }
1852
+ }
1853
+
1854
+ Object.create = function create(prototype, properties) {
1855
+ var object;
1856
+ if (prototype === null) {
1857
+ object = createEmpty();
1858
+ } else {
1859
+ if (typeof prototype != "object")
1860
+ throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
1861
+ var Type = function () {};
1862
+ Type.prototype = prototype;
1863
+ object = new Type();
1864
+ object.__proto__ = prototype;
1865
+ }
1866
+ if (properties !== void 0)
1867
+ Object.defineProperties(object, properties);
1868
+ return object;
1869
+ };
1870
+ }
1871
+
1872
+ function doesDefinePropertyWork(object) {
1873
+ try {
1874
+ Object.defineProperty(object, "sentinel", {});
1875
+ return "sentinel" in object;
1876
+ } catch (exception) {
1877
+ }
1878
+ }
1879
+ if (Object.defineProperty) {
1880
+ var definePropertyWorksOnObject = doesDefinePropertyWork({});
1881
+ var definePropertyWorksOnDom = typeof document == "undefined" ||
1882
+ doesDefinePropertyWork(document.createElement("div"));
1883
+ if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
1884
+ var definePropertyFallback = Object.defineProperty;
1885
+ }
1886
+ }
1887
+
1888
+ if (!Object.defineProperty || definePropertyFallback) {
1889
+ var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
1890
+ var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
1891
+ var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
1892
+ "on this javascript engine";
1893
+
1894
+ Object.defineProperty = function defineProperty(object, property, descriptor) {
1895
+ if ((typeof object != "object" && typeof object != "function") || object === null)
1896
+ throw new TypeError(ERR_NON_OBJECT_TARGET + object);
1897
+ if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
1898
+ throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
1899
+ if (definePropertyFallback) {
1900
+ try {
1901
+ return definePropertyFallback.call(Object, object, property, descriptor);
1902
+ } catch (exception) {
1903
+ }
1904
+ }
1905
+ if (owns(descriptor, "value")) {
1906
+
1907
+ if (supportsAccessors && (lookupGetter(object, property) ||
1908
+ lookupSetter(object, property)))
1909
+ {
1910
+ var prototype = object.__proto__;
1911
+ object.__proto__ = prototypeOfObject;
1912
+ delete object[property];
1913
+ object[property] = descriptor.value;
1914
+ object.__proto__ = prototype;
1915
+ } else {
1916
+ object[property] = descriptor.value;
1917
+ }
1918
+ } else {
1919
+ if (!supportsAccessors)
1920
+ throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
1921
+ if (owns(descriptor, "get"))
1922
+ defineGetter(object, property, descriptor.get);
1923
+ if (owns(descriptor, "set"))
1924
+ defineSetter(object, property, descriptor.set);
1925
+ }
1926
+
1927
+ return object;
1928
+ };
1929
+ }
1930
+ if (!Object.defineProperties) {
1931
+ Object.defineProperties = function defineProperties(object, properties) {
1932
+ for (var property in properties) {
1933
+ if (owns(properties, property))
1934
+ Object.defineProperty(object, property, properties[property]);
1935
+ }
1936
+ return object;
1937
+ };
1938
+ }
1939
+ if (!Object.seal) {
1940
+ Object.seal = function seal(object) {
1941
+ return object;
1942
+ };
1943
+ }
1944
+ if (!Object.freeze) {
1945
+ Object.freeze = function freeze(object) {
1946
+ return object;
1947
+ };
1948
+ }
1949
+ try {
1950
+ Object.freeze(function () {});
1951
+ } catch (exception) {
1952
+ Object.freeze = (function freeze(freezeObject) {
1953
+ return function freeze(object) {
1954
+ if (typeof object == "function") {
1955
+ return object;
1956
+ } else {
1957
+ return freezeObject(object);
1958
+ }
1959
+ };
1960
+ })(Object.freeze);
1961
+ }
1962
+ if (!Object.preventExtensions) {
1963
+ Object.preventExtensions = function preventExtensions(object) {
1964
+ return object;
1965
+ };
1966
+ }
1967
+ if (!Object.isSealed) {
1968
+ Object.isSealed = function isSealed(object) {
1969
+ return false;
1970
+ };
1971
+ }
1972
+ if (!Object.isFrozen) {
1973
+ Object.isFrozen = function isFrozen(object) {
1974
+ return false;
1975
+ };
1976
+ }
1977
+ if (!Object.isExtensible) {
1978
+ Object.isExtensible = function isExtensible(object) {
1979
+ if (Object(object) === object) {
1980
+ throw new TypeError(); // TODO message
1981
+ }
1982
+ var name = '';
1983
+ while (owns(object, name)) {
1984
+ name += '?';
1985
+ }
1986
+ object[name] = true;
1987
+ var returnValue = owns(object, name);
1988
+ delete object[name];
1989
+ return returnValue;
1990
+ };
1991
+ }
1992
+ if (!Object.keys) {
1993
+ var hasDontEnumBug = true,
1994
+ dontEnums = [
1995
+ "toString",
1996
+ "toLocaleString",
1997
+ "valueOf",
1998
+ "hasOwnProperty",
1999
+ "isPrototypeOf",
2000
+ "propertyIsEnumerable",
2001
+ "constructor"
2002
+ ],
2003
+ dontEnumsLength = dontEnums.length;
2004
+
2005
+ for (var key in {"toString": null}) {
2006
+ hasDontEnumBug = false;
2007
+ }
2008
+
2009
+ Object.keys = function keys(object) {
2010
+
2011
+ if (
2012
+ (typeof object != "object" && typeof object != "function") ||
2013
+ object === null
2014
+ ) {
2015
+ throw new TypeError("Object.keys called on a non-object");
2016
+ }
2017
+
2018
+ var keys = [];
2019
+ for (var name in object) {
2020
+ if (owns(object, name)) {
2021
+ keys.push(name);
2022
+ }
2023
+ }
2024
+
2025
+ if (hasDontEnumBug) {
2026
+ for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
2027
+ var dontEnum = dontEnums[i];
2028
+ if (owns(object, dontEnum)) {
2029
+ keys.push(dontEnum);
2030
+ }
2031
+ }
2032
+ }
2033
+ return keys;
2034
+ };
2035
+
2036
+ }
2037
+ if (!Date.now) {
2038
+ Date.now = function now() {
2039
+ return new Date().getTime();
2040
+ };
2041
+ }
2042
+ var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
2043
+ "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
2044
+ "\u2029\uFEFF";
2045
+ if (!String.prototype.trim || ws.trim()) {
2046
+ ws = "[" + ws + "]";
2047
+ var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
2048
+ trimEndRegexp = new RegExp(ws + ws + "*$");
2049
+ String.prototype.trim = function trim() {
2050
+ return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
2051
+ };
2052
+ }
2053
+
2054
+ function toInteger(n) {
2055
+ n = +n;
2056
+ if (n !== n) { // isNaN
2057
+ n = 0;
2058
+ } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
2059
+ n = (n > 0 || -1) * Math.floor(Math.abs(n));
2060
+ }
2061
+ return n;
2062
+ }
2063
+
2064
+ function isPrimitive(input) {
2065
+ var type = typeof input;
2066
+ return (
2067
+ input === null ||
2068
+ type === "undefined" ||
2069
+ type === "boolean" ||
2070
+ type === "number" ||
2071
+ type === "string"
2072
+ );
2073
+ }
2074
+
2075
+ function toPrimitive(input) {
2076
+ var val, valueOf, toString;
2077
+ if (isPrimitive(input)) {
2078
+ return input;
2079
+ }
2080
+ valueOf = input.valueOf;
2081
+ if (typeof valueOf === "function") {
2082
+ val = valueOf.call(input);
2083
+ if (isPrimitive(val)) {
2084
+ return val;
2085
+ }
2086
+ }
2087
+ toString = input.toString;
2088
+ if (typeof toString === "function") {
2089
+ val = toString.call(input);
2090
+ if (isPrimitive(val)) {
2091
+ return val;
2092
+ }
2093
+ }
2094
+ throw new TypeError();
2095
+ }
2096
+ var toObject = function (o) {
2097
+ if (o == null) { // this matches both null and undefined
2098
+ throw new TypeError("can't convert "+o+" to object");
2099
+ }
2100
+ return Object(o);
2101
+ };
2102
+
2103
+ });
2104
+ define("ace/mode/jsonata_worker",["require","exports","ace/lib/oop","ace/worker/mirror"], function(require, exports) {
2105
+ var oop = require("../lib/oop");
2106
+ var Mirror = require("../worker/mirror").Mirror;
2107
+
2108
+ var JSONataWorker = exports.JSONataWorker = function(sender) {
2109
+ Mirror.call(this, sender);
2110
+ this.setTimeout(200);
2111
+ };
2112
+
2113
+ oop.inherits(JSONataWorker, Mirror);
2114
+
2115
+ (function() {
2116
+
2117
+ this.onUpdate = function() {
2118
+ var value = this.doc.getValue();
2119
+ var errors = [];
2120
+ try {
2121
+ if (value) {
2122
+ jsonata(value);
2123
+ }
2124
+ } catch (e) {
2125
+ var pos = this.doc.indexToPosition(e.position-1);
2126
+ var msg = e.message;
2127
+ msg = msg.replace(/ at column \d+/,"");
2128
+ errors.push({
2129
+ row: pos.row,
2130
+ column: pos.column,
2131
+ text: msg,
2132
+ type: "error"
2133
+ });
2134
+ }
2135
+ this.sender.emit("annotate", errors);
2136
+ };
2137
+
2138
+ }).call(JSONataWorker.prototype);
2139
+
2140
+ });