@cdklabs/cdk-ssm-documents 0.0.70 → 0.0.71

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 (790) hide show
  1. package/.jsii +25 -25
  2. package/lib/construct/synth-utils.js +1 -1
  3. package/lib/document/automation-document.js +1 -1
  4. package/lib/document/command-document.js +1 -1
  5. package/lib/document/document-builder.js +2 -2
  6. package/lib/document/ssm-document.js +1 -1
  7. package/lib/domain/aws-service.js +1 -1
  8. package/lib/domain/choice.js +1 -1
  9. package/lib/domain/data-type.js +1 -1
  10. package/lib/domain/enum/install-action.js +2 -2
  11. package/lib/domain/enum/install-uninstall-repair.js +2 -2
  12. package/lib/domain/enum/installation-type.js +2 -2
  13. package/lib/domain/enum/package-name.js +2 -2
  14. package/lib/domain/input.js +1 -1
  15. package/lib/domain/operation.js +1 -1
  16. package/lib/domain/platform.js +1 -1
  17. package/lib/domain/precondition.js +1 -1
  18. package/lib/incident-response/incident-response.js +3 -3
  19. package/lib/interface/approve-hook.js +2 -2
  20. package/lib/interface/auth-method.js +3 -3
  21. package/lib/interface/aws-invoker.js +2 -2
  22. package/lib/interface/downloadable-content.js +8 -8
  23. package/lib/interface/environment.js +3 -3
  24. package/lib/interface/execute-automation-hook/api-execute-automation-hook.js +1 -1
  25. package/lib/interface/observer.js +1 -1
  26. package/lib/interface/on-failure.js +6 -6
  27. package/lib/interface/pause-hook.js +2 -2
  28. package/lib/interface/run-command-hook/api-run-command-hook.js +1 -1
  29. package/lib/interface/run-document-location.js +2 -2
  30. package/lib/interface/sleep-hook.js +2 -2
  31. package/lib/interface/step-ref.js +1 -1
  32. package/lib/interface/variables/boolean-variable.js +2 -2
  33. package/lib/interface/variables/map-list-variable.js +2 -2
  34. package/lib/interface/variables/number-variable.js +2 -2
  35. package/lib/interface/variables/secure-string-variable.js +4 -4
  36. package/lib/interface/variables/string-list-variable.js +2 -2
  37. package/lib/interface/variables/string-map-variable.js +2 -2
  38. package/lib/interface/variables/string-variable.js +4 -4
  39. package/lib/interface/variables/variable.js +2 -2
  40. package/lib/interface/webhook.js +1 -1
  41. package/lib/parent-steps/automation/approve-step.js +1 -1
  42. package/lib/parent-steps/automation/assert-aws-resource-step.js +1 -1
  43. package/lib/parent-steps/automation/aws-api-step.js +1 -1
  44. package/lib/parent-steps/automation/branch-step.js +1 -1
  45. package/lib/parent-steps/automation/change-instance-state-step.js +3 -3
  46. package/lib/parent-steps/automation/copy-image-step.js +1 -1
  47. package/lib/parent-steps/automation/create-image-step.js +1 -1
  48. package/lib/parent-steps/automation/create-stack-step.js +3 -3
  49. package/lib/parent-steps/automation/create-tags-step.js +3 -3
  50. package/lib/parent-steps/automation/delete-image-step.js +1 -1
  51. package/lib/parent-steps/automation/delete-stack-step.js +1 -1
  52. package/lib/parent-steps/automation/execute-automation-step.js +1 -1
  53. package/lib/parent-steps/automation/execute-script-step.js +5 -5
  54. package/lib/parent-steps/automation/execute-state-machine-step.js +1 -1
  55. package/lib/parent-steps/automation/invoke-lambda-function-step.js +1 -1
  56. package/lib/parent-steps/automation/invoke-webhook-step.js +1 -1
  57. package/lib/parent-steps/automation/pause-step.js +1 -1
  58. package/lib/parent-steps/automation/run-command-step.js +3 -3
  59. package/lib/parent-steps/automation/run-instance-step.js +1 -1
  60. package/lib/parent-steps/automation/sleep-step.js +1 -1
  61. package/lib/parent-steps/automation/update-variable.js +1 -1
  62. package/lib/parent-steps/automation/wait-for-resource-step.js +1 -1
  63. package/lib/parent-steps/automation-step.js +1 -1
  64. package/lib/parent-steps/command/applications-step.js +1 -1
  65. package/lib/parent-steps/command/configure-docker-step.js +1 -1
  66. package/lib/parent-steps/command/configure-package-step.js +1 -1
  67. package/lib/parent-steps/command/domain-join-step.js +1 -1
  68. package/lib/parent-steps/command/download-content-step.js +1 -1
  69. package/lib/parent-steps/command/ps-module-step.js +1 -1
  70. package/lib/parent-steps/command/run-docker-action-step.js +1 -1
  71. package/lib/parent-steps/command/run-document-step.js +1 -1
  72. package/lib/parent-steps/command/run-powershell-script-step.js +1 -1
  73. package/lib/parent-steps/command/run-shell-script-step.js +1 -1
  74. package/lib/parent-steps/command/software-inventory-step.js +1 -1
  75. package/lib/parent-steps/command/update-agent-step.js +1 -1
  76. package/lib/parent-steps/command/update-ssm-agent-step.js +1 -1
  77. package/lib/parent-steps/command-step.js +1 -1
  78. package/lib/parent-steps/step.js +1 -1
  79. package/lib/patterns/automation/composite-step.js +2 -2
  80. package/lib/patterns/automation/reboot-instance-and-wait.js +1 -1
  81. package/lib/patterns/automation/string-step.js +1 -1
  82. package/lib/patterns/document/string-document.js +1 -1
  83. package/lib/patterns/document/timed-document.js +1 -1
  84. package/lib/samples/hello-world.js +1 -1
  85. package/lib/simulation/automation/approve-simulation.js +1 -1
  86. package/lib/simulation/automation/assert-aws-resource-simulation.js +4 -5
  87. package/lib/simulation/automation/automation-simulation-base.js +1 -1
  88. package/lib/simulation/automation/aws-api-simulation.js +1 -1
  89. package/lib/simulation/automation/branch-simulation.js +1 -1
  90. package/lib/simulation/automation/change-instance-state-simulation.js +1 -1
  91. package/lib/simulation/automation/copy-image-simulation.js +1 -1
  92. package/lib/simulation/automation/create-image-simulation.js +1 -1
  93. package/lib/simulation/automation/create-stack-simulation.js +1 -1
  94. package/lib/simulation/automation/create-tags-simulation.js +1 -1
  95. package/lib/simulation/automation/delete-image-simulation.js +1 -1
  96. package/lib/simulation/automation/delete-stack-simulation.js +1 -1
  97. package/lib/simulation/automation/execute-script-simulation.js +1 -1
  98. package/lib/simulation/automation/execute-state-machine-simulation.js +1 -1
  99. package/lib/simulation/automation/invoke-lambda-function-simulation.js +1 -1
  100. package/lib/simulation/automation/invoke-webhook-simulation.js +1 -1
  101. package/lib/simulation/automation/pause-simulation.js +1 -1
  102. package/lib/simulation/automation/run-command-simulation.js +1 -1
  103. package/lib/simulation/automation/run-instance-simulation.js +1 -1
  104. package/lib/simulation/automation/sleep-simulation.js +1 -1
  105. package/lib/simulation/automation/update-variable-simulation.js +1 -1
  106. package/lib/simulation/automation/wait-for-resource-simulation.js +1 -1
  107. package/lib/simulation/automation-step-simulation.js +4 -5
  108. package/lib/simulation/command/command-simulation-base.js +1 -1
  109. package/lib/simulation/command/ps-module-simulation.js +1 -1
  110. package/lib/simulation/command/run-powershell-script-simulation.js +1 -1
  111. package/lib/simulation/command/run-shell-script-simulation.js +1 -1
  112. package/lib/simulation/command-step-simulation.js +1 -1
  113. package/lib/simulation/document/automation-simulation.js +1 -1
  114. package/lib/simulation/document/command-simulation.js +1 -1
  115. package/lib/simulation/simulation.js +1 -1
  116. package/node_modules/@jsep-plugin/assignment/LICENSE +20 -0
  117. package/node_modules/@jsep-plugin/assignment/README.md +37 -0
  118. package/node_modules/@jsep-plugin/assignment/dist/cjs/index.cjs.js +95 -0
  119. package/node_modules/@jsep-plugin/assignment/dist/cjs/index.cjs.js.map +1 -0
  120. package/node_modules/@jsep-plugin/assignment/dist/cjs/index.cjs.min.js +2 -0
  121. package/node_modules/@jsep-plugin/assignment/dist/cjs/index.cjs.min.js.map +1 -0
  122. package/node_modules/@jsep-plugin/assignment/dist/cjs/package.json +3 -0
  123. package/node_modules/@jsep-plugin/assignment/dist/iife/index.iife.js +98 -0
  124. package/node_modules/@jsep-plugin/assignment/dist/iife/index.iife.js.map +1 -0
  125. package/node_modules/@jsep-plugin/assignment/dist/iife/index.iife.min.js +2 -0
  126. package/node_modules/@jsep-plugin/assignment/dist/iife/index.iife.min.js.map +1 -0
  127. package/node_modules/@jsep-plugin/assignment/dist/index.js +92 -0
  128. package/node_modules/@jsep-plugin/assignment/dist/index.min.js +2 -0
  129. package/node_modules/@jsep-plugin/assignment/dist/index.min.js.map +1 -0
  130. package/node_modules/@jsep-plugin/assignment/package.json +39 -0
  131. package/node_modules/@jsep-plugin/assignment/types/tsd.d.ts +39 -0
  132. package/node_modules/@jsep-plugin/regex/LICENSE +20 -0
  133. package/node_modules/@jsep-plugin/regex/README.md +36 -0
  134. package/node_modules/@jsep-plugin/regex/dist/cjs/index.cjs.js +66 -0
  135. package/node_modules/@jsep-plugin/regex/dist/cjs/index.cjs.js.map +1 -0
  136. package/node_modules/@jsep-plugin/regex/dist/cjs/index.cjs.min.js +2 -0
  137. package/node_modules/@jsep-plugin/regex/dist/cjs/index.cjs.min.js.map +1 -0
  138. package/node_modules/@jsep-plugin/regex/dist/cjs/package.json +3 -0
  139. package/node_modules/@jsep-plugin/regex/dist/iife/index.iife.js +69 -0
  140. package/node_modules/@jsep-plugin/regex/dist/iife/index.iife.js.map +1 -0
  141. package/node_modules/@jsep-plugin/regex/dist/iife/index.iife.min.js +2 -0
  142. package/node_modules/@jsep-plugin/regex/dist/iife/index.iife.min.js.map +1 -0
  143. package/node_modules/@jsep-plugin/regex/dist/index.js +63 -0
  144. package/node_modules/@jsep-plugin/regex/dist/index.min.js +2 -0
  145. package/node_modules/@jsep-plugin/regex/dist/index.min.js.map +1 -0
  146. package/node_modules/@jsep-plugin/regex/package.json +39 -0
  147. package/node_modules/@jsep-plugin/regex/types/tsd.d.ts +7 -0
  148. package/node_modules/jsep/LICENSE +20 -0
  149. package/node_modules/jsep/README.md +208 -0
  150. package/node_modules/jsep/dist/cjs/jsep.cjs.js +1129 -0
  151. package/node_modules/jsep/dist/cjs/jsep.cjs.js.map +1 -0
  152. package/node_modules/jsep/dist/cjs/jsep.cjs.min.js +2 -0
  153. package/node_modules/jsep/dist/cjs/jsep.cjs.min.js.map +1 -0
  154. package/node_modules/jsep/dist/cjs/package.json +3 -0
  155. package/node_modules/jsep/dist/iife/jsep.iife.js +1132 -0
  156. package/node_modules/jsep/dist/iife/jsep.iife.js.map +1 -0
  157. package/node_modules/jsep/dist/iife/jsep.iife.min.js +2 -0
  158. package/node_modules/jsep/dist/iife/jsep.iife.min.js.map +1 -0
  159. package/node_modules/jsep/dist/jsep.js +1126 -0
  160. package/node_modules/jsep/dist/jsep.min.js +2 -0
  161. package/node_modules/jsep/dist/jsep.min.js.map +1 -0
  162. package/node_modules/jsep/package.json +153 -0
  163. package/node_modules/jsep/typings/tsd.d.ts +180 -0
  164. package/node_modules/jsonpath-plus/.claude/settings.local.json +9 -0
  165. package/node_modules/jsonpath-plus/CHANGES.md +453 -0
  166. package/node_modules/jsonpath-plus/LICENSE +22 -0
  167. package/node_modules/jsonpath-plus/README.md +412 -0
  168. package/node_modules/jsonpath-plus/SECURITY.md +38 -0
  169. package/node_modules/jsonpath-plus/bin/jsonpath-cli.js +36 -0
  170. package/node_modules/jsonpath-plus/dist/index-browser-esm.js +2164 -0
  171. package/node_modules/jsonpath-plus/dist/index-browser-esm.min.js +2 -0
  172. package/node_modules/jsonpath-plus/dist/index-browser-esm.min.js.map +1 -0
  173. package/node_modules/jsonpath-plus/dist/index-browser-umd.cjs +2172 -0
  174. package/node_modules/jsonpath-plus/dist/index-browser-umd.min.cjs +2 -0
  175. package/node_modules/jsonpath-plus/dist/index-browser-umd.min.cjs.map +1 -0
  176. package/node_modules/jsonpath-plus/dist/index-node-cjs.cjs +2076 -0
  177. package/node_modules/jsonpath-plus/dist/index-node-esm.js +2074 -0
  178. package/node_modules/jsonpath-plus/package.json +141 -0
  179. package/node_modules/jsonpath-plus/pnpm-workspace.yaml +2 -0
  180. package/node_modules/jsonpath-plus/src/Safe-Script.js +208 -0
  181. package/node_modules/jsonpath-plus/src/jsonpath-browser.js +102 -0
  182. package/node_modules/jsonpath-plus/src/jsonpath-node.js +8 -0
  183. package/node_modules/jsonpath-plus/src/jsonpath.d.ts +226 -0
  184. package/node_modules/jsonpath-plus/src/jsonpath.js +784 -0
  185. package/package.json +3 -3
  186. package/node_modules/escodegen/LICENSE.BSD +0 -21
  187. package/node_modules/escodegen/README.md +0 -84
  188. package/node_modules/escodegen/bin/escodegen.js +0 -77
  189. package/node_modules/escodegen/bin/esgenerate.js +0 -64
  190. package/node_modules/escodegen/escodegen.js +0 -2667
  191. package/node_modules/escodegen/package.json +0 -63
  192. package/node_modules/esprima/LICENSE.BSD +0 -21
  193. package/node_modules/esprima/README.md +0 -46
  194. package/node_modules/esprima/bin/esparse.js +0 -139
  195. package/node_modules/esprima/bin/esvalidate.js +0 -236
  196. package/node_modules/esprima/dist/esprima.js +0 -6709
  197. package/node_modules/esprima/package.json +0 -112
  198. package/node_modules/estraverse/.jshintrc +0 -16
  199. package/node_modules/estraverse/LICENSE.BSD +0 -19
  200. package/node_modules/estraverse/README.md +0 -153
  201. package/node_modules/estraverse/estraverse.js +0 -805
  202. package/node_modules/estraverse/gulpfile.js +0 -70
  203. package/node_modules/estraverse/package.json +0 -40
  204. package/node_modules/esutils/LICENSE.BSD +0 -19
  205. package/node_modules/esutils/README.md +0 -174
  206. package/node_modules/esutils/lib/ast.js +0 -144
  207. package/node_modules/esutils/lib/code.js +0 -135
  208. package/node_modules/esutils/lib/keyword.js +0 -165
  209. package/node_modules/esutils/lib/utils.js +0 -33
  210. package/node_modules/esutils/package.json +0 -44
  211. package/node_modules/jsonpath/.jscsrc +0 -60
  212. package/node_modules/jsonpath/.jshintrc +0 -9
  213. package/node_modules/jsonpath/.travis.yml +0 -3
  214. package/node_modules/jsonpath/Dockerfile +0 -1
  215. package/node_modules/jsonpath/Gruntfile.js +0 -83
  216. package/node_modules/jsonpath/LICENSE +0 -7
  217. package/node_modules/jsonpath/README.md +0 -216
  218. package/node_modules/jsonpath/bin/generate_parser.js +0 -8
  219. package/node_modules/jsonpath/fig.yml +0 -5
  220. package/node_modules/jsonpath/generated/parser.js +0 -721
  221. package/node_modules/jsonpath/include/action.js +0 -4
  222. package/node_modules/jsonpath/include/module.js +0 -34
  223. package/node_modules/jsonpath/index.js +0 -1
  224. package/node_modules/jsonpath/jsonpath.js +0 -7093
  225. package/node_modules/jsonpath/jsonpath.min.js +0 -4
  226. package/node_modules/jsonpath/lib/aesprim.js +0 -18
  227. package/node_modules/jsonpath/lib/dict.js +0 -6
  228. package/node_modules/jsonpath/lib/grammar.js +0 -106
  229. package/node_modules/jsonpath/lib/handlers.js +0 -409
  230. package/node_modules/jsonpath/lib/index.js +0 -304
  231. package/node_modules/jsonpath/lib/parser.js +0 -21
  232. package/node_modules/jsonpath/lib/slice.js +0 -41
  233. package/node_modules/jsonpath/node_modules/esprima/LICENSE.BSD +0 -19
  234. package/node_modules/jsonpath/node_modules/esprima/README.md +0 -24
  235. package/node_modules/jsonpath/node_modules/esprima/bin/esparse.js +0 -127
  236. package/node_modules/jsonpath/node_modules/esprima/bin/esvalidate.js +0 -199
  237. package/node_modules/jsonpath/node_modules/esprima/esprima.js +0 -3772
  238. package/node_modules/jsonpath/node_modules/esprima/package.json +0 -83
  239. package/node_modules/jsonpath/node_modules/esprima/test/compat.js +0 -241
  240. package/node_modules/jsonpath/node_modules/esprima/test/reflect.js +0 -422
  241. package/node_modules/jsonpath/node_modules/esprima/test/run.js +0 -67
  242. package/node_modules/jsonpath/node_modules/esprima/test/runner.js +0 -495
  243. package/node_modules/jsonpath/node_modules/esprima/test/test.js +0 -25593
  244. package/node_modules/jsonpath/package.json +0 -45
  245. package/node_modules/jsonpath/test/data/store.json +0 -31
  246. package/node_modules/jsonpath/test/lessons.js +0 -38
  247. package/node_modules/jsonpath/test/parse.js +0 -164
  248. package/node_modules/jsonpath/test/query.js +0 -359
  249. package/node_modules/jsonpath/test/security.js +0 -238
  250. package/node_modules/jsonpath/test/slice.js +0 -57
  251. package/node_modules/jsonpath/test/stringify.js +0 -54
  252. package/node_modules/jsonpath/test/sugar.js +0 -72
  253. package/node_modules/source-map/LICENSE +0 -28
  254. package/node_modules/source-map/README.md +0 -742
  255. package/node_modules/source-map/dist/source-map.debug.js +0 -3234
  256. package/node_modules/source-map/dist/source-map.js +0 -3233
  257. package/node_modules/source-map/dist/source-map.min.js +0 -2
  258. package/node_modules/source-map/dist/source-map.min.js.map +0 -1
  259. package/node_modules/source-map/lib/array-set.js +0 -121
  260. package/node_modules/source-map/lib/base64-vlq.js +0 -140
  261. package/node_modules/source-map/lib/base64.js +0 -67
  262. package/node_modules/source-map/lib/binary-search.js +0 -111
  263. package/node_modules/source-map/lib/mapping-list.js +0 -79
  264. package/node_modules/source-map/lib/quick-sort.js +0 -114
  265. package/node_modules/source-map/lib/source-map-consumer.js +0 -1145
  266. package/node_modules/source-map/lib/source-map-generator.js +0 -425
  267. package/node_modules/source-map/lib/source-node.js +0 -413
  268. package/node_modules/source-map/lib/util.js +0 -488
  269. package/node_modules/source-map/package.json +0 -73
  270. package/node_modules/source-map/source-map.d.ts +0 -98
  271. package/node_modules/source-map/source-map.js +0 -8
  272. package/node_modules/static-eval/.travis.yml +0 -18
  273. package/node_modules/static-eval/CHANGELOG.md +0 -21
  274. package/node_modules/static-eval/LICENSE +0 -20
  275. package/node_modules/static-eval/example/eval.js +0 -7
  276. package/node_modules/static-eval/example/vars.js +0 -11
  277. package/node_modules/static-eval/index.js +0 -209
  278. package/node_modules/static-eval/package.json +0 -54
  279. package/node_modules/static-eval/readme.markdown +0 -87
  280. package/node_modules/static-eval/security.md +0 -15
  281. package/node_modules/static-eval/test/eval.js +0 -177
  282. package/node_modules/static-eval/test/prop.js +0 -16
  283. package/node_modules/static-eval/test/template-strings.js +0 -33
  284. package/node_modules/underscore/LICENSE +0 -22
  285. package/node_modules/underscore/README.md +0 -34
  286. package/node_modules/underscore/amd/_baseCreate.js +0 -21
  287. package/node_modules/underscore/amd/_baseIteratee.js +0 -15
  288. package/node_modules/underscore/amd/_cb.js +0 -12
  289. package/node_modules/underscore/amd/_chainResult.js +0 -10
  290. package/node_modules/underscore/amd/_collectNonEnumProps.js +0 -42
  291. package/node_modules/underscore/amd/_createAssigner.js +0 -24
  292. package/node_modules/underscore/amd/_createEscaper.js +0 -21
  293. package/node_modules/underscore/amd/_createIndexFinder.js +0 -30
  294. package/node_modules/underscore/amd/_createPredicateIndexFinder.js +0 -18
  295. package/node_modules/underscore/amd/_createReduce.js +0 -30
  296. package/node_modules/underscore/amd/_createSizePropertyCheck.js +0 -13
  297. package/node_modules/underscore/amd/_deepGet.js +0 -15
  298. package/node_modules/underscore/amd/_escapeMap.js +0 -15
  299. package/node_modules/underscore/amd/_executeBound.js +0 -16
  300. package/node_modules/underscore/amd/_flatten.js +0 -32
  301. package/node_modules/underscore/amd/_getByteLength.js +0 -8
  302. package/node_modules/underscore/amd/_getLength.js +0 -8
  303. package/node_modules/underscore/amd/_group.js +0 -18
  304. package/node_modules/underscore/amd/_has.js +0 -10
  305. package/node_modules/underscore/amd/_hasObjectTag.js +0 -7
  306. package/node_modules/underscore/amd/_isArrayLike.js +0 -11
  307. package/node_modules/underscore/amd/_isBufferLike.js +0 -9
  308. package/node_modules/underscore/amd/_keyInObj.js +0 -11
  309. package/node_modules/underscore/amd/_methodFingerprint.js +0 -44
  310. package/node_modules/underscore/amd/_optimizeCb.js +0 -27
  311. package/node_modules/underscore/amd/_set.js +0 -21
  312. package/node_modules/underscore/amd/_setup.js +0 -70
  313. package/node_modules/underscore/amd/_shallowProperty.js +0 -12
  314. package/node_modules/underscore/amd/_stringTagBug.js +0 -16
  315. package/node_modules/underscore/amd/_tagTester.js +0 -13
  316. package/node_modules/underscore/amd/_toBufferView.js +0 -15
  317. package/node_modules/underscore/amd/_toPath.js +0 -11
  318. package/node_modules/underscore/amd/_unescapeMap.js +0 -8
  319. package/node_modules/underscore/amd/after.js +0 -14
  320. package/node_modules/underscore/amd/allKeys.js +0 -15
  321. package/node_modules/underscore/amd/before.js +0 -18
  322. package/node_modules/underscore/amd/bind.js +0 -15
  323. package/node_modules/underscore/amd/bindAll.js +0 -19
  324. package/node_modules/underscore/amd/chain.js +0 -12
  325. package/node_modules/underscore/amd/chunk.js +0 -17
  326. package/node_modules/underscore/amd/clone.js +0 -11
  327. package/node_modules/underscore/amd/compact.js +0 -10
  328. package/node_modules/underscore/amd/compose.js +0 -18
  329. package/node_modules/underscore/amd/constant.js +0 -12
  330. package/node_modules/underscore/amd/contains.js +0 -12
  331. package/node_modules/underscore/amd/countBy.js +0 -12
  332. package/node_modules/underscore/amd/create.js +0 -14
  333. package/node_modules/underscore/amd/debounce.js +0 -43
  334. package/node_modules/underscore/amd/defaults.js +0 -8
  335. package/node_modules/underscore/amd/defer.js +0 -9
  336. package/node_modules/underscore/amd/delay.js +0 -13
  337. package/node_modules/underscore/amd/difference.js +0 -14
  338. package/node_modules/underscore/amd/each.js +0 -25
  339. package/node_modules/underscore/amd/escape.js +0 -8
  340. package/node_modules/underscore/amd/every.js +0 -17
  341. package/node_modules/underscore/amd/extend.js +0 -8
  342. package/node_modules/underscore/amd/extendOwn.js +0 -10
  343. package/node_modules/underscore/amd/filter.js +0 -15
  344. package/node_modules/underscore/amd/find.js +0 -12
  345. package/node_modules/underscore/amd/findIndex.js +0 -8
  346. package/node_modules/underscore/amd/findKey.js +0 -15
  347. package/node_modules/underscore/amd/findLastIndex.js +0 -8
  348. package/node_modules/underscore/amd/findWhere.js +0 -11
  349. package/node_modules/underscore/amd/first.js +0 -13
  350. package/node_modules/underscore/amd/flatten.js +0 -11
  351. package/node_modules/underscore/amd/functions.js +0 -14
  352. package/node_modules/underscore/amd/get.js +0 -14
  353. package/node_modules/underscore/amd/groupBy.js +0 -11
  354. package/node_modules/underscore/amd/has.js +0 -19
  355. package/node_modules/underscore/amd/identity.js +0 -10
  356. package/node_modules/underscore/amd/index-default.js +0 -12
  357. package/node_modules/underscore/amd/index.js +0 -154
  358. package/node_modules/underscore/amd/indexBy.js +0 -11
  359. package/node_modules/underscore/amd/indexOf.js +0 -11
  360. package/node_modules/underscore/amd/initial.js +0 -12
  361. package/node_modules/underscore/amd/intersection.js +0 -22
  362. package/node_modules/underscore/amd/invert.js +0 -15
  363. package/node_modules/underscore/amd/invoke.js +0 -28
  364. package/node_modules/underscore/amd/isArguments.js +0 -19
  365. package/node_modules/underscore/amd/isArray.js +0 -9
  366. package/node_modules/underscore/amd/isArrayBuffer.js +0 -7
  367. package/node_modules/underscore/amd/isBoolean.js +0 -10
  368. package/node_modules/underscore/amd/isDataView.js +0 -15
  369. package/node_modules/underscore/amd/isDate.js +0 -7
  370. package/node_modules/underscore/amd/isElement.js +0 -10
  371. package/node_modules/underscore/amd/isEmpty.js +0 -18
  372. package/node_modules/underscore/amd/isEqual.js +0 -133
  373. package/node_modules/underscore/amd/isError.js +0 -7
  374. package/node_modules/underscore/amd/isFinite.js +0 -10
  375. package/node_modules/underscore/amd/isFunction.js +0 -18
  376. package/node_modules/underscore/amd/isMap.js +0 -7
  377. package/node_modules/underscore/amd/isMatch.js +0 -17
  378. package/node_modules/underscore/amd/isNaN.js +0 -10
  379. package/node_modules/underscore/amd/isNull.js +0 -10
  380. package/node_modules/underscore/amd/isNumber.js +0 -7
  381. package/node_modules/underscore/amd/isObject.js +0 -11
  382. package/node_modules/underscore/amd/isRegExp.js +0 -7
  383. package/node_modules/underscore/amd/isSet.js +0 -7
  384. package/node_modules/underscore/amd/isString.js +0 -7
  385. package/node_modules/underscore/amd/isSymbol.js +0 -7
  386. package/node_modules/underscore/amd/isTypedArray.js +0 -16
  387. package/node_modules/underscore/amd/isUndefined.js +0 -10
  388. package/node_modules/underscore/amd/isWeakMap.js +0 -7
  389. package/node_modules/underscore/amd/isWeakSet.js +0 -7
  390. package/node_modules/underscore/amd/iteratee.js +0 -13
  391. package/node_modules/underscore/amd/keys.js +0 -17
  392. package/node_modules/underscore/amd/last.js +0 -13
  393. package/node_modules/underscore/amd/lastIndexOf.js +0 -9
  394. package/node_modules/underscore/amd/map.js +0 -18
  395. package/node_modules/underscore/amd/mapObject.js +0 -19
  396. package/node_modules/underscore/amd/matcher.js +0 -14
  397. package/node_modules/underscore/amd/max.js +0 -30
  398. package/node_modules/underscore/amd/memoize.js +0 -17
  399. package/node_modules/underscore/amd/min.js +0 -30
  400. package/node_modules/underscore/amd/mixin.js +0 -18
  401. package/node_modules/underscore/amd/negate.js +0 -12
  402. package/node_modules/underscore/amd/noop.js +0 -8
  403. package/node_modules/underscore/amd/now.js +0 -10
  404. package/node_modules/underscore/amd/object.js +0 -20
  405. package/node_modules/underscore/amd/omit.js +0 -20
  406. package/node_modules/underscore/amd/once.js +0 -9
  407. package/node_modules/underscore/amd/pairs.js +0 -17
  408. package/node_modules/underscore/amd/partial.js +0 -25
  409. package/node_modules/underscore/amd/partition.js +0 -11
  410. package/node_modules/underscore/amd/pick.js +0 -25
  411. package/node_modules/underscore/amd/pluck.js +0 -10
  412. package/node_modules/underscore/amd/property.js +0 -14
  413. package/node_modules/underscore/amd/propertyOf.js +0 -13
  414. package/node_modules/underscore/amd/random.js +0 -14
  415. package/node_modules/underscore/amd/range.js +0 -27
  416. package/node_modules/underscore/amd/reduce.js +0 -9
  417. package/node_modules/underscore/amd/reduceRight.js +0 -8
  418. package/node_modules/underscore/amd/reject.js +0 -10
  419. package/node_modules/underscore/amd/rest.js +0 -12
  420. package/node_modules/underscore/amd/restArguments.js +0 -33
  421. package/node_modules/underscore/amd/result.js +0 -25
  422. package/node_modules/underscore/amd/sample.js +0 -27
  423. package/node_modules/underscore/amd/set.js +0 -15
  424. package/node_modules/underscore/amd/shuffle.js +0 -10
  425. package/node_modules/underscore/amd/size.js +0 -11
  426. package/node_modules/underscore/amd/some.js +0 -17
  427. package/node_modules/underscore/amd/sortBy.js +0 -26
  428. package/node_modules/underscore/amd/sortedIndex.js +0 -18
  429. package/node_modules/underscore/amd/tap.js +0 -13
  430. package/node_modules/underscore/amd/template.js +0 -103
  431. package/node_modules/underscore/amd/templateSettings.js +0 -13
  432. package/node_modules/underscore/amd/throttle.js +0 -51
  433. package/node_modules/underscore/amd/times.js +0 -13
  434. package/node_modules/underscore/amd/toArray.js +0 -18
  435. package/node_modules/underscore/amd/toPath.js +0 -12
  436. package/node_modules/underscore/amd/underscore-array-methods.js +0 -30
  437. package/node_modules/underscore/amd/underscore.js +0 -29
  438. package/node_modules/underscore/amd/unescape.js +0 -8
  439. package/node_modules/underscore/amd/union.js +0 -11
  440. package/node_modules/underscore/amd/uniq.js +0 -37
  441. package/node_modules/underscore/amd/uniqueId.js +0 -13
  442. package/node_modules/underscore/amd/unzip.js +0 -17
  443. package/node_modules/underscore/amd/values.js +0 -16
  444. package/node_modules/underscore/amd/where.js +0 -11
  445. package/node_modules/underscore/amd/without.js +0 -10
  446. package/node_modules/underscore/amd/wrap.js +0 -12
  447. package/node_modules/underscore/amd/zip.js +0 -9
  448. package/node_modules/underscore/cjs/_baseCreate.js +0 -20
  449. package/node_modules/underscore/cjs/_baseIteratee.js +0 -19
  450. package/node_modules/underscore/cjs/_cb.js +0 -12
  451. package/node_modules/underscore/cjs/_chainResult.js +0 -8
  452. package/node_modules/underscore/cjs/_collectNonEnumProps.js +0 -42
  453. package/node_modules/underscore/cjs/_createAssigner.js +0 -20
  454. package/node_modules/underscore/cjs/_createEscaper.js +0 -19
  455. package/node_modules/underscore/cjs/_createIndexFinder.js +0 -30
  456. package/node_modules/underscore/cjs/_createPredicateIndexFinder.js +0 -17
  457. package/node_modules/underscore/cjs/_createReduce.js +0 -30
  458. package/node_modules/underscore/cjs/_createSizePropertyCheck.js +0 -11
  459. package/node_modules/underscore/cjs/_deepGet.js +0 -11
  460. package/node_modules/underscore/cjs/_escapeMap.js +0 -11
  461. package/node_modules/underscore/cjs/_executeBound.js +0 -15
  462. package/node_modules/underscore/cjs/_flatten.js +0 -33
  463. package/node_modules/underscore/cjs/_getByteLength.js +0 -6
  464. package/node_modules/underscore/cjs/_getLength.js +0 -6
  465. package/node_modules/underscore/cjs/_group.js +0 -17
  466. package/node_modules/underscore/cjs/_has.js +0 -8
  467. package/node_modules/underscore/cjs/_hasObjectTag.js +0 -5
  468. package/node_modules/underscore/cjs/_isArrayLike.js +0 -10
  469. package/node_modules/underscore/cjs/_isBufferLike.js +0 -8
  470. package/node_modules/underscore/cjs/_keyInObj.js +0 -7
  471. package/node_modules/underscore/cjs/_methodFingerprint.js +0 -44
  472. package/node_modules/underscore/cjs/_optimizeCb.js +0 -23
  473. package/node_modules/underscore/cjs/_set.js +0 -21
  474. package/node_modules/underscore/cjs/_setup.js +0 -66
  475. package/node_modules/underscore/cjs/_shallowProperty.js +0 -8
  476. package/node_modules/underscore/cjs/_stringTagBug.js +0 -15
  477. package/node_modules/underscore/cjs/_tagTester.js +0 -11
  478. package/node_modules/underscore/cjs/_toBufferView.js +0 -13
  479. package/node_modules/underscore/cjs/_toPath.js +0 -10
  480. package/node_modules/underscore/cjs/_unescapeMap.js +0 -7
  481. package/node_modules/underscore/cjs/after.js +0 -10
  482. package/node_modules/underscore/cjs/allKeys.js +0 -15
  483. package/node_modules/underscore/cjs/before.js +0 -14
  484. package/node_modules/underscore/cjs/bind.js +0 -15
  485. package/node_modules/underscore/cjs/bindAll.js +0 -19
  486. package/node_modules/underscore/cjs/chain.js +0 -10
  487. package/node_modules/underscore/cjs/chunk.js +0 -15
  488. package/node_modules/underscore/cjs/clone.js +0 -11
  489. package/node_modules/underscore/cjs/compact.js +0 -8
  490. package/node_modules/underscore/cjs/compose.js +0 -14
  491. package/node_modules/underscore/cjs/constant.js +0 -8
  492. package/node_modules/underscore/cjs/contains.js +0 -12
  493. package/node_modules/underscore/cjs/countBy.js +0 -11
  494. package/node_modules/underscore/cjs/create.js +0 -13
  495. package/node_modules/underscore/cjs/debounce.js +0 -42
  496. package/node_modules/underscore/cjs/defaults.js +0 -7
  497. package/node_modules/underscore/cjs/defer.js +0 -9
  498. package/node_modules/underscore/cjs/delay.js +0 -11
  499. package/node_modules/underscore/cjs/difference.js +0 -15
  500. package/node_modules/underscore/cjs/each.js +0 -25
  501. package/node_modules/underscore/cjs/escape.js +0 -7
  502. package/node_modules/underscore/cjs/every.js +0 -17
  503. package/node_modules/underscore/cjs/extend.js +0 -7
  504. package/node_modules/underscore/cjs/extendOwn.js +0 -9
  505. package/node_modules/underscore/cjs/filter.js +0 -14
  506. package/node_modules/underscore/cjs/find.js +0 -12
  507. package/node_modules/underscore/cjs/findIndex.js +0 -6
  508. package/node_modules/underscore/cjs/findKey.js +0 -14
  509. package/node_modules/underscore/cjs/findLastIndex.js +0 -6
  510. package/node_modules/underscore/cjs/findWhere.js +0 -10
  511. package/node_modules/underscore/cjs/first.js +0 -11
  512. package/node_modules/underscore/cjs/flatten.js +0 -9
  513. package/node_modules/underscore/cjs/functions.js +0 -12
  514. package/node_modules/underscore/cjs/get.js +0 -14
  515. package/node_modules/underscore/cjs/groupBy.js +0 -10
  516. package/node_modules/underscore/cjs/has.js +0 -18
  517. package/node_modules/underscore/cjs/identity.js +0 -6
  518. package/node_modules/underscore/cjs/index-default.js +0 -11
  519. package/node_modules/underscore/cjs/index.js +0 -278
  520. package/node_modules/underscore/cjs/indexBy.js +0 -9
  521. package/node_modules/underscore/cjs/indexOf.js +0 -11
  522. package/node_modules/underscore/cjs/initial.js +0 -10
  523. package/node_modules/underscore/cjs/intersection.js +0 -21
  524. package/node_modules/underscore/cjs/invert.js +0 -13
  525. package/node_modules/underscore/cjs/invoke.js +0 -30
  526. package/node_modules/underscore/cjs/isArguments.js +0 -18
  527. package/node_modules/underscore/cjs/isArray.js +0 -8
  528. package/node_modules/underscore/cjs/isArrayBuffer.js +0 -5
  529. package/node_modules/underscore/cjs/isBoolean.js +0 -8
  530. package/node_modules/underscore/cjs/isDataView.js +0 -16
  531. package/node_modules/underscore/cjs/isDate.js +0 -5
  532. package/node_modules/underscore/cjs/isElement.js +0 -6
  533. package/node_modules/underscore/cjs/isEmpty.js +0 -20
  534. package/node_modules/underscore/cjs/isEqual.js +0 -140
  535. package/node_modules/underscore/cjs/isError.js +0 -5
  536. package/node_modules/underscore/cjs/isFinite.js +0 -9
  537. package/node_modules/underscore/cjs/isFunction.js +0 -17
  538. package/node_modules/underscore/cjs/isMap.js +0 -7
  539. package/node_modules/underscore/cjs/isMatch.js +0 -15
  540. package/node_modules/underscore/cjs/isNaN.js +0 -9
  541. package/node_modules/underscore/cjs/isNull.js +0 -6
  542. package/node_modules/underscore/cjs/isNumber.js +0 -5
  543. package/node_modules/underscore/cjs/isObject.js +0 -7
  544. package/node_modules/underscore/cjs/isRegExp.js +0 -5
  545. package/node_modules/underscore/cjs/isSet.js +0 -7
  546. package/node_modules/underscore/cjs/isString.js +0 -5
  547. package/node_modules/underscore/cjs/isSymbol.js +0 -5
  548. package/node_modules/underscore/cjs/isTypedArray.js +0 -17
  549. package/node_modules/underscore/cjs/isUndefined.js +0 -6
  550. package/node_modules/underscore/cjs/isWeakMap.js +0 -7
  551. package/node_modules/underscore/cjs/isWeakSet.js +0 -5
  552. package/node_modules/underscore/cjs/iteratee.js +0 -12
  553. package/node_modules/underscore/cjs/keys.js +0 -18
  554. package/node_modules/underscore/cjs/last.js +0 -11
  555. package/node_modules/underscore/cjs/lastIndexOf.js +0 -8
  556. package/node_modules/underscore/cjs/map.js +0 -18
  557. package/node_modules/underscore/cjs/mapObject.js +0 -18
  558. package/node_modules/underscore/cjs/matcher.js +0 -13
  559. package/node_modules/underscore/cjs/max.js +0 -31
  560. package/node_modules/underscore/cjs/memoize.js +0 -15
  561. package/node_modules/underscore/cjs/min.js +0 -31
  562. package/node_modules/underscore/cjs/mixin.js +0 -20
  563. package/node_modules/underscore/cjs/negate.js +0 -8
  564. package/node_modules/underscore/cjs/noop.js +0 -4
  565. package/node_modules/underscore/cjs/now.js +0 -6
  566. package/node_modules/underscore/cjs/object.js +0 -18
  567. package/node_modules/underscore/cjs/omit.js +0 -24
  568. package/node_modules/underscore/cjs/once.js +0 -8
  569. package/node_modules/underscore/cjs/pairs.js +0 -15
  570. package/node_modules/underscore/cjs/partial.js +0 -25
  571. package/node_modules/underscore/cjs/partition.js +0 -9
  572. package/node_modules/underscore/cjs/pick.js +0 -28
  573. package/node_modules/underscore/cjs/pluck.js +0 -9
  574. package/node_modules/underscore/cjs/property.js +0 -13
  575. package/node_modules/underscore/cjs/propertyOf.js +0 -12
  576. package/node_modules/underscore/cjs/random.js +0 -10
  577. package/node_modules/underscore/cjs/range.js +0 -23
  578. package/node_modules/underscore/cjs/reduce.js +0 -7
  579. package/node_modules/underscore/cjs/reduceRight.js +0 -6
  580. package/node_modules/underscore/cjs/reject.js +0 -10
  581. package/node_modules/underscore/cjs/rest.js +0 -10
  582. package/node_modules/underscore/cjs/restArguments.js +0 -29
  583. package/node_modules/underscore/cjs/result.js +0 -24
  584. package/node_modules/underscore/cjs/sample.js +0 -29
  585. package/node_modules/underscore/cjs/set.js +0 -15
  586. package/node_modules/underscore/cjs/shuffle.js +0 -8
  587. package/node_modules/underscore/cjs/size.js +0 -10
  588. package/node_modules/underscore/cjs/some.js +0 -17
  589. package/node_modules/underscore/cjs/sortBy.js +0 -26
  590. package/node_modules/underscore/cjs/sortedIndex.js +0 -17
  591. package/node_modules/underscore/cjs/tap.js +0 -9
  592. package/node_modules/underscore/cjs/template.js +0 -103
  593. package/node_modules/underscore/cjs/templateSettings.js +0 -11
  594. package/node_modules/underscore/cjs/throttle.js +0 -49
  595. package/node_modules/underscore/cjs/times.js +0 -11
  596. package/node_modules/underscore/cjs/toArray.js +0 -22
  597. package/node_modules/underscore/cjs/toPath.js +0 -11
  598. package/node_modules/underscore/cjs/underscore-array-methods.js +0 -31
  599. package/node_modules/underscore/cjs/underscore.js +0 -27
  600. package/node_modules/underscore/cjs/unescape.js +0 -7
  601. package/node_modules/underscore/cjs/union.js +0 -11
  602. package/node_modules/underscore/cjs/uniq.js +0 -38
  603. package/node_modules/underscore/cjs/uniqueId.js +0 -9
  604. package/node_modules/underscore/cjs/unzip.js +0 -17
  605. package/node_modules/underscore/cjs/values.js +0 -14
  606. package/node_modules/underscore/cjs/where.js +0 -10
  607. package/node_modules/underscore/cjs/without.js +0 -9
  608. package/node_modules/underscore/cjs/wrap.js +0 -10
  609. package/node_modules/underscore/cjs/zip.js +0 -8
  610. package/node_modules/underscore/modules/.eslintrc +0 -21
  611. package/node_modules/underscore/modules/_baseCreate.js +0 -18
  612. package/node_modules/underscore/modules/_baseIteratee.js +0 -17
  613. package/node_modules/underscore/modules/_cb.js +0 -10
  614. package/node_modules/underscore/modules/_chainResult.js +0 -6
  615. package/node_modules/underscore/modules/_collectNonEnumProps.js +0 -40
  616. package/node_modules/underscore/modules/_createAssigner.js +0 -18
  617. package/node_modules/underscore/modules/_createEscaper.js +0 -17
  618. package/node_modules/underscore/modules/_createIndexFinder.js +0 -28
  619. package/node_modules/underscore/modules/_createPredicateIndexFinder.js +0 -15
  620. package/node_modules/underscore/modules/_createReduce.js +0 -28
  621. package/node_modules/underscore/modules/_createSizePropertyCheck.js +0 -9
  622. package/node_modules/underscore/modules/_deepGet.js +0 -9
  623. package/node_modules/underscore/modules/_escapeMap.js +0 -9
  624. package/node_modules/underscore/modules/_executeBound.js +0 -13
  625. package/node_modules/underscore/modules/_flatten.js +0 -31
  626. package/node_modules/underscore/modules/_getByteLength.js +0 -4
  627. package/node_modules/underscore/modules/_getLength.js +0 -4
  628. package/node_modules/underscore/modules/_group.js +0 -15
  629. package/node_modules/underscore/modules/_has.js +0 -6
  630. package/node_modules/underscore/modules/_hasObjectTag.js +0 -3
  631. package/node_modules/underscore/modules/_isArrayLike.js +0 -8
  632. package/node_modules/underscore/modules/_isBufferLike.js +0 -6
  633. package/node_modules/underscore/modules/_keyInObj.js +0 -5
  634. package/node_modules/underscore/modules/_methodFingerprint.js +0 -37
  635. package/node_modules/underscore/modules/_optimizeCb.js +0 -21
  636. package/node_modules/underscore/modules/_setup.js +0 -43
  637. package/node_modules/underscore/modules/_shallowProperty.js +0 -6
  638. package/node_modules/underscore/modules/_stringTagBug.js +0 -10
  639. package/node_modules/underscore/modules/_tagTester.js +0 -9
  640. package/node_modules/underscore/modules/_toBufferView.js +0 -11
  641. package/node_modules/underscore/modules/_toPath.js +0 -8
  642. package/node_modules/underscore/modules/_unescapeMap.js +0 -5
  643. package/node_modules/underscore/modules/after.js +0 -8
  644. package/node_modules/underscore/modules/allKeys.js +0 -13
  645. package/node_modules/underscore/modules/before.js +0 -12
  646. package/node_modules/underscore/modules/bind.js +0 -13
  647. package/node_modules/underscore/modules/bindAll.js +0 -17
  648. package/node_modules/underscore/modules/chain.js +0 -8
  649. package/node_modules/underscore/modules/chunk.js +0 -13
  650. package/node_modules/underscore/modules/clone.js +0 -9
  651. package/node_modules/underscore/modules/compact.js +0 -6
  652. package/node_modules/underscore/modules/compose.js +0 -12
  653. package/node_modules/underscore/modules/constant.js +0 -6
  654. package/node_modules/underscore/modules/contains.js +0 -10
  655. package/node_modules/underscore/modules/countBy.js +0 -9
  656. package/node_modules/underscore/modules/create.js +0 -11
  657. package/node_modules/underscore/modules/debounce.js +0 -40
  658. package/node_modules/underscore/modules/defaults.js +0 -5
  659. package/node_modules/underscore/modules/defer.js +0 -7
  660. package/node_modules/underscore/modules/delay.js +0 -9
  661. package/node_modules/underscore/modules/difference.js +0 -13
  662. package/node_modules/underscore/modules/each.js +0 -23
  663. package/node_modules/underscore/modules/escape.js +0 -5
  664. package/node_modules/underscore/modules/every.js +0 -15
  665. package/node_modules/underscore/modules/extend.js +0 -5
  666. package/node_modules/underscore/modules/extendOwn.js +0 -7
  667. package/node_modules/underscore/modules/filter.js +0 -12
  668. package/node_modules/underscore/modules/find.js +0 -10
  669. package/node_modules/underscore/modules/findIndex.js +0 -4
  670. package/node_modules/underscore/modules/findKey.js +0 -12
  671. package/node_modules/underscore/modules/findLastIndex.js +0 -4
  672. package/node_modules/underscore/modules/findWhere.js +0 -8
  673. package/node_modules/underscore/modules/first.js +0 -9
  674. package/node_modules/underscore/modules/flatten.js +0 -7
  675. package/node_modules/underscore/modules/functions.js +0 -10
  676. package/node_modules/underscore/modules/get.js +0 -12
  677. package/node_modules/underscore/modules/groupBy.js +0 -8
  678. package/node_modules/underscore/modules/has.js +0 -16
  679. package/node_modules/underscore/modules/identity.js +0 -4
  680. package/node_modules/underscore/modules/index-all.js +0 -18
  681. package/node_modules/underscore/modules/index-default.js +0 -27
  682. package/node_modules/underscore/modules/index.js +0 -200
  683. package/node_modules/underscore/modules/indexBy.js +0 -7
  684. package/node_modules/underscore/modules/indexOf.js +0 -9
  685. package/node_modules/underscore/modules/initial.js +0 -8
  686. package/node_modules/underscore/modules/intersection.js +0 -19
  687. package/node_modules/underscore/modules/invert.js +0 -11
  688. package/node_modules/underscore/modules/invoke.js +0 -28
  689. package/node_modules/underscore/modules/isArguments.js +0 -16
  690. package/node_modules/underscore/modules/isArray.js +0 -6
  691. package/node_modules/underscore/modules/isArrayBuffer.js +0 -3
  692. package/node_modules/underscore/modules/isBoolean.js +0 -6
  693. package/node_modules/underscore/modules/isDataView.js +0 -14
  694. package/node_modules/underscore/modules/isDate.js +0 -3
  695. package/node_modules/underscore/modules/isElement.js +0 -4
  696. package/node_modules/underscore/modules/isEmpty.js +0 -18
  697. package/node_modules/underscore/modules/isEqual.js +0 -138
  698. package/node_modules/underscore/modules/isError.js +0 -3
  699. package/node_modules/underscore/modules/isFinite.js +0 -7
  700. package/node_modules/underscore/modules/isFunction.js +0 -15
  701. package/node_modules/underscore/modules/isMap.js +0 -5
  702. package/node_modules/underscore/modules/isMatch.js +0 -13
  703. package/node_modules/underscore/modules/isNaN.js +0 -7
  704. package/node_modules/underscore/modules/isNull.js +0 -4
  705. package/node_modules/underscore/modules/isNumber.js +0 -3
  706. package/node_modules/underscore/modules/isObject.js +0 -5
  707. package/node_modules/underscore/modules/isRegExp.js +0 -3
  708. package/node_modules/underscore/modules/isSet.js +0 -5
  709. package/node_modules/underscore/modules/isString.js +0 -3
  710. package/node_modules/underscore/modules/isSymbol.js +0 -3
  711. package/node_modules/underscore/modules/isTypedArray.js +0 -15
  712. package/node_modules/underscore/modules/isUndefined.js +0 -4
  713. package/node_modules/underscore/modules/isWeakMap.js +0 -5
  714. package/node_modules/underscore/modules/isWeakSet.js +0 -3
  715. package/node_modules/underscore/modules/iteratee.js +0 -10
  716. package/node_modules/underscore/modules/keys.js +0 -16
  717. package/node_modules/underscore/modules/last.js +0 -9
  718. package/node_modules/underscore/modules/lastIndexOf.js +0 -6
  719. package/node_modules/underscore/modules/map.js +0 -16
  720. package/node_modules/underscore/modules/mapObject.js +0 -16
  721. package/node_modules/underscore/modules/matcher.js +0 -11
  722. package/node_modules/underscore/modules/max.js +0 -29
  723. package/node_modules/underscore/modules/memoize.js +0 -13
  724. package/node_modules/underscore/modules/min.js +0 -29
  725. package/node_modules/underscore/modules/mixin.js +0 -18
  726. package/node_modules/underscore/modules/negate.js +0 -6
  727. package/node_modules/underscore/modules/noop.js +0 -2
  728. package/node_modules/underscore/modules/now.js +0 -4
  729. package/node_modules/underscore/modules/object.js +0 -16
  730. package/node_modules/underscore/modules/omit.js +0 -22
  731. package/node_modules/underscore/modules/once.js +0 -6
  732. package/node_modules/underscore/modules/package.json +0 -1
  733. package/node_modules/underscore/modules/pairs.js +0 -13
  734. package/node_modules/underscore/modules/partial.js +0 -24
  735. package/node_modules/underscore/modules/partition.js +0 -7
  736. package/node_modules/underscore/modules/pick.js +0 -26
  737. package/node_modules/underscore/modules/pluck.js +0 -7
  738. package/node_modules/underscore/modules/property.js +0 -11
  739. package/node_modules/underscore/modules/propertyOf.js +0 -10
  740. package/node_modules/underscore/modules/random.js +0 -8
  741. package/node_modules/underscore/modules/range.js +0 -21
  742. package/node_modules/underscore/modules/reduce.js +0 -5
  743. package/node_modules/underscore/modules/reduceRight.js +0 -4
  744. package/node_modules/underscore/modules/reject.js +0 -8
  745. package/node_modules/underscore/modules/rest.js +0 -8
  746. package/node_modules/underscore/modules/restArguments.js +0 -27
  747. package/node_modules/underscore/modules/result.js +0 -22
  748. package/node_modules/underscore/modules/sample.js +0 -27
  749. package/node_modules/underscore/modules/shuffle.js +0 -6
  750. package/node_modules/underscore/modules/size.js +0 -8
  751. package/node_modules/underscore/modules/some.js +0 -15
  752. package/node_modules/underscore/modules/sortBy.js +0 -24
  753. package/node_modules/underscore/modules/sortedIndex.js +0 -15
  754. package/node_modules/underscore/modules/tap.js +0 -7
  755. package/node_modules/underscore/modules/template.js +0 -101
  756. package/node_modules/underscore/modules/templateSettings.js +0 -9
  757. package/node_modules/underscore/modules/throttle.js +0 -47
  758. package/node_modules/underscore/modules/times.js +0 -9
  759. package/node_modules/underscore/modules/toArray.js +0 -20
  760. package/node_modules/underscore/modules/toPath.js +0 -9
  761. package/node_modules/underscore/modules/underscore-array-methods.js +0 -31
  762. package/node_modules/underscore/modules/underscore.js +0 -25
  763. package/node_modules/underscore/modules/unescape.js +0 -5
  764. package/node_modules/underscore/modules/union.js +0 -9
  765. package/node_modules/underscore/modules/uniq.js +0 -36
  766. package/node_modules/underscore/modules/uniqueId.js +0 -7
  767. package/node_modules/underscore/modules/unzip.js +0 -15
  768. package/node_modules/underscore/modules/values.js +0 -12
  769. package/node_modules/underscore/modules/where.js +0 -8
  770. package/node_modules/underscore/modules/without.js +0 -7
  771. package/node_modules/underscore/modules/wrap.js +0 -8
  772. package/node_modules/underscore/modules/zip.js +0 -6
  773. package/node_modules/underscore/package.json +0 -124
  774. package/node_modules/underscore/underscore-esm-min.js +0 -5
  775. package/node_modules/underscore/underscore-esm-min.js.map +0 -1
  776. package/node_modules/underscore/underscore-esm.js +0 -2034
  777. package/node_modules/underscore/underscore-esm.js.map +0 -1
  778. package/node_modules/underscore/underscore-min.js +0 -6
  779. package/node_modules/underscore/underscore-min.js.map +0 -1
  780. package/node_modules/underscore/underscore-node-f.cjs +0 -2158
  781. package/node_modules/underscore/underscore-node-f.cjs.map +0 -1
  782. package/node_modules/underscore/underscore-node.cjs +0 -11
  783. package/node_modules/underscore/underscore-node.cjs.map +0 -1
  784. package/node_modules/underscore/underscore-node.mjs +0 -7
  785. package/node_modules/underscore/underscore-node.mjs.map +0 -1
  786. package/node_modules/underscore/underscore-umd-min.js +0 -6
  787. package/node_modules/underscore/underscore-umd-min.js.map +0 -1
  788. package/node_modules/underscore/underscore-umd.js +0 -2042
  789. package/node_modules/underscore/underscore-umd.js.map +0 -1
  790. package/node_modules/underscore/underscore.js +0 -2042
@@ -0,0 +1,2172 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSONPath = {}));
5
+ })(this, (function (exports) { 'use strict';
6
+
7
+ /**
8
+ * @implements {IHooks}
9
+ */
10
+ class Hooks {
11
+ /**
12
+ * @callback HookCallback
13
+ * @this {*|Jsep} this
14
+ * @param {Jsep} env
15
+ * @returns: void
16
+ */
17
+ /**
18
+ * Adds the given callback to the list of callbacks for the given hook.
19
+ *
20
+ * The callback will be invoked when the hook it is registered for is run.
21
+ *
22
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
23
+ *
24
+ * @param {string|object} name The name of the hook, or an object of callbacks keyed by name
25
+ * @param {HookCallback|boolean} callback The callback function which is given environment variables.
26
+ * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)
27
+ * @public
28
+ */
29
+ add(name, callback, first) {
30
+ if (typeof arguments[0] != 'string') {
31
+ // Multiple hook callbacks, keyed by name
32
+ for (let name in arguments[0]) {
33
+ this.add(name, arguments[0][name], arguments[1]);
34
+ }
35
+ } else {
36
+ (Array.isArray(name) ? name : [name]).forEach(function (name) {
37
+ this[name] = this[name] || [];
38
+ if (callback) {
39
+ this[name][first ? 'unshift' : 'push'](callback);
40
+ }
41
+ }, this);
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Runs a hook invoking all registered callbacks with the given environment variables.
47
+ *
48
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
49
+ *
50
+ * @param {string} name The name of the hook.
51
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
52
+ * @public
53
+ */
54
+ run(name, env) {
55
+ this[name] = this[name] || [];
56
+ this[name].forEach(function (callback) {
57
+ callback.call(env && env.context ? env.context : env, env);
58
+ });
59
+ }
60
+ }
61
+
62
+ /**
63
+ * @implements {IPlugins}
64
+ */
65
+ class Plugins {
66
+ constructor(jsep) {
67
+ this.jsep = jsep;
68
+ this.registered = {};
69
+ }
70
+
71
+ /**
72
+ * @callback PluginSetup
73
+ * @this {Jsep} jsep
74
+ * @returns: void
75
+ */
76
+ /**
77
+ * Adds the given plugin(s) to the registry
78
+ *
79
+ * @param {object} plugins
80
+ * @param {string} plugins.name The name of the plugin
81
+ * @param {PluginSetup} plugins.init The init function
82
+ * @public
83
+ */
84
+ register() {
85
+ for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
86
+ plugins[_key] = arguments[_key];
87
+ }
88
+ plugins.forEach(plugin => {
89
+ if (typeof plugin !== 'object' || !plugin.name || !plugin.init) {
90
+ throw new Error('Invalid JSEP plugin format');
91
+ }
92
+ if (this.registered[plugin.name]) {
93
+ // already registered. Ignore.
94
+ return;
95
+ }
96
+ plugin.init(this.jsep);
97
+ this.registered[plugin.name] = plugin;
98
+ });
99
+ }
100
+ }
101
+
102
+ // JavaScript Expression Parser (JSEP) 1.4.0
103
+
104
+ class Jsep {
105
+ /**
106
+ * @returns {string}
107
+ */
108
+ static get version() {
109
+ // To be filled in by the template
110
+ return '1.4.0';
111
+ }
112
+
113
+ /**
114
+ * @returns {string}
115
+ */
116
+ static toString() {
117
+ return 'JavaScript Expression Parser (JSEP) v' + Jsep.version;
118
+ }
119
+ // ==================== CONFIG ================================
120
+ /**
121
+ * @method addUnaryOp
122
+ * @param {string} op_name The name of the unary op to add
123
+ * @returns {Jsep}
124
+ */
125
+ static addUnaryOp(op_name) {
126
+ Jsep.max_unop_len = Math.max(op_name.length, Jsep.max_unop_len);
127
+ Jsep.unary_ops[op_name] = 1;
128
+ return Jsep;
129
+ }
130
+
131
+ /**
132
+ * @method jsep.addBinaryOp
133
+ * @param {string} op_name The name of the binary op to add
134
+ * @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence
135
+ * @param {boolean} [isRightAssociative=false] whether operator is right-associative
136
+ * @returns {Jsep}
137
+ */
138
+ static addBinaryOp(op_name, precedence, isRightAssociative) {
139
+ Jsep.max_binop_len = Math.max(op_name.length, Jsep.max_binop_len);
140
+ Jsep.binary_ops[op_name] = precedence;
141
+ if (isRightAssociative) {
142
+ Jsep.right_associative.add(op_name);
143
+ } else {
144
+ Jsep.right_associative.delete(op_name);
145
+ }
146
+ return Jsep;
147
+ }
148
+
149
+ /**
150
+ * @method addIdentifierChar
151
+ * @param {string} char The additional character to treat as a valid part of an identifier
152
+ * @returns {Jsep}
153
+ */
154
+ static addIdentifierChar(char) {
155
+ Jsep.additional_identifier_chars.add(char);
156
+ return Jsep;
157
+ }
158
+
159
+ /**
160
+ * @method addLiteral
161
+ * @param {string} literal_name The name of the literal to add
162
+ * @param {*} literal_value The value of the literal
163
+ * @returns {Jsep}
164
+ */
165
+ static addLiteral(literal_name, literal_value) {
166
+ Jsep.literals[literal_name] = literal_value;
167
+ return Jsep;
168
+ }
169
+
170
+ /**
171
+ * @method removeUnaryOp
172
+ * @param {string} op_name The name of the unary op to remove
173
+ * @returns {Jsep}
174
+ */
175
+ static removeUnaryOp(op_name) {
176
+ delete Jsep.unary_ops[op_name];
177
+ if (op_name.length === Jsep.max_unop_len) {
178
+ Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);
179
+ }
180
+ return Jsep;
181
+ }
182
+
183
+ /**
184
+ * @method removeAllUnaryOps
185
+ * @returns {Jsep}
186
+ */
187
+ static removeAllUnaryOps() {
188
+ Jsep.unary_ops = {};
189
+ Jsep.max_unop_len = 0;
190
+ return Jsep;
191
+ }
192
+
193
+ /**
194
+ * @method removeIdentifierChar
195
+ * @param {string} char The additional character to stop treating as a valid part of an identifier
196
+ * @returns {Jsep}
197
+ */
198
+ static removeIdentifierChar(char) {
199
+ Jsep.additional_identifier_chars.delete(char);
200
+ return Jsep;
201
+ }
202
+
203
+ /**
204
+ * @method removeBinaryOp
205
+ * @param {string} op_name The name of the binary op to remove
206
+ * @returns {Jsep}
207
+ */
208
+ static removeBinaryOp(op_name) {
209
+ delete Jsep.binary_ops[op_name];
210
+ if (op_name.length === Jsep.max_binop_len) {
211
+ Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);
212
+ }
213
+ Jsep.right_associative.delete(op_name);
214
+ return Jsep;
215
+ }
216
+
217
+ /**
218
+ * @method removeAllBinaryOps
219
+ * @returns {Jsep}
220
+ */
221
+ static removeAllBinaryOps() {
222
+ Jsep.binary_ops = {};
223
+ Jsep.max_binop_len = 0;
224
+ return Jsep;
225
+ }
226
+
227
+ /**
228
+ * @method removeLiteral
229
+ * @param {string} literal_name The name of the literal to remove
230
+ * @returns {Jsep}
231
+ */
232
+ static removeLiteral(literal_name) {
233
+ delete Jsep.literals[literal_name];
234
+ return Jsep;
235
+ }
236
+
237
+ /**
238
+ * @method removeAllLiterals
239
+ * @returns {Jsep}
240
+ */
241
+ static removeAllLiterals() {
242
+ Jsep.literals = {};
243
+ return Jsep;
244
+ }
245
+ // ==================== END CONFIG ============================
246
+
247
+ /**
248
+ * @returns {string}
249
+ */
250
+ get char() {
251
+ return this.expr.charAt(this.index);
252
+ }
253
+
254
+ /**
255
+ * @returns {number}
256
+ */
257
+ get code() {
258
+ return this.expr.charCodeAt(this.index);
259
+ }
260
+ /**
261
+ * @param {string} expr a string with the passed in express
262
+ * @returns Jsep
263
+ */
264
+ constructor(expr) {
265
+ // `index` stores the character number we are currently at
266
+ // All of the gobbles below will modify `index` as we move along
267
+ this.expr = expr;
268
+ this.index = 0;
269
+ }
270
+
271
+ /**
272
+ * static top-level parser
273
+ * @returns {jsep.Expression}
274
+ */
275
+ static parse(expr) {
276
+ return new Jsep(expr).parse();
277
+ }
278
+
279
+ /**
280
+ * Get the longest key length of any object
281
+ * @param {object} obj
282
+ * @returns {number}
283
+ */
284
+ static getMaxKeyLen(obj) {
285
+ return Math.max(0, ...Object.keys(obj).map(k => k.length));
286
+ }
287
+
288
+ /**
289
+ * `ch` is a character code in the next three functions
290
+ * @param {number} ch
291
+ * @returns {boolean}
292
+ */
293
+ static isDecimalDigit(ch) {
294
+ return ch >= 48 && ch <= 57; // 0...9
295
+ }
296
+
297
+ /**
298
+ * Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.
299
+ * @param {string} op_val
300
+ * @returns {number}
301
+ */
302
+ static binaryPrecedence(op_val) {
303
+ return Jsep.binary_ops[op_val] || 0;
304
+ }
305
+
306
+ /**
307
+ * Looks for start of identifier
308
+ * @param {number} ch
309
+ * @returns {boolean}
310
+ */
311
+ static isIdentifierStart(ch) {
312
+ return ch >= 65 && ch <= 90 ||
313
+ // A...Z
314
+ ch >= 97 && ch <= 122 ||
315
+ // a...z
316
+ ch >= 128 && !Jsep.binary_ops[String.fromCharCode(ch)] ||
317
+ // any non-ASCII that is not an operator
318
+ Jsep.additional_identifier_chars.has(String.fromCharCode(ch)); // additional characters
319
+ }
320
+
321
+ /**
322
+ * @param {number} ch
323
+ * @returns {boolean}
324
+ */
325
+ static isIdentifierPart(ch) {
326
+ return Jsep.isIdentifierStart(ch) || Jsep.isDecimalDigit(ch);
327
+ }
328
+
329
+ /**
330
+ * throw error at index of the expression
331
+ * @param {string} message
332
+ * @throws
333
+ */
334
+ throwError(message) {
335
+ const error = new Error(message + ' at character ' + this.index);
336
+ error.index = this.index;
337
+ error.description = message;
338
+ throw error;
339
+ }
340
+
341
+ /**
342
+ * Run a given hook
343
+ * @param {string} name
344
+ * @param {jsep.Expression|false} [node]
345
+ * @returns {?jsep.Expression}
346
+ */
347
+ runHook(name, node) {
348
+ if (Jsep.hooks[name]) {
349
+ const env = {
350
+ context: this,
351
+ node
352
+ };
353
+ Jsep.hooks.run(name, env);
354
+ return env.node;
355
+ }
356
+ return node;
357
+ }
358
+
359
+ /**
360
+ * Runs a given hook until one returns a node
361
+ * @param {string} name
362
+ * @returns {?jsep.Expression}
363
+ */
364
+ searchHook(name) {
365
+ if (Jsep.hooks[name]) {
366
+ const env = {
367
+ context: this
368
+ };
369
+ Jsep.hooks[name].find(function (callback) {
370
+ callback.call(env.context, env);
371
+ return env.node;
372
+ });
373
+ return env.node;
374
+ }
375
+ }
376
+
377
+ /**
378
+ * Push `index` up to the next non-space character
379
+ */
380
+ gobbleSpaces() {
381
+ let ch = this.code;
382
+ // Whitespace
383
+ while (ch === Jsep.SPACE_CODE || ch === Jsep.TAB_CODE || ch === Jsep.LF_CODE || ch === Jsep.CR_CODE) {
384
+ ch = this.expr.charCodeAt(++this.index);
385
+ }
386
+ this.runHook('gobble-spaces');
387
+ }
388
+
389
+ /**
390
+ * Top-level method to parse all expressions and returns compound or single node
391
+ * @returns {jsep.Expression}
392
+ */
393
+ parse() {
394
+ this.runHook('before-all');
395
+ const nodes = this.gobbleExpressions();
396
+
397
+ // If there's only one expression just try returning the expression
398
+ const node = nodes.length === 1 ? nodes[0] : {
399
+ type: Jsep.COMPOUND,
400
+ body: nodes
401
+ };
402
+ return this.runHook('after-all', node);
403
+ }
404
+
405
+ /**
406
+ * top-level parser (but can be reused within as well)
407
+ * @param {number} [untilICode]
408
+ * @returns {jsep.Expression[]}
409
+ */
410
+ gobbleExpressions(untilICode) {
411
+ let nodes = [],
412
+ ch_i,
413
+ node;
414
+ while (this.index < this.expr.length) {
415
+ ch_i = this.code;
416
+
417
+ // Expressions can be separated by semicolons, commas, or just inferred without any
418
+ // separators
419
+ if (ch_i === Jsep.SEMCOL_CODE || ch_i === Jsep.COMMA_CODE) {
420
+ this.index++; // ignore separators
421
+ } else {
422
+ // Try to gobble each expression individually
423
+ if (node = this.gobbleExpression()) {
424
+ nodes.push(node);
425
+ // If we weren't able to find a binary expression and are out of room, then
426
+ // the expression passed in probably has too much
427
+ } else if (this.index < this.expr.length) {
428
+ if (ch_i === untilICode) {
429
+ break;
430
+ }
431
+ this.throwError('Unexpected "' + this.char + '"');
432
+ }
433
+ }
434
+ }
435
+ return nodes;
436
+ }
437
+
438
+ /**
439
+ * The main parsing function.
440
+ * @returns {?jsep.Expression}
441
+ */
442
+ gobbleExpression() {
443
+ const node = this.searchHook('gobble-expression') || this.gobbleBinaryExpression();
444
+ this.gobbleSpaces();
445
+ return this.runHook('after-expression', node);
446
+ }
447
+
448
+ /**
449
+ * Search for the operation portion of the string (e.g. `+`, `===`)
450
+ * Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)
451
+ * and move down from 3 to 2 to 1 character until a matching binary operation is found
452
+ * then, return that binary operation
453
+ * @returns {string|boolean}
454
+ */
455
+ gobbleBinaryOp() {
456
+ this.gobbleSpaces();
457
+ let to_check = this.expr.substr(this.index, Jsep.max_binop_len);
458
+ let tc_len = to_check.length;
459
+ while (tc_len > 0) {
460
+ // Don't accept a binary op when it is an identifier.
461
+ // Binary ops that start with a identifier-valid character must be followed
462
+ // by a non identifier-part valid character
463
+ if (Jsep.binary_ops.hasOwnProperty(to_check) && (!Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {
464
+ this.index += tc_len;
465
+ return to_check;
466
+ }
467
+ to_check = to_check.substr(0, --tc_len);
468
+ }
469
+ return false;
470
+ }
471
+
472
+ /**
473
+ * This function is responsible for gobbling an individual expression,
474
+ * e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`
475
+ * @returns {?jsep.BinaryExpression}
476
+ */
477
+ gobbleBinaryExpression() {
478
+ let node, biop, prec, stack, biop_info, left, right, i, cur_biop;
479
+
480
+ // First, try to get the leftmost thing
481
+ // Then, check to see if there's a binary operator operating on that leftmost thing
482
+ // Don't gobbleBinaryOp without a left-hand-side
483
+ left = this.gobbleToken();
484
+ if (!left) {
485
+ return left;
486
+ }
487
+ biop = this.gobbleBinaryOp();
488
+
489
+ // If there wasn't a binary operator, just return the leftmost node
490
+ if (!biop) {
491
+ return left;
492
+ }
493
+
494
+ // Otherwise, we need to start a stack to properly place the binary operations in their
495
+ // precedence structure
496
+ biop_info = {
497
+ value: biop,
498
+ prec: Jsep.binaryPrecedence(biop),
499
+ right_a: Jsep.right_associative.has(biop)
500
+ };
501
+ right = this.gobbleToken();
502
+ if (!right) {
503
+ this.throwError("Expected expression after " + biop);
504
+ }
505
+ stack = [left, biop_info, right];
506
+
507
+ // Properly deal with precedence using [recursive descent](http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm)
508
+ while (biop = this.gobbleBinaryOp()) {
509
+ prec = Jsep.binaryPrecedence(biop);
510
+ if (prec === 0) {
511
+ this.index -= biop.length;
512
+ break;
513
+ }
514
+ biop_info = {
515
+ value: biop,
516
+ prec,
517
+ right_a: Jsep.right_associative.has(biop)
518
+ };
519
+ cur_biop = biop;
520
+
521
+ // Reduce: make a binary expression from the three topmost entries.
522
+ const comparePrev = prev => biop_info.right_a && prev.right_a ? prec > prev.prec : prec <= prev.prec;
523
+ while (stack.length > 2 && comparePrev(stack[stack.length - 2])) {
524
+ right = stack.pop();
525
+ biop = stack.pop().value;
526
+ left = stack.pop();
527
+ node = {
528
+ type: Jsep.BINARY_EXP,
529
+ operator: biop,
530
+ left,
531
+ right
532
+ };
533
+ stack.push(node);
534
+ }
535
+ node = this.gobbleToken();
536
+ if (!node) {
537
+ this.throwError("Expected expression after " + cur_biop);
538
+ }
539
+ stack.push(biop_info, node);
540
+ }
541
+ i = stack.length - 1;
542
+ node = stack[i];
543
+ while (i > 1) {
544
+ node = {
545
+ type: Jsep.BINARY_EXP,
546
+ operator: stack[i - 1].value,
547
+ left: stack[i - 2],
548
+ right: node
549
+ };
550
+ i -= 2;
551
+ }
552
+ return node;
553
+ }
554
+
555
+ /**
556
+ * An individual part of a binary expression:
557
+ * e.g. `foo.bar(baz)`, `1`, `"abc"`, `(a % 2)` (because it's in parenthesis)
558
+ * @returns {boolean|jsep.Expression}
559
+ */
560
+ gobbleToken() {
561
+ let ch, to_check, tc_len, node;
562
+ this.gobbleSpaces();
563
+ node = this.searchHook('gobble-token');
564
+ if (node) {
565
+ return this.runHook('after-token', node);
566
+ }
567
+ ch = this.code;
568
+ if (Jsep.isDecimalDigit(ch) || ch === Jsep.PERIOD_CODE) {
569
+ // Char code 46 is a dot `.` which can start off a numeric literal
570
+ return this.gobbleNumericLiteral();
571
+ }
572
+ if (ch === Jsep.SQUOTE_CODE || ch === Jsep.DQUOTE_CODE) {
573
+ // Single or double quotes
574
+ node = this.gobbleStringLiteral();
575
+ } else if (ch === Jsep.OBRACK_CODE) {
576
+ node = this.gobbleArray();
577
+ } else {
578
+ to_check = this.expr.substr(this.index, Jsep.max_unop_len);
579
+ tc_len = to_check.length;
580
+ while (tc_len > 0) {
581
+ // Don't accept an unary op when it is an identifier.
582
+ // Unary ops that start with a identifier-valid character must be followed
583
+ // by a non identifier-part valid character
584
+ if (Jsep.unary_ops.hasOwnProperty(to_check) && (!Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {
585
+ this.index += tc_len;
586
+ const argument = this.gobbleToken();
587
+ if (!argument) {
588
+ this.throwError('missing unaryOp argument');
589
+ }
590
+ return this.runHook('after-token', {
591
+ type: Jsep.UNARY_EXP,
592
+ operator: to_check,
593
+ argument,
594
+ prefix: true
595
+ });
596
+ }
597
+ to_check = to_check.substr(0, --tc_len);
598
+ }
599
+ if (Jsep.isIdentifierStart(ch)) {
600
+ node = this.gobbleIdentifier();
601
+ if (Jsep.literals.hasOwnProperty(node.name)) {
602
+ node = {
603
+ type: Jsep.LITERAL,
604
+ value: Jsep.literals[node.name],
605
+ raw: node.name
606
+ };
607
+ } else if (node.name === Jsep.this_str) {
608
+ node = {
609
+ type: Jsep.THIS_EXP
610
+ };
611
+ }
612
+ } else if (ch === Jsep.OPAREN_CODE) {
613
+ // open parenthesis
614
+ node = this.gobbleGroup();
615
+ }
616
+ }
617
+ if (!node) {
618
+ return this.runHook('after-token', false);
619
+ }
620
+ node = this.gobbleTokenProperty(node);
621
+ return this.runHook('after-token', node);
622
+ }
623
+
624
+ /**
625
+ * Gobble properties of of identifiers/strings/arrays/groups.
626
+ * e.g. `foo`, `bar.baz`, `foo['bar'].baz`
627
+ * It also gobbles function calls:
628
+ * e.g. `Math.acos(obj.angle)`
629
+ * @param {jsep.Expression} node
630
+ * @returns {jsep.Expression}
631
+ */
632
+ gobbleTokenProperty(node) {
633
+ this.gobbleSpaces();
634
+ let ch = this.code;
635
+ while (ch === Jsep.PERIOD_CODE || ch === Jsep.OBRACK_CODE || ch === Jsep.OPAREN_CODE || ch === Jsep.QUMARK_CODE) {
636
+ let optional;
637
+ if (ch === Jsep.QUMARK_CODE) {
638
+ if (this.expr.charCodeAt(this.index + 1) !== Jsep.PERIOD_CODE) {
639
+ break;
640
+ }
641
+ optional = true;
642
+ this.index += 2;
643
+ this.gobbleSpaces();
644
+ ch = this.code;
645
+ }
646
+ this.index++;
647
+ if (ch === Jsep.OBRACK_CODE) {
648
+ node = {
649
+ type: Jsep.MEMBER_EXP,
650
+ computed: true,
651
+ object: node,
652
+ property: this.gobbleExpression()
653
+ };
654
+ if (!node.property) {
655
+ this.throwError('Unexpected "' + this.char + '"');
656
+ }
657
+ this.gobbleSpaces();
658
+ ch = this.code;
659
+ if (ch !== Jsep.CBRACK_CODE) {
660
+ this.throwError('Unclosed [');
661
+ }
662
+ this.index++;
663
+ } else if (ch === Jsep.OPAREN_CODE) {
664
+ // A function call is being made; gobble all the arguments
665
+ node = {
666
+ type: Jsep.CALL_EXP,
667
+ 'arguments': this.gobbleArguments(Jsep.CPAREN_CODE),
668
+ callee: node
669
+ };
670
+ } else if (ch === Jsep.PERIOD_CODE || optional) {
671
+ if (optional) {
672
+ this.index--;
673
+ }
674
+ this.gobbleSpaces();
675
+ node = {
676
+ type: Jsep.MEMBER_EXP,
677
+ computed: false,
678
+ object: node,
679
+ property: this.gobbleIdentifier()
680
+ };
681
+ }
682
+ if (optional) {
683
+ node.optional = true;
684
+ } // else leave undefined for compatibility with esprima
685
+
686
+ this.gobbleSpaces();
687
+ ch = this.code;
688
+ }
689
+ return node;
690
+ }
691
+
692
+ /**
693
+ * Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to
694
+ * keep track of everything in the numeric literal and then calling `parseFloat` on that string
695
+ * @returns {jsep.Literal}
696
+ */
697
+ gobbleNumericLiteral() {
698
+ let number = '',
699
+ ch,
700
+ chCode;
701
+ while (Jsep.isDecimalDigit(this.code)) {
702
+ number += this.expr.charAt(this.index++);
703
+ }
704
+ if (this.code === Jsep.PERIOD_CODE) {
705
+ // can start with a decimal marker
706
+ number += this.expr.charAt(this.index++);
707
+ while (Jsep.isDecimalDigit(this.code)) {
708
+ number += this.expr.charAt(this.index++);
709
+ }
710
+ }
711
+ ch = this.char;
712
+ if (ch === 'e' || ch === 'E') {
713
+ // exponent marker
714
+ number += this.expr.charAt(this.index++);
715
+ ch = this.char;
716
+ if (ch === '+' || ch === '-') {
717
+ // exponent sign
718
+ number += this.expr.charAt(this.index++);
719
+ }
720
+ while (Jsep.isDecimalDigit(this.code)) {
721
+ // exponent itself
722
+ number += this.expr.charAt(this.index++);
723
+ }
724
+ if (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1))) {
725
+ this.throwError('Expected exponent (' + number + this.char + ')');
726
+ }
727
+ }
728
+ chCode = this.code;
729
+
730
+ // Check to make sure this isn't a variable name that start with a number (123abc)
731
+ if (Jsep.isIdentifierStart(chCode)) {
732
+ this.throwError('Variable names cannot start with a number (' + number + this.char + ')');
733
+ } else if (chCode === Jsep.PERIOD_CODE || number.length === 1 && number.charCodeAt(0) === Jsep.PERIOD_CODE) {
734
+ this.throwError('Unexpected period');
735
+ }
736
+ return {
737
+ type: Jsep.LITERAL,
738
+ value: parseFloat(number),
739
+ raw: number
740
+ };
741
+ }
742
+
743
+ /**
744
+ * Parses a string literal, staring with single or double quotes with basic support for escape codes
745
+ * e.g. `"hello world"`, `'this is\nJSEP'`
746
+ * @returns {jsep.Literal}
747
+ */
748
+ gobbleStringLiteral() {
749
+ let str = '';
750
+ const startIndex = this.index;
751
+ const quote = this.expr.charAt(this.index++);
752
+ let closed = false;
753
+ while (this.index < this.expr.length) {
754
+ let ch = this.expr.charAt(this.index++);
755
+ if (ch === quote) {
756
+ closed = true;
757
+ break;
758
+ } else if (ch === '\\') {
759
+ // Check for all of the common escape codes
760
+ ch = this.expr.charAt(this.index++);
761
+ switch (ch) {
762
+ case 'n':
763
+ str += '\n';
764
+ break;
765
+ case 'r':
766
+ str += '\r';
767
+ break;
768
+ case 't':
769
+ str += '\t';
770
+ break;
771
+ case 'b':
772
+ str += '\b';
773
+ break;
774
+ case 'f':
775
+ str += '\f';
776
+ break;
777
+ case 'v':
778
+ str += '\x0B';
779
+ break;
780
+ default:
781
+ str += ch;
782
+ }
783
+ } else {
784
+ str += ch;
785
+ }
786
+ }
787
+ if (!closed) {
788
+ this.throwError('Unclosed quote after "' + str + '"');
789
+ }
790
+ return {
791
+ type: Jsep.LITERAL,
792
+ value: str,
793
+ raw: this.expr.substring(startIndex, this.index)
794
+ };
795
+ }
796
+
797
+ /**
798
+ * Gobbles only identifiers
799
+ * e.g.: `foo`, `_value`, `$x1`
800
+ * Also, this function checks if that identifier is a literal:
801
+ * (e.g. `true`, `false`, `null`) or `this`
802
+ * @returns {jsep.Identifier}
803
+ */
804
+ gobbleIdentifier() {
805
+ let ch = this.code,
806
+ start = this.index;
807
+ if (Jsep.isIdentifierStart(ch)) {
808
+ this.index++;
809
+ } else {
810
+ this.throwError('Unexpected ' + this.char);
811
+ }
812
+ while (this.index < this.expr.length) {
813
+ ch = this.code;
814
+ if (Jsep.isIdentifierPart(ch)) {
815
+ this.index++;
816
+ } else {
817
+ break;
818
+ }
819
+ }
820
+ return {
821
+ type: Jsep.IDENTIFIER,
822
+ name: this.expr.slice(start, this.index)
823
+ };
824
+ }
825
+
826
+ /**
827
+ * Gobbles a list of arguments within the context of a function call
828
+ * or array literal. This function also assumes that the opening character
829
+ * `(` or `[` has already been gobbled, and gobbles expressions and commas
830
+ * until the terminator character `)` or `]` is encountered.
831
+ * e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`
832
+ * @param {number} termination
833
+ * @returns {jsep.Expression[]}
834
+ */
835
+ gobbleArguments(termination) {
836
+ const args = [];
837
+ let closed = false;
838
+ let separator_count = 0;
839
+ while (this.index < this.expr.length) {
840
+ this.gobbleSpaces();
841
+ let ch_i = this.code;
842
+ if (ch_i === termination) {
843
+ // done parsing
844
+ closed = true;
845
+ this.index++;
846
+ if (termination === Jsep.CPAREN_CODE && separator_count && separator_count >= args.length) {
847
+ this.throwError('Unexpected token ' + String.fromCharCode(termination));
848
+ }
849
+ break;
850
+ } else if (ch_i === Jsep.COMMA_CODE) {
851
+ // between expressions
852
+ this.index++;
853
+ separator_count++;
854
+ if (separator_count !== args.length) {
855
+ // missing argument
856
+ if (termination === Jsep.CPAREN_CODE) {
857
+ this.throwError('Unexpected token ,');
858
+ } else if (termination === Jsep.CBRACK_CODE) {
859
+ for (let arg = args.length; arg < separator_count; arg++) {
860
+ args.push(null);
861
+ }
862
+ }
863
+ }
864
+ } else if (args.length !== separator_count && separator_count !== 0) {
865
+ // NOTE: `&& separator_count !== 0` allows for either all commas, or all spaces as arguments
866
+ this.throwError('Expected comma');
867
+ } else {
868
+ const node = this.gobbleExpression();
869
+ if (!node || node.type === Jsep.COMPOUND) {
870
+ this.throwError('Expected comma');
871
+ }
872
+ args.push(node);
873
+ }
874
+ }
875
+ if (!closed) {
876
+ this.throwError('Expected ' + String.fromCharCode(termination));
877
+ }
878
+ return args;
879
+ }
880
+
881
+ /**
882
+ * Responsible for parsing a group of things within parentheses `()`
883
+ * that have no identifier in front (so not a function call)
884
+ * This function assumes that it needs to gobble the opening parenthesis
885
+ * and then tries to gobble everything within that parenthesis, assuming
886
+ * that the next thing it should see is the close parenthesis. If not,
887
+ * then the expression probably doesn't have a `)`
888
+ * @returns {boolean|jsep.Expression}
889
+ */
890
+ gobbleGroup() {
891
+ this.index++;
892
+ let nodes = this.gobbleExpressions(Jsep.CPAREN_CODE);
893
+ if (this.code === Jsep.CPAREN_CODE) {
894
+ this.index++;
895
+ if (nodes.length === 1) {
896
+ return nodes[0];
897
+ } else if (!nodes.length) {
898
+ return false;
899
+ } else {
900
+ return {
901
+ type: Jsep.SEQUENCE_EXP,
902
+ expressions: nodes
903
+ };
904
+ }
905
+ } else {
906
+ this.throwError('Unclosed (');
907
+ }
908
+ }
909
+
910
+ /**
911
+ * Responsible for parsing Array literals `[1, 2, 3]`
912
+ * This function assumes that it needs to gobble the opening bracket
913
+ * and then tries to gobble the expressions as arguments.
914
+ * @returns {jsep.ArrayExpression}
915
+ */
916
+ gobbleArray() {
917
+ this.index++;
918
+ return {
919
+ type: Jsep.ARRAY_EXP,
920
+ elements: this.gobbleArguments(Jsep.CBRACK_CODE)
921
+ };
922
+ }
923
+ }
924
+
925
+ // Static fields:
926
+ const hooks = new Hooks();
927
+ Object.assign(Jsep, {
928
+ hooks,
929
+ plugins: new Plugins(Jsep),
930
+ // Node Types
931
+ // ----------
932
+ // This is the full set of types that any JSEP node can be.
933
+ // Store them here to save space when minified
934
+ COMPOUND: 'Compound',
935
+ SEQUENCE_EXP: 'SequenceExpression',
936
+ IDENTIFIER: 'Identifier',
937
+ MEMBER_EXP: 'MemberExpression',
938
+ LITERAL: 'Literal',
939
+ THIS_EXP: 'ThisExpression',
940
+ CALL_EXP: 'CallExpression',
941
+ UNARY_EXP: 'UnaryExpression',
942
+ BINARY_EXP: 'BinaryExpression',
943
+ ARRAY_EXP: 'ArrayExpression',
944
+ TAB_CODE: 9,
945
+ LF_CODE: 10,
946
+ CR_CODE: 13,
947
+ SPACE_CODE: 32,
948
+ PERIOD_CODE: 46,
949
+ // '.'
950
+ COMMA_CODE: 44,
951
+ // ','
952
+ SQUOTE_CODE: 39,
953
+ // single quote
954
+ DQUOTE_CODE: 34,
955
+ // double quotes
956
+ OPAREN_CODE: 40,
957
+ // (
958
+ CPAREN_CODE: 41,
959
+ // )
960
+ OBRACK_CODE: 91,
961
+ // [
962
+ CBRACK_CODE: 93,
963
+ // ]
964
+ QUMARK_CODE: 63,
965
+ // ?
966
+ SEMCOL_CODE: 59,
967
+ // ;
968
+ COLON_CODE: 58,
969
+ // :
970
+
971
+ // Operations
972
+ // ----------
973
+ // Use a quickly-accessible map to store all of the unary operators
974
+ // Values are set to `1` (it really doesn't matter)
975
+ unary_ops: {
976
+ '-': 1,
977
+ '!': 1,
978
+ '~': 1,
979
+ '+': 1
980
+ },
981
+ // Also use a map for the binary operations but set their values to their
982
+ // binary precedence for quick reference (higher number = higher precedence)
983
+ // see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)
984
+ binary_ops: {
985
+ '||': 1,
986
+ '??': 1,
987
+ '&&': 2,
988
+ '|': 3,
989
+ '^': 4,
990
+ '&': 5,
991
+ '==': 6,
992
+ '!=': 6,
993
+ '===': 6,
994
+ '!==': 6,
995
+ '<': 7,
996
+ '>': 7,
997
+ '<=': 7,
998
+ '>=': 7,
999
+ '<<': 8,
1000
+ '>>': 8,
1001
+ '>>>': 8,
1002
+ '+': 9,
1003
+ '-': 9,
1004
+ '*': 10,
1005
+ '/': 10,
1006
+ '%': 10,
1007
+ '**': 11
1008
+ },
1009
+ // sets specific binary_ops as right-associative
1010
+ right_associative: new Set(['**']),
1011
+ // Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)
1012
+ additional_identifier_chars: new Set(['$', '_']),
1013
+ // Literals
1014
+ // ----------
1015
+ // Store the values to return for the various literals we may encounter
1016
+ literals: {
1017
+ 'true': true,
1018
+ 'false': false,
1019
+ 'null': null
1020
+ },
1021
+ // Except for `this`, which is special. This could be changed to something like `'self'` as well
1022
+ this_str: 'this'
1023
+ });
1024
+ Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);
1025
+ Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);
1026
+
1027
+ // Backward Compatibility:
1028
+ const jsep = expr => new Jsep(expr).parse();
1029
+ const stdClassProps = Object.getOwnPropertyNames(class Test {});
1030
+ Object.getOwnPropertyNames(Jsep).filter(prop => !stdClassProps.includes(prop) && jsep[prop] === undefined).forEach(m => {
1031
+ jsep[m] = Jsep[m];
1032
+ });
1033
+ jsep.Jsep = Jsep; // allows for const { Jsep } = require('jsep');
1034
+
1035
+ const CONDITIONAL_EXP = 'ConditionalExpression';
1036
+ var ternary = {
1037
+ name: 'ternary',
1038
+ init(jsep) {
1039
+ // Ternary expression: test ? consequent : alternate
1040
+ jsep.hooks.add('after-expression', function gobbleTernary(env) {
1041
+ if (env.node && this.code === jsep.QUMARK_CODE) {
1042
+ this.index++;
1043
+ const test = env.node;
1044
+ const consequent = this.gobbleExpression();
1045
+ if (!consequent) {
1046
+ this.throwError('Expected expression');
1047
+ }
1048
+ this.gobbleSpaces();
1049
+ if (this.code === jsep.COLON_CODE) {
1050
+ this.index++;
1051
+ const alternate = this.gobbleExpression();
1052
+ if (!alternate) {
1053
+ this.throwError('Expected expression');
1054
+ }
1055
+ env.node = {
1056
+ type: CONDITIONAL_EXP,
1057
+ test,
1058
+ consequent,
1059
+ alternate
1060
+ };
1061
+
1062
+ // check for operators of higher priority than ternary (i.e. assignment)
1063
+ // jsep sets || at 1, and assignment at 0.9, and conditional should be between them
1064
+ if (test.operator && jsep.binary_ops[test.operator] <= 0.9) {
1065
+ let newTest = test;
1066
+ while (newTest.right.operator && jsep.binary_ops[newTest.right.operator] <= 0.9) {
1067
+ newTest = newTest.right;
1068
+ }
1069
+ env.node.test = newTest.right;
1070
+ newTest.right = env.node;
1071
+ env.node = test;
1072
+ }
1073
+ } else {
1074
+ this.throwError('Expected :');
1075
+ }
1076
+ }
1077
+ });
1078
+ }
1079
+ };
1080
+
1081
+ // Add default plugins:
1082
+
1083
+ jsep.plugins.register(ternary);
1084
+
1085
+ const FSLASH_CODE = 47; // '/'
1086
+ const BSLASH_CODE = 92; // '\\'
1087
+
1088
+ var index = {
1089
+ name: 'regex',
1090
+ init(jsep) {
1091
+ // Regex literal: /abc123/ig
1092
+ jsep.hooks.add('gobble-token', function gobbleRegexLiteral(env) {
1093
+ if (this.code === FSLASH_CODE) {
1094
+ const patternIndex = ++this.index;
1095
+ let inCharSet = false;
1096
+ while (this.index < this.expr.length) {
1097
+ if (this.code === FSLASH_CODE && !inCharSet) {
1098
+ const pattern = this.expr.slice(patternIndex, this.index);
1099
+ let flags = '';
1100
+ while (++this.index < this.expr.length) {
1101
+ const code = this.code;
1102
+ if (code >= 97 && code <= 122 // a...z
1103
+ || code >= 65 && code <= 90 // A...Z
1104
+ || code >= 48 && code <= 57) {
1105
+ // 0-9
1106
+ flags += this.char;
1107
+ } else {
1108
+ break;
1109
+ }
1110
+ }
1111
+ let value;
1112
+ try {
1113
+ value = new RegExp(pattern, flags);
1114
+ } catch (e) {
1115
+ this.throwError(e.message);
1116
+ }
1117
+ env.node = {
1118
+ type: jsep.LITERAL,
1119
+ value,
1120
+ raw: this.expr.slice(patternIndex - 1, this.index)
1121
+ };
1122
+
1123
+ // allow . [] and () after regex: /regex/.test(a)
1124
+ env.node = this.gobbleTokenProperty(env.node);
1125
+ return env.node;
1126
+ }
1127
+ if (this.code === jsep.OBRACK_CODE) {
1128
+ inCharSet = true;
1129
+ } else if (inCharSet && this.code === jsep.CBRACK_CODE) {
1130
+ inCharSet = false;
1131
+ }
1132
+ this.index += this.code === BSLASH_CODE ? 2 : 1;
1133
+ }
1134
+ this.throwError('Unclosed Regex');
1135
+ }
1136
+ });
1137
+ }
1138
+ };
1139
+
1140
+ const PLUS_CODE = 43; // +
1141
+ const MINUS_CODE = 45; // -
1142
+
1143
+ const plugin = {
1144
+ name: 'assignment',
1145
+ assignmentOperators: new Set(['=', '*=', '**=', '/=', '%=', '+=', '-=', '<<=', '>>=', '>>>=', '&=', '^=', '|=', '||=', '&&=', '??=']),
1146
+ updateOperators: [PLUS_CODE, MINUS_CODE],
1147
+ assignmentPrecedence: 0.9,
1148
+ init(jsep) {
1149
+ const updateNodeTypes = [jsep.IDENTIFIER, jsep.MEMBER_EXP];
1150
+ plugin.assignmentOperators.forEach(op => jsep.addBinaryOp(op, plugin.assignmentPrecedence, true));
1151
+ jsep.hooks.add('gobble-token', function gobbleUpdatePrefix(env) {
1152
+ const code = this.code;
1153
+ if (plugin.updateOperators.some(c => c === code && c === this.expr.charCodeAt(this.index + 1))) {
1154
+ this.index += 2;
1155
+ env.node = {
1156
+ type: 'UpdateExpression',
1157
+ operator: code === PLUS_CODE ? '++' : '--',
1158
+ argument: this.gobbleTokenProperty(this.gobbleIdentifier()),
1159
+ prefix: true
1160
+ };
1161
+ if (!env.node.argument || !updateNodeTypes.includes(env.node.argument.type)) {
1162
+ this.throwError(`Unexpected ${env.node.operator}`);
1163
+ }
1164
+ }
1165
+ });
1166
+ jsep.hooks.add('after-token', function gobbleUpdatePostfix(env) {
1167
+ if (env.node) {
1168
+ const code = this.code;
1169
+ if (plugin.updateOperators.some(c => c === code && c === this.expr.charCodeAt(this.index + 1))) {
1170
+ if (!updateNodeTypes.includes(env.node.type)) {
1171
+ this.throwError(`Unexpected ${env.node.operator}`);
1172
+ }
1173
+ this.index += 2;
1174
+ env.node = {
1175
+ type: 'UpdateExpression',
1176
+ operator: code === PLUS_CODE ? '++' : '--',
1177
+ argument: env.node,
1178
+ prefix: false
1179
+ };
1180
+ }
1181
+ }
1182
+ });
1183
+ jsep.hooks.add('after-expression', function gobbleAssignment(env) {
1184
+ if (env.node) {
1185
+ // Note: Binaries can be chained in a single expression to respect
1186
+ // operator precedence (i.e. a = b = 1 + 2 + 3)
1187
+ // Update all binary assignment nodes in the tree
1188
+ updateBinariesToAssignments(env.node);
1189
+ }
1190
+ });
1191
+ function updateBinariesToAssignments(node) {
1192
+ if (plugin.assignmentOperators.has(node.operator)) {
1193
+ node.type = 'AssignmentExpression';
1194
+ updateBinariesToAssignments(node.left);
1195
+ updateBinariesToAssignments(node.right);
1196
+ } else if (!node.operator) {
1197
+ Object.values(node).forEach(val => {
1198
+ if (val && typeof val === 'object') {
1199
+ updateBinariesToAssignments(val);
1200
+ }
1201
+ });
1202
+ }
1203
+ }
1204
+ }
1205
+ };
1206
+
1207
+ /* eslint-disable no-bitwise -- Convenient */
1208
+
1209
+ // register plugins
1210
+ jsep.plugins.register(index, plugin);
1211
+ jsep.addUnaryOp('typeof');
1212
+ jsep.addUnaryOp('void');
1213
+ jsep.addLiteral('null', null);
1214
+ jsep.addLiteral('undefined', undefined);
1215
+ const BLOCKED_PROTO_PROPERTIES = new Set(['constructor', '__proto__', '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__']);
1216
+ const SafeEval = {
1217
+ /**
1218
+ * @param {jsep.Expression} ast
1219
+ * @param {Record<string, any>} subs
1220
+ */
1221
+ evalAst(ast, subs) {
1222
+ switch (ast.type) {
1223
+ case 'BinaryExpression':
1224
+ case 'LogicalExpression':
1225
+ return SafeEval.evalBinaryExpression(ast, subs);
1226
+ case 'Compound':
1227
+ return SafeEval.evalCompound(ast, subs);
1228
+ case 'ConditionalExpression':
1229
+ return SafeEval.evalConditionalExpression(ast, subs);
1230
+ case 'Identifier':
1231
+ return SafeEval.evalIdentifier(ast, subs);
1232
+ case 'Literal':
1233
+ return SafeEval.evalLiteral(ast, subs);
1234
+ case 'MemberExpression':
1235
+ return SafeEval.evalMemberExpression(ast, subs);
1236
+ case 'UnaryExpression':
1237
+ return SafeEval.evalUnaryExpression(ast, subs);
1238
+ case 'ArrayExpression':
1239
+ return SafeEval.evalArrayExpression(ast, subs);
1240
+ case 'CallExpression':
1241
+ return SafeEval.evalCallExpression(ast, subs);
1242
+ case 'AssignmentExpression':
1243
+ return SafeEval.evalAssignmentExpression(ast, subs);
1244
+ default:
1245
+ throw SyntaxError('Unexpected expression', ast);
1246
+ }
1247
+ },
1248
+ evalBinaryExpression(ast, subs) {
1249
+ const result = {
1250
+ '||': (a, b) => a || b(),
1251
+ '&&': (a, b) => a && b(),
1252
+ '|': (a, b) => a | b(),
1253
+ '^': (a, b) => a ^ b(),
1254
+ '&': (a, b) => a & b(),
1255
+ // eslint-disable-next-line eqeqeq -- API
1256
+ '==': (a, b) => a == b(),
1257
+ // eslint-disable-next-line eqeqeq -- API
1258
+ '!=': (a, b) => a != b(),
1259
+ '===': (a, b) => a === b(),
1260
+ '!==': (a, b) => a !== b(),
1261
+ '<': (a, b) => a < b(),
1262
+ '>': (a, b) => a > b(),
1263
+ '<=': (a, b) => a <= b(),
1264
+ '>=': (a, b) => a >= b(),
1265
+ '<<': (a, b) => a << b(),
1266
+ '>>': (a, b) => a >> b(),
1267
+ '>>>': (a, b) => a >>> b(),
1268
+ '+': (a, b) => a + b(),
1269
+ '-': (a, b) => a - b(),
1270
+ '*': (a, b) => a * b(),
1271
+ '/': (a, b) => a / b(),
1272
+ '%': (a, b) => a % b()
1273
+ }[ast.operator](SafeEval.evalAst(ast.left, subs), () => SafeEval.evalAst(ast.right, subs));
1274
+ return result;
1275
+ },
1276
+ evalCompound(ast, subs) {
1277
+ let last;
1278
+ for (let i = 0; i < ast.body.length; i++) {
1279
+ if (ast.body[i].type === 'Identifier' && ['var', 'let', 'const'].includes(ast.body[i].name) && ast.body[i + 1] && ast.body[i + 1].type === 'AssignmentExpression') {
1280
+ // var x=2; is detected as
1281
+ // [{Identifier var}, {AssignmentExpression x=2}]
1282
+ // eslint-disable-next-line @stylistic/max-len -- Long
1283
+ // eslint-disable-next-line sonarjs/updated-loop-counter -- Convenient
1284
+ i += 1;
1285
+ }
1286
+ const expr = ast.body[i];
1287
+ last = SafeEval.evalAst(expr, subs);
1288
+ }
1289
+ return last;
1290
+ },
1291
+ evalConditionalExpression(ast, subs) {
1292
+ if (SafeEval.evalAst(ast.test, subs)) {
1293
+ return SafeEval.evalAst(ast.consequent, subs);
1294
+ }
1295
+ return SafeEval.evalAst(ast.alternate, subs);
1296
+ },
1297
+ evalIdentifier(ast, subs) {
1298
+ if (Object.hasOwn(subs, ast.name)) {
1299
+ return subs[ast.name];
1300
+ }
1301
+ throw ReferenceError(`${ast.name} is not defined`);
1302
+ },
1303
+ evalLiteral(ast) {
1304
+ return ast.value;
1305
+ },
1306
+ evalMemberExpression(ast, subs) {
1307
+ const prop = String(
1308
+ // NOTE: `String(value)` throws error when
1309
+ // value has overwritten the toString method to return non-string
1310
+ // i.e. `value = {toString: () => []}`
1311
+ ast.computed ? SafeEval.evalAst(ast.property) // `object[property]`
1312
+ : ast.property.name // `object.property` property is Identifier
1313
+ );
1314
+ const obj = SafeEval.evalAst(ast.object, subs);
1315
+ if (obj === undefined || obj === null) {
1316
+ throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
1317
+ }
1318
+ if (!Object.hasOwn(obj, prop) && BLOCKED_PROTO_PROPERTIES.has(prop)) {
1319
+ throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
1320
+ }
1321
+ const result = obj[prop];
1322
+ if (typeof result === 'function') {
1323
+ return result.bind(obj); // arrow functions aren't affected by bind.
1324
+ }
1325
+ return result;
1326
+ },
1327
+ evalUnaryExpression(ast, subs) {
1328
+ const result = {
1329
+ '-': a => -SafeEval.evalAst(a, subs),
1330
+ '!': a => !SafeEval.evalAst(a, subs),
1331
+ '~': a => ~SafeEval.evalAst(a, subs),
1332
+ // eslint-disable-next-line no-implicit-coercion -- API
1333
+ '+': a => +SafeEval.evalAst(a, subs),
1334
+ typeof: a => typeof SafeEval.evalAst(a, subs),
1335
+ // eslint-disable-next-line no-void, sonarjs/void-use -- feature
1336
+ void: a => void SafeEval.evalAst(a, subs)
1337
+ }[ast.operator](ast.argument);
1338
+ return result;
1339
+ },
1340
+ evalArrayExpression(ast, subs) {
1341
+ return ast.elements.map(el => SafeEval.evalAst(el, subs));
1342
+ },
1343
+ evalCallExpression(ast, subs) {
1344
+ const args = ast.arguments.map(arg => SafeEval.evalAst(arg, subs));
1345
+ const func = SafeEval.evalAst(ast.callee, subs);
1346
+ /* c8 ignore start */
1347
+ if (func === Function) {
1348
+ // unreachable since BLOCKED_PROTO_PROPERTIES includes 'constructor'
1349
+ throw new Error('Function constructor is disabled');
1350
+ }
1351
+ /* c8 ignore end */
1352
+ return func(...args);
1353
+ },
1354
+ evalAssignmentExpression(ast, subs) {
1355
+ if (ast.left.type !== 'Identifier') {
1356
+ throw SyntaxError('Invalid left-hand side in assignment');
1357
+ }
1358
+ const id = ast.left.name;
1359
+ const value = SafeEval.evalAst(ast.right, subs);
1360
+ subs[id] = value;
1361
+ return subs[id];
1362
+ }
1363
+ };
1364
+
1365
+ /**
1366
+ * A replacement for NodeJS' VM.Script which is also {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP | Content Security Policy} friendly.
1367
+ */
1368
+ class SafeScript {
1369
+ /**
1370
+ * @param {string} expr Expression to evaluate
1371
+ */
1372
+ constructor(expr) {
1373
+ this.code = expr;
1374
+ this.ast = jsep(this.code);
1375
+ }
1376
+
1377
+ /**
1378
+ * @param {object} context Object whose items will be added
1379
+ * to evaluation
1380
+ * @returns {EvaluatedResult} Result of evaluated code
1381
+ */
1382
+ runInNewContext(context) {
1383
+ // `Object.create(null)` creates a prototypeless object
1384
+ const keyMap = Object.assign(Object.create(null), context);
1385
+ return SafeEval.evalAst(this.ast, keyMap);
1386
+ }
1387
+ }
1388
+
1389
+ /* eslint-disable camelcase -- Convenient for escaping */
1390
+
1391
+
1392
+ /**
1393
+ * @typedef {null|boolean|number|string|object|GenericArray} JSONObject
1394
+ */
1395
+
1396
+ /**
1397
+ * @typedef {any} AnyItem
1398
+ */
1399
+
1400
+ /**
1401
+ * @typedef {any} AnyResult
1402
+ */
1403
+
1404
+ /**
1405
+ * Copies array and then pushes item into it.
1406
+ * @param {GenericArray} arr Array to copy and into which to push
1407
+ * @param {AnyItem} item Array item to add (to end)
1408
+ * @returns {GenericArray} Copy of the original array
1409
+ */
1410
+ function push(arr, item) {
1411
+ arr = arr.slice();
1412
+ arr.push(item);
1413
+ return arr;
1414
+ }
1415
+ /**
1416
+ * Copies array and then unshifts item into it.
1417
+ * @param {AnyItem} item Array item to add (to beginning)
1418
+ * @param {GenericArray} arr Array to copy and into which to unshift
1419
+ * @returns {GenericArray} Copy of the original array
1420
+ */
1421
+ function unshift(item, arr) {
1422
+ arr = arr.slice();
1423
+ arr.unshift(item);
1424
+ return arr;
1425
+ }
1426
+
1427
+ /**
1428
+ * Caught when JSONPath is used without `new` but rethrown if with `new`
1429
+ * @extends Error
1430
+ */
1431
+ class NewError extends Error {
1432
+ /**
1433
+ * @param {AnyResult} value The evaluated scalar value
1434
+ */
1435
+ constructor(value) {
1436
+ super('JSONPath should not be called with "new" (it prevents return ' + 'of (unwrapped) scalar values)');
1437
+ this.avoidNew = true;
1438
+ this.value = value;
1439
+ this.name = 'NewError';
1440
+ }
1441
+ }
1442
+
1443
+ /**
1444
+ * @typedef {object} ReturnObject
1445
+ * @property {string} path
1446
+ * @property {JSONObject} value
1447
+ * @property {object|GenericArray} parent
1448
+ * @property {string} parentProperty
1449
+ */
1450
+
1451
+ /**
1452
+ * @callback JSONPathCallback
1453
+ * @param {string|object} preferredOutput
1454
+ * @param {"value"|"property"} type
1455
+ * @param {ReturnObject} fullRetObj
1456
+ * @returns {void}
1457
+ */
1458
+
1459
+ /**
1460
+ * @callback OtherTypeCallback
1461
+ * @param {JSONObject} val
1462
+ * @param {string} path
1463
+ * @param {object|GenericArray} parent
1464
+ * @param {string} parentPropName
1465
+ * @returns {boolean}
1466
+ */
1467
+
1468
+ /**
1469
+ * @typedef {any} ContextItem
1470
+ */
1471
+
1472
+ /**
1473
+ * @typedef {any} EvaluatedResult
1474
+ */
1475
+
1476
+ /**
1477
+ * @callback EvalCallback
1478
+ * @param {string} code
1479
+ * @param {ContextItem} context
1480
+ * @returns {EvaluatedResult}
1481
+ */
1482
+
1483
+ /**
1484
+ * @typedef {typeof SafeScript} EvalClass
1485
+ */
1486
+
1487
+ /**
1488
+ * @typedef {object} JSONPathOptions
1489
+ * @property {JSON} json
1490
+ * @property {string|string[]} path
1491
+ * @property {"value"|"path"|"pointer"|"parent"|"parentProperty"|
1492
+ * "all"} [resultType="value"]
1493
+ * @property {boolean} [flatten=false]
1494
+ * @property {boolean} [wrap=true]
1495
+ * @property {object} [sandbox={}]
1496
+ * @property {EvalCallback|EvalClass|'safe'|'native'|
1497
+ * boolean} [eval = 'safe']
1498
+ * @property {object|GenericArray|null} [parent=null]
1499
+ * @property {string|null} [parentProperty=null]
1500
+ * @property {JSONPathCallback} [callback]
1501
+ * @property {OtherTypeCallback} [otherTypeCallback] Defaults to
1502
+ * function which throws on encountering `@other`
1503
+ * @property {boolean} [autostart=true]
1504
+ */
1505
+
1506
+ /**
1507
+ * @param {string|JSONPathOptions} opts If a string, will be treated as `expr`
1508
+ * @param {string} [expr] JSON path to evaluate
1509
+ * @param {JSON} [obj] JSON object to evaluate against
1510
+ * @param {JSONPathCallback} [callback] Passed 3 arguments: 1) desired payload
1511
+ * per `resultType`, 2) `"value"|"property"`, 3) Full returned object with
1512
+ * all payloads
1513
+ * @param {OtherTypeCallback} [otherTypeCallback] If `@other()` is at the end
1514
+ * of one's query, this will be invoked with the value of the item, its
1515
+ * path, its parent, and its parent's property name, and it should return
1516
+ * a boolean indicating whether the supplied value belongs to the "other"
1517
+ * type or not (or it may handle transformations and return `false`).
1518
+ * @returns {JSONPath}
1519
+ * @class
1520
+ */
1521
+ function JSONPath(opts, expr, obj, callback, otherTypeCallback) {
1522
+ // eslint-disable-next-line no-restricted-syntax -- Allow for pseudo-class
1523
+ if (!(this instanceof JSONPath)) {
1524
+ try {
1525
+ return new JSONPath(opts, expr, obj, callback, otherTypeCallback);
1526
+ } catch (e) {
1527
+ if (!e.avoidNew) {
1528
+ throw e;
1529
+ }
1530
+ return e.value;
1531
+ }
1532
+ }
1533
+ if (typeof opts === 'string') {
1534
+ otherTypeCallback = callback;
1535
+ callback = obj;
1536
+ obj = expr;
1537
+ expr = opts;
1538
+ opts = null;
1539
+ }
1540
+ const optObj = opts && typeof opts === 'object';
1541
+ opts = opts || {};
1542
+ this.json = opts.json || obj;
1543
+ this.path = opts.path || expr;
1544
+ this.resultType = opts.resultType || 'value';
1545
+ this.flatten = opts.flatten || false;
1546
+ this.wrap = Object.hasOwn(opts, 'wrap') ? opts.wrap : true;
1547
+ this.sandbox = opts.sandbox || {};
1548
+ this.eval = opts.eval === undefined ? 'safe' : opts.eval;
1549
+ this.ignoreEvalErrors = typeof opts.ignoreEvalErrors === 'undefined' ? false : opts.ignoreEvalErrors;
1550
+ this.parent = opts.parent || null;
1551
+ this.parentProperty = opts.parentProperty || null;
1552
+ this.callback = opts.callback || callback || null;
1553
+ this.otherTypeCallback = opts.otherTypeCallback || otherTypeCallback || function () {
1554
+ throw new TypeError('You must supply an otherTypeCallback callback option ' + 'with the @other() operator.');
1555
+ };
1556
+ if (opts.autostart !== false) {
1557
+ const args = {
1558
+ path: optObj ? opts.path : expr
1559
+ };
1560
+ if (!optObj) {
1561
+ args.json = obj;
1562
+ } else if ('json' in opts) {
1563
+ args.json = opts.json;
1564
+ }
1565
+ const ret = this.evaluate(args);
1566
+ if (!ret || typeof ret !== 'object') {
1567
+ throw new NewError(ret);
1568
+ }
1569
+ return ret;
1570
+ }
1571
+ }
1572
+
1573
+ // PUBLIC METHODS
1574
+ JSONPath.prototype.evaluate = function (expr, json, callback, otherTypeCallback) {
1575
+ let currParent = this.parent,
1576
+ currParentProperty = this.parentProperty;
1577
+ let {
1578
+ flatten,
1579
+ wrap
1580
+ } = this;
1581
+ this.currResultType = this.resultType;
1582
+ this.currEval = this.eval;
1583
+ this.currSandbox = this.sandbox;
1584
+ callback = callback || this.callback;
1585
+ this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;
1586
+ json = json || this.json;
1587
+ expr = expr || this.path;
1588
+ if (expr && typeof expr === 'object' && !Array.isArray(expr)) {
1589
+ if (!expr.path && expr.path !== '') {
1590
+ throw new TypeError('You must supply a "path" property when providing an object ' + 'argument to JSONPath.evaluate().');
1591
+ }
1592
+ if (!Object.hasOwn(expr, 'json')) {
1593
+ throw new TypeError('You must supply a "json" property when providing an object ' + 'argument to JSONPath.evaluate().');
1594
+ }
1595
+ ({
1596
+ json
1597
+ } = expr);
1598
+ flatten = Object.hasOwn(expr, 'flatten') ? expr.flatten : flatten;
1599
+ this.currResultType = Object.hasOwn(expr, 'resultType') ? expr.resultType : this.currResultType;
1600
+ this.currSandbox = Object.hasOwn(expr, 'sandbox') ? expr.sandbox : this.currSandbox;
1601
+ wrap = Object.hasOwn(expr, 'wrap') ? expr.wrap : wrap;
1602
+ this.currEval = Object.hasOwn(expr, 'eval') ? expr.eval : this.currEval;
1603
+ callback = Object.hasOwn(expr, 'callback') ? expr.callback : callback;
1604
+ this.currOtherTypeCallback = Object.hasOwn(expr, 'otherTypeCallback') ? expr.otherTypeCallback : this.currOtherTypeCallback;
1605
+ currParent = Object.hasOwn(expr, 'parent') ? expr.parent : currParent;
1606
+ currParentProperty = Object.hasOwn(expr, 'parentProperty') ? expr.parentProperty : currParentProperty;
1607
+ expr = expr.path;
1608
+ }
1609
+ currParent = currParent || null;
1610
+ currParentProperty = currParentProperty || null;
1611
+ if (Array.isArray(expr)) {
1612
+ expr = JSONPath.toPathString(expr);
1613
+ }
1614
+ if (!expr && expr !== '' || !json) {
1615
+ return undefined;
1616
+ }
1617
+ const exprList = JSONPath.toPathArray(expr);
1618
+ if (exprList[0] === '$' && exprList.length > 1) {
1619
+ exprList.shift();
1620
+ }
1621
+ this._hasParentSelector = null;
1622
+ const result = this._trace(exprList, json, ['$'], currParent, currParentProperty, callback).filter(function (ea) {
1623
+ return ea && !ea.isParentSelector;
1624
+ });
1625
+ if (!result.length) {
1626
+ return wrap ? [] : undefined;
1627
+ }
1628
+ if (!wrap && result.length === 1 && !result[0].hasArrExpr) {
1629
+ return this._getPreferredOutput(result[0]);
1630
+ }
1631
+ return result.reduce((rslt, ea) => {
1632
+ const valOrPath = this._getPreferredOutput(ea);
1633
+ if (flatten && Array.isArray(valOrPath)) {
1634
+ rslt = rslt.concat(valOrPath);
1635
+ } else {
1636
+ rslt.push(valOrPath);
1637
+ }
1638
+ return rslt;
1639
+ }, []);
1640
+ };
1641
+
1642
+ // PRIVATE METHODS
1643
+
1644
+ JSONPath.prototype._getPreferredOutput = function (ea) {
1645
+ const resultType = this.currResultType;
1646
+ switch (resultType) {
1647
+ case 'all':
1648
+ {
1649
+ const path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
1650
+ ea.pointer = JSONPath.toPointer(path);
1651
+ ea.path = typeof ea.path === 'string' ? ea.path : JSONPath.toPathString(ea.path);
1652
+ return ea;
1653
+ }
1654
+ case 'value':
1655
+ case 'parent':
1656
+ case 'parentProperty':
1657
+ return ea[resultType];
1658
+ case 'path':
1659
+ return JSONPath.toPathString(ea[resultType]);
1660
+ case 'pointer':
1661
+ return JSONPath.toPointer(ea.path);
1662
+ default:
1663
+ throw new TypeError('Unknown result type');
1664
+ }
1665
+ };
1666
+ JSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {
1667
+ if (callback) {
1668
+ const preferredOutput = this._getPreferredOutput(fullRetObj);
1669
+ fullRetObj.path = typeof fullRetObj.path === 'string' ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path);
1670
+ // eslint-disable-next-line n/callback-return -- No need to return
1671
+ callback(preferredOutput, type, fullRetObj);
1672
+ }
1673
+ };
1674
+
1675
+ /**
1676
+ *
1677
+ * @param {string} expr
1678
+ * @param {JSONObject} val
1679
+ * @param {string} path
1680
+ * @param {object|GenericArray} parent
1681
+ * @param {string} parentPropName
1682
+ * @param {JSONPathCallback} callback
1683
+ * @param {boolean} hasArrExpr
1684
+ * @param {boolean} literalPriority
1685
+ * @returns {ReturnObject|ReturnObject[]}
1686
+ */
1687
+ JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
1688
+ // No expr to follow? return path and value as the result of
1689
+ // this trace branch
1690
+ let retObj;
1691
+ if (!expr.length) {
1692
+ retObj = {
1693
+ path,
1694
+ value: val,
1695
+ parent,
1696
+ parentProperty: parentPropName,
1697
+ hasArrExpr
1698
+ };
1699
+ this._handleCallback(retObj, callback, 'value');
1700
+ return retObj;
1701
+ }
1702
+ const loc = expr[0],
1703
+ x = expr.slice(1);
1704
+
1705
+ // We need to gather the return value of recursive trace calls in order to
1706
+ // do the parent sel computation.
1707
+ const ret = [];
1708
+ /**
1709
+ *
1710
+ * @param {ReturnObject|ReturnObject[]} elems
1711
+ * @returns {void}
1712
+ */
1713
+ function addRet(elems) {
1714
+ if (Array.isArray(elems)) {
1715
+ // This was causing excessive stack size in Node (with or
1716
+ // without Babel) against our performance test:
1717
+ // `ret.push(...elems);`
1718
+ elems.forEach(t => {
1719
+ ret.push(t);
1720
+ });
1721
+ } else {
1722
+ ret.push(elems);
1723
+ }
1724
+ }
1725
+ if ((typeof loc !== 'string' || literalPriority) && val && Object.hasOwn(val, loc)) {
1726
+ // simple case--directly follow property
1727
+ addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr));
1728
+ // eslint-disable-next-line unicorn/prefer-switch -- Part of larger `if`
1729
+ } else if (loc === '*') {
1730
+ // all child properties
1731
+ this._walk(val, m => {
1732
+ addRet(this._trace(x, val[m], push(path, m), val, m, callback, true, true));
1733
+ });
1734
+ } else if (loc === '..') {
1735
+ // all descendent parent properties
1736
+ // Check remaining expression with val's immediate children
1737
+ addRet(this._trace(x, val, path, parent, parentPropName, callback, hasArrExpr));
1738
+ this._walk(val, m => {
1739
+ // We don't join m and x here because we only want parents,
1740
+ // not scalar values
1741
+ if (typeof val[m] === 'object') {
1742
+ // Keep going with recursive descent on val's
1743
+ // object children
1744
+ addRet(this._trace(expr.slice(), val[m], push(path, m), val, m, callback, true));
1745
+ }
1746
+ });
1747
+ // The parent sel computation is handled in the frame above using the
1748
+ // ancestor object of val
1749
+ } else if (loc === '^') {
1750
+ // This is not a final endpoint, so we do not invoke the callback here
1751
+ this._hasParentSelector = true;
1752
+ return {
1753
+ path: path.slice(0, -1),
1754
+ expr: x,
1755
+ isParentSelector: true
1756
+ };
1757
+ } else if (loc === '~') {
1758
+ // property name
1759
+ retObj = {
1760
+ path: push(path, loc),
1761
+ value: parentPropName,
1762
+ parent,
1763
+ parentProperty: null
1764
+ };
1765
+ this._handleCallback(retObj, callback, 'property');
1766
+ return retObj;
1767
+ } else if (loc === '$') {
1768
+ // root only
1769
+ addRet(this._trace(x, val, path, null, null, callback, hasArrExpr));
1770
+ } else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(loc)) {
1771
+ // [start:end:step] Python slice syntax
1772
+ addRet(this._slice(loc, x, val, path, parent, parentPropName, callback));
1773
+ } else if (loc.indexOf('?(') === 0) {
1774
+ // [?(expr)] (filtering)
1775
+ if (this.currEval === false) {
1776
+ throw new Error('Eval [?(expr)] prevented in JSONPath expression.');
1777
+ }
1778
+ const safeLoc = loc.replace(/^\?\((.*?)\)$/u, '$1');
1779
+ // check for a nested filter expression
1780
+ const nested = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(safeLoc);
1781
+ if (nested) {
1782
+ // find if there are matches in the nested expression
1783
+ // add them to the result set if there is at least one match
1784
+ this._walk(val, m => {
1785
+ const npath = [nested[2]];
1786
+ const nvalue = nested[1] ? val[m][nested[1]] : val[m];
1787
+ const filterResults = this._trace(npath, nvalue, path, parent, parentPropName, callback, true);
1788
+ if (filterResults.length > 0) {
1789
+ addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
1790
+ }
1791
+ });
1792
+ } else {
1793
+ this._walk(val, m => {
1794
+ if (this._eval(safeLoc, val[m], m, path, parent, parentPropName)) {
1795
+ addRet(this._trace(x, val[m], push(path, m), val, m, callback, true));
1796
+ }
1797
+ });
1798
+ }
1799
+ } else if (loc[0] === '(') {
1800
+ // [(expr)] (dynamic property/index)
1801
+ if (this.currEval === false) {
1802
+ throw new Error('Eval [(expr)] prevented in JSONPath expression.');
1803
+ }
1804
+ // As this will resolve to a property name (but we don't know it
1805
+ // yet), property and parent information is relative to the
1806
+ // parent of the property to which this expression will resolve
1807
+ addRet(this._trace(unshift(this._eval(loc, val, path.at(-1), path.slice(0, -1), parent, parentPropName), x), val, path, parent, parentPropName, callback, hasArrExpr));
1808
+ } else if (loc[0] === '@') {
1809
+ // value type: @boolean(), etc.
1810
+ let addType = false;
1811
+ const valueType = loc.slice(1, -2);
1812
+ switch (valueType) {
1813
+ case 'scalar':
1814
+ if (!val || !['object', 'function'].includes(typeof val)) {
1815
+ addType = true;
1816
+ }
1817
+ break;
1818
+ case 'boolean':
1819
+ case 'string':
1820
+ case 'undefined':
1821
+ case 'function':
1822
+ if (typeof val === valueType) {
1823
+ addType = true;
1824
+ }
1825
+ break;
1826
+ case 'integer':
1827
+ if (Number.isFinite(val) && !(val % 1)) {
1828
+ addType = true;
1829
+ }
1830
+ break;
1831
+ case 'number':
1832
+ if (Number.isFinite(val)) {
1833
+ addType = true;
1834
+ }
1835
+ break;
1836
+ case 'nonFinite':
1837
+ if (typeof val === 'number' && !Number.isFinite(val)) {
1838
+ addType = true;
1839
+ }
1840
+ break;
1841
+ case 'object':
1842
+ if (val && typeof val === valueType) {
1843
+ addType = true;
1844
+ }
1845
+ break;
1846
+ case 'array':
1847
+ if (Array.isArray(val)) {
1848
+ addType = true;
1849
+ }
1850
+ break;
1851
+ case 'other':
1852
+ addType = this.currOtherTypeCallback(val, path, parent, parentPropName);
1853
+ break;
1854
+ case 'null':
1855
+ if (val === null) {
1856
+ addType = true;
1857
+ }
1858
+ break;
1859
+ /* c8 ignore next 2 */
1860
+ default:
1861
+ throw new TypeError('Unknown value type ' + valueType);
1862
+ }
1863
+ if (addType) {
1864
+ retObj = {
1865
+ path,
1866
+ value: val,
1867
+ parent,
1868
+ parentProperty: parentPropName
1869
+ };
1870
+ this._handleCallback(retObj, callback, 'value');
1871
+ return retObj;
1872
+ }
1873
+ // `-escaped property
1874
+ } else if (loc[0] === '`' && val && Object.hasOwn(val, loc.slice(1))) {
1875
+ const locProp = loc.slice(1);
1876
+ addRet(this._trace(x, val[locProp], push(path, locProp), val, locProp, callback, hasArrExpr, true));
1877
+ } else if (loc.includes(',')) {
1878
+ // [name1,name2,...]
1879
+ const parts = loc.split(',');
1880
+ for (const part of parts) {
1881
+ addRet(this._trace(unshift(part, x), val, path, parent, parentPropName, callback, true));
1882
+ }
1883
+ // simple case--directly follow property
1884
+ } else if (!literalPriority && val && Object.hasOwn(val, loc)) {
1885
+ addRet(this._trace(x, val[loc], push(path, loc), val, loc, callback, hasArrExpr, true));
1886
+ }
1887
+
1888
+ // We check the resulting values for parent selections. For parent
1889
+ // selections we discard the value object and continue the trace with the
1890
+ // current val object
1891
+ if (this._hasParentSelector) {
1892
+ for (let t = 0; t < ret.length; t++) {
1893
+ const rett = ret[t];
1894
+ if (rett && rett.isParentSelector) {
1895
+ const tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
1896
+ if (Array.isArray(tmp)) {
1897
+ ret[t] = tmp[0];
1898
+ const tl = tmp.length;
1899
+ for (let tt = 1; tt < tl; tt++) {
1900
+ // eslint-disable-next-line @stylistic/max-len -- Long
1901
+ // eslint-disable-next-line sonarjs/updated-loop-counter -- Convenient
1902
+ t++;
1903
+ ret.splice(t, 0, tmp[tt]);
1904
+ }
1905
+ } else {
1906
+ ret[t] = tmp;
1907
+ }
1908
+ }
1909
+ }
1910
+ }
1911
+ return ret;
1912
+ };
1913
+ JSONPath.prototype._walk = function (val, f) {
1914
+ if (Array.isArray(val)) {
1915
+ const n = val.length;
1916
+ for (let i = 0; i < n; i++) {
1917
+ f(i);
1918
+ }
1919
+ } else if (val && typeof val === 'object') {
1920
+ Object.keys(val).forEach(m => {
1921
+ f(m);
1922
+ });
1923
+ }
1924
+ };
1925
+ JSONPath.prototype._slice = function (loc, expr, val, path, parent, parentPropName, callback) {
1926
+ if (!Array.isArray(val)) {
1927
+ return undefined;
1928
+ }
1929
+ const len = val.length,
1930
+ parts = loc.split(':'),
1931
+ step = parts[2] && Number.parseInt(parts[2]) || 1;
1932
+ let start = parts[0] && Number.parseInt(parts[0]) || 0,
1933
+ end = parts[1] && Number.parseInt(parts[1]) || len;
1934
+ start = start < 0 ? Math.max(0, start + len) : Math.min(len, start);
1935
+ end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);
1936
+ const ret = [];
1937
+ for (let i = start; i < end; i += step) {
1938
+ const tmp = this._trace(unshift(i, expr), val, path, parent, parentPropName, callback, true);
1939
+ // Should only be possible to be an array here since first part of
1940
+ // ``unshift(i, expr)` passed in above would not be empty, nor `~`,
1941
+ // nor begin with `@` (as could return objects)
1942
+ // This was causing excessive stack size in Node (with or
1943
+ // without Babel) against our performance test: `ret.push(...tmp);`
1944
+ tmp.forEach(t => {
1945
+ ret.push(t);
1946
+ });
1947
+ }
1948
+ return ret;
1949
+ };
1950
+ JSONPath.prototype._eval = function (code, _v, _vname, path, parent, parentPropName) {
1951
+ this.currSandbox._$_parentProperty = parentPropName;
1952
+ this.currSandbox._$_parent = parent;
1953
+ this.currSandbox._$_property = _vname;
1954
+ this.currSandbox._$_root = this.json;
1955
+ this.currSandbox._$_v = _v;
1956
+ const containsPath = code.includes('@path');
1957
+ if (containsPath) {
1958
+ this.currSandbox._$_path = JSONPath.toPathString(path.concat([_vname]));
1959
+ }
1960
+ const scriptCacheKey = this.currEval + 'Script:' + code;
1961
+ if (!JSONPath.cache[scriptCacheKey]) {
1962
+ let script = code.replaceAll('@parentProperty', '_$_parentProperty').replaceAll('@parent', '_$_parent').replaceAll('@property', '_$_property').replaceAll('@root', '_$_root').replaceAll(/@([.\s)[])/gu, '_$_v$1');
1963
+ if (containsPath) {
1964
+ script = script.replaceAll('@path', '_$_path');
1965
+ }
1966
+ if (this.currEval === 'safe' || this.currEval === true || this.currEval === undefined) {
1967
+ JSONPath.cache[scriptCacheKey] = new this.safeVm.Script(script);
1968
+ } else if (this.currEval === 'native') {
1969
+ JSONPath.cache[scriptCacheKey] = new this.vm.Script(script);
1970
+ } else if (typeof this.currEval === 'function' && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, 'runInNewContext')) {
1971
+ const CurrEval = this.currEval;
1972
+ JSONPath.cache[scriptCacheKey] = new CurrEval(script);
1973
+ } else if (typeof this.currEval === 'function') {
1974
+ JSONPath.cache[scriptCacheKey] = {
1975
+ runInNewContext: context => this.currEval(script, context)
1976
+ };
1977
+ } else {
1978
+ throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
1979
+ }
1980
+ }
1981
+ try {
1982
+ return JSONPath.cache[scriptCacheKey].runInNewContext(this.currSandbox);
1983
+ } catch (e) {
1984
+ if (this.ignoreEvalErrors) {
1985
+ return false;
1986
+ }
1987
+ throw new Error('jsonPath: ' + e.message + ': ' + code);
1988
+ }
1989
+ };
1990
+
1991
+ // PUBLIC CLASS PROPERTIES AND METHODS
1992
+
1993
+ // Could store the cache object itself
1994
+ JSONPath.cache = {};
1995
+
1996
+ /**
1997
+ * @param {string[]} pathArr Array to convert
1998
+ * @returns {string} The path string
1999
+ */
2000
+ JSONPath.toPathString = function (pathArr) {
2001
+ const x = pathArr,
2002
+ n = x.length;
2003
+ let p = '$';
2004
+ for (let i = 1; i < n; i++) {
2005
+ if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
2006
+ p += /^[0-9*]+$/u.test(x[i]) ? '[' + x[i] + ']' : "['" + x[i] + "']";
2007
+ }
2008
+ }
2009
+ return p;
2010
+ };
2011
+
2012
+ /**
2013
+ * @param {string} pointer JSON Path
2014
+ * @returns {string} JSON Pointer
2015
+ */
2016
+ JSONPath.toPointer = function (pointer) {
2017
+ const x = pointer,
2018
+ n = x.length;
2019
+ let p = '';
2020
+ for (let i = 1; i < n; i++) {
2021
+ if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
2022
+ p += '/' + x[i].toString().replaceAll('~', '~0').replaceAll('/', '~1');
2023
+ }
2024
+ }
2025
+ return p;
2026
+ };
2027
+
2028
+ /**
2029
+ * @param {string} expr Expression to convert
2030
+ * @returns {string[]}
2031
+ */
2032
+ JSONPath.toPathArray = function (expr) {
2033
+ const {
2034
+ cache
2035
+ } = JSONPath;
2036
+ if (cache[expr]) {
2037
+ return cache[expr].concat();
2038
+ }
2039
+ const subx = [];
2040
+ const normalized = expr
2041
+ // Properties
2042
+ .replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ';$&;')
2043
+ // Parenthetical evaluations (filtering and otherwise), directly
2044
+ // within brackets or single quotes
2045
+ .replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function ($0, $1) {
2046
+ return '[#' + (subx.push($1) - 1) + ']';
2047
+ })
2048
+ // Escape periods and tildes within properties
2049
+ .replaceAll(/\[['"]([^'\]]*)['"]\]/gu, function ($0, prop) {
2050
+ return "['" + prop.replaceAll('.', '%@%').replaceAll('~', '%%@@%%') + "']";
2051
+ })
2052
+ // Properties operator
2053
+ .replaceAll('~', ';~;')
2054
+ // Split by property boundaries
2055
+ .replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ';')
2056
+ // Reinsert periods within properties
2057
+ .replaceAll('%@%', '.')
2058
+ // Reinsert tildes within properties
2059
+ .replaceAll('%%@@%%', '~')
2060
+ // Parent
2061
+ .replaceAll(/(?:;)?(\^+)(?:;)?/gu, function ($0, ups) {
2062
+ return ';' + ups.split('').join(';') + ';';
2063
+ })
2064
+ // Descendents
2065
+ .replaceAll(/;;;|;;/gu, ';..;')
2066
+ // Remove trailing
2067
+ .replaceAll(/;$|'?\]|'$/gu, '');
2068
+ const exprList = normalized.split(';').map(function (exp) {
2069
+ const match = exp.match(/#(\d+)/u);
2070
+ return !match || !match[1] ? exp : subx[match[1]];
2071
+ });
2072
+ cache[expr] = exprList;
2073
+ return cache[expr].concat();
2074
+ };
2075
+ JSONPath.prototype.safeVm = {
2076
+ Script: SafeScript
2077
+ };
2078
+
2079
+ /**
2080
+ * @typedef {any} ContextItem
2081
+ */
2082
+
2083
+ /**
2084
+ * @typedef {any} EvaluatedResult
2085
+ */
2086
+
2087
+ /**
2088
+ * @callback ConditionCallback
2089
+ * @param {ContextItem} item
2090
+ * @returns {boolean}
2091
+ */
2092
+
2093
+ /**
2094
+ * Copy items out of one array into another.
2095
+ * @param {GenericArray} source Array with items to copy
2096
+ * @param {GenericArray} target Array to which to copy
2097
+ * @param {ConditionCallback} conditionCb Callback passed the current item;
2098
+ * will move item if evaluates to `true`
2099
+ * @returns {void}
2100
+ */
2101
+ const moveToAnotherArray = function (source, target, conditionCb) {
2102
+ const il = source.length;
2103
+ for (let i = 0; i < il; i++) {
2104
+ const item = source[i];
2105
+ if (conditionCb(item)) {
2106
+ // eslint-disable-next-line @stylistic/max-len -- Long
2107
+ // eslint-disable-next-line sonarjs/updated-loop-counter -- Convenient
2108
+ target.push(source.splice(i--, 1)[0]);
2109
+ }
2110
+ }
2111
+ };
2112
+
2113
+ /**
2114
+ * In-browser replacement for NodeJS' VM.Script.
2115
+ */
2116
+ class Script {
2117
+ /**
2118
+ * @param {string} expr Expression to evaluate
2119
+ */
2120
+ constructor(expr) {
2121
+ this.code = expr;
2122
+ }
2123
+
2124
+ /**
2125
+ * @param {object} context Object whose items will be added
2126
+ * to evaluation
2127
+ * @returns {EvaluatedResult} Result of evaluated code
2128
+ */
2129
+ runInNewContext(context) {
2130
+ let expr = this.code;
2131
+ const keys = Object.keys(context);
2132
+ const funcs = [];
2133
+ moveToAnotherArray(keys, funcs, key => {
2134
+ return typeof context[key] === 'function';
2135
+ });
2136
+ const values = keys.map(vr => {
2137
+ return context[vr];
2138
+ });
2139
+ const funcString = funcs.reduce((s, func) => {
2140
+ let fString = context[func].toString();
2141
+ if (!/function/u.test(fString)) {
2142
+ fString = 'function ' + fString;
2143
+ }
2144
+ return 'var ' + func + '=' + fString + ';' + s;
2145
+ }, '');
2146
+ expr = funcString + expr;
2147
+
2148
+ // Mitigate http://perfectionkills.com/global-eval-what-are-the-options/#new_function
2149
+ if (!/(['"])use strict\1/u.test(expr) && !keys.includes('arguments')) {
2150
+ expr = 'var arguments = undefined;' + expr;
2151
+ }
2152
+
2153
+ // Remove last semi so `return` will be inserted before
2154
+ // the previous one instead, allowing for the return
2155
+ // of a bare ending expression
2156
+ expr = expr.replace(/;\s*$/u, '');
2157
+
2158
+ // Insert `return`
2159
+ const lastStatementEnd = expr.lastIndexOf(';');
2160
+ const code = lastStatementEnd !== -1 ? expr.slice(0, lastStatementEnd + 1) + ' return ' + expr.slice(lastStatementEnd + 1) : ' return ' + expr;
2161
+
2162
+ // eslint-disable-next-line no-new-func -- User's choice
2163
+ return new Function(...keys, code)(...values);
2164
+ }
2165
+ }
2166
+ JSONPath.prototype.vm = {
2167
+ Script
2168
+ };
2169
+
2170
+ exports.JSONPath = JSONPath;
2171
+
2172
+ }));