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