lakutata 2.0.81 → 2.0.82

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 (369) hide show
  1. package/orm.cjs +731 -731
  2. package/orm.mjs +835 -835
  3. package/package.json +1 -1
  4. package/src/components/Database.cjs +2 -2
  5. package/src/components/Database.mjs +6 -6
  6. package/src/components/cacher/Cacher.cjs +129 -129
  7. package/src/components/cacher/Cacher.mjs +117 -117
  8. package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +94 -94
  9. package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +100 -100
  10. package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.cjs +12 -12
  11. package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.mjs +11 -11
  12. package/src/components/cacher/adapters/CreateMongoCacheAdapter.cjs +16 -16
  13. package/src/components/cacher/adapters/CreateMongoCacheAdapter.mjs +14 -14
  14. package/src/components/cacher/adapters/CreateMysqlCacheAdapter.cjs +11 -11
  15. package/src/components/cacher/adapters/CreateMysqlCacheAdapter.mjs +11 -11
  16. package/src/components/cacher/adapters/CreatePostgresCacheAdapter.cjs +12 -12
  17. package/src/components/cacher/adapters/CreatePostgresCacheAdapter.mjs +13 -13
  18. package/src/components/cacher/adapters/CreateRedisCacheAdapter.cjs +2 -2
  19. package/src/components/cacher/adapters/CreateRedisCacheAdapter.mjs +2 -2
  20. package/src/components/cacher/adapters/CreateSqliteCacheAdapter.cjs +10 -10
  21. package/src/components/cacher/adapters/CreateSqliteCacheAdapter.mjs +10 -10
  22. package/src/components/cacher/lib/IsDriverPackageInstalled.cjs +2 -2
  23. package/src/components/cacher/lib/IsDriverPackageInstalled.mjs +5 -5
  24. package/src/components/docker/ConnectionOptionsBuilder.cjs +10 -10
  25. package/src/components/docker/ConnectionOptionsBuilder.mjs +6 -6
  26. package/src/components/docker/Docker.cjs +1687 -1687
  27. package/src/components/docker/Docker.mjs +1563 -1563
  28. package/src/components/docker/lib/ParseEnvToRecord.cjs +2 -2
  29. package/src/components/docker/lib/ParseEnvToRecord.mjs +12 -12
  30. package/src/components/docker/lib/ParseRepositoryTag.cjs +9 -9
  31. package/src/components/docker/lib/ParseRepositoryTag.mjs +11 -11
  32. package/src/components/entrypoint/Entrypoint.cjs +1789 -1789
  33. package/src/components/entrypoint/Entrypoint.mjs +1632 -1632
  34. package/src/components/monitor/AliveMonitor.cjs +2 -2
  35. package/src/components/monitor/AliveMonitor.mjs +2 -2
  36. package/src/components/monitor/MemoryMonitor.cjs +3 -3
  37. package/src/decorators/asst/After.cjs +3 -3
  38. package/src/decorators/asst/After.mjs +2 -2
  39. package/src/decorators/asst/Before.cjs +2 -2
  40. package/src/decorators/asst/Before.mjs +4 -4
  41. package/src/decorators/ctrl/CLIAction.cjs +2 -2
  42. package/src/decorators/ctrl/CLIAction.mjs +7 -7
  43. package/src/decorators/ctrl/HTTPAction.cjs +6 -6
  44. package/src/decorators/ctrl/HTTPAction.mjs +4 -4
  45. package/src/decorators/ctrl/ServiceAction.cjs +3 -3
  46. package/src/decorators/ctrl/ServiceAction.mjs +4 -4
  47. package/src/decorators/ctrl/http/DELETE.cjs +2 -2
  48. package/src/decorators/ctrl/http/DELETE.mjs +2 -2
  49. package/src/decorators/ctrl/http/GET.cjs +2 -2
  50. package/src/decorators/ctrl/http/GET.mjs +2 -2
  51. package/src/decorators/ctrl/http/HEAD.cjs +2 -2
  52. package/src/decorators/ctrl/http/HEAD.mjs +2 -2
  53. package/src/decorators/ctrl/http/OPTIONS.cjs +2 -2
  54. package/src/decorators/ctrl/http/OPTIONS.mjs +2 -2
  55. package/src/decorators/ctrl/http/PATCH.cjs +2 -2
  56. package/src/decorators/ctrl/http/PATCH.mjs +2 -2
  57. package/src/decorators/ctrl/http/POST.cjs +2 -2
  58. package/src/decorators/ctrl/http/POST.mjs +2 -2
  59. package/src/decorators/ctrl/http/PUT.cjs +2 -2
  60. package/src/decorators/ctrl/http/PUT.mjs +2 -2
  61. package/src/decorators/di/Autoload.cjs +2 -2
  62. package/src/decorators/di/Autoload.mjs +2 -2
  63. package/src/decorators/di/Configurable.cjs +3 -3
  64. package/src/decorators/di/Configurable.mjs +2 -2
  65. package/src/decorators/di/Inject.cjs +6 -6
  66. package/src/decorators/di/Inject.mjs +11 -11
  67. package/src/decorators/di/Lifetime.cjs +18 -18
  68. package/src/decorators/di/Lifetime.mjs +13 -13
  69. package/src/decorators/dto/Accept.cjs +3 -3
  70. package/src/decorators/dto/Accept.mjs +2 -2
  71. package/src/decorators/dto/Expect.cjs +2 -2
  72. package/src/decorators/dto/Expect.mjs +3 -3
  73. package/src/decorators/dto/IndexSignature.cjs +2 -2
  74. package/src/decorators/dto/IndexSignature.mjs +3 -3
  75. package/src/decorators/dto/Return.cjs +3 -3
  76. package/src/decorators/dto/Return.mjs +2 -2
  77. package/src/lib/base/EventEmitter.cjs +238 -238
  78. package/src/lib/base/EventEmitter.mjs +221 -221
  79. package/src/lib/base/async-constructor/Append.cjs +11 -11
  80. package/src/lib/base/async-constructor/Append.mjs +7 -7
  81. package/src/lib/base/internal/BasicInfo.cjs +10 -10
  82. package/src/lib/base/internal/BasicInfo.mjs +9 -9
  83. package/src/lib/base/internal/CamelCase.cjs +4 -4
  84. package/src/lib/base/internal/CamelCase.mjs +11 -11
  85. package/src/lib/base/internal/ConfigurableRecordsInjection.cjs +19 -19
  86. package/src/lib/base/internal/ConfigurableRecordsInjection.mjs +18 -18
  87. package/src/lib/base/internal/ConstructorSymbol.cjs +10 -10
  88. package/src/lib/base/internal/ConstructorSymbol.mjs +8 -8
  89. package/src/lib/base/internal/ControllerEntrypoint.cjs +65 -65
  90. package/src/lib/base/internal/ControllerEntrypoint.mjs +36 -36
  91. package/src/lib/base/internal/DataValidator.cjs +70 -70
  92. package/src/lib/base/internal/DataValidator.mjs +137 -137
  93. package/src/lib/base/internal/GetActionDTOAndOptions.cjs +9 -9
  94. package/src/lib/base/internal/GetActionDTOAndOptions.mjs +10 -10
  95. package/src/lib/base/internal/IEEE754.cjs +74 -74
  96. package/src/lib/base/internal/IEEE754.mjs +70 -70
  97. package/src/lib/base/internal/MethodAssistantFunction.cjs +28 -28
  98. package/src/lib/base/internal/MethodAssistantFunction.mjs +38 -38
  99. package/src/lib/base/internal/MethodValidation.cjs +25 -25
  100. package/src/lib/base/internal/MethodValidation.mjs +20 -20
  101. package/src/lib/base/internal/ObjectConfiguration.cjs +10 -10
  102. package/src/lib/base/internal/ObjectConfiguration.mjs +15 -15
  103. package/src/lib/base/internal/ObjectContainer.cjs +7 -7
  104. package/src/lib/base/internal/ObjectContainer.mjs +6 -6
  105. package/src/lib/base/internal/ObjectInjection.cjs +16 -16
  106. package/src/lib/base/internal/ObjectInjection.mjs +13 -13
  107. package/src/lib/base/internal/ObjectLifetime.cjs +10 -10
  108. package/src/lib/base/internal/ObjectLifetime.mjs +9 -9
  109. package/src/lib/base/internal/ObjectWeakRefs.cjs +11 -11
  110. package/src/lib/base/internal/ObjectWeakRefs.mjs +9 -9
  111. package/src/lib/base/internal/PatternManager.cjs +235 -235
  112. package/src/lib/base/internal/PatternManager.mjs +233 -233
  113. package/src/lib/base/internal/StringifyPattern.cjs +26 -26
  114. package/src/lib/base/internal/StringifyPattern.mjs +26 -26
  115. package/src/lib/base/internal/ThrowWarning.cjs +2 -2
  116. package/src/lib/base/internal/ThrowWarning.mjs +2 -2
  117. package/src/lib/core/Alias.cjs +5 -5
  118. package/src/lib/core/Application.cjs +57 -57
  119. package/src/lib/core/Application.mjs +63 -63
  120. package/src/lib/helpers/ArrayToSet.cjs +2 -2
  121. package/src/lib/helpers/ArrayToSet.mjs +3 -3
  122. package/src/lib/helpers/As.cjs +2 -2
  123. package/src/lib/helpers/As.mjs +2 -2
  124. package/src/lib/helpers/ConvertArrayLikeToIterable.cjs +3 -3
  125. package/src/lib/helpers/ConvertArrayLikeToIterable.mjs +3 -3
  126. package/src/lib/helpers/ConvertArrayLikeToStream.cjs +2 -2
  127. package/src/lib/helpers/ConvertArrayLikeToStream.mjs +2 -2
  128. package/src/lib/helpers/Delay.cjs +2 -2
  129. package/src/lib/helpers/Delay.mjs +2 -2
  130. package/src/lib/helpers/DevNull.cjs +2 -2
  131. package/src/lib/helpers/DevNull.mjs +2 -2
  132. package/src/lib/helpers/GetObjectNestingDepth.cjs +12 -12
  133. package/src/lib/helpers/GetObjectNestingDepth.mjs +11 -11
  134. package/src/lib/helpers/GetObjectPropertyPaths.cjs +7 -7
  135. package/src/lib/helpers/GetObjectPropertyPaths.mjs +9 -9
  136. package/src/lib/helpers/Glob.cjs +890 -890
  137. package/src/lib/helpers/Glob.mjs +889 -889
  138. package/src/lib/helpers/GraceExit.cjs +3 -3
  139. package/src/lib/helpers/GraceExit.mjs +7 -7
  140. package/src/lib/helpers/HexToIEEE754.cjs +4 -4
  141. package/src/lib/helpers/HexToIEEE754.mjs +2 -2
  142. package/src/lib/helpers/HexToSigned.cjs +5 -5
  143. package/src/lib/helpers/HexToSigned.mjs +4 -4
  144. package/src/lib/helpers/HexToUnsigned.cjs +2 -2
  145. package/src/lib/helpers/HexToUnsigned.mjs +2 -2
  146. package/src/lib/helpers/IEEE754ToHex.cjs +5 -5
  147. package/src/lib/helpers/IEEE754ToHex.mjs +5 -5
  148. package/src/lib/helpers/IsAbortError.cjs +2 -2
  149. package/src/lib/helpers/IsAbortError.mjs +3 -3
  150. package/src/lib/helpers/IsEmptyObject.cjs +3 -3
  151. package/src/lib/helpers/IsEmptyObject.mjs +3 -3
  152. package/src/lib/helpers/IsExists.cjs +5 -5
  153. package/src/lib/helpers/IsExists.mjs +4 -4
  154. package/src/lib/helpers/IsHtml.cjs +23 -7
  155. package/src/lib/helpers/IsHtml.mjs +23 -7
  156. package/src/lib/helpers/IsNativeFunction.cjs +2 -2
  157. package/src/lib/helpers/IsNativeFunction.mjs +2 -2
  158. package/src/lib/helpers/IsPath.cjs +2 -2
  159. package/src/lib/helpers/IsPath.mjs +5 -5
  160. package/src/lib/helpers/IsPromise.cjs +2 -2
  161. package/src/lib/helpers/IsPromise.mjs +2 -2
  162. package/src/lib/helpers/IsPromiseLike.cjs +5 -5
  163. package/src/lib/helpers/IsPromiseLike.mjs +6 -6
  164. package/src/lib/helpers/IsXML.cjs +1502 -1650
  165. package/src/lib/helpers/IsXML.mjs +1500 -1648
  166. package/src/lib/helpers/MD5.cjs +2 -2
  167. package/src/lib/helpers/MD5.mjs +2 -2
  168. package/src/lib/helpers/MergeArray.cjs +3 -3
  169. package/src/lib/helpers/MergeArray.mjs +3 -3
  170. package/src/lib/helpers/MergeMap.cjs +3 -3
  171. package/src/lib/helpers/MergeMap.mjs +3 -3
  172. package/src/lib/helpers/MergeSet.cjs +2 -2
  173. package/src/lib/helpers/MergeSet.mjs +3 -3
  174. package/src/lib/helpers/NoCase.cjs +27 -27
  175. package/src/lib/helpers/NoCase.mjs +24 -24
  176. package/src/lib/helpers/NonceStr.cjs +2 -2
  177. package/src/lib/helpers/NonceStr.mjs +2 -2
  178. package/src/lib/helpers/ObjectConstructor.cjs +2 -2
  179. package/src/lib/helpers/ObjectConstructor.mjs +4 -4
  180. package/src/lib/helpers/ObjectHash.cjs +234 -234
  181. package/src/lib/helpers/ObjectHash.mjs +227 -227
  182. package/src/lib/helpers/ObjectParentConstructor.cjs +2 -2
  183. package/src/lib/helpers/ObjectParentConstructor.mjs +5 -5
  184. package/src/lib/helpers/ObjectParentConstructors.cjs +6 -6
  185. package/src/lib/helpers/ObjectParentConstructors.mjs +2 -2
  186. package/src/lib/helpers/ObjectPrototype.cjs +2 -2
  187. package/src/lib/helpers/ObjectPrototype.mjs +2 -2
  188. package/src/lib/helpers/ObjectToMap.cjs +2 -2
  189. package/src/lib/helpers/ObjectToMap.mjs +3 -3
  190. package/src/lib/helpers/Paginator.cjs +2 -2
  191. package/src/lib/helpers/Paginator.mjs +6 -6
  192. package/src/lib/helpers/RandomString.cjs +82 -82
  193. package/src/lib/helpers/RandomString.mjs +67 -67
  194. package/src/lib/helpers/SHA1.cjs +2 -2
  195. package/src/lib/helpers/SHA1.mjs +2 -2
  196. package/src/lib/helpers/SHA256.cjs +2 -2
  197. package/src/lib/helpers/SHA256.mjs +2 -2
  198. package/src/lib/helpers/SetToArray.cjs +2 -2
  199. package/src/lib/helpers/SetToArray.mjs +2 -2
  200. package/src/lib/helpers/SignedToHex.cjs +4 -4
  201. package/src/lib/helpers/SignedToHex.mjs +4 -4
  202. package/src/lib/helpers/SortArray.cjs +16 -16
  203. package/src/lib/helpers/SortArray.mjs +15 -15
  204. package/src/lib/helpers/SortKeys.cjs +41 -41
  205. package/src/lib/helpers/SortKeys.mjs +41 -41
  206. package/src/lib/helpers/SortObject.cjs +2 -2
  207. package/src/lib/helpers/SortObject.mjs +2 -2
  208. package/src/lib/helpers/Templating.cjs +25 -25
  209. package/src/lib/helpers/Templating.mjs +25 -25
  210. package/src/lib/helpers/URLBuilder.cjs +234 -234
  211. package/src/lib/helpers/URLBuilder.mjs +231 -231
  212. package/src/lib/helpers/UniqueArray.cjs +3 -3
  213. package/src/lib/helpers/UniqueArray.mjs +2 -2
  214. package/src/lib/helpers/UnsignedToHex.cjs +3 -3
  215. package/src/lib/helpers/UnsignedToHex.mjs +3 -3
  216. package/src/lib/ioc/DependencyInjectionContainer.cjs +106 -106
  217. package/src/lib/ioc/DependencyInjectionContainer.mjs +122 -122
  218. package/src/lib/ioc/FunctionTokenizer.cjs +115 -115
  219. package/src/lib/ioc/FunctionTokenizer.mjs +102 -102
  220. package/src/lib/ioc/Lifetime.cjs +5 -5
  221. package/src/lib/ioc/Lifetime.mjs +5 -5
  222. package/src/lib/ioc/ListModules.cjs +3359 -3359
  223. package/src/lib/ioc/ListModules.mjs +2274 -2274
  224. package/src/lib/ioc/LoadModules.cjs +56 -56
  225. package/src/lib/ioc/LoadModules.mjs +69 -69
  226. package/src/lib/ioc/ParamParser.cjs +30 -30
  227. package/src/lib/ioc/ParamParser.mjs +41 -41
  228. package/src/lib/ioc/Resolvers.cjs +87 -87
  229. package/src/lib/ioc/Resolvers.mjs +109 -109
  230. package/src/lib/ioc/Utils.cjs +12 -12
  231. package/src/lib/ioc/Utils.mjs +18 -18
  232. package/src/lib/validation/VLD.cjs +1124 -1124
  233. package/src/lib/validation/VLD.mjs +1113 -1113
  234. package/src/providers/Database.cjs +2 -2
  235. package/src/providers/Database.mjs +7 -7
  236. package/src/providers/PasswordHash.cjs +330 -330
  237. package/src/providers/PasswordHash.mjs +397 -397
  238. package/vendor/Package.1.cjs +256 -256
  239. package/vendor/Package.1.mjs +254 -254
  240. package/vendor/Package.112.cjs +32208 -32208
  241. package/vendor/Package.112.mjs +32111 -32111
  242. package/vendor/Package.13.cjs +36 -36
  243. package/vendor/Package.13.mjs +24 -24
  244. package/vendor/Package.16.cjs +10312 -10312
  245. package/vendor/Package.16.mjs +10309 -10309
  246. package/vendor/Package.17.cjs +924 -924
  247. package/vendor/Package.17.mjs +943 -943
  248. package/vendor/Package.18.cjs +19 -19
  249. package/vendor/Package.18.mjs +21 -21
  250. package/vendor/Package.19.cjs +19 -19
  251. package/vendor/Package.19.mjs +20 -20
  252. package/vendor/Package.2.cjs +3913 -3913
  253. package/vendor/Package.2.mjs +3931 -3931
  254. package/vendor/Package.20.cjs +16 -16
  255. package/vendor/Package.20.mjs +12 -12
  256. package/vendor/Package.21.cjs +19 -19
  257. package/vendor/Package.21.mjs +17 -17
  258. package/vendor/Package.22.cjs +11 -11
  259. package/vendor/Package.22.mjs +12 -12
  260. package/vendor/Package.23.cjs +8 -8
  261. package/vendor/Package.23.mjs +12 -12
  262. package/vendor/Package.24.cjs +16 -16
  263. package/vendor/Package.24.mjs +14 -14
  264. package/vendor/Package.25.cjs +11 -11
  265. package/vendor/Package.25.mjs +12 -12
  266. package/vendor/Package.26.cjs +19 -19
  267. package/vendor/Package.26.mjs +12 -12
  268. package/vendor/Package.27.cjs +16 -16
  269. package/vendor/Package.27.mjs +6 -6
  270. package/vendor/Package.28.cjs +19 -19
  271. package/vendor/Package.28.mjs +17 -17
  272. package/vendor/Package.29.cjs +15 -15
  273. package/vendor/Package.29.mjs +13 -13
  274. package/vendor/Package.3.cjs +60 -60
  275. package/vendor/Package.3.mjs +85 -85
  276. package/vendor/Package.30.cjs +9 -9
  277. package/vendor/Package.30.mjs +9 -9
  278. package/vendor/Package.31.cjs +14 -14
  279. package/vendor/Package.31.mjs +27 -27
  280. package/vendor/Package.32.cjs +11 -11
  281. package/vendor/Package.32.mjs +11 -11
  282. package/vendor/Package.33.cjs +4 -4
  283. package/vendor/Package.33.mjs +6 -6
  284. package/vendor/Package.34.cjs +10 -10
  285. package/vendor/Package.34.mjs +23 -23
  286. package/vendor/Package.35.cjs +6 -6
  287. package/vendor/Package.35.mjs +16 -16
  288. package/vendor/Package.36.cjs +17 -17
  289. package/vendor/Package.36.mjs +21 -21
  290. package/vendor/Package.37.cjs +15 -15
  291. package/vendor/Package.37.mjs +17 -17
  292. package/vendor/Package.38.cjs +12 -12
  293. package/vendor/Package.38.mjs +16 -16
  294. package/vendor/Package.39.cjs +17 -17
  295. package/vendor/Package.39.mjs +13 -13
  296. package/vendor/Package.4.cjs +412 -412
  297. package/vendor/Package.4.mjs +537 -537
  298. package/vendor/Package.40.cjs +5 -5
  299. package/vendor/Package.40.mjs +6 -6
  300. package/vendor/Package.41.cjs +18 -18
  301. package/vendor/Package.41.mjs +17 -17
  302. package/vendor/Package.42.cjs +24 -24
  303. package/vendor/Package.42.mjs +17 -17
  304. package/vendor/Package.43.cjs +5 -5
  305. package/vendor/Package.43.mjs +19 -19
  306. package/vendor/Package.44.cjs +16 -16
  307. package/vendor/Package.44.mjs +13 -13
  308. package/vendor/Package.45.cjs +21 -21
  309. package/vendor/Package.45.mjs +22 -22
  310. package/vendor/Package.46.cjs +6 -6
  311. package/vendor/Package.46.mjs +22 -22
  312. package/vendor/Package.47.cjs +16 -16
  313. package/vendor/Package.47.mjs +29 -29
  314. package/vendor/Package.48.cjs +8 -8
  315. package/vendor/Package.48.mjs +16 -16
  316. package/vendor/Package.49.cjs +6 -6
  317. package/vendor/Package.49.mjs +20 -20
  318. package/vendor/Package.5.cjs +10 -10
  319. package/vendor/Package.5.mjs +9 -9
  320. package/vendor/Package.50.cjs +13 -13
  321. package/vendor/Package.50.mjs +14 -14
  322. package/vendor/Package.51.cjs +18 -18
  323. package/vendor/Package.51.mjs +23 -23
  324. package/vendor/Package.52.cjs +4 -4
  325. package/vendor/Package.52.mjs +5 -5
  326. package/vendor/Package.53.cjs +6 -6
  327. package/vendor/Package.53.mjs +8 -8
  328. package/vendor/Package.54.cjs +30 -30
  329. package/vendor/Package.54.mjs +29 -29
  330. package/vendor/Package.55.cjs +16 -16
  331. package/vendor/Package.55.mjs +20 -20
  332. package/vendor/Package.56.cjs +14 -14
  333. package/vendor/Package.56.mjs +18 -18
  334. package/vendor/Package.57.cjs +6 -6
  335. package/vendor/Package.57.mjs +17 -17
  336. package/vendor/Package.58.cjs +22 -22
  337. package/vendor/Package.58.mjs +19 -19
  338. package/vendor/Package.59.cjs +18 -18
  339. package/vendor/Package.59.mjs +13 -13
  340. package/vendor/Package.6.cjs +1739 -1739
  341. package/vendor/Package.6.mjs +1739 -1739
  342. package/vendor/Package.60.cjs +13553 -13553
  343. package/vendor/Package.60.mjs +13562 -13562
  344. package/vendor/Package.610.cjs +9 -9
  345. package/vendor/Package.611.cjs +39 -39
  346. package/vendor/Package.611.mjs +22 -22
  347. package/vendor/Package.612.cjs +33 -33
  348. package/vendor/Package.612.mjs +17 -17
  349. package/vendor/Package.613.cjs +62 -62
  350. package/vendor/Package.613.mjs +29 -29
  351. package/vendor/Package.62.cjs +292 -292
  352. package/vendor/Package.62.mjs +312 -312
  353. package/vendor/Package.63.cjs +354 -354
  354. package/vendor/Package.63.mjs +229 -229
  355. package/vendor/Package.64.cjs +74 -74
  356. package/vendor/Package.64.mjs +74 -74
  357. package/vendor/Package.65.cjs +1833 -1833
  358. package/vendor/Package.65.mjs +1656 -1656
  359. package/vendor/Package.66.cjs +16 -16
  360. package/vendor/Package.66.mjs +16 -16
  361. package/vendor/Package.67.cjs +87 -87
  362. package/vendor/Package.67.mjs +85 -85
  363. package/vendor/Package.68.cjs +115 -256
  364. package/vendor/Package.68.mjs +134 -268
  365. package/vendor/Package.69.cjs +8 -8
  366. package/vendor/Package.7.cjs +3 -3
  367. package/vendor/Package.7.mjs +3 -3
  368. package/vendor/Package.9.cjs +45 -45
  369. package/vendor/Package.9.mjs +79 -79
@@ -1,521 +1,516 @@
1
- "use strict";
2
-
3
- const e = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
4
-
5
- const t = e + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
6
-
7
- const i = "[" + e + "][" + t + "]*";
8
-
9
- const n = new RegExp("^" + i + "$");
10
-
11
- function s(e, t) {
12
- const i = [];
13
- let n = t.exec(e);
14
- while (n) {
15
- const s = [];
16
- s.startIndex = t.lastIndex - n[0].length;
17
- const r = n.length;
18
- for (let e = 0; e < r; e++) {
19
- s.push(n[e]);
20
- }
21
- i.push(s);
22
- n = t.exec(e);
23
- }
24
- return i;
25
- }
26
-
27
- const r = function(e) {
28
- const t = n.exec(e);
29
- return !(t === null || typeof t === "undefined");
30
- };
31
-
32
- function o(e) {
33
- return typeof e !== "undefined";
34
- }
35
-
36
- function a(e) {
37
- return Object.keys(e).length === 0;
38
- }
39
-
40
- function l(e, t, i) {
41
- if (t) {
42
- const n = Object.keys(t);
43
- const s = n.length;
44
- for (let r = 0; r < s; r++) {
45
- if (i === "strict") {
46
- e[n[r]] = [ t[n[r]] ];
1
+ import { g as e } from "../../../vendor/Package.5.mjs";
2
+
3
+ var t = {};
4
+
5
+ var i = {};
6
+
7
+ var r;
8
+
9
+ function requireUtil() {
10
+ if (r) return i;
11
+ r = 1;
12
+ (function(e) {
13
+ "use strict";
14
+ const t = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
15
+ const i = t + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
16
+ const r = "[" + t + "][" + i + "]*";
17
+ const n = new RegExp("^" + r + "$");
18
+ const getAllMatches = function(e, t) {
19
+ const i = [];
20
+ let r = t.exec(e);
21
+ while (r) {
22
+ const n = [];
23
+ n.startIndex = t.lastIndex - r[0].length;
24
+ const s = r.length;
25
+ for (let e = 0; e < s; e++) {
26
+ n.push(r[e]);
27
+ }
28
+ i.push(n);
29
+ r = t.exec(e);
30
+ }
31
+ return i;
32
+ };
33
+ const isName = function(e) {
34
+ const t = n.exec(e);
35
+ return !(t === null || typeof t === "undefined");
36
+ };
37
+ e.isExist = function(e) {
38
+ return typeof e !== "undefined";
39
+ };
40
+ e.isEmptyObject = function(e) {
41
+ return Object.keys(e).length === 0;
42
+ };
43
+ e.merge = function(e, t, i) {
44
+ if (t) {
45
+ const r = Object.keys(t);
46
+ const n = r.length;
47
+ for (let s = 0; s < n; s++) {
48
+ if (i === "strict") {
49
+ e[r[s]] = [ t[r[s]] ];
50
+ } else {
51
+ e[r[s]] = t[r[s]];
52
+ }
53
+ }
54
+ }
55
+ };
56
+ e.getValue = function(t) {
57
+ if (e.isExist(t)) {
58
+ return t;
47
59
  } else {
48
- e[n[r]] = t[n[r]];
60
+ return "";
49
61
  }
50
- }
51
- }
52
- }
53
-
54
- function u(e) {
55
- if (exports.isExist(e)) {
56
- return e;
57
- } else {
58
- return "";
59
- }
62
+ };
63
+ e.isName = isName;
64
+ e.getAllMatches = getAllMatches;
65
+ e.nameRegexp = r;
66
+ })(i);
67
+ return i;
60
68
  }
61
69
 
62
- "use strict";
63
-
64
- const f = {
65
- allowBooleanAttributes: false,
66
- unpairedTags: []
67
- };
70
+ var n;
68
71
 
69
- function d(e, t) {
70
- t = Object.assign({}, f, t);
71
- const i = [];
72
- let n = false;
73
- let s = false;
74
- if (e[0] === "\ufeff") {
75
- e = e.substr(1);
76
- }
77
- for (let r = 0; r < e.length; r++) {
78
- if (e[r] === "<" && e[r + 1] === "?") {
79
- r += 2;
80
- r = c(e, r);
81
- if (r.err) return r;
82
- } else if (e[r] === "<") {
83
- let o = r;
84
- r++;
85
- if (e[r] === "!") {
86
- r = p(e, r);
87
- continue;
88
- } else {
89
- let a = false;
90
- if (e[r] === "/") {
91
- a = true;
92
- r++;
93
- }
94
- let l = "";
95
- for (;r < e.length && e[r] !== ">" && e[r] !== " " && e[r] !== "\t" && e[r] !== "\n" && e[r] !== "\r"; r++) {
96
- l += e[r];
97
- }
98
- l = l.trim();
99
- if (l[l.length - 1] === "/") {
100
- l = l.substring(0, l.length - 1);
101
- r--;
102
- }
103
- if (!I(l)) {
104
- let t;
105
- if (l.trim().length === 0) {
106
- t = "Invalid space after '<'.";
107
- } else {
108
- t = "Tag '" + l + "' is an invalid name.";
72
+ function requireValidator() {
73
+ if (n) return t;
74
+ n = 1;
75
+ "use strict";
76
+ const e = requireUtil();
77
+ const i = {
78
+ allowBooleanAttributes: false,
79
+ unpairedTags: []
80
+ };
81
+ t.validate = function(e, t) {
82
+ t = Object.assign({}, i, t);
83
+ const r = [];
84
+ let n = false;
85
+ let s = false;
86
+ if (e[0] === "\ufeff") {
87
+ e = e.substr(1);
88
+ }
89
+ for (let i = 0; i < e.length; i++) {
90
+ if (e[i] === "<" && e[i + 1] === "?") {
91
+ i += 2;
92
+ i = readPI(e, i);
93
+ if (i.err) return i;
94
+ } else if (e[i] === "<") {
95
+ let o = i;
96
+ i++;
97
+ if (e[i] === "!") {
98
+ i = readCommentAndCDATA(e, i);
99
+ continue;
100
+ } else {
101
+ let a = false;
102
+ if (e[i] === "/") {
103
+ a = true;
104
+ i++;
109
105
  }
110
- return T("InvalidTag", t, v(e, r));
111
- }
112
- const u = x(e, r);
113
- if (u === false) {
114
- return T("InvalidAttr", "Attributes for '" + l + "' have open quote.", v(e, r));
115
- }
116
- let f = u.value;
117
- r = u.index;
118
- if (f[f.length - 1] === "/") {
119
- const i = r - f.length;
120
- f = f.substring(0, f.length - 1);
121
- const s = b(f, t);
122
- if (s === true) {
123
- n = true;
124
- } else {
125
- return T(s.err.code, s.err.msg, v(e, i + s.err.line));
106
+ let l = "";
107
+ for (;i < e.length && e[i] !== ">" && e[i] !== " " && e[i] !== "\t" && e[i] !== "\n" && e[i] !== "\r"; i++) {
108
+ l += e[i];
126
109
  }
127
- } else if (a) {
128
- if (!u.tagClosed) {
129
- return T("InvalidTag", "Closing tag '" + l + "' doesn't have proper closing.", v(e, r));
130
- } else if (f.trim().length > 0) {
131
- return T("InvalidTag", "Closing tag '" + l + "' can't have attributes or invalid starting.", v(e, o));
132
- } else if (i.length === 0) {
133
- return T("InvalidTag", "Closing tag '" + l + "' has not been opened.", v(e, o));
134
- } else {
135
- const t = i.pop();
136
- if (l !== t.tagName) {
137
- let i = v(e, t.tagStartPos);
138
- return T("InvalidTag", "Expected closing tag '" + t.tagName + "' (opened in line " + i.line + ", col " + i.col + ") instead of closing tag '" + l + "'.", v(e, o));
139
- }
140
- if (i.length == 0) {
141
- s = true;
142
- }
110
+ l = l.trim();
111
+ if (l[l.length - 1] === "/") {
112
+ l = l.substring(0, l.length - 1);
113
+ i--;
143
114
  }
144
- } else {
145
- const a = b(f, t);
146
- if (a !== true) {
147
- return T(a.err.code, a.err.msg, v(e, r - f.length + a.err.line));
115
+ if (!validateTagName(l)) {
116
+ let t;
117
+ if (l.trim().length === 0) {
118
+ t = "Invalid space after '<'.";
119
+ } else {
120
+ t = "Tag '" + l + "' is an invalid name.";
121
+ }
122
+ return getErrorObject("InvalidTag", t, getLineNumberForPosition(e, i));
148
123
  }
149
- if (s === true) {
150
- return T("InvalidXml", "Multiple possible root nodes found.", v(e, r));
151
- } else if (t.unpairedTags.indexOf(l) !== -1) {} else {
152
- i.push({
153
- tagName: l,
154
- tagStartPos: o
155
- });
124
+ const u = readAttributeStr(e, i);
125
+ if (u === false) {
126
+ return getErrorObject("InvalidAttr", "Attributes for '" + l + "' have open quote.", getLineNumberForPosition(e, i));
156
127
  }
157
- n = true;
158
- }
159
- for (r++; r < e.length; r++) {
160
- if (e[r] === "<") {
161
- if (e[r + 1] === "!") {
162
- r++;
163
- r = p(e, r);
164
- continue;
165
- } else if (e[r + 1] === "?") {
166
- r = c(e, ++r);
167
- if (r.err) return r;
128
+ let f = u.value;
129
+ i = u.index;
130
+ if (f[f.length - 1] === "/") {
131
+ const r = i - f.length;
132
+ f = f.substring(0, f.length - 1);
133
+ const s = validateAttributeString(f, t);
134
+ if (s === true) {
135
+ n = true;
168
136
  } else {
169
- break;
137
+ return getErrorObject(s.err.code, s.err.msg, getLineNumberForPosition(e, r + s.err.line));
138
+ }
139
+ } else if (a) {
140
+ if (!u.tagClosed) {
141
+ return getErrorObject("InvalidTag", "Closing tag '" + l + "' doesn't have proper closing.", getLineNumberForPosition(e, i));
142
+ } else if (f.trim().length > 0) {
143
+ return getErrorObject("InvalidTag", "Closing tag '" + l + "' can't have attributes or invalid starting.", getLineNumberForPosition(e, o));
144
+ } else if (r.length === 0) {
145
+ return getErrorObject("InvalidTag", "Closing tag '" + l + "' has not been opened.", getLineNumberForPosition(e, o));
146
+ } else {
147
+ const t = r.pop();
148
+ if (l !== t.tagName) {
149
+ let i = getLineNumberForPosition(e, t.tagStartPos);
150
+ return getErrorObject("InvalidTag", "Expected closing tag '" + t.tagName + "' (opened in line " + i.line + ", col " + i.col + ") instead of closing tag '" + l + "'.", getLineNumberForPosition(e, o));
151
+ }
152
+ if (r.length == 0) {
153
+ s = true;
154
+ }
170
155
  }
171
- } else if (e[r] === "&") {
172
- const t = w(e, r);
173
- if (t == -1) return T("InvalidChar", "char '&' is not expected.", v(e, r));
174
- r = t;
175
156
  } else {
176
- if (s === true && !h(e[r])) {
177
- return T("InvalidXml", "Extra text at the end", v(e, r));
157
+ const a = validateAttributeString(f, t);
158
+ if (a !== true) {
159
+ return getErrorObject(a.err.code, a.err.msg, getLineNumberForPosition(e, i - f.length + a.err.line));
160
+ }
161
+ if (s === true) {
162
+ return getErrorObject("InvalidXml", "Multiple possible root nodes found.", getLineNumberForPosition(e, i));
163
+ } else if (t.unpairedTags.indexOf(l) !== -1) {} else {
164
+ r.push({
165
+ tagName: l,
166
+ tagStartPos: o
167
+ });
178
168
  }
169
+ n = true;
170
+ }
171
+ for (i++; i < e.length; i++) {
172
+ if (e[i] === "<") {
173
+ if (e[i + 1] === "!") {
174
+ i++;
175
+ i = readCommentAndCDATA(e, i);
176
+ continue;
177
+ } else if (e[i + 1] === "?") {
178
+ i = readPI(e, ++i);
179
+ if (i.err) return i;
180
+ } else {
181
+ break;
182
+ }
183
+ } else if (e[i] === "&") {
184
+ const t = validateAmpersand(e, i);
185
+ if (t == -1) return getErrorObject("InvalidChar", "char '&' is not expected.", getLineNumberForPosition(e, i));
186
+ i = t;
187
+ } else {
188
+ if (s === true && !isWhiteSpace(e[i])) {
189
+ return getErrorObject("InvalidXml", "Extra text at the end", getLineNumberForPosition(e, i));
190
+ }
191
+ }
192
+ }
193
+ if (e[i] === "<") {
194
+ i--;
179
195
  }
180
196
  }
181
- if (e[r] === "<") {
182
- r--;
197
+ } else {
198
+ if (isWhiteSpace(e[i])) {
199
+ continue;
183
200
  }
201
+ return getErrorObject("InvalidChar", "char '" + e[i] + "' is not expected.", getLineNumberForPosition(e, i));
184
202
  }
185
- } else {
186
- if (h(e[r])) {
187
- continue;
188
- }
189
- return T("InvalidChar", "char '" + e[r] + "' is not expected.", v(e, r));
190
203
  }
191
- }
192
- if (!n) {
193
- return T("InvalidXml", "Start tag expected.", 1);
194
- } else if (i.length == 1) {
195
- return T("InvalidTag", "Unclosed tag '" + i[0].tagName + "'.", v(e, i[0].tagStartPos));
196
- } else if (i.length > 0) {
197
- return T("InvalidXml", "Invalid '" + JSON.stringify(i.map((e => e.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", {
198
- line: 1,
199
- col: 1
200
- });
201
- }
202
- return true;
203
- }
204
-
205
- function h(e) {
206
- return e === " " || e === "\t" || e === "\n" || e === "\r";
207
- }
208
-
209
- function c(e, t) {
210
- const i = t;
211
- for (;t < e.length; t++) {
212
- if (e[t] == "?" || e[t] == " ") {
213
- const n = e.substr(i, t - i);
214
- if (t > 5 && n === "xml") {
215
- return T("InvalidXml", "XML declaration allowed only at the start of the document.", v(e, t));
216
- } else if (e[t] == "?" && e[t + 1] == ">") {
217
- t++;
218
- break;
219
- } else {
220
- continue;
204
+ if (!n) {
205
+ return getErrorObject("InvalidXml", "Start tag expected.", 1);
206
+ } else if (r.length == 1) {
207
+ return getErrorObject("InvalidTag", "Unclosed tag '" + r[0].tagName + "'.", getLineNumberForPosition(e, r[0].tagStartPos));
208
+ } else if (r.length > 0) {
209
+ return getErrorObject("InvalidXml", "Invalid '" + JSON.stringify(r.map((e => e.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", {
210
+ line: 1,
211
+ col: 1
212
+ });
213
+ }
214
+ return true;
215
+ };
216
+ function isWhiteSpace(e) {
217
+ return e === " " || e === "\t" || e === "\n" || e === "\r";
218
+ }
219
+ function readPI(e, t) {
220
+ const i = t;
221
+ for (;t < e.length; t++) {
222
+ if (e[t] == "?" || e[t] == " ") {
223
+ const r = e.substr(i, t - i);
224
+ if (t > 5 && r === "xml") {
225
+ return getErrorObject("InvalidXml", "XML declaration allowed only at the start of the document.", getLineNumberForPosition(e, t));
226
+ } else if (e[t] == "?" && e[t + 1] == ">") {
227
+ t++;
228
+ break;
229
+ } else {
230
+ continue;
231
+ }
221
232
  }
222
233
  }
234
+ return t;
223
235
  }
224
- return t;
225
- }
226
-
227
- function p(e, t) {
228
- if (e.length > t + 5 && e[t + 1] === "-" && e[t + 2] === "-") {
229
- for (t += 3; t < e.length; t++) {
230
- if (e[t] === "-" && e[t + 1] === "-" && e[t + 2] === ">") {
231
- t += 2;
232
- break;
236
+ function readCommentAndCDATA(e, t) {
237
+ if (e.length > t + 5 && e[t + 1] === "-" && e[t + 2] === "-") {
238
+ for (t += 3; t < e.length; t++) {
239
+ if (e[t] === "-" && e[t + 1] === "-" && e[t + 2] === ">") {
240
+ t += 2;
241
+ break;
242
+ }
243
+ }
244
+ } else if (e.length > t + 8 && e[t + 1] === "D" && e[t + 2] === "O" && e[t + 3] === "C" && e[t + 4] === "T" && e[t + 5] === "Y" && e[t + 6] === "P" && e[t + 7] === "E") {
245
+ let i = 1;
246
+ for (t += 8; t < e.length; t++) {
247
+ if (e[t] === "<") {
248
+ i++;
249
+ } else if (e[t] === ">") {
250
+ i--;
251
+ if (i === 0) {
252
+ break;
253
+ }
254
+ }
255
+ }
256
+ } else if (e.length > t + 9 && e[t + 1] === "[" && e[t + 2] === "C" && e[t + 3] === "D" && e[t + 4] === "A" && e[t + 5] === "T" && e[t + 6] === "A" && e[t + 7] === "[") {
257
+ for (t += 8; t < e.length; t++) {
258
+ if (e[t] === "]" && e[t + 1] === "]" && e[t + 2] === ">") {
259
+ t += 2;
260
+ break;
261
+ }
233
262
  }
234
263
  }
235
- } else if (e.length > t + 8 && e[t + 1] === "D" && e[t + 2] === "O" && e[t + 3] === "C" && e[t + 4] === "T" && e[t + 5] === "Y" && e[t + 6] === "P" && e[t + 7] === "E") {
236
- let i = 1;
237
- for (t += 8; t < e.length; t++) {
238
- if (e[t] === "<") {
239
- i++;
264
+ return t;
265
+ }
266
+ const r = '"';
267
+ const s = "'";
268
+ function readAttributeStr(e, t) {
269
+ let i = "";
270
+ let n = "";
271
+ let o = false;
272
+ for (;t < e.length; t++) {
273
+ if (e[t] === r || e[t] === s) {
274
+ if (n === "") {
275
+ n = e[t];
276
+ } else if (n !== e[t]) {} else {
277
+ n = "";
278
+ }
240
279
  } else if (e[t] === ">") {
241
- i--;
242
- if (i === 0) {
280
+ if (n === "") {
281
+ o = true;
243
282
  break;
244
283
  }
245
284
  }
285
+ i += e[t];
246
286
  }
247
- } else if (e.length > t + 9 && e[t + 1] === "[" && e[t + 2] === "C" && e[t + 3] === "D" && e[t + 4] === "A" && e[t + 5] === "T" && e[t + 6] === "A" && e[t + 7] === "[") {
248
- for (t += 8; t < e.length; t++) {
249
- if (e[t] === "]" && e[t + 1] === "]" && e[t + 2] === ">") {
250
- t += 2;
251
- break;
252
- }
287
+ if (n !== "") {
288
+ return false;
253
289
  }
290
+ return {
291
+ value: i,
292
+ index: t,
293
+ tagClosed: o
294
+ };
254
295
  }
255
- return t;
256
- }
257
-
258
- const g = '"';
259
-
260
- const m = "'";
261
-
262
- function x(e, t) {
263
- let i = "";
264
- let n = "";
265
- let s = false;
266
- for (;t < e.length; t++) {
267
- if (e[t] === g || e[t] === m) {
268
- if (n === "") {
269
- n = e[t];
270
- } else if (n !== e[t]) {} else {
271
- n = "";
296
+ const o = new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?", "g");
297
+ function validateAttributeString(t, i) {
298
+ const r = e.getAllMatches(t, o);
299
+ const n = {};
300
+ for (let e = 0; e < r.length; e++) {
301
+ if (r[e][1].length === 0) {
302
+ return getErrorObject("InvalidAttr", "Attribute '" + r[e][2] + "' has no space in starting.", getPositionFromMatch(r[e]));
303
+ } else if (r[e][3] !== undefined && r[e][4] === undefined) {
304
+ return getErrorObject("InvalidAttr", "Attribute '" + r[e][2] + "' is without value.", getPositionFromMatch(r[e]));
305
+ } else if (r[e][3] === undefined && !i.allowBooleanAttributes) {
306
+ return getErrorObject("InvalidAttr", "boolean attribute '" + r[e][2] + "' is not allowed.", getPositionFromMatch(r[e]));
272
307
  }
273
- } else if (e[t] === ">") {
274
- if (n === "") {
275
- s = true;
276
- break;
308
+ const t = r[e][2];
309
+ if (!validateAttrName(t)) {
310
+ return getErrorObject("InvalidAttr", "Attribute '" + t + "' is an invalid name.", getPositionFromMatch(r[e]));
311
+ }
312
+ if (!n.hasOwnProperty(t)) {
313
+ n[t] = 1;
314
+ } else {
315
+ return getErrorObject("InvalidAttr", "Attribute '" + t + "' is repeated.", getPositionFromMatch(r[e]));
277
316
  }
278
317
  }
279
- i += e[t];
280
- }
281
- if (n !== "") {
282
- return false;
318
+ return true;
283
319
  }
284
- return {
285
- value: i,
286
- index: t,
287
- tagClosed: s
288
- };
289
- }
290
-
291
- const N = new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?", "g");
292
-
293
- function b(e, t) {
294
- const i = s(e, N);
295
- const n = {};
296
- for (let e = 0; e < i.length; e++) {
297
- if (i[e][1].length === 0) {
298
- return T("InvalidAttr", "Attribute '" + i[e][2] + "' has no space in starting.", O(i[e]));
299
- } else if (i[e][3] !== undefined && i[e][4] === undefined) {
300
- return T("InvalidAttr", "Attribute '" + i[e][2] + "' is without value.", O(i[e]));
301
- } else if (i[e][3] === undefined && !t.allowBooleanAttributes) {
302
- return T("InvalidAttr", "boolean attribute '" + i[e][2] + "' is not allowed.", O(i[e]));
303
- }
304
- const s = i[e][2];
305
- if (!y(s)) {
306
- return T("InvalidAttr", "Attribute '" + s + "' is an invalid name.", O(i[e]));
307
- }
308
- if (!n.hasOwnProperty(s)) {
309
- n[s] = 1;
310
- } else {
311
- return T("InvalidAttr", "Attribute '" + s + "' is repeated.", O(i[e]));
320
+ function validateNumberAmpersand(e, t) {
321
+ let i = /\d/;
322
+ if (e[t] === "x") {
323
+ t++;
324
+ i = /[\da-fA-F]/;
325
+ }
326
+ for (;t < e.length; t++) {
327
+ if (e[t] === ";") return t;
328
+ if (!e[t].match(i)) break;
312
329
  }
330
+ return -1;
313
331
  }
314
- return true;
315
- }
316
-
317
- function E(e, t) {
318
- let i = /\d/;
319
- if (e[t] === "x") {
332
+ function validateAmpersand(e, t) {
320
333
  t++;
321
- i = /[\da-fA-F]/;
334
+ if (e[t] === ";") return -1;
335
+ if (e[t] === "#") {
336
+ t++;
337
+ return validateNumberAmpersand(e, t);
338
+ }
339
+ let i = 0;
340
+ for (;t < e.length; t++, i++) {
341
+ if (e[t].match(/\w/) && i < 20) continue;
342
+ if (e[t] === ";") break;
343
+ return -1;
344
+ }
345
+ return t;
346
+ }
347
+ function getErrorObject(e, t, i) {
348
+ return {
349
+ err: {
350
+ code: e,
351
+ msg: t,
352
+ line: i.line || i,
353
+ col: i.col
354
+ }
355
+ };
322
356
  }
323
- for (;t < e.length; t++) {
324
- if (e[t] === ";") return t;
325
- if (!e[t].match(i)) break;
357
+ function validateAttrName(t) {
358
+ return e.isName(t);
326
359
  }
327
- return -1;
328
- }
329
-
330
- function w(e, t) {
331
- t++;
332
- if (e[t] === ";") return -1;
333
- if (e[t] === "#") {
334
- t++;
335
- return E(e, t);
360
+ function validateTagName(t) {
361
+ return e.isName(t);
336
362
  }
337
- let i = 0;
338
- for (;t < e.length; t++, i++) {
339
- if (e[t].match(/\w/) && i < 20) continue;
340
- if (e[t] === ";") break;
341
- return -1;
363
+ function getLineNumberForPosition(e, t) {
364
+ const i = e.substring(0, t).split(/\r?\n/);
365
+ return {
366
+ line: i.length,
367
+ col: i[i.length - 1].length + 1
368
+ };
369
+ }
370
+ function getPositionFromMatch(e) {
371
+ return e.startIndex + e[1].length;
342
372
  }
343
373
  return t;
344
374
  }
345
375
 
346
- function T(e, t, i) {
347
- return {
348
- err: {
349
- code: e,
350
- msg: t,
351
- line: i.line || i,
352
- col: i.col
376
+ var s = {};
377
+
378
+ var o;
379
+
380
+ function requireOptionsBuilder() {
381
+ if (o) return s;
382
+ o = 1;
383
+ const e = {
384
+ preserveOrder: false,
385
+ attributeNamePrefix: "@_",
386
+ attributesGroupName: false,
387
+ textNodeName: "#text",
388
+ ignoreAttributes: true,
389
+ removeNSPrefix: false,
390
+ allowBooleanAttributes: false,
391
+ parseTagValue: true,
392
+ parseAttributeValue: false,
393
+ trimValues: true,
394
+ cdataPropName: false,
395
+ numberParseOptions: {
396
+ hex: true,
397
+ leadingZeros: true,
398
+ eNotation: true
399
+ },
400
+ tagValueProcessor: function(e, t) {
401
+ return t;
402
+ },
403
+ attributeValueProcessor: function(e, t) {
404
+ return t;
405
+ },
406
+ stopNodes: [],
407
+ alwaysCreateTextNode: false,
408
+ isArray: () => false,
409
+ commentPropName: false,
410
+ unpairedTags: [],
411
+ processEntities: true,
412
+ htmlEntities: false,
413
+ ignoreDeclaration: false,
414
+ ignorePiTags: false,
415
+ transformTagName: false,
416
+ transformAttributeName: false,
417
+ updateTag: function(e, t, i) {
418
+ return e;
353
419
  }
354
420
  };
355
- }
356
-
357
- function y(e) {
358
- return r(e);
359
- }
360
-
361
- function I(e) {
362
- return r(e);
363
- }
364
-
365
- function v(e, t) {
366
- const i = e.substring(0, t).split(/\r?\n/);
367
- return {
368
- line: i.length,
369
- col: i[i.length - 1].length + 1
421
+ const buildOptions = function(t) {
422
+ return Object.assign({}, e, t);
370
423
  };
424
+ s.buildOptions = buildOptions;
425
+ s.defaultOptions = e;
426
+ return s;
371
427
  }
372
428
 
373
- function O(e) {
374
- return e.startIndex + e[1].length;
375
- }
429
+ var a;
376
430
 
377
- const P = {
378
- preserveOrder: false,
379
- attributeNamePrefix: "@_",
380
- attributesGroupName: false,
381
- textNodeName: "#text",
382
- ignoreAttributes: true,
383
- removeNSPrefix: false,
384
- allowBooleanAttributes: false,
385
- parseTagValue: true,
386
- parseAttributeValue: false,
387
- trimValues: true,
388
- cdataPropName: false,
389
- numberParseOptions: {
390
- hex: true,
391
- leadingZeros: true,
392
- eNotation: true
393
- },
394
- tagValueProcessor: function(e, t) {
395
- return t;
396
- },
397
- attributeValueProcessor: function(e, t) {
398
- return t;
399
- },
400
- stopNodes: [],
401
- alwaysCreateTextNode: false,
402
- isArray: () => false,
403
- commentPropName: false,
404
- unpairedTags: [],
405
- processEntities: true,
406
- htmlEntities: false,
407
- ignoreDeclaration: false,
408
- ignorePiTags: false,
409
- transformTagName: false,
410
- transformAttributeName: false,
411
- updateTag: function(e, t, i) {
412
- return e;
413
- },
414
- captureMetaData: false
415
- };
416
-
417
- const A = function(e) {
418
- return Object.assign({}, P, e);
419
- };
420
-
421
- "use strict";
431
+ var l;
422
432
 
423
- let C;
424
-
425
- if (typeof Symbol !== "function") {
426
- C = "@@xmlMetadata";
427
- } else {
428
- C = Symbol("XML Node Metadata");
429
- }
430
-
431
- class XmlNode {
432
- constructor(e) {
433
- this.tagname = e;
434
- this.child = [];
435
- this[":@"] = {};
436
- }
437
- add(e, t) {
438
- if (e === "__proto__") e = "#__proto__";
439
- this.child.push({
440
- [e]: t
441
- });
442
- }
443
- addChild(e, t) {
444
- if (e.tagname === "__proto__") e.tagname = "#__proto__";
445
- if (e[":@"] && Object.keys(e[":@"]).length > 0) {
446
- this.child.push({
447
- [e.tagname]: e.child,
448
- [":@"]: e[":@"]
449
- });
450
- } else {
433
+ function requireXmlNode() {
434
+ if (l) return a;
435
+ l = 1;
436
+ "use strict";
437
+ class XmlNode {
438
+ constructor(e) {
439
+ this.tagname = e;
440
+ this.child = [];
441
+ this[":@"] = {};
442
+ }
443
+ add(e, t) {
444
+ if (e === "__proto__") e = "#__proto__";
451
445
  this.child.push({
452
- [e.tagname]: e.child
446
+ [e]: t
453
447
  });
454
448
  }
455
- if (t !== undefined) {
456
- this.child[this.child.length - 1][C] = {
457
- startIndex: t
458
- };
449
+ addChild(e) {
450
+ if (e.tagname === "__proto__") e.tagname = "#__proto__";
451
+ if (e[":@"] && Object.keys(e[":@"]).length > 0) {
452
+ this.child.push({
453
+ [e.tagname]: e.child,
454
+ [":@"]: e[":@"]
455
+ });
456
+ } else {
457
+ this.child.push({
458
+ [e.tagname]: e.child
459
+ });
460
+ }
459
461
  }
460
462
  }
461
- static getMetaDataSymbol() {
462
- return C;
463
- }
463
+ a = XmlNode;
464
+ return a;
464
465
  }
465
466
 
466
- class DocTypeReader {
467
- constructor(e) {
468
- this.suppressValidationErr = !e;
469
- }
470
- readDocType(e, t) {
467
+ var u;
468
+
469
+ var f;
470
+
471
+ function requireDocTypeReader() {
472
+ if (f) return u;
473
+ f = 1;
474
+ const e = requireUtil();
475
+ function readDocType(e, t) {
471
476
  const i = {};
472
477
  if (e[t + 3] === "O" && e[t + 4] === "C" && e[t + 5] === "T" && e[t + 6] === "Y" && e[t + 7] === "P" && e[t + 8] === "E") {
473
478
  t = t + 9;
474
- let n = 1;
475
- let s = false, r = false;
479
+ let r = 1;
480
+ let n = false, s = false;
476
481
  let o = "";
477
482
  for (;t < e.length; t++) {
478
- if (e[t] === "<" && !r) {
479
- if (s && V(e, "!ENTITY", t)) {
483
+ if (e[t] === "<" && !s) {
484
+ if (n && isEntity(e, t)) {
480
485
  t += 7;
481
- let n, s;
482
- [n, s, t] = this.readEntityExp(e, t + 1, this.suppressValidationErr);
483
- if (s.indexOf("&") === -1) i[n] = {
484
- regx: RegExp(`&${n};`, "g"),
485
- val: s
486
+ let r, n;
487
+ [r, n, t] = readEntityExp(e, t + 1);
488
+ if (n.indexOf("&") === -1) i[validateEntityName(r)] = {
489
+ regx: RegExp(`&${r};`, "g"),
490
+ val: n
486
491
  };
487
- } else if (s && V(e, "!ELEMENT", t)) {
488
- t += 8;
489
- const {index: i} = this.readElementExp(e, t + 1);
490
- t = i;
491
- } else if (s && V(e, "!ATTLIST", t)) {
492
- t += 8;
493
- } else if (s && V(e, "!NOTATION", t)) {
494
- t += 9;
495
- const {index: i} = this.readNotationExp(e, t + 1, this.suppressValidationErr);
496
- t = i;
497
- } else if (V(e, "!--", t)) r = true; else throw new Error(`Invalid DOCTYPE`);
498
- n++;
492
+ } else if (n && isElement(e, t)) t += 8; else if (n && isAttlist(e, t)) t += 8; else if (n && isNotation(e, t)) t += 9; else if (isComment) s = true; else throw new Error("Invalid DOCTYPE");
493
+ r++;
499
494
  o = "";
500
495
  } else if (e[t] === ">") {
501
- if (r) {
496
+ if (s) {
502
497
  if (e[t - 1] === "-" && e[t - 2] === "-") {
503
- r = false;
504
- n--;
498
+ s = false;
499
+ r--;
505
500
  }
506
501
  } else {
507
- n--;
502
+ r--;
508
503
  }
509
- if (n === 0) {
504
+ if (r === 0) {
510
505
  break;
511
506
  }
512
507
  } else if (e[t] === "[") {
513
- s = true;
508
+ n = true;
514
509
  } else {
515
510
  o += e[t];
516
511
  }
517
512
  }
518
- if (n !== 0) {
513
+ if (r !== 0) {
519
514
  throw new Error(`Unclosed DOCTYPE`);
520
515
  }
521
516
  } else {
@@ -526,1377 +521,1234 @@ class DocTypeReader {
526
521
  i: t
527
522
  };
528
523
  }
529
- readEntityExp(e, t) {
530
- t = S(e, t);
524
+ function readEntityExp(e, t) {
531
525
  let i = "";
532
- while (t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'") {
526
+ for (;t < e.length && (e[t] !== "'" && e[t] !== '"'); t++) {
533
527
  i += e[t];
534
- t++;
535
- }
536
- D(i);
537
- t = S(e, t);
538
- if (!this.suppressValidationErr) {
539
- if (e.substring(t, t + 6).toUpperCase() === "SYSTEM") {
540
- throw new Error("External entities are not supported");
541
- } else if (e[t] === "%") {
542
- throw new Error("Parameter entities are not supported");
543
- }
544
528
  }
529
+ i = i.trim();
530
+ if (i.indexOf(" ") !== -1) throw new Error("External entites are not supported");
531
+ const r = e[t++];
545
532
  let n = "";
546
- [t, n] = this.readIdentifierVal(e, t, "entity");
547
- t--;
533
+ for (;t < e.length && e[t] !== r; t++) {
534
+ n += e[t];
535
+ }
548
536
  return [ i, n, t ];
549
537
  }
550
- readNotationExp(e, t) {
551
- t = S(e, t);
552
- let i = "";
553
- while (t < e.length && !/\s/.test(e[t])) {
554
- i += e[t];
555
- t++;
556
- }
557
- !this.suppressValidationErr && D(i);
558
- t = S(e, t);
559
- const n = e.substring(t, t + 6).toUpperCase();
560
- if (!this.suppressValidationErr && n !== "SYSTEM" && n !== "PUBLIC") {
561
- throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);
562
- }
563
- t += n.length;
564
- t = S(e, t);
565
- let s = null;
566
- let r = null;
567
- if (n === "PUBLIC") {
568
- [t, s] = this.readIdentifierVal(e, t, "publicIdentifier");
569
- t = S(e, t);
570
- if (e[t] === '"' || e[t] === "'") {
571
- [t, r] = this.readIdentifierVal(e, t, "systemIdentifier");
572
- }
573
- } else if (n === "SYSTEM") {
574
- [t, r] = this.readIdentifierVal(e, t, "systemIdentifier");
575
- if (!this.suppressValidationErr && !r) {
576
- throw new Error("Missing mandatory system identifier for SYSTEM notation");
577
- }
578
- }
579
- return {
580
- notationName: i,
581
- publicIdentifier: s,
582
- systemIdentifier: r,
583
- index: --t
584
- };
538
+ function isComment(e, t) {
539
+ if (e[t + 1] === "!" && e[t + 2] === "-" && e[t + 3] === "-") return true;
540
+ return false;
585
541
  }
586
- readIdentifierVal(e, t, i) {
587
- let n = "";
588
- const s = e[t];
589
- if (s !== '"' && s !== "'") {
590
- throw new Error(`Expected quoted string, found "${s}"`);
591
- }
592
- t++;
593
- while (t < e.length && e[t] !== s) {
594
- n += e[t];
595
- t++;
596
- }
597
- if (e[t] !== s) {
598
- throw new Error(`Unterminated ${i} value`);
599
- }
600
- t++;
601
- return [ t, n ];
542
+ function isEntity(e, t) {
543
+ if (e[t + 1] === "!" && e[t + 2] === "E" && e[t + 3] === "N" && e[t + 4] === "T" && e[t + 5] === "I" && e[t + 6] === "T" && e[t + 7] === "Y") return true;
544
+ return false;
602
545
  }
603
- readElementExp(e, t) {
604
- t = S(e, t);
605
- let i = "";
606
- while (t < e.length && !/\s/.test(e[t])) {
607
- i += e[t];
608
- t++;
609
- }
610
- if (!this.suppressValidationErr && !r(i)) {
611
- throw new Error(`Invalid element name: "${i}"`);
612
- }
613
- t = S(e, t);
614
- let n = "";
615
- if (e[t] === "E" && V(e, "MPTY", t)) t += 4; else if (e[t] === "A" && V(e, "NY", t)) t += 2; else if (e[t] === "(") {
616
- t++;
617
- while (t < e.length && e[t] !== ")") {
618
- n += e[t];
619
- t++;
620
- }
621
- if (e[t] !== ")") {
622
- throw new Error("Unterminated content model");
623
- }
624
- } else if (!this.suppressValidationErr) {
625
- throw new Error(`Invalid Element Expression, found "${e[t]}"`);
626
- }
627
- return {
628
- elementName: i,
629
- contentModel: n.trim(),
630
- index: t
631
- };
546
+ function isElement(e, t) {
547
+ if (e[t + 1] === "!" && e[t + 2] === "E" && e[t + 3] === "L" && e[t + 4] === "E" && e[t + 5] === "M" && e[t + 6] === "E" && e[t + 7] === "N" && e[t + 8] === "T") return true;
548
+ return false;
632
549
  }
633
- readAttlistExp(e, t) {
634
- t = S(e, t);
635
- let i = "";
636
- while (t < e.length && !/\s/.test(e[t])) {
637
- i += e[t];
638
- t++;
639
- }
640
- D(i);
641
- t = S(e, t);
642
- let n = "";
643
- while (t < e.length && !/\s/.test(e[t])) {
644
- n += e[t];
645
- t++;
646
- }
647
- if (!D(n)) {
648
- throw new Error(`Invalid attribute name: "${n}"`);
649
- }
650
- t = S(e, t);
651
- let s = "";
652
- if (e.substring(t, t + 8).toUpperCase() === "NOTATION") {
653
- s = "NOTATION";
654
- t += 8;
655
- t = S(e, t);
656
- if (e[t] !== "(") {
657
- throw new Error(`Expected '(', found "${e[t]}"`);
658
- }
659
- t++;
660
- let i = [];
661
- while (t < e.length && e[t] !== ")") {
662
- let n = "";
663
- while (t < e.length && e[t] !== "|" && e[t] !== ")") {
664
- n += e[t];
665
- t++;
666
- }
667
- n = n.trim();
668
- if (!D(n)) {
669
- throw new Error(`Invalid notation name: "${n}"`);
670
- }
671
- i.push(n);
672
- if (e[t] === "|") {
673
- t++;
674
- t = S(e, t);
675
- }
676
- }
677
- if (e[t] !== ")") {
678
- throw new Error("Unterminated list of notations");
679
- }
680
- t++;
681
- s += " (" + i.join("|") + ")";
682
- } else {
683
- while (t < e.length && !/\s/.test(e[t])) {
684
- s += e[t];
685
- t++;
686
- }
687
- const i = [ "CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS" ];
688
- if (!this.suppressValidationErr && !i.includes(s.toUpperCase())) {
689
- throw new Error(`Invalid attribute type: "${s}"`);
690
- }
691
- }
692
- t = S(e, t);
693
- let r = "";
694
- if (e.substring(t, t + 8).toUpperCase() === "#REQUIRED") {
695
- r = "#REQUIRED";
696
- t += 8;
697
- } else if (e.substring(t, t + 7).toUpperCase() === "#IMPLIED") {
698
- r = "#IMPLIED";
699
- t += 7;
700
- } else {
701
- [t, r] = this.readIdentifierVal(e, t, "ATTLIST");
702
- }
703
- return {
704
- elementName: i,
705
- attributeName: n,
706
- attributeType: s,
707
- defaultValue: r,
708
- index: t
709
- };
550
+ function isAttlist(e, t) {
551
+ if (e[t + 1] === "!" && e[t + 2] === "A" && e[t + 3] === "T" && e[t + 4] === "T" && e[t + 5] === "L" && e[t + 6] === "I" && e[t + 7] === "S" && e[t + 8] === "T") return true;
552
+ return false;
710
553
  }
711
- }
712
-
713
- const S = (e, t) => {
714
- while (t < e.length && /\s/.test(e[t])) {
715
- t++;
554
+ function isNotation(e, t) {
555
+ if (e[t + 1] === "!" && e[t + 2] === "N" && e[t + 3] === "O" && e[t + 4] === "T" && e[t + 5] === "A" && e[t + 6] === "T" && e[t + 7] === "I" && e[t + 8] === "O" && e[t + 9] === "N") return true;
556
+ return false;
716
557
  }
717
- return t;
718
- };
719
-
720
- function V(e, t, i) {
721
- for (let n = 0; n < t.length; n++) {
722
- if (t[n] !== e[i + n + 1]) return false;
558
+ function validateEntityName(t) {
559
+ if (e.isName(t)) return t; else throw new Error(`Invalid entity name ${t}`);
723
560
  }
724
- return true;
561
+ u = readDocType;
562
+ return u;
725
563
  }
726
564
 
727
- function D(e) {
728
- if (r(e)) return e; else throw new Error(`Invalid entity name ${e}`);
729
- }
730
-
731
- const $ = /^[-+]?0x[a-fA-F0-9]+$/;
732
-
733
- const j = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
565
+ var d;
734
566
 
735
- const k = {
736
- hex: true,
737
- leadingZeros: true,
738
- decimalPoint: ".",
739
- eNotation: true
740
- };
567
+ var c;
741
568
 
742
- function F(e, t = {}) {
743
- t = Object.assign({}, k, t);
744
- if (!e || typeof e !== "string") return e;
745
- let i = e.trim();
746
- if (t.skipLike !== undefined && t.skipLike.test(i)) return e; else if (e === "0") return 0; else if (t.hex && $.test(i)) {
747
- return U(i, 16);
748
- } else if (i.search(/.+[eE].+/) !== -1) {
749
- return _(e, i, t);
750
- } else {
751
- const n = j.exec(i);
752
- if (n) {
753
- const s = n[1] || "";
754
- const r = n[2];
755
- let o = L(n[3]);
756
- const a = s ? e[r.length + 1] === "." : e[r.length] === ".";
757
- if (!t.leadingZeros && (r.length > 1 || r.length === 1 && !a)) {
758
- return e;
759
- } else {
760
- const n = Number(i);
761
- const a = String(n);
762
- if (n === 0) return n;
763
- if (a.search(/[eE]/) !== -1) {
764
- if (t.eNotation) return n; else return e;
765
- } else if (i.indexOf(".") !== -1) {
766
- if (a === "0") return n; else if (a === o) return n; else if (a === `${s}${o}`) return n; else return e;
767
- }
768
- let l = r ? o : i;
769
- if (r) {
770
- return l === a || s + l === a ? n : e;
569
+ function requireStrnum() {
570
+ if (c) return d;
571
+ c = 1;
572
+ const e = /^[-+]?0x[a-fA-F0-9]+$/;
573
+ const t = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
574
+ const i = {
575
+ hex: true,
576
+ leadingZeros: true,
577
+ decimalPoint: ".",
578
+ eNotation: true
579
+ };
580
+ function toNumber(r, n = {}) {
581
+ n = Object.assign({}, i, n);
582
+ if (!r || typeof r !== "string") return r;
583
+ let s = r.trim();
584
+ if (n.skipLike !== undefined && n.skipLike.test(s)) return r; else if (r === "0") return 0; else if (n.hex && e.test(s)) {
585
+ return parse_int(s, 16);
586
+ } else if (s.search(/[eE]/) !== -1) {
587
+ const e = s.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
588
+ if (e) {
589
+ if (n.leadingZeros) {
590
+ s = (e[1] || "") + e[3];
771
591
  } else {
772
- return l === a || l === s + a ? n : e;
592
+ if (e[2] === "0" && e[3][0] === ".") {} else {
593
+ return r;
594
+ }
773
595
  }
596
+ return n.eNotation ? Number(s) : r;
597
+ } else {
598
+ return r;
774
599
  }
775
600
  } else {
776
- return e;
601
+ const e = t.exec(s);
602
+ if (e) {
603
+ const t = e[1];
604
+ const i = e[2];
605
+ let o = trimZeros(e[3]);
606
+ if (!n.leadingZeros && i.length > 0 && t && s[2] !== ".") return r; else if (!n.leadingZeros && i.length > 0 && !t && s[1] !== ".") return r; else if (n.leadingZeros && i === r) return 0; else {
607
+ const e = Number(s);
608
+ const a = "" + e;
609
+ if (a.search(/[eE]/) !== -1) {
610
+ if (n.eNotation) return e; else return r;
611
+ } else if (s.indexOf(".") !== -1) {
612
+ if (a === "0" && o === "") return e; else if (a === o) return e; else if (t && a === "-" + o) return e; else return r;
613
+ }
614
+ if (i) {
615
+ return o === a || t + o === a ? e : r;
616
+ } else {
617
+ return s === a || s === t + a ? e : r;
618
+ }
619
+ }
620
+ } else {
621
+ return r;
622
+ }
777
623
  }
778
624
  }
779
- }
780
-
781
- const M = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
782
-
783
- function _(e, t, i) {
784
- if (!i.eNotation) return e;
785
- const n = t.match(M);
786
- if (n) {
787
- let s = n[1] || "";
788
- const r = n[3].indexOf("e") === -1 ? "E" : "e";
789
- const o = n[2];
790
- const a = s ? e[o.length + 1] === r : e[o.length] === r;
791
- if (o.length > 1 && a) return e; else if (o.length === 1 && (n[3].startsWith(`.${r}`) || n[3][0] === r)) {
792
- return Number(t);
793
- } else if (i.leadingZeros && !a) {
794
- t = (n[1] || "") + n[3];
795
- return Number(t);
796
- } else return e;
797
- } else {
625
+ function trimZeros(e) {
626
+ if (e && e.indexOf(".") !== -1) {
627
+ e = e.replace(/0+$/, "");
628
+ if (e === ".") e = "0"; else if (e[0] === ".") e = "0" + e; else if (e[e.length - 1] === ".") e = e.substr(0, e.length - 1);
629
+ return e;
630
+ }
798
631
  return e;
799
632
  }
800
- }
801
-
802
- function L(e) {
803
- if (e && e.indexOf(".") !== -1) {
804
- e = e.replace(/0+$/, "");
805
- if (e === ".") e = "0"; else if (e[0] === ".") e = "0" + e; else if (e[e.length - 1] === ".") e = e.substring(0, e.length - 1);
806
- return e;
633
+ function parse_int(e, t) {
634
+ if (parseInt) return parseInt(e, t); else if (Number.parseInt) return Number.parseInt(e, t); else if (window && window.parseInt) return window.parseInt(e, t); else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
807
635
  }
808
- return e;
636
+ d = toNumber;
637
+ return d;
809
638
  }
810
639
 
811
- function U(e, t) {
812
- if (parseInt) return parseInt(e, t); else if (Number.parseInt) return Number.parseInt(e, t); else if (window && window.parseInt) return window.parseInt(e, t); else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
813
- }
640
+ var g;
814
641
 
815
- function R(e) {
816
- if (typeof e === "function") {
817
- return e;
818
- }
819
- if (Array.isArray(e)) {
820
- return t => {
821
- for (const i of e) {
822
- if (typeof i === "string" && t === i) {
823
- return true;
824
- }
825
- if (i instanceof RegExp && i.test(t)) {
826
- return true;
827
- }
828
- }
829
- };
830
- }
831
- return () => false;
832
- }
833
-
834
- "use strict";
642
+ var h;
835
643
 
836
- class OrderedObjParser {
837
- constructor(e) {
838
- this.options = e;
839
- this.currentNode = null;
840
- this.tagsNodeStack = [];
841
- this.docTypeEntities = {};
842
- this.lastEntities = {
843
- apos: {
844
- regex: /&(apos|#39|#x27);/g,
845
- val: "'"
846
- },
847
- gt: {
848
- regex: /&(gt|#62|#x3E);/g,
849
- val: ">"
850
- },
851
- lt: {
852
- regex: /&(lt|#60|#x3C);/g,
853
- val: "<"
854
- },
855
- quot: {
856
- regex: /&(quot|#34|#x22);/g,
857
- val: '"'
858
- }
859
- };
860
- this.ampEntity = {
861
- regex: /&(amp|#38|#x26);/g,
862
- val: "&"
863
- };
864
- this.htmlEntities = {
865
- space: {
866
- regex: /&(nbsp|#160);/g,
867
- val: " "
868
- },
869
- cent: {
870
- regex: /&(cent|#162);/g,
871
- val: "¢"
872
- },
873
- pound: {
874
- regex: /&(pound|#163);/g,
875
- val: "£"
876
- },
877
- yen: {
878
- regex: /&(yen|#165);/g,
879
- val: "¥"
880
- },
881
- euro: {
882
- regex: /&(euro|#8364);/g,
883
- val: "€"
884
- },
885
- copyright: {
886
- regex: /&(copy|#169);/g,
887
- val: "©"
888
- },
889
- reg: {
890
- regex: /&(reg|#174);/g,
891
- val: "®"
892
- },
893
- inr: {
894
- regex: /&(inr|#8377);/g,
895
- val: "₹"
896
- },
897
- num_dec: {
898
- regex: /&#([0-9]{1,7});/g,
899
- val: (e, t) => String.fromCodePoint(Number.parseInt(t, 10))
900
- },
901
- num_hex: {
902
- regex: /&#x([0-9a-fA-F]{1,6});/g,
903
- val: (e, t) => String.fromCodePoint(Number.parseInt(t, 16))
904
- }
905
- };
906
- this.addExternalEntities = X;
907
- this.parseXml = q;
908
- this.parseTextData = B;
909
- this.resolveNameSpace = Y;
910
- this.buildAttributesMap = W;
911
- this.isItStopNode = z;
912
- this.replaceEntitiesValue = K;
913
- this.readStopNodeData = te;
914
- this.saveTextToParentTag = Q;
915
- this.addChild = Z;
916
- this.ignoreAttributesFn = R(this.options.ignoreAttributes);
917
- if (this.options.stopNodes && this.options.stopNodes.length > 0) {
918
- this.stopNodesExact = new Set;
919
- this.stopNodesWildcard = new Set;
920
- for (let e = 0; e < this.options.stopNodes.length; e++) {
921
- const t = this.options.stopNodes[e];
922
- if (typeof t !== "string") continue;
923
- if (t.startsWith("*.")) {
924
- this.stopNodesWildcard.add(t.substring(2));
925
- } else {
926
- this.stopNodesExact.add(t);
644
+ function requireIgnoreAttributes() {
645
+ if (h) return g;
646
+ h = 1;
647
+ function getIgnoreAttributesFn(e) {
648
+ if (typeof e === "function") {
649
+ return e;
650
+ }
651
+ if (Array.isArray(e)) {
652
+ return t => {
653
+ for (const i of e) {
654
+ if (typeof i === "string" && t === i) {
655
+ return true;
656
+ }
657
+ if (i instanceof RegExp && i.test(t)) {
658
+ return true;
659
+ }
927
660
  }
928
- }
661
+ };
929
662
  }
663
+ return () => false;
930
664
  }
665
+ g = getIgnoreAttributesFn;
666
+ return g;
931
667
  }
932
668
 
933
- function X(e) {
934
- const t = Object.keys(e);
935
- for (let i = 0; i < t.length; i++) {
936
- const n = t[i];
937
- this.lastEntities[n] = {
938
- regex: new RegExp("&" + n + ";", "g"),
939
- val: e[n]
940
- };
669
+ var p;
670
+
671
+ var m;
672
+
673
+ function requireOrderedObjParser() {
674
+ if (m) return p;
675
+ m = 1;
676
+ "use strict";
677
+ const e = requireUtil();
678
+ const t = requireXmlNode();
679
+ const i = requireDocTypeReader();
680
+ const r = requireStrnum();
681
+ const n = requireIgnoreAttributes();
682
+ class OrderedObjParser {
683
+ constructor(e) {
684
+ this.options = e;
685
+ this.currentNode = null;
686
+ this.tagsNodeStack = [];
687
+ this.docTypeEntities = {};
688
+ this.lastEntities = {
689
+ apos: {
690
+ regex: /&(apos|#39|#x27);/g,
691
+ val: "'"
692
+ },
693
+ gt: {
694
+ regex: /&(gt|#62|#x3E);/g,
695
+ val: ">"
696
+ },
697
+ lt: {
698
+ regex: /&(lt|#60|#x3C);/g,
699
+ val: "<"
700
+ },
701
+ quot: {
702
+ regex: /&(quot|#34|#x22);/g,
703
+ val: '"'
704
+ }
705
+ };
706
+ this.ampEntity = {
707
+ regex: /&(amp|#38|#x26);/g,
708
+ val: "&"
709
+ };
710
+ this.htmlEntities = {
711
+ space: {
712
+ regex: /&(nbsp|#160);/g,
713
+ val: " "
714
+ },
715
+ cent: {
716
+ regex: /&(cent|#162);/g,
717
+ val: "¢"
718
+ },
719
+ pound: {
720
+ regex: /&(pound|#163);/g,
721
+ val: "£"
722
+ },
723
+ yen: {
724
+ regex: /&(yen|#165);/g,
725
+ val: "¥"
726
+ },
727
+ euro: {
728
+ regex: /&(euro|#8364);/g,
729
+ val: "€"
730
+ },
731
+ copyright: {
732
+ regex: /&(copy|#169);/g,
733
+ val: "©"
734
+ },
735
+ reg: {
736
+ regex: /&(reg|#174);/g,
737
+ val: "®"
738
+ },
739
+ inr: {
740
+ regex: /&(inr|#8377);/g,
741
+ val: "₹"
742
+ },
743
+ num_dec: {
744
+ regex: /&#([0-9]{1,7});/g,
745
+ val: (e, t) => String.fromCharCode(Number.parseInt(t, 10))
746
+ },
747
+ num_hex: {
748
+ regex: /&#x([0-9a-fA-F]{1,6});/g,
749
+ val: (e, t) => String.fromCharCode(Number.parseInt(t, 16))
750
+ }
751
+ };
752
+ this.addExternalEntities = addExternalEntities;
753
+ this.parseXml = parseXml;
754
+ this.parseTextData = parseTextData;
755
+ this.resolveNameSpace = resolveNameSpace;
756
+ this.buildAttributesMap = buildAttributesMap;
757
+ this.isItStopNode = isItStopNode;
758
+ this.replaceEntitiesValue = replaceEntitiesValue;
759
+ this.readStopNodeData = readStopNodeData;
760
+ this.saveTextToParentTag = saveTextToParentTag;
761
+ this.addChild = addChild;
762
+ this.ignoreAttributesFn = n(this.options.ignoreAttributes);
763
+ }
764
+ }
765
+ function addExternalEntities(e) {
766
+ const t = Object.keys(e);
767
+ for (let i = 0; i < t.length; i++) {
768
+ const r = t[i];
769
+ this.lastEntities[r] = {
770
+ regex: new RegExp("&" + r + ";", "g"),
771
+ val: e[r]
772
+ };
773
+ }
941
774
  }
942
- }
943
-
944
- function B(e, t, i, n, s, r, o) {
945
- if (e !== undefined) {
946
- if (this.options.trimValues && !n) {
947
- e = e.trim();
948
- }
949
- if (e.length > 0) {
950
- if (!o) e = this.replaceEntitiesValue(e);
951
- const n = this.options.tagValueProcessor(t, e, i, s, r);
952
- if (n === null || n === undefined) {
953
- return e;
954
- } else if (typeof n !== typeof e || n !== e) {
955
- return n;
956
- } else if (this.options.trimValues) {
957
- return ie(e, this.options.parseTagValue, this.options.numberParseOptions);
958
- } else {
959
- const t = e.trim();
960
- if (t === e) {
961
- return ie(e, this.options.parseTagValue, this.options.numberParseOptions);
962
- } else {
775
+ function parseTextData(e, t, i, r, n, s, o) {
776
+ if (e !== undefined) {
777
+ if (this.options.trimValues && !r) {
778
+ e = e.trim();
779
+ }
780
+ if (e.length > 0) {
781
+ if (!o) e = this.replaceEntitiesValue(e);
782
+ const r = this.options.tagValueProcessor(t, e, i, n, s);
783
+ if (r === null || r === undefined) {
963
784
  return e;
785
+ } else if (typeof r !== typeof e || r !== e) {
786
+ return r;
787
+ } else if (this.options.trimValues) {
788
+ return parseValue(e, this.options.parseTagValue, this.options.numberParseOptions);
789
+ } else {
790
+ const t = e.trim();
791
+ if (t === e) {
792
+ return parseValue(e, this.options.parseTagValue, this.options.numberParseOptions);
793
+ } else {
794
+ return e;
795
+ }
964
796
  }
965
797
  }
966
798
  }
967
799
  }
968
- }
969
-
970
- function Y(e) {
971
- if (this.options.removeNSPrefix) {
972
- const t = e.split(":");
973
- const i = e.charAt(0) === "/" ? "/" : "";
974
- if (t[0] === "xmlns") {
975
- return "";
976
- }
977
- if (t.length === 2) {
978
- e = i + t[1];
800
+ function resolveNameSpace(e) {
801
+ if (this.options.removeNSPrefix) {
802
+ const t = e.split(":");
803
+ const i = e.charAt(0) === "/" ? "/" : "";
804
+ if (t[0] === "xmlns") {
805
+ return "";
806
+ }
807
+ if (t.length === 2) {
808
+ e = i + t[1];
809
+ }
979
810
  }
811
+ return e;
980
812
  }
981
- return e;
982
- }
983
-
984
- const G = new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?", "gm");
985
-
986
- function W(e, t, i) {
987
- if (this.options.ignoreAttributes !== true && typeof e === "string") {
988
- const i = s(e, G);
989
- const n = i.length;
990
- const r = {};
991
- for (let e = 0; e < n; e++) {
992
- const n = this.resolveNameSpace(i[e][1]);
993
- if (this.ignoreAttributesFn(n, t)) {
994
- continue;
995
- }
996
- let s = i[e][4];
997
- let o = this.options.attributeNamePrefix + n;
998
- if (n.length) {
999
- if (this.options.transformAttributeName) {
1000
- o = this.options.transformAttributeName(o);
813
+ const s = new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?", "gm");
814
+ function buildAttributesMap(t, i, r) {
815
+ if (this.options.ignoreAttributes !== true && typeof t === "string") {
816
+ const r = e.getAllMatches(t, s);
817
+ const n = r.length;
818
+ const o = {};
819
+ for (let e = 0; e < n; e++) {
820
+ const t = this.resolveNameSpace(r[e][1]);
821
+ if (this.ignoreAttributesFn(t, i)) {
822
+ continue;
1001
823
  }
1002
- if (o === "__proto__") o = "#__proto__";
1003
- if (s !== undefined) {
1004
- if (this.options.trimValues) {
1005
- s = s.trim();
824
+ let n = r[e][4];
825
+ let s = this.options.attributeNamePrefix + t;
826
+ if (t.length) {
827
+ if (this.options.transformAttributeName) {
828
+ s = this.options.transformAttributeName(s);
1006
829
  }
1007
- s = this.replaceEntitiesValue(s);
1008
- const e = this.options.attributeValueProcessor(n, s, t);
1009
- if (e === null || e === undefined) {
1010
- r[o] = s;
1011
- } else if (typeof e !== typeof s || e !== s) {
1012
- r[o] = e;
1013
- } else {
1014
- r[o] = ie(s, this.options.parseAttributeValue, this.options.numberParseOptions);
830
+ if (s === "__proto__") s = "#__proto__";
831
+ if (n !== undefined) {
832
+ if (this.options.trimValues) {
833
+ n = n.trim();
834
+ }
835
+ n = this.replaceEntitiesValue(n);
836
+ const e = this.options.attributeValueProcessor(t, n, i);
837
+ if (e === null || e === undefined) {
838
+ o[s] = n;
839
+ } else if (typeof e !== typeof n || e !== n) {
840
+ o[s] = e;
841
+ } else {
842
+ o[s] = parseValue(n, this.options.parseAttributeValue, this.options.numberParseOptions);
843
+ }
844
+ } else if (this.options.allowBooleanAttributes) {
845
+ o[s] = true;
1015
846
  }
1016
- } else if (this.options.allowBooleanAttributes) {
1017
- r[o] = true;
1018
847
  }
1019
848
  }
849
+ if (!Object.keys(o).length) {
850
+ return;
851
+ }
852
+ if (this.options.attributesGroupName) {
853
+ const e = {};
854
+ e[this.options.attributesGroupName] = o;
855
+ return e;
856
+ }
857
+ return o;
1020
858
  }
1021
- if (!Object.keys(r).length) {
1022
- return;
1023
- }
1024
- if (this.options.attributesGroupName) {
1025
- const e = {};
1026
- e[this.options.attributesGroupName] = r;
1027
- return e;
1028
- }
1029
- return r;
1030
859
  }
1031
- }
1032
-
1033
- const q = function(e) {
1034
- e = e.replace(/\r\n?/g, "\n");
1035
- const t = new XmlNode("!xml");
1036
- let i = t;
1037
- let n = "";
1038
- let s = "";
1039
- const r = new DocTypeReader(this.options.processEntities);
1040
- for (let o = 0; o < e.length; o++) {
1041
- const a = e[o];
1042
- if (a === "<") {
1043
- if (e[o + 1] === "/") {
1044
- const t = H(e, ">", o, "Closing Tag is not closed.");
1045
- let r = e.substring(o + 2, t).trim();
1046
- if (this.options.removeNSPrefix) {
1047
- const e = r.indexOf(":");
1048
- if (e !== -1) {
1049
- r = r.substr(e + 1);
860
+ const parseXml = function(e) {
861
+ e = e.replace(/\r\n?/g, "\n");
862
+ const r = new t("!xml");
863
+ let n = r;
864
+ let s = "";
865
+ let o = "";
866
+ for (let a = 0; a < e.length; a++) {
867
+ const l = e[a];
868
+ if (l === "<") {
869
+ if (e[a + 1] === "/") {
870
+ const t = findClosingIndex(e, ">", a, "Closing Tag is not closed.");
871
+ let i = e.substring(a + 2, t).trim();
872
+ if (this.options.removeNSPrefix) {
873
+ const e = i.indexOf(":");
874
+ if (e !== -1) {
875
+ i = i.substr(e + 1);
876
+ }
1050
877
  }
1051
- }
1052
- if (this.options.transformTagName) {
1053
- r = this.options.transformTagName(r);
1054
- }
1055
- if (i) {
1056
- n = this.saveTextToParentTag(n, i, s);
1057
- }
1058
- const a = s.substring(s.lastIndexOf(".") + 1);
1059
- if (r && this.options.unpairedTags.indexOf(r) !== -1) {
1060
- throw new Error(`Unpaired tag can not be used as closing tag: </${r}>`);
1061
- }
1062
- let l = 0;
1063
- if (a && this.options.unpairedTags.indexOf(a) !== -1) {
1064
- l = s.lastIndexOf(".", s.lastIndexOf(".") - 1);
1065
- this.tagsNodeStack.pop();
1066
- } else {
1067
- l = s.lastIndexOf(".");
1068
- }
1069
- s = s.substring(0, l);
1070
- i = this.tagsNodeStack.pop();
1071
- n = "";
1072
- o = t;
1073
- } else if (e[o + 1] === "?") {
1074
- let t = ee(e, o, false, "?>");
1075
- if (!t) throw new Error("Pi Tag is not closed.");
1076
- n = this.saveTextToParentTag(n, i, s);
1077
- if (this.options.ignoreDeclaration && t.tagName === "?xml" || this.options.ignorePiTags) {} else {
1078
- const e = new XmlNode(t.tagName);
1079
- e.add(this.options.textNodeName, "");
1080
- if (t.tagName !== t.tagExp && t.attrExpPresent) {
1081
- e[":@"] = this.buildAttributesMap(t.tagExp, s, t.tagName);
878
+ if (this.options.transformTagName) {
879
+ i = this.options.transformTagName(i);
1082
880
  }
1083
- this.addChild(i, e, s, o);
1084
- }
1085
- o = t.closeIndex + 1;
1086
- } else if (e.substr(o + 1, 3) === "!--") {
1087
- const t = H(e, "--\x3e", o + 4, "Comment is not closed.");
1088
- if (this.options.commentPropName) {
1089
- const r = e.substring(o + 4, t - 2);
1090
- n = this.saveTextToParentTag(n, i, s);
1091
- i.add(this.options.commentPropName, [ {
1092
- [this.options.textNodeName]: r
1093
- } ]);
1094
- }
1095
- o = t;
1096
- } else if (e.substr(o + 1, 2) === "!D") {
1097
- const t = r.readDocType(e, o);
1098
- this.docTypeEntities = t.entities;
1099
- o = t.i;
1100
- } else if (e.substr(o + 1, 2) === "![") {
1101
- const t = H(e, "]]>", o, "CDATA is not closed.") - 2;
1102
- const r = e.substring(o + 9, t);
1103
- n = this.saveTextToParentTag(n, i, s);
1104
- let a = this.parseTextData(r, i.tagname, s, true, false, true, true);
1105
- if (a == undefined) a = "";
1106
- if (this.options.cdataPropName) {
1107
- i.add(this.options.cdataPropName, [ {
1108
- [this.options.textNodeName]: r
1109
- } ]);
1110
- } else {
1111
- i.add(this.options.textNodeName, a);
1112
- }
1113
- o = t + 2;
1114
- } else {
1115
- let r = ee(e, o, this.options.removeNSPrefix);
1116
- let a = r.tagName;
1117
- const l = r.rawTagName;
1118
- let u = r.tagExp;
1119
- let f = r.attrExpPresent;
1120
- let d = r.closeIndex;
1121
- if (this.options.transformTagName) {
1122
- a = this.options.transformTagName(a);
1123
- }
1124
- if (i && n) {
1125
- if (i.tagname !== "!xml") {
1126
- n = this.saveTextToParentTag(n, i, s, false);
881
+ if (n) {
882
+ s = this.saveTextToParentTag(s, n, o);
1127
883
  }
1128
- }
1129
- const h = i;
1130
- if (h && this.options.unpairedTags.indexOf(h.tagname) !== -1) {
1131
- i = this.tagsNodeStack.pop();
1132
- s = s.substring(0, s.lastIndexOf("."));
1133
- }
1134
- if (a !== t.tagname) {
1135
- s += s ? "." + a : a;
1136
- }
1137
- const c = o;
1138
- if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s, a)) {
1139
- let t = "";
1140
- if (u.length > 0 && u.lastIndexOf("/") === u.length - 1) {
1141
- if (a[a.length - 1] === "/") {
1142
- a = a.substr(0, a.length - 1);
1143
- s = s.substr(0, s.length - 1);
1144
- u = a;
1145
- } else {
1146
- u = u.substr(0, u.length - 1);
1147
- }
1148
- o = r.closeIndex;
1149
- } else if (this.options.unpairedTags.indexOf(a) !== -1) {
1150
- o = r.closeIndex;
884
+ const r = o.substring(o.lastIndexOf(".") + 1);
885
+ if (i && this.options.unpairedTags.indexOf(i) !== -1) {
886
+ throw new Error(`Unpaired tag can not be used as closing tag: </${i}>`);
887
+ }
888
+ let l = 0;
889
+ if (r && this.options.unpairedTags.indexOf(r) !== -1) {
890
+ l = o.lastIndexOf(".", o.lastIndexOf(".") - 1);
891
+ this.tagsNodeStack.pop();
1151
892
  } else {
1152
- const i = this.readStopNodeData(e, l, d + 1);
1153
- if (!i) throw new Error(`Unexpected end of ${l}`);
1154
- o = i.i;
1155
- t = i.tagContent;
893
+ l = o.lastIndexOf(".");
894
+ }
895
+ o = o.substring(0, l);
896
+ n = this.tagsNodeStack.pop();
897
+ s = "";
898
+ a = t;
899
+ } else if (e[a + 1] === "?") {
900
+ let i = readTagExp(e, a, false, "?>");
901
+ if (!i) throw new Error("Pi Tag is not closed.");
902
+ s = this.saveTextToParentTag(s, n, o);
903
+ if (this.options.ignoreDeclaration && i.tagName === "?xml" || this.options.ignorePiTags) {} else {
904
+ const e = new t(i.tagName);
905
+ e.add(this.options.textNodeName, "");
906
+ if (i.tagName !== i.tagExp && i.attrExpPresent) {
907
+ e[":@"] = this.buildAttributesMap(i.tagExp, o, i.tagName);
908
+ }
909
+ this.addChild(n, e, o);
1156
910
  }
1157
- const n = new XmlNode(a);
1158
- if (a !== u && f) {
1159
- n[":@"] = this.buildAttributesMap(u, s, a);
911
+ a = i.closeIndex + 1;
912
+ } else if (e.substr(a + 1, 3) === "!--") {
913
+ const t = findClosingIndex(e, "--\x3e", a + 4, "Comment is not closed.");
914
+ if (this.options.commentPropName) {
915
+ const i = e.substring(a + 4, t - 2);
916
+ s = this.saveTextToParentTag(s, n, o);
917
+ n.add(this.options.commentPropName, [ {
918
+ [this.options.textNodeName]: i
919
+ } ]);
1160
920
  }
1161
- if (t) {
1162
- t = this.parseTextData(t, a, s, true, f, true, true);
921
+ a = t;
922
+ } else if (e.substr(a + 1, 2) === "!D") {
923
+ const t = i(e, a);
924
+ this.docTypeEntities = t.entities;
925
+ a = t.i;
926
+ } else if (e.substr(a + 1, 2) === "![") {
927
+ const t = findClosingIndex(e, "]]>", a, "CDATA is not closed.") - 2;
928
+ const i = e.substring(a + 9, t);
929
+ s = this.saveTextToParentTag(s, n, o);
930
+ let r = this.parseTextData(i, n.tagname, o, true, false, true, true);
931
+ if (r == undefined) r = "";
932
+ if (this.options.cdataPropName) {
933
+ n.add(this.options.cdataPropName, [ {
934
+ [this.options.textNodeName]: i
935
+ } ]);
936
+ } else {
937
+ n.add(this.options.textNodeName, r);
1163
938
  }
1164
- s = s.substr(0, s.lastIndexOf("."));
1165
- n.add(this.options.textNodeName, t);
1166
- this.addChild(i, n, s, c);
939
+ a = t + 2;
1167
940
  } else {
1168
- if (u.length > 0 && u.lastIndexOf("/") === u.length - 1) {
1169
- if (a[a.length - 1] === "/") {
1170
- a = a.substr(0, a.length - 1);
1171
- s = s.substr(0, s.length - 1);
1172
- u = a;
941
+ let i = readTagExp(e, a, this.options.removeNSPrefix);
942
+ let l = i.tagName;
943
+ const u = i.rawTagName;
944
+ let f = i.tagExp;
945
+ let d = i.attrExpPresent;
946
+ let c = i.closeIndex;
947
+ if (this.options.transformTagName) {
948
+ l = this.options.transformTagName(l);
949
+ }
950
+ if (n && s) {
951
+ if (n.tagname !== "!xml") {
952
+ s = this.saveTextToParentTag(s, n, o, false);
953
+ }
954
+ }
955
+ const g = n;
956
+ if (g && this.options.unpairedTags.indexOf(g.tagname) !== -1) {
957
+ n = this.tagsNodeStack.pop();
958
+ o = o.substring(0, o.lastIndexOf("."));
959
+ }
960
+ if (l !== r.tagname) {
961
+ o += o ? "." + l : l;
962
+ }
963
+ if (this.isItStopNode(this.options.stopNodes, o, l)) {
964
+ let r = "";
965
+ if (f.length > 0 && f.lastIndexOf("/") === f.length - 1) {
966
+ if (l[l.length - 1] === "/") {
967
+ l = l.substr(0, l.length - 1);
968
+ o = o.substr(0, o.length - 1);
969
+ f = l;
970
+ } else {
971
+ f = f.substr(0, f.length - 1);
972
+ }
973
+ a = i.closeIndex;
974
+ } else if (this.options.unpairedTags.indexOf(l) !== -1) {
975
+ a = i.closeIndex;
1173
976
  } else {
1174
- u = u.substr(0, u.length - 1);
977
+ const t = this.readStopNodeData(e, u, c + 1);
978
+ if (!t) throw new Error(`Unexpected end of ${u}`);
979
+ a = t.i;
980
+ r = t.tagContent;
1175
981
  }
1176
- if (this.options.transformTagName) {
1177
- a = this.options.transformTagName(a);
982
+ const s = new t(l);
983
+ if (l !== f && d) {
984
+ s[":@"] = this.buildAttributesMap(f, o, l);
1178
985
  }
1179
- const e = new XmlNode(a);
1180
- if (a !== u && f) {
1181
- e[":@"] = this.buildAttributesMap(u, s, a);
986
+ if (r) {
987
+ r = this.parseTextData(r, l, o, true, d, true, true);
1182
988
  }
1183
- this.addChild(i, e, s, c);
1184
- s = s.substr(0, s.lastIndexOf("."));
989
+ o = o.substr(0, o.lastIndexOf("."));
990
+ s.add(this.options.textNodeName, r);
991
+ this.addChild(n, s, o);
1185
992
  } else {
1186
- const e = new XmlNode(a);
1187
- this.tagsNodeStack.push(i);
1188
- if (a !== u && f) {
1189
- e[":@"] = this.buildAttributesMap(u, s, a);
993
+ if (f.length > 0 && f.lastIndexOf("/") === f.length - 1) {
994
+ if (l[l.length - 1] === "/") {
995
+ l = l.substr(0, l.length - 1);
996
+ o = o.substr(0, o.length - 1);
997
+ f = l;
998
+ } else {
999
+ f = f.substr(0, f.length - 1);
1000
+ }
1001
+ if (this.options.transformTagName) {
1002
+ l = this.options.transformTagName(l);
1003
+ }
1004
+ const e = new t(l);
1005
+ if (l !== f && d) {
1006
+ e[":@"] = this.buildAttributesMap(f, o, l);
1007
+ }
1008
+ this.addChild(n, e, o);
1009
+ o = o.substr(0, o.lastIndexOf("."));
1010
+ } else {
1011
+ const e = new t(l);
1012
+ this.tagsNodeStack.push(n);
1013
+ if (l !== f && d) {
1014
+ e[":@"] = this.buildAttributesMap(f, o, l);
1015
+ }
1016
+ this.addChild(n, e, o);
1017
+ n = e;
1190
1018
  }
1191
- this.addChild(i, e, s, c);
1192
- i = e;
1019
+ s = "";
1020
+ a = c;
1193
1021
  }
1194
- n = "";
1195
- o = d;
1196
1022
  }
1023
+ } else {
1024
+ s += e[a];
1197
1025
  }
1026
+ }
1027
+ return r.child;
1028
+ };
1029
+ function addChild(e, t, i) {
1030
+ const r = this.options.updateTag(t.tagname, i, t[":@"]);
1031
+ if (r === false) {} else if (typeof r === "string") {
1032
+ t.tagname = r;
1033
+ e.addChild(t);
1198
1034
  } else {
1199
- n += e[o];
1035
+ e.addChild(t);
1200
1036
  }
1201
1037
  }
1202
- return t.child;
1203
- };
1204
-
1205
- function Z(e, t, i, n) {
1206
- if (!this.options.captureMetaData) n = undefined;
1207
- const s = this.options.updateTag(t.tagname, i, t[":@"]);
1208
- if (s === false) {} else if (typeof s === "string") {
1209
- t.tagname = s;
1210
- e.addChild(t, n);
1211
- } else {
1212
- e.addChild(t, n);
1213
- }
1214
- }
1215
-
1216
- const K = function(e) {
1217
- if (this.options.processEntities) {
1218
- for (let t in this.docTypeEntities) {
1219
- const i = this.docTypeEntities[t];
1220
- e = e.replace(i.regx, i.val);
1221
- }
1222
- for (let t in this.lastEntities) {
1223
- const i = this.lastEntities[t];
1224
- e = e.replace(i.regex, i.val);
1225
- }
1226
- if (this.options.htmlEntities) {
1227
- for (let t in this.htmlEntities) {
1228
- const i = this.htmlEntities[t];
1038
+ const replaceEntitiesValue = function(e) {
1039
+ if (this.options.processEntities) {
1040
+ for (let t in this.docTypeEntities) {
1041
+ const i = this.docTypeEntities[t];
1042
+ e = e.replace(i.regx, i.val);
1043
+ }
1044
+ for (let t in this.lastEntities) {
1045
+ const i = this.lastEntities[t];
1229
1046
  e = e.replace(i.regex, i.val);
1230
1047
  }
1048
+ if (this.options.htmlEntities) {
1049
+ for (let t in this.htmlEntities) {
1050
+ const i = this.htmlEntities[t];
1051
+ e = e.replace(i.regex, i.val);
1052
+ }
1053
+ }
1054
+ e = e.replace(this.ampEntity.regex, this.ampEntity.val);
1055
+ }
1056
+ return e;
1057
+ };
1058
+ function saveTextToParentTag(e, t, i, r) {
1059
+ if (e) {
1060
+ if (r === undefined) r = t.child.length === 0;
1061
+ e = this.parseTextData(e, t.tagname, i, false, t[":@"] ? Object.keys(t[":@"]).length !== 0 : false, r);
1062
+ if (e !== undefined && e !== "") t.add(this.options.textNodeName, e);
1063
+ e = "";
1231
1064
  }
1232
- e = e.replace(this.ampEntity.regex, this.ampEntity.val);
1065
+ return e;
1233
1066
  }
1234
- return e;
1235
- };
1236
-
1237
- function Q(e, t, i, n) {
1238
- if (e) {
1239
- if (n === undefined) n = t.child.length === 0;
1240
- e = this.parseTextData(e, t.tagname, i, false, t[":@"] ? Object.keys(t[":@"]).length !== 0 : false, n);
1241
- if (e !== undefined && e !== "") t.add(this.options.textNodeName, e);
1242
- e = "";
1067
+ function isItStopNode(e, t, i) {
1068
+ const r = "*." + i;
1069
+ for (const i in e) {
1070
+ const n = e[i];
1071
+ if (r === n || t === n) return true;
1072
+ }
1073
+ return false;
1243
1074
  }
1244
- return e;
1245
- }
1246
-
1247
- function z(e, t, i, n) {
1248
- if (t && t.has(n)) return true;
1249
- if (e && e.has(i)) return true;
1250
- return false;
1251
- }
1252
-
1253
- function J(e, t, i = ">") {
1254
- let n;
1255
- let s = "";
1256
- for (let r = t; r < e.length; r++) {
1257
- let t = e[r];
1258
- if (n) {
1259
- if (t === n) n = "";
1260
- } else if (t === '"' || t === "'") {
1261
- n = t;
1262
- } else if (t === i[0]) {
1263
- if (i[1]) {
1264
- if (e[r + 1] === i[1]) {
1075
+ function tagExpWithClosingIndex(e, t, i = ">") {
1076
+ let r;
1077
+ let n = "";
1078
+ for (let s = t; s < e.length; s++) {
1079
+ let t = e[s];
1080
+ if (r) {
1081
+ if (t === r) r = "";
1082
+ } else if (t === '"' || t === "'") {
1083
+ r = t;
1084
+ } else if (t === i[0]) {
1085
+ if (i[1]) {
1086
+ if (e[s + 1] === i[1]) {
1087
+ return {
1088
+ data: n,
1089
+ index: s
1090
+ };
1091
+ }
1092
+ } else {
1265
1093
  return {
1266
- data: s,
1267
- index: r
1094
+ data: n,
1095
+ index: s
1268
1096
  };
1269
1097
  }
1270
- } else {
1271
- return {
1272
- data: s,
1273
- index: r
1274
- };
1098
+ } else if (t === "\t") {
1099
+ t = " ";
1275
1100
  }
1276
- } else if (t === "\t") {
1277
- t = " ";
1101
+ n += t;
1278
1102
  }
1279
- s += t;
1280
- }
1281
- }
1282
-
1283
- function H(e, t, i, n) {
1284
- const s = e.indexOf(t, i);
1285
- if (s === -1) {
1286
- throw new Error(n);
1287
- } else {
1288
- return s + t.length - 1;
1289
- }
1290
- }
1291
-
1292
- function ee(e, t, i, n = ">") {
1293
- const s = J(e, t + 1, n);
1294
- if (!s) return;
1295
- let r = s.data;
1296
- const o = s.index;
1297
- const a = r.search(/\s/);
1298
- let l = r;
1299
- let u = true;
1300
- if (a !== -1) {
1301
- l = r.substring(0, a);
1302
- r = r.substring(a + 1).trimStart();
1303
1103
  }
1304
- const f = l;
1305
- if (i) {
1306
- const e = l.indexOf(":");
1307
- if (e !== -1) {
1308
- l = l.substr(e + 1);
1309
- u = l !== s.data.substr(e + 1);
1104
+ function findClosingIndex(e, t, i, r) {
1105
+ const n = e.indexOf(t, i);
1106
+ if (n === -1) {
1107
+ throw new Error(r);
1108
+ } else {
1109
+ return n + t.length - 1;
1110
+ }
1111
+ }
1112
+ function readTagExp(e, t, i, r = ">") {
1113
+ const n = tagExpWithClosingIndex(e, t + 1, r);
1114
+ if (!n) return;
1115
+ let s = n.data;
1116
+ const o = n.index;
1117
+ const a = s.search(/\s/);
1118
+ let l = s;
1119
+ let u = true;
1120
+ if (a !== -1) {
1121
+ l = s.substring(0, a);
1122
+ s = s.substring(a + 1).trimStart();
1123
+ }
1124
+ const f = l;
1125
+ if (i) {
1126
+ const e = l.indexOf(":");
1127
+ if (e !== -1) {
1128
+ l = l.substr(e + 1);
1129
+ u = l !== n.data.substr(e + 1);
1130
+ }
1310
1131
  }
1132
+ return {
1133
+ tagName: l,
1134
+ tagExp: s,
1135
+ closeIndex: o,
1136
+ attrExpPresent: u,
1137
+ rawTagName: f
1138
+ };
1311
1139
  }
1312
- return {
1313
- tagName: l,
1314
- tagExp: r,
1315
- closeIndex: o,
1316
- attrExpPresent: u,
1317
- rawTagName: f
1318
- };
1319
- }
1320
-
1321
- function te(e, t, i) {
1322
- const n = i;
1323
- let s = 1;
1324
- for (;i < e.length; i++) {
1325
- if (e[i] === "<") {
1326
- if (e[i + 1] === "/") {
1327
- const r = H(e, ">", i, `${t} is not closed`);
1328
- let o = e.substring(i + 2, r).trim();
1329
- if (o === t) {
1330
- s--;
1331
- if (s === 0) {
1332
- return {
1333
- tagContent: e.substring(n, i),
1334
- i: r
1335
- };
1140
+ function readStopNodeData(e, t, i) {
1141
+ const r = i;
1142
+ let n = 1;
1143
+ for (;i < e.length; i++) {
1144
+ if (e[i] === "<") {
1145
+ if (e[i + 1] === "/") {
1146
+ const s = findClosingIndex(e, ">", i, `${t} is not closed`);
1147
+ let o = e.substring(i + 2, s).trim();
1148
+ if (o === t) {
1149
+ n--;
1150
+ if (n === 0) {
1151
+ return {
1152
+ tagContent: e.substring(r, i),
1153
+ i: s
1154
+ };
1155
+ }
1336
1156
  }
1337
- }
1338
- i = r;
1339
- } else if (e[i + 1] === "?") {
1340
- const t = H(e, "?>", i + 1, "StopNode is not closed.");
1341
- i = t;
1342
- } else if (e.substr(i + 1, 3) === "!--") {
1343
- const t = H(e, "--\x3e", i + 3, "StopNode is not closed.");
1344
- i = t;
1345
- } else if (e.substr(i + 1, 2) === "![") {
1346
- const t = H(e, "]]>", i, "StopNode is not closed.") - 2;
1347
- i = t;
1348
- } else {
1349
- const n = ee(e, i, ">");
1350
- if (n) {
1351
- const e = n && n.tagName;
1352
- if (e === t && n.tagExp[n.tagExp.length - 1] !== "/") {
1353
- s++;
1157
+ i = s;
1158
+ } else if (e[i + 1] === "?") {
1159
+ const t = findClosingIndex(e, "?>", i + 1, "StopNode is not closed.");
1160
+ i = t;
1161
+ } else if (e.substr(i + 1, 3) === "!--") {
1162
+ const t = findClosingIndex(e, "--\x3e", i + 3, "StopNode is not closed.");
1163
+ i = t;
1164
+ } else if (e.substr(i + 1, 2) === "![") {
1165
+ const t = findClosingIndex(e, "]]>", i, "StopNode is not closed.") - 2;
1166
+ i = t;
1167
+ } else {
1168
+ const r = readTagExp(e, i, ">");
1169
+ if (r) {
1170
+ const e = r && r.tagName;
1171
+ if (e === t && r.tagExp[r.tagExp.length - 1] !== "/") {
1172
+ n++;
1173
+ }
1174
+ i = r.closeIndex;
1354
1175
  }
1355
- i = n.closeIndex;
1356
1176
  }
1357
1177
  }
1358
1178
  }
1359
1179
  }
1360
- }
1361
-
1362
- function ie(e, t, i) {
1363
- if (t && typeof e === "string") {
1364
- const t = e.trim();
1365
- if (t === "true") return true; else if (t === "false") return false; else return F(e, i);
1366
- } else {
1367
- if (o(e)) {
1368
- return e;
1180
+ function parseValue(t, i, n) {
1181
+ if (i && typeof t === "string") {
1182
+ const e = t.trim();
1183
+ if (e === "true") return true; else if (e === "false") return false; else return r(t, n);
1369
1184
  } else {
1370
- return "";
1185
+ if (e.isExist(t)) {
1186
+ return t;
1187
+ } else {
1188
+ return "";
1189
+ }
1371
1190
  }
1372
1191
  }
1192
+ p = OrderedObjParser;
1193
+ return p;
1373
1194
  }
1374
1195
 
1375
- "use strict";
1376
-
1377
- const ne = XmlNode.getMetaDataSymbol();
1378
-
1379
- function se(e, t) {
1380
- return re(e, t);
1381
- }
1382
-
1383
- function re(e, t, i) {
1384
- let n;
1385
- const s = {};
1386
- for (let r = 0; r < e.length; r++) {
1387
- const o = e[r];
1388
- const a = oe(o);
1389
- let l = "";
1390
- if (i === undefined) l = a; else l = i + "." + a;
1391
- if (a === t.textNodeName) {
1392
- if (n === undefined) n = o[a]; else n += "" + o[a];
1393
- } else if (a === undefined) {
1394
- continue;
1395
- } else if (o[a]) {
1396
- let e = re(o[a], t, l);
1397
- const i = le(e, t);
1398
- if (o[ne] !== undefined) {
1399
- e[ne] = o[ne];
1400
- }
1401
- if (o[":@"]) {
1402
- ae(e, o[":@"], l, t);
1403
- } else if (Object.keys(e).length === 1 && e[t.textNodeName] !== undefined && !t.alwaysCreateTextNode) {
1404
- e = e[t.textNodeName];
1405
- } else if (Object.keys(e).length === 0) {
1406
- if (t.alwaysCreateTextNode) e[t.textNodeName] = ""; else e = "";
1407
- }
1408
- if (s[a] !== undefined && s.hasOwnProperty(a)) {
1409
- if (!Array.isArray(s[a])) {
1410
- s[a] = [ s[a] ];
1196
+ var b = {};
1197
+
1198
+ var x;
1199
+
1200
+ function requireNode2json() {
1201
+ if (x) return b;
1202
+ x = 1;
1203
+ "use strict";
1204
+ function prettify(e, t) {
1205
+ return compress(e, t);
1206
+ }
1207
+ function compress(e, t, i) {
1208
+ let r;
1209
+ const n = {};
1210
+ for (let s = 0; s < e.length; s++) {
1211
+ const o = e[s];
1212
+ const a = propName(o);
1213
+ let l = "";
1214
+ if (i === undefined) l = a; else l = i + "." + a;
1215
+ if (a === t.textNodeName) {
1216
+ if (r === undefined) r = o[a]; else r += "" + o[a];
1217
+ } else if (a === undefined) {
1218
+ continue;
1219
+ } else if (o[a]) {
1220
+ let e = compress(o[a], t, l);
1221
+ const i = isLeafTag(e, t);
1222
+ if (o[":@"]) {
1223
+ assignAttributes(e, o[":@"], l, t);
1224
+ } else if (Object.keys(e).length === 1 && e[t.textNodeName] !== undefined && !t.alwaysCreateTextNode) {
1225
+ e = e[t.textNodeName];
1226
+ } else if (Object.keys(e).length === 0) {
1227
+ if (t.alwaysCreateTextNode) e[t.textNodeName] = ""; else e = "";
1411
1228
  }
1412
- s[a].push(e);
1413
- } else {
1414
- if (t.isArray(a, l, i)) {
1415
- s[a] = [ e ];
1229
+ if (n[a] !== undefined && n.hasOwnProperty(a)) {
1230
+ if (!Array.isArray(n[a])) {
1231
+ n[a] = [ n[a] ];
1232
+ }
1233
+ n[a].push(e);
1416
1234
  } else {
1417
- s[a] = e;
1235
+ if (t.isArray(a, l, i)) {
1236
+ n[a] = [ e ];
1237
+ } else {
1238
+ n[a] = e;
1239
+ }
1418
1240
  }
1419
1241
  }
1420
1242
  }
1243
+ if (typeof r === "string") {
1244
+ if (r.length > 0) n[t.textNodeName] = r;
1245
+ } else if (r !== undefined) n[t.textNodeName] = r;
1246
+ return n;
1421
1247
  }
1422
- if (typeof n === "string") {
1423
- if (n.length > 0) s[t.textNodeName] = n;
1424
- } else if (n !== undefined) s[t.textNodeName] = n;
1425
- return s;
1426
- }
1427
-
1428
- function oe(e) {
1429
- const t = Object.keys(e);
1430
- for (let e = 0; e < t.length; e++) {
1431
- const i = t[e];
1432
- if (i !== ":@") return i;
1433
- }
1434
- }
1435
-
1436
- function ae(e, t, i, n) {
1437
- if (t) {
1438
- const s = Object.keys(t);
1439
- const r = s.length;
1440
- for (let o = 0; o < r; o++) {
1441
- const r = s[o];
1442
- if (n.isArray(r, i + "." + r, true, true)) {
1443
- e[r] = [ t[r] ];
1444
- } else {
1445
- e[r] = t[r];
1446
- }
1248
+ function propName(e) {
1249
+ const t = Object.keys(e);
1250
+ for (let e = 0; e < t.length; e++) {
1251
+ const i = t[e];
1252
+ if (i !== ":@") return i;
1447
1253
  }
1448
1254
  }
1449
- }
1450
-
1451
- function le(e, t) {
1452
- const {textNodeName: i} = t;
1453
- const n = Object.keys(e).length;
1454
- if (n === 0) {
1455
- return true;
1456
- }
1457
- if (n === 1 && (e[i] || typeof e[i] === "boolean" || e[i] === 0)) {
1458
- return true;
1459
- }
1460
- return false;
1461
- }
1462
-
1463
- class XMLParser {
1464
- constructor(e) {
1465
- this.externalEntities = {};
1466
- this.options = A(e);
1467
- }
1468
- parse(e, t) {
1469
- if (typeof e !== "string" && e.toString) {
1470
- e = e.toString();
1471
- } else if (typeof e !== "string") {
1472
- throw new Error("XML data is accepted in String or Bytes[] form.");
1473
- }
1255
+ function assignAttributes(e, t, i, r) {
1474
1256
  if (t) {
1475
- if (t === true) t = {};
1476
- const i = d(e, t);
1477
- if (i !== true) {
1478
- throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`);
1257
+ const n = Object.keys(t);
1258
+ const s = n.length;
1259
+ for (let o = 0; o < s; o++) {
1260
+ const s = n[o];
1261
+ if (r.isArray(s, i + "." + s, true, true)) {
1262
+ e[s] = [ t[s] ];
1263
+ } else {
1264
+ e[s] = t[s];
1265
+ }
1479
1266
  }
1480
1267
  }
1481
- const i = new OrderedObjParser(this.options);
1482
- i.addExternalEntities(this.externalEntities);
1483
- const n = i.parseXml(e);
1484
- if (this.options.preserveOrder || n === undefined) return n; else return se(n, this.options);
1485
1268
  }
1486
- addEntity(e, t) {
1487
- if (t.indexOf("&") !== -1) {
1488
- throw new Error("Entity value can't have '&'");
1489
- } else if (e.indexOf("&") !== -1 || e.indexOf(";") !== -1) {
1490
- throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
1491
- } else if (t === "&") {
1492
- throw new Error("An entity with value '&' is not permitted");
1493
- } else {
1494
- this.externalEntities[e] = t;
1269
+ function isLeafTag(e, t) {
1270
+ const {textNodeName: i} = t;
1271
+ const r = Object.keys(e).length;
1272
+ if (r === 0) {
1273
+ return true;
1495
1274
  }
1275
+ if (r === 1 && (e[i] || typeof e[i] === "boolean" || e[i] === 0)) {
1276
+ return true;
1277
+ }
1278
+ return false;
1496
1279
  }
1497
- static getMetaDataSymbol() {
1498
- return XmlNode.getMetaDataSymbol();
1499
- }
1500
- }
1501
-
1502
- const ue = "\n";
1503
-
1504
- function fe(e, t) {
1505
- let i = "";
1506
- if (t.format && t.indentBy.length > 0) {
1507
- i = ue;
1508
- }
1509
- return de(e, t, "", i);
1280
+ b.prettify = prettify;
1281
+ return b;
1510
1282
  }
1511
1283
 
1512
- function de(e, t, i, n) {
1513
- let s = "";
1514
- let r = false;
1515
- for (let o = 0; o < e.length; o++) {
1516
- const a = e[o];
1517
- const l = he(a);
1518
- if (l === undefined) continue;
1519
- let u = "";
1520
- if (i.length === 0) u = l; else u = `${i}.${l}`;
1521
- if (l === t.textNodeName) {
1522
- let e = a[l];
1523
- if (!pe(u, t)) {
1524
- e = t.tagValueProcessor(l, e);
1525
- e = ge(e, t);
1526
- }
1527
- if (r) {
1528
- s += n;
1284
+ var N;
1285
+
1286
+ var E;
1287
+
1288
+ function requireXMLParser() {
1289
+ if (E) return N;
1290
+ E = 1;
1291
+ const {buildOptions: e} = requireOptionsBuilder();
1292
+ const t = requireOrderedObjParser();
1293
+ const {prettify: i} = requireNode2json();
1294
+ const r = requireValidator();
1295
+ class XMLParser {
1296
+ constructor(t) {
1297
+ this.externalEntities = {};
1298
+ this.options = e(t);
1299
+ }
1300
+ parse(e, n) {
1301
+ if (typeof e === "string") {} else if (e.toString) {
1302
+ e = e.toString();
1303
+ } else {
1304
+ throw new Error("XML data is accepted in String or Bytes[] form.");
1529
1305
  }
1530
- s += e;
1531
- r = false;
1532
- continue;
1533
- } else if (l === t.cdataPropName) {
1534
- if (r) {
1535
- s += n;
1306
+ if (n) {
1307
+ if (n === true) n = {};
1308
+ const t = r.validate(e, n);
1309
+ if (t !== true) {
1310
+ throw Error(`${t.err.msg}:${t.err.line}:${t.err.col}`);
1311
+ }
1536
1312
  }
1537
- s += `<![CDATA[${a[l][0][t.textNodeName]}]]>`;
1538
- r = false;
1539
- continue;
1540
- } else if (l === t.commentPropName) {
1541
- s += n + `\x3c!--${a[l][0][t.textNodeName]}--\x3e`;
1542
- r = true;
1543
- continue;
1544
- } else if (l[0] === "?") {
1545
- const e = ce(a[":@"], t);
1546
- const i = l === "?xml" ? "" : n;
1547
- let o = a[l][0][t.textNodeName];
1548
- o = o.length !== 0 ? " " + o : "";
1549
- s += i + `<${l}${o}${e}?>`;
1550
- r = true;
1551
- continue;
1552
- }
1553
- let f = n;
1554
- if (f !== "") {
1555
- f += t.indentBy;
1556
- }
1557
- const d = ce(a[":@"], t);
1558
- const h = n + `<${l}${d}`;
1559
- const c = de(a[l], t, u, f);
1560
- if (t.unpairedTags.indexOf(l) !== -1) {
1561
- if (t.suppressUnpairedNode) s += h + ">"; else s += h + "/>";
1562
- } else if ((!c || c.length === 0) && t.suppressEmptyNode) {
1563
- s += h + "/>";
1564
- } else if (c && c.endsWith(">")) {
1565
- s += h + `>${c}${n}</${l}>`;
1566
- } else {
1567
- s += h + ">";
1568
- if (c && n !== "" && (c.includes("/>") || c.includes("</"))) {
1569
- s += n + t.indentBy + c + n;
1313
+ const s = new t(this.options);
1314
+ s.addExternalEntities(this.externalEntities);
1315
+ const o = s.parseXml(e);
1316
+ if (this.options.preserveOrder || o === undefined) return o; else return i(o, this.options);
1317
+ }
1318
+ addEntity(e, t) {
1319
+ if (t.indexOf("&") !== -1) {
1320
+ throw new Error("Entity value can't have '&'");
1321
+ } else if (e.indexOf("&") !== -1 || e.indexOf(";") !== -1) {
1322
+ throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
1323
+ } else if (t === "&") {
1324
+ throw new Error("An entity with value '&' is not permitted");
1570
1325
  } else {
1571
- s += c;
1326
+ this.externalEntities[e] = t;
1572
1327
  }
1573
- s += `</${l}>`;
1574
1328
  }
1575
- r = true;
1576
1329
  }
1577
- return s;
1330
+ N = XMLParser;
1331
+ return N;
1578
1332
  }
1579
1333
 
1580
- function he(e) {
1581
- const t = Object.keys(e);
1582
- for (let i = 0; i < t.length; i++) {
1583
- const n = t[i];
1584
- if (!e.hasOwnProperty(n)) continue;
1585
- if (n !== ":@") return n;
1586
- }
1587
- }
1334
+ var v;
1335
+
1336
+ var O;
1588
1337
 
1589
- function ce(e, t) {
1590
- let i = "";
1591
- if (e && !t.ignoreAttributes) {
1592
- for (let n in e) {
1593
- if (!e.hasOwnProperty(n)) continue;
1594
- let s = t.attributeValueProcessor(n, e[n]);
1595
- s = ge(s, t);
1596
- if (s === true && t.suppressBooleanAttributes) {
1597
- i += ` ${n.substr(t.attributeNamePrefix.length)}`;
1338
+ function requireOrderedJs2Xml() {
1339
+ if (O) return v;
1340
+ O = 1;
1341
+ const e = "\n";
1342
+ function toXml(t, i) {
1343
+ let r = "";
1344
+ if (i.format && i.indentBy.length > 0) {
1345
+ r = e;
1346
+ }
1347
+ return arrToStr(t, i, "", r);
1348
+ }
1349
+ function arrToStr(e, t, i, r) {
1350
+ let n = "";
1351
+ let s = false;
1352
+ for (let o = 0; o < e.length; o++) {
1353
+ const a = e[o];
1354
+ const l = propName(a);
1355
+ if (l === undefined) continue;
1356
+ let u = "";
1357
+ if (i.length === 0) u = l; else u = `${i}.${l}`;
1358
+ if (l === t.textNodeName) {
1359
+ let e = a[l];
1360
+ if (!isStopNode(u, t)) {
1361
+ e = t.tagValueProcessor(l, e);
1362
+ e = replaceEntitiesValue(e, t);
1363
+ }
1364
+ if (s) {
1365
+ n += r;
1366
+ }
1367
+ n += e;
1368
+ s = false;
1369
+ continue;
1370
+ } else if (l === t.cdataPropName) {
1371
+ if (s) {
1372
+ n += r;
1373
+ }
1374
+ n += `<![CDATA[${a[l][0][t.textNodeName]}]]>`;
1375
+ s = false;
1376
+ continue;
1377
+ } else if (l === t.commentPropName) {
1378
+ n += r + `\x3c!--${a[l][0][t.textNodeName]}--\x3e`;
1379
+ s = true;
1380
+ continue;
1381
+ } else if (l[0] === "?") {
1382
+ const e = attr_to_str(a[":@"], t);
1383
+ const i = l === "?xml" ? "" : r;
1384
+ let o = a[l][0][t.textNodeName];
1385
+ o = o.length !== 0 ? " " + o : "";
1386
+ n += i + `<${l}${o}${e}?>`;
1387
+ s = true;
1388
+ continue;
1389
+ }
1390
+ let f = r;
1391
+ if (f !== "") {
1392
+ f += t.indentBy;
1393
+ }
1394
+ const d = attr_to_str(a[":@"], t);
1395
+ const c = r + `<${l}${d}`;
1396
+ const g = arrToStr(a[l], t, u, f);
1397
+ if (t.unpairedTags.indexOf(l) !== -1) {
1398
+ if (t.suppressUnpairedNode) n += c + ">"; else n += c + "/>";
1399
+ } else if ((!g || g.length === 0) && t.suppressEmptyNode) {
1400
+ n += c + "/>";
1401
+ } else if (g && g.endsWith(">")) {
1402
+ n += c + `>${g}${r}</${l}>`;
1598
1403
  } else {
1599
- i += ` ${n.substr(t.attributeNamePrefix.length)}="${s}"`;
1404
+ n += c + ">";
1405
+ if (g && r !== "" && (g.includes("/>") || g.includes("</"))) {
1406
+ n += r + t.indentBy + g + r;
1407
+ } else {
1408
+ n += g;
1409
+ }
1410
+ n += `</${l}>`;
1600
1411
  }
1412
+ s = true;
1601
1413
  }
1414
+ return n;
1602
1415
  }
1603
- return i;
1604
- }
1605
-
1606
- function pe(e, t) {
1607
- e = e.substr(0, e.length - t.textNodeName.length - 1);
1608
- let i = e.substr(e.lastIndexOf(".") + 1);
1609
- for (let n in t.stopNodes) {
1610
- if (t.stopNodes[n] === e || t.stopNodes[n] === "*." + i) return true;
1416
+ function propName(e) {
1417
+ const t = Object.keys(e);
1418
+ for (let i = 0; i < t.length; i++) {
1419
+ const r = t[i];
1420
+ if (!e.hasOwnProperty(r)) continue;
1421
+ if (r !== ":@") return r;
1422
+ }
1611
1423
  }
1612
- return false;
1613
- }
1614
-
1615
- function ge(e, t) {
1616
- if (e && e.length > 0 && t.processEntities) {
1617
- for (let i = 0; i < t.entities.length; i++) {
1618
- const n = t.entities[i];
1619
- e = e.replace(n.regex, n.val);
1424
+ function attr_to_str(e, t) {
1425
+ let i = "";
1426
+ if (e && !t.ignoreAttributes) {
1427
+ for (let r in e) {
1428
+ if (!e.hasOwnProperty(r)) continue;
1429
+ let n = t.attributeValueProcessor(r, e[r]);
1430
+ n = replaceEntitiesValue(n, t);
1431
+ if (n === true && t.suppressBooleanAttributes) {
1432
+ i += ` ${r.substr(t.attributeNamePrefix.length)}`;
1433
+ } else {
1434
+ i += ` ${r.substr(t.attributeNamePrefix.length)}="${n}"`;
1435
+ }
1436
+ }
1620
1437
  }
1438
+ return i;
1621
1439
  }
1622
- return e;
1623
- }
1624
-
1625
- "use strict";
1626
-
1627
- const me = {
1628
- attributeNamePrefix: "@_",
1629
- attributesGroupName: false,
1630
- textNodeName: "#text",
1631
- ignoreAttributes: true,
1632
- cdataPropName: false,
1633
- format: false,
1634
- indentBy: " ",
1635
- suppressEmptyNode: false,
1636
- suppressUnpairedNode: true,
1637
- suppressBooleanAttributes: true,
1638
- tagValueProcessor: function(e, t) {
1639
- return t;
1640
- },
1641
- attributeValueProcessor: function(e, t) {
1642
- return t;
1643
- },
1644
- preserveOrder: false,
1645
- commentPropName: false,
1646
- unpairedTags: [],
1647
- entities: [ {
1648
- regex: new RegExp("&", "g"),
1649
- val: "&amp;"
1650
- }, {
1651
- regex: new RegExp(">", "g"),
1652
- val: "&gt;"
1653
- }, {
1654
- regex: new RegExp("<", "g"),
1655
- val: "&lt;"
1656
- }, {
1657
- regex: new RegExp("'", "g"),
1658
- val: "&apos;"
1659
- }, {
1660
- regex: new RegExp('"', "g"),
1661
- val: "&quot;"
1662
- } ],
1663
- processEntities: true,
1664
- stopNodes: [],
1665
- oneListGroup: false
1666
- };
1667
-
1668
- function xe(e) {
1669
- this.options = Object.assign({}, me, e);
1670
- if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
1671
- this.isAttribute = function() {
1672
- return false;
1673
- };
1674
- } else {
1675
- this.ignoreAttributesFn = R(this.options.ignoreAttributes);
1676
- this.attrPrefixLen = this.options.attributeNamePrefix.length;
1677
- this.isAttribute = we;
1440
+ function isStopNode(e, t) {
1441
+ e = e.substr(0, e.length - t.textNodeName.length - 1);
1442
+ let i = e.substr(e.lastIndexOf(".") + 1);
1443
+ for (let r in t.stopNodes) {
1444
+ if (t.stopNodes[r] === e || t.stopNodes[r] === "*." + i) return true;
1445
+ }
1446
+ return false;
1678
1447
  }
1679
- this.processTextOrObjNode = Ne;
1680
- if (this.options.format) {
1681
- this.indentate = Ee;
1682
- this.tagEndChar = ">\n";
1683
- this.newLine = "\n";
1684
- } else {
1685
- this.indentate = function() {
1686
- return "";
1687
- };
1688
- this.tagEndChar = ">";
1689
- this.newLine = "";
1448
+ function replaceEntitiesValue(e, t) {
1449
+ if (e && e.length > 0 && t.processEntities) {
1450
+ for (let i = 0; i < t.entities.length; i++) {
1451
+ const r = t.entities[i];
1452
+ e = e.replace(r.regex, r.val);
1453
+ }
1454
+ }
1455
+ return e;
1690
1456
  }
1457
+ v = toXml;
1458
+ return v;
1691
1459
  }
1692
1460
 
1693
- xe.prototype.build = function(e) {
1694
- if (this.options.preserveOrder) {
1695
- return fe(e, this.options);
1696
- } else {
1697
- if (Array.isArray(e) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {
1698
- e = {
1699
- [this.options.arrayNodeName]: e
1461
+ var T;
1462
+
1463
+ var P;
1464
+
1465
+ function requireJson2xml() {
1466
+ if (P) return T;
1467
+ P = 1;
1468
+ "use strict";
1469
+ const e = requireOrderedJs2Xml();
1470
+ const t = requireIgnoreAttributes();
1471
+ const i = {
1472
+ attributeNamePrefix: "@_",
1473
+ attributesGroupName: false,
1474
+ textNodeName: "#text",
1475
+ ignoreAttributes: true,
1476
+ cdataPropName: false,
1477
+ format: false,
1478
+ indentBy: " ",
1479
+ suppressEmptyNode: false,
1480
+ suppressUnpairedNode: true,
1481
+ suppressBooleanAttributes: true,
1482
+ tagValueProcessor: function(e, t) {
1483
+ return t;
1484
+ },
1485
+ attributeValueProcessor: function(e, t) {
1486
+ return t;
1487
+ },
1488
+ preserveOrder: false,
1489
+ commentPropName: false,
1490
+ unpairedTags: [],
1491
+ entities: [ {
1492
+ regex: new RegExp("&", "g"),
1493
+ val: "&amp;"
1494
+ }, {
1495
+ regex: new RegExp(">", "g"),
1496
+ val: "&gt;"
1497
+ }, {
1498
+ regex: new RegExp("<", "g"),
1499
+ val: "&lt;"
1500
+ }, {
1501
+ regex: new RegExp("'", "g"),
1502
+ val: "&apos;"
1503
+ }, {
1504
+ regex: new RegExp('"', "g"),
1505
+ val: "&quot;"
1506
+ } ],
1507
+ processEntities: true,
1508
+ stopNodes: [],
1509
+ oneListGroup: false
1510
+ };
1511
+ function Builder(e) {
1512
+ this.options = Object.assign({}, i, e);
1513
+ if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
1514
+ this.isAttribute = function() {
1515
+ return false;
1700
1516
  };
1517
+ } else {
1518
+ this.ignoreAttributesFn = t(this.options.ignoreAttributes);
1519
+ this.attrPrefixLen = this.options.attributeNamePrefix.length;
1520
+ this.isAttribute = isAttribute;
1521
+ }
1522
+ this.processTextOrObjNode = processTextOrObjNode;
1523
+ if (this.options.format) {
1524
+ this.indentate = indentate;
1525
+ this.tagEndChar = ">\n";
1526
+ this.newLine = "\n";
1527
+ } else {
1528
+ this.indentate = function() {
1529
+ return "";
1530
+ };
1531
+ this.tagEndChar = ">";
1532
+ this.newLine = "";
1701
1533
  }
1702
- return this.j2x(e, 0, []).val;
1703
1534
  }
1704
- };
1705
-
1706
- xe.prototype.j2x = function(e, t, i) {
1707
- let n = "";
1708
- let s = "";
1709
- const r = i.join(".");
1710
- for (let o in e) {
1711
- if (!Object.prototype.hasOwnProperty.call(e, o)) continue;
1712
- if (typeof e[o] === "undefined") {
1713
- if (this.isAttribute(o)) {
1714
- s += "";
1715
- }
1716
- } else if (e[o] === null) {
1717
- if (this.isAttribute(o)) {
1718
- s += "";
1719
- } else if (o === this.options.cdataPropName) {
1720
- s += "";
1721
- } else if (o[0] === "?") {
1722
- s += this.indentate(t) + "<" + o + "?" + this.tagEndChar;
1723
- } else {
1724
- s += this.indentate(t) + "<" + o + "/" + this.tagEndChar;
1535
+ Builder.prototype.build = function(t) {
1536
+ if (this.options.preserveOrder) {
1537
+ return e(t, this.options);
1538
+ } else {
1539
+ if (Array.isArray(t) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {
1540
+ t = {
1541
+ [this.options.arrayNodeName]: t
1542
+ };
1725
1543
  }
1726
- } else if (e[o] instanceof Date) {
1727
- s += this.buildTextValNode(e[o], o, "", t);
1728
- } else if (typeof e[o] !== "object") {
1729
- const i = this.isAttribute(o);
1730
- if (i && !this.ignoreAttributesFn(i, r)) {
1731
- n += this.buildAttrPairStr(i, "" + e[o]);
1732
- } else if (!i) {
1733
- if (o === this.options.textNodeName) {
1734
- let t = this.options.tagValueProcessor(o, "" + e[o]);
1735
- s += this.replaceEntitiesValue(t);
1544
+ return this.j2x(t, 0, []).val;
1545
+ }
1546
+ };
1547
+ Builder.prototype.j2x = function(e, t, i) {
1548
+ let r = "";
1549
+ let n = "";
1550
+ const s = i.join(".");
1551
+ for (let o in e) {
1552
+ if (!Object.prototype.hasOwnProperty.call(e, o)) continue;
1553
+ if (typeof e[o] === "undefined") {
1554
+ if (this.isAttribute(o)) {
1555
+ n += "";
1556
+ }
1557
+ } else if (e[o] === null) {
1558
+ if (this.isAttribute(o)) {
1559
+ n += "";
1560
+ } else if (o === this.options.cdataPropName) {
1561
+ n += "";
1562
+ } else if (o[0] === "?") {
1563
+ n += this.indentate(t) + "<" + o + "?" + this.tagEndChar;
1736
1564
  } else {
1737
- s += this.buildTextValNode(e[o], o, "", t);
1565
+ n += this.indentate(t) + "<" + o + "/" + this.tagEndChar;
1738
1566
  }
1739
- }
1740
- } else if (Array.isArray(e[o])) {
1741
- const n = e[o].length;
1742
- let r = "";
1743
- let a = "";
1744
- for (let l = 0; l < n; l++) {
1745
- const n = e[o][l];
1746
- if (typeof n === "undefined") {} else if (n === null) {
1747
- if (o[0] === "?") s += this.indentate(t) + "<" + o + "?" + this.tagEndChar; else s += this.indentate(t) + "<" + o + "/" + this.tagEndChar;
1748
- } else if (typeof n === "object") {
1749
- if (this.options.oneListGroup) {
1750
- const e = this.j2x(n, t + 1, i.concat(o));
1751
- r += e.val;
1752
- if (this.options.attributesGroupName && n.hasOwnProperty(this.options.attributesGroupName)) {
1753
- a += e.attrStr;
1754
- }
1567
+ } else if (e[o] instanceof Date) {
1568
+ n += this.buildTextValNode(e[o], o, "", t);
1569
+ } else if (typeof e[o] !== "object") {
1570
+ const i = this.isAttribute(o);
1571
+ if (i && !this.ignoreAttributesFn(i, s)) {
1572
+ r += this.buildAttrPairStr(i, "" + e[o]);
1573
+ } else if (!i) {
1574
+ if (o === this.options.textNodeName) {
1575
+ let t = this.options.tagValueProcessor(o, "" + e[o]);
1576
+ n += this.replaceEntitiesValue(t);
1755
1577
  } else {
1756
- r += this.processTextOrObjNode(n, o, t, i);
1578
+ n += this.buildTextValNode(e[o], o, "", t);
1757
1579
  }
1758
- } else {
1759
- if (this.options.oneListGroup) {
1760
- let e = this.options.tagValueProcessor(o, n);
1761
- e = this.replaceEntitiesValue(e);
1762
- r += e;
1580
+ }
1581
+ } else if (Array.isArray(e[o])) {
1582
+ const r = e[o].length;
1583
+ let s = "";
1584
+ let a = "";
1585
+ for (let l = 0; l < r; l++) {
1586
+ const r = e[o][l];
1587
+ if (typeof r === "undefined") {} else if (r === null) {
1588
+ if (o[0] === "?") n += this.indentate(t) + "<" + o + "?" + this.tagEndChar; else n += this.indentate(t) + "<" + o + "/" + this.tagEndChar;
1589
+ } else if (typeof r === "object") {
1590
+ if (this.options.oneListGroup) {
1591
+ const e = this.j2x(r, t + 1, i.concat(o));
1592
+ s += e.val;
1593
+ if (this.options.attributesGroupName && r.hasOwnProperty(this.options.attributesGroupName)) {
1594
+ a += e.attrStr;
1595
+ }
1596
+ } else {
1597
+ s += this.processTextOrObjNode(r, o, t, i);
1598
+ }
1763
1599
  } else {
1764
- r += this.buildTextValNode(n, o, "", t);
1600
+ if (this.options.oneListGroup) {
1601
+ let e = this.options.tagValueProcessor(o, r);
1602
+ e = this.replaceEntitiesValue(e);
1603
+ s += e;
1604
+ } else {
1605
+ s += this.buildTextValNode(r, o, "", t);
1606
+ }
1765
1607
  }
1766
1608
  }
1767
- }
1768
- if (this.options.oneListGroup) {
1769
- r = this.buildObjectNode(r, o, a, t);
1770
- }
1771
- s += r;
1772
- } else {
1773
- if (this.options.attributesGroupName && o === this.options.attributesGroupName) {
1774
- const t = Object.keys(e[o]);
1775
- const i = t.length;
1776
- for (let s = 0; s < i; s++) {
1777
- n += this.buildAttrPairStr(t[s], "" + e[o][t[s]]);
1609
+ if (this.options.oneListGroup) {
1610
+ s = this.buildObjectNode(s, o, a, t);
1778
1611
  }
1612
+ n += s;
1779
1613
  } else {
1780
- s += this.processTextOrObjNode(e[o], o, t, i);
1614
+ if (this.options.attributesGroupName && o === this.options.attributesGroupName) {
1615
+ const t = Object.keys(e[o]);
1616
+ const i = t.length;
1617
+ for (let n = 0; n < i; n++) {
1618
+ r += this.buildAttrPairStr(t[n], "" + e[o][t[n]]);
1619
+ }
1620
+ } else {
1621
+ n += this.processTextOrObjNode(e[o], o, t, i);
1622
+ }
1781
1623
  }
1782
1624
  }
1783
- }
1784
- return {
1785
- attrStr: n,
1786
- val: s
1625
+ return {
1626
+ attrStr: r,
1627
+ val: n
1628
+ };
1787
1629
  };
1788
- };
1789
-
1790
- xe.prototype.buildAttrPairStr = function(e, t) {
1791
- t = this.options.attributeValueProcessor(e, "" + t);
1792
- t = this.replaceEntitiesValue(t);
1793
- if (this.options.suppressBooleanAttributes && t === "true") {
1794
- return " " + e;
1795
- } else return " " + e + '="' + t + '"';
1796
- };
1797
-
1798
- function Ne(e, t, i, n) {
1799
- const s = this.j2x(e, i + 1, n.concat(t));
1800
- if (e[this.options.textNodeName] !== undefined && Object.keys(e).length === 1) {
1801
- return this.buildTextValNode(e[this.options.textNodeName], t, s.attrStr, i);
1802
- } else {
1803
- return this.buildObjectNode(s.val, t, s.attrStr, i);
1630
+ Builder.prototype.buildAttrPairStr = function(e, t) {
1631
+ t = this.options.attributeValueProcessor(e, "" + t);
1632
+ t = this.replaceEntitiesValue(t);
1633
+ if (this.options.suppressBooleanAttributes && t === "true") {
1634
+ return " " + e;
1635
+ } else return " " + e + '="' + t + '"';
1636
+ };
1637
+ function processTextOrObjNode(e, t, i, r) {
1638
+ const n = this.j2x(e, i + 1, r.concat(t));
1639
+ if (e[this.options.textNodeName] !== undefined && Object.keys(e).length === 1) {
1640
+ return this.buildTextValNode(e[this.options.textNodeName], t, n.attrStr, i);
1641
+ } else {
1642
+ return this.buildObjectNode(n.val, t, n.attrStr, i);
1643
+ }
1804
1644
  }
1805
- }
1806
-
1807
- xe.prototype.buildObjectNode = function(e, t, i, n) {
1808
- if (e === "") {
1809
- if (t[0] === "?") return this.indentate(n) + "<" + t + i + "?" + this.tagEndChar; else {
1810
- return this.indentate(n) + "<" + t + i + this.closeTag(t) + this.tagEndChar;
1645
+ Builder.prototype.buildObjectNode = function(e, t, i, r) {
1646
+ if (e === "") {
1647
+ if (t[0] === "?") return this.indentate(r) + "<" + t + i + "?" + this.tagEndChar; else {
1648
+ return this.indentate(r) + "<" + t + i + this.closeTag(t) + this.tagEndChar;
1649
+ }
1650
+ } else {
1651
+ let n = "</" + t + this.tagEndChar;
1652
+ let s = "";
1653
+ if (t[0] === "?") {
1654
+ s = "?";
1655
+ n = "";
1656
+ }
1657
+ if ((i || i === "") && e.indexOf("<") === -1) {
1658
+ return this.indentate(r) + "<" + t + i + s + ">" + e + n;
1659
+ } else if (this.options.commentPropName !== false && t === this.options.commentPropName && s.length === 0) {
1660
+ return this.indentate(r) + `\x3c!--${e}--\x3e` + this.newLine;
1661
+ } else {
1662
+ return this.indentate(r) + "<" + t + i + s + this.tagEndChar + e + this.indentate(r) + n;
1663
+ }
1811
1664
  }
1812
- } else {
1813
- let s = "</" + t + this.tagEndChar;
1814
- let r = "";
1815
- if (t[0] === "?") {
1816
- r = "?";
1817
- s = "";
1818
- }
1819
- if ((i || i === "") && e.indexOf("<") === -1) {
1820
- return this.indentate(n) + "<" + t + i + r + ">" + e + s;
1821
- } else if (this.options.commentPropName !== false && t === this.options.commentPropName && r.length === 0) {
1822
- return this.indentate(n) + `\x3c!--${e}--\x3e` + this.newLine;
1665
+ };
1666
+ Builder.prototype.closeTag = function(e) {
1667
+ let t = "";
1668
+ if (this.options.unpairedTags.indexOf(e) !== -1) {
1669
+ if (!this.options.suppressUnpairedNode) t = "/";
1670
+ } else if (this.options.suppressEmptyNode) {
1671
+ t = "/";
1823
1672
  } else {
1824
- return this.indentate(n) + "<" + t + i + r + this.tagEndChar + e + this.indentate(n) + s;
1673
+ t = `></${e}`;
1825
1674
  }
1826
- }
1827
- };
1828
-
1829
- xe.prototype.closeTag = function(e) {
1830
- let t = "";
1831
- if (this.options.unpairedTags.indexOf(e) !== -1) {
1832
- if (!this.options.suppressUnpairedNode) t = "/";
1833
- } else if (this.options.suppressEmptyNode) {
1834
- t = "/";
1835
- } else {
1836
- t = `></${e}`;
1837
- }
1838
- return t;
1839
- };
1840
-
1841
- function be(e, t, i, n) {
1842
- if (e !== "") {
1843
- return this.buildObjectNode(e, t, i, n);
1844
- } else {
1845
- if (t[0] === "?") return this.indentate(n) + "<" + t + i + "?" + this.tagEndChar; else {
1846
- return this.indentate(n) + "<" + t + i + "/" + this.tagEndChar;
1675
+ return t;
1676
+ };
1677
+ function buildEmptyObjNode(e, t, i, r) {
1678
+ if (e !== "") {
1679
+ return this.buildObjectNode(e, t, i, r);
1680
+ } else {
1681
+ if (t[0] === "?") return this.indentate(r) + "<" + t + i + "?" + this.tagEndChar; else {
1682
+ return this.indentate(r) + "<" + t + i + "/" + this.tagEndChar;
1683
+ }
1847
1684
  }
1848
1685
  }
1849
- }
1850
-
1851
- xe.prototype.buildTextValNode = function(e, t, i, n) {
1852
- if (this.options.cdataPropName !== false && t === this.options.cdataPropName) {
1853
- return this.indentate(n) + `<![CDATA[${e}]]>` + this.newLine;
1854
- } else if (this.options.commentPropName !== false && t === this.options.commentPropName) {
1855
- return this.indentate(n) + `\x3c!--${e}--\x3e` + this.newLine;
1856
- } else if (t[0] === "?") {
1857
- return this.indentate(n) + "<" + t + i + "?" + this.tagEndChar;
1858
- } else {
1859
- let s = this.options.tagValueProcessor(t, e);
1860
- s = this.replaceEntitiesValue(s);
1861
- if (s === "") {
1862
- return this.indentate(n) + "<" + t + i + this.closeTag(t) + this.tagEndChar;
1686
+ Builder.prototype.buildTextValNode = function(e, t, i, r) {
1687
+ if (this.options.cdataPropName !== false && t === this.options.cdataPropName) {
1688
+ return this.indentate(r) + `<![CDATA[${e}]]>` + this.newLine;
1689
+ } else if (this.options.commentPropName !== false && t === this.options.commentPropName) {
1690
+ return this.indentate(r) + `\x3c!--${e}--\x3e` + this.newLine;
1691
+ } else if (t[0] === "?") {
1692
+ return this.indentate(r) + "<" + t + i + "?" + this.tagEndChar;
1863
1693
  } else {
1864
- return this.indentate(n) + "<" + t + i + ">" + s + "</" + t + this.tagEndChar;
1694
+ let n = this.options.tagValueProcessor(t, e);
1695
+ n = this.replaceEntitiesValue(n);
1696
+ if (n === "") {
1697
+ return this.indentate(r) + "<" + t + i + this.closeTag(t) + this.tagEndChar;
1698
+ } else {
1699
+ return this.indentate(r) + "<" + t + i + ">" + n + "</" + t + this.tagEndChar;
1700
+ }
1701
+ }
1702
+ };
1703
+ Builder.prototype.replaceEntitiesValue = function(e) {
1704
+ if (e && e.length > 0 && this.options.processEntities) {
1705
+ for (let t = 0; t < this.options.entities.length; t++) {
1706
+ const i = this.options.entities[t];
1707
+ e = e.replace(i.regex, i.val);
1708
+ }
1865
1709
  }
1710
+ return e;
1711
+ };
1712
+ function indentate(e) {
1713
+ return this.options.indentBy.repeat(e);
1866
1714
  }
1867
- };
1868
-
1869
- xe.prototype.replaceEntitiesValue = function(e) {
1870
- if (e && e.length > 0 && this.options.processEntities) {
1871
- for (let t = 0; t < this.options.entities.length; t++) {
1872
- const i = this.options.entities[t];
1873
- e = e.replace(i.regex, i.val);
1715
+ function isAttribute(e) {
1716
+ if (e.startsWith(this.options.attributeNamePrefix) && e !== this.options.textNodeName) {
1717
+ return e.substr(this.attrPrefixLen);
1718
+ } else {
1719
+ return false;
1874
1720
  }
1875
1721
  }
1876
- return e;
1877
- };
1878
-
1879
- function Ee(e) {
1880
- return this.options.indentBy.repeat(e);
1722
+ T = Builder;
1723
+ return T;
1881
1724
  }
1882
1725
 
1883
- function we(e) {
1884
- if (e.startsWith(this.options.attributeNamePrefix) && e !== this.options.textNodeName) {
1885
- return e.substr(this.attrPrefixLen);
1886
- } else {
1887
- return false;
1888
- }
1726
+ var A;
1727
+
1728
+ var y;
1729
+
1730
+ function requireFxp() {
1731
+ if (y) return A;
1732
+ y = 1;
1733
+ "use strict";
1734
+ const e = requireValidator();
1735
+ const t = requireXMLParser();
1736
+ const i = requireJson2xml();
1737
+ A = {
1738
+ XMLParser: t,
1739
+ XMLValidator: e,
1740
+ XMLBuilder: i
1741
+ };
1742
+ return A;
1889
1743
  }
1890
1744
 
1891
- "use strict";
1745
+ var I = requireFxp();
1892
1746
 
1893
- const Te = {
1894
- validate: d
1895
- };
1747
+ const w = e(I);
1896
1748
 
1897
- function ye(e) {
1749
+ function IsXML(e) {
1898
1750
  try {
1899
- Te.validate(e, {
1751
+ I.XMLValidator.validate(e, {
1900
1752
  allowBooleanAttributes: true
1901
1753
  });
1902
1754
  return true;
@@ -1905,4 +1757,4 @@ function ye(e) {
1905
1757
  }
1906
1758
  }
1907
1759
 
1908
- export { ye as IsXML };
1760
+ export { IsXML };