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